diff --git a/hadoop-unit-maven-plugin/pom.xml b/hadoop-unit-maven-plugin/pom.xml
index dbb6875b..15f0336a 100644
--- a/hadoop-unit-maven-plugin/pom.xml
+++ b/hadoop-unit-maven-plugin/pom.xml
@@ -15,7 +15,6 @@
3.3.9
-
1.1.0
diff --git a/hadoop-unit-testcontainer/pom.xml b/hadoop-unit-testcontainer/pom.xml
index 6dfcf08e..f0944211 100644
--- a/hadoop-unit-testcontainer/pom.xml
+++ b/hadoop-unit-testcontainer/pom.xml
@@ -33,5 +33,10 @@
${junit.version}
+
+ ch.qos.logback
+ logback-classic
+
+
\ No newline at end of file
diff --git a/hadoop-unit-testcontainer/src/main/java/fr/jetoile/hadoopunit/component/TestContainerBootstrap.java b/hadoop-unit-testcontainer/src/main/java/fr/jetoile/hadoopunit/component/TestContainerBootstrap.java
index e3bb492a..7972298f 100644
--- a/hadoop-unit-testcontainer/src/main/java/fr/jetoile/hadoopunit/component/TestContainerBootstrap.java
+++ b/hadoop-unit-testcontainer/src/main/java/fr/jetoile/hadoopunit/component/TestContainerBootstrap.java
@@ -24,7 +24,9 @@
import org.testcontainers.containers.BindMode;
import org.testcontainers.containers.FixedHostPortGenericContainer;
import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.OutputFrame;
import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.output.ToStringConsumer;
import java.net.URL;
import java.util.Arrays;
@@ -176,6 +178,7 @@ private void build() {
container.withClasspathResourceMapping(local, remote, BindMode.valueOf(bindMode));
});
}
+
}
@Override
@@ -187,7 +190,7 @@ public Bootstrap start() {
build();
container.start();
container.followOutput(new Slf4jLogConsumer(LOGGER));
- } catch (Exception e) {
+ } catch (Throwable e) {
LOGGER.error("unable to add testcontainer", e);
}
state = State.STARTED;
diff --git a/hadoop-unit-testcontainer/src/main/resources/hadoop-unit-default.properties b/hadoop-unit-testcontainer/src/main/resources/hadoop-unit-default.properties
index ddd24d41..e69de29b 100644
--- a/hadoop-unit-testcontainer/src/main/resources/hadoop-unit-default.properties
+++ b/hadoop-unit-testcontainer/src/main/resources/hadoop-unit-default.properties
@@ -1,9 +0,0 @@
-#testcontainer.imagename=couchbase:4.5.0
-#testcontainer.exposedports=8091,8092,8093,8094,11207,11210,11211,18091,18092,18093
-testcontainer.imagename=alpine:3.2
-testcontainer.exposedports=80
-testcontainer.envs=MAGIC_NUMBER:42
-testcontainer.labels=MAGIC_NUMBER:42
-testcontainer.command=/bin/sh, -c, while true; do echo \"$MAGIC_NUMBER\" | nc -l -p 80; done
-testcontainer.fixed.exposedports=21300:80
-testcontainer.classpath.resources.mapping=hadoop-unit-default.properties:/hadoop-unit-default.properties:READ_ONLY
\ No newline at end of file
diff --git a/hadoop-unit-testcontainer/src/test/java/fr/jetoile/hadoopunit/component/TestContainerBootstrapTest.java b/hadoop-unit-testcontainer/src/test/java/fr/jetoile/hadoopunit/component/TestContainerBootstrapTest.java
index 154a10a0..feed78f9 100644
--- a/hadoop-unit-testcontainer/src/test/java/fr/jetoile/hadoopunit/component/TestContainerBootstrapTest.java
+++ b/hadoop-unit-testcontainer/src/test/java/fr/jetoile/hadoopunit/component/TestContainerBootstrapTest.java
@@ -1,3 +1,16 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package fr.jetoile.hadoopunit.component;
import fr.jetoile.hadoopunit.HadoopBootstrap;
@@ -43,7 +56,7 @@ public static void setup() throws BootstrapException {
@AfterClass
- public static void tearDown() throws BootstrapException {
+ public static void tearDown() {
HadoopBootstrap.INSTANCE.stopAll();
}
diff --git a/hadoop-unit-testcontainer/src/main/resources/logback.xml b/hadoop-unit-testcontainer/src/test/resources/logback.xml
similarity index 100%
rename from hadoop-unit-testcontainer/src/main/resources/logback.xml
rename to hadoop-unit-testcontainer/src/test/resources/logback.xml
diff --git a/sample/pom.xml b/sample/pom.xml
index 4be8bda6..5faf5937 100644
--- a/sample/pom.xml
+++ b/sample/pom.xml
@@ -20,6 +20,7 @@
knox-hbase-webhdfs
redis
confluent-integrationtest
+ testcontainer-integrationtest
sample
diff --git a/sample/solr-parquet-spark/pom.xml b/sample/solr-parquet-spark/pom.xml
index 7b5b75f2..297cc856 100644
--- a/sample/solr-parquet-spark/pom.xml
+++ b/sample/solr-parquet-spark/pom.xml
@@ -127,7 +127,8 @@
hadoop-unit-solrcloud
fr.jetoile.hadoop
${hadoop-unit.version}
- fr.jetoile.hadoopunit.component.SolrCloudBootstrap
+ fr.jetoile.hadoopunit.component.SolrCloudBootstrap
+
file://${project.basedir}/src/test/resources/solr
diff --git a/sample/testcontainer-integrationtest/pom.xml b/sample/testcontainer-integrationtest/pom.xml
new file mode 100644
index 00000000..fd9b3c10
--- /dev/null
+++ b/sample/testcontainer-integrationtest/pom.xml
@@ -0,0 +1,108 @@
+
+
+
+ sample
+ fr.jetoile.hadoop
+ 3.2-SNAPSHOT
+
+ 4.0.0
+
+ testcontainer-integrationtest
+
+
+ 2.9.0
+
+
+
+
+ fr.jetoile.hadoop
+ hadoop-unit-commons
+
+
+
+ redis.clients
+ jedis
+ ${jedis.version}
+ test
+
+
+
+
+
+ default
+
+ true
+
+ !travis
+
+
+
+
+
+
+ hadoop-unit-maven-plugin
+ fr.jetoile.hadoop
+ ${hadoop-unit.version}
+
+
+ start
+
+ embedded-start
+
+ pre-integration-test
+
+
+ embedded-stop
+
+ embedded-stop
+
+ post-integration-test
+
+
+
+
+
+ TESTCONTAINER
+ hadoop-unit-testcontainer
+ fr.jetoile.hadoop
+ ${hadoop-unit.version}
+ fr.jetoile.hadoopunit.component.TestContainerBootstrap
+
+ redis:5.0.3
+ 6379
+ 21300:6379
+
+
+
+
+
+
+
+
+
+
+
+
+ travis
+
+ false
+
+ travis
+
+
+
+
+
+ maven-surefire-plugin
+
+ true
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sample/testcontainer-integrationtest/src/test/java/fr/jetoile/hadoopunit/testcontainer/TestContainerBootstrapIntegrationTest.java b/sample/testcontainer-integrationtest/src/test/java/fr/jetoile/hadoopunit/testcontainer/TestContainerBootstrapIntegrationTest.java
new file mode 100644
index 00000000..88626f7e
--- /dev/null
+++ b/sample/testcontainer-integrationtest/src/test/java/fr/jetoile/hadoopunit/testcontainer/TestContainerBootstrapIntegrationTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package fr.jetoile.hadoopunit.testcontainer;
+
+import org.junit.Test;
+import redis.clients.jedis.Jedis;
+
+import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
+
+
+public class TestContainerBootstrapIntegrationTest {
+
+ @Test
+ public void testStartAndStopRedis() {
+ Jedis jedis = new Jedis("127.0.0.1", 21300);
+
+ jedis.hset("test", "foo", "FOO");
+ String foundObject = jedis.hget("test", "foo");
+
+ assertThat(foundObject).isEqualTo("FOO");
+
+ jedis.close();
+ }
+
+}
\ No newline at end of file
diff --git a/sample/testcontainer-integrationtest/src/test/resources/logback.xml b/sample/testcontainer-integrationtest/src/test/resources/logback.xml
new file mode 100755
index 00000000..6aae1090
--- /dev/null
+++ b/sample/testcontainer-integrationtest/src/test/resources/logback.xml
@@ -0,0 +1,29 @@
+
+
+
+ %d{HH:mm:ss.SSS} %-5level %logger{36} - %msg %n
+
+
+
+
+
+
+ true
+
+ %d{HH:mm:ss.SSS} %-5level %logger{36} - %green(%msg) %n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file