diff --git a/.gitignore b/.gitignore
new file mode 100755
index 00000000..a41405eb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+*.idea
+*.idea/**
+*.iml
+*.ipr
+target
+*.project
+*.classpath
+*.iws
+*.settings/**
+*.log
+*.log.gz
+rebel.xml
diff --git a/README.md b/README.md
new file mode 100755
index 00000000..c99e712d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+Use https://github.com/sakserv/hadoop-mini-clusters
+
diff --git a/pom.xml b/pom.xml
new file mode 100755
index 00000000..ba4a1cae
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,258 @@
+
+
+ 4.0.0
+
+ fr.jetoile.sample
+ hadoop-bootstrap
+ 1.0-SNAPSHOT
+
+
+ scm:git:https://git@github.com/jetoile/hadoop-bootstrap.git
+ HEAD
+
+
+
+
+
+ 1.8
+
+ 1.8
+ 1.8
+
+ 1.7.12
+ 1.1.3
+
+
+ 2.4
+ 1.10
+ 3.2.1
+
+
+
+
+
+
+ com.github.sakserv
+ hadoop-mini-clusters-hivemetastore
+ 0.1.3
+
+
+
+ com.github.sakserv
+ hadoop-mini-clusters-hiveserver2
+ 0.1.3
+
+
+
+ com.github.sakserv
+ hadoop-mini-clusters-zookeeper
+ 0.1.3
+
+
+
+ commons-configuration
+ commons-configuration
+ ${commons-configuration.version}
+
+
+
+ commons-collections
+ commons-collections
+ ${commons-collections.version}
+
+
+
+ commons-io
+ commons-io
+ ${commons-io.version}
+
+
+
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+
+
+
+ ch.qos.logback
+ logback-classic
+ ${logback-classic.version}
+
+
+
+ org.projectlombok
+ lombok
+ 1.16.6
+ provided
+
+
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+ org.easytesting
+ fest-assert
+ 1.4
+ test
+
+
+ org.mockito
+ mockito-all
+ 1.8.5
+ test
+
+
+
+
+
+
+
+ maven-assembly-plugin
+ 2.4
+
+
+ maven-compiler-plugin
+ 3.0
+
+
+ ${java.version}
+
+
+
+
+ maven-dependency-plugin
+ 2.4
+
+
+ maven-source-plugin
+ 2.1.2
+
+
+ maven-deploy-plugin
+ 2.6
+
+
+ maven-install-plugin
+ 2.3.1
+
+
+ maven-resources-plugin
+ 2.6
+
+
+ org.codehaus.mojo
+ appassembler-maven-plugin
+ 1.5
+
+
+
+
+
+
+ org.codehaus.mojo
+ appassembler-maven-plugin
+
+
+
+ spring-integ-reader
+ package
+
+ generate-daemons
+
+
+ ${project.build.directory}/appassembler-jsw
+
+ flat
+
+
+
+ ${project.name}
+ fr.jetoile.sample.Main
+
+
+
+ jsw
+
+
+
+ jsw
+
+ linux-x86-64
+
+
+
+
+ configuration.directory.in.classpath.first
+ conf
+
+
+
+ wrapper.logfile.maxsize
+ 100m
+
+
+
+
+
+
+ 256M
+ 2048M
+
+ com.sun.management.jmxremote
+ com.sun.management.jmxremote.port=8199
+ com.sun.management.jmxremote.authenticate=false
+
+ com.sun.management.jmxremote.ssl=false
+ com.sun.management.jmxremote.local.only=false
+
+
+
+ -Xdebug
+
+ -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
+
+ -server
+
+
+ -XX:+HeapDumpOnOutOfMemoryError
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ maven-assembly-plugin
+
+
+ src/main/assembly/descriptor.xml
+
+ false
+
+
+
+
+ assembly
+ package
+
+ single
+
+
+
+
+
+
+
+
diff --git a/src/main/assembly/descriptor.xml b/src/main/assembly/descriptor.xml
new file mode 100755
index 00000000..f13d22f6
--- /dev/null
+++ b/src/main/assembly/descriptor.xml
@@ -0,0 +1,51 @@
+
+
+
+ reader
+
+ false
+
+
+ tar.gz
+
+
+
+
+
+ ${project.build.directory}/appassembler-jsw/jsw/${project.name}
+ /
+
+ bin/${project.name}
+ bin/wrapper-linux-x86-32
+ bin/wrapper-linux-x86-64
+
+ 640
+ 750
+
+
+
+ src/main/assembly
+ /logs
+
+ *
+
+
+
+
+
+
+
+ bin
+ 750
+
+
+
+ bin
+ 750
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/fr/jetoile/sample/BootstrapException.java b/src/main/java/fr/jetoile/sample/BootstrapException.java
new file mode 100644
index 00000000..bc9010d1
--- /dev/null
+++ b/src/main/java/fr/jetoile/sample/BootstrapException.java
@@ -0,0 +1,13 @@
+package fr.jetoile.sample;
+
+import org.apache.commons.configuration.ConfigurationException;
+
+public class BootstrapException extends Exception {
+ public BootstrapException(String s, ConfigurationException e) {
+ super(s, e);
+ }
+
+ public BootstrapException(String s) {
+ super(s);
+ }
+}
diff --git a/src/main/java/fr/jetoile/sample/Main.java b/src/main/java/fr/jetoile/sample/Main.java
new file mode 100755
index 00000000..fb62f911
--- /dev/null
+++ b/src/main/java/fr/jetoile/sample/Main.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2011 Khanh Tuong Maudoux
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package fr.jetoile.sample;
+
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class Main {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(Main.class);
+
+ public static final String CONF_PROPERTIES = "default.properties";
+
+ private static Configuration config;
+
+ public static void main(String[] args) throws BootstrapException {
+
+ try {
+ config = new PropertiesConfiguration(Main.CONF_PROPERTIES);
+
+ } catch (ConfigurationException e) {
+ throw new BootstrapException("bad config", e);
+ }
+
+ }
+
+}
+
+
diff --git a/src/main/java/fr/jetoile/sample/Utils.java b/src/main/java/fr/jetoile/sample/Utils.java
new file mode 100644
index 00000000..4b561602
--- /dev/null
+++ b/src/main/java/fr/jetoile/sample/Utils.java
@@ -0,0 +1,16 @@
+package fr.jetoile.sample;
+
+import java.io.IOException;
+import java.net.Socket;
+
+
+public class Utils {
+
+ public static boolean available(String url, int port) {
+ try (Socket ignored = new Socket(url, port)) {
+ return false;
+ } catch (IOException ignored) {
+ return true;
+ }
+ }
+}
diff --git a/src/main/java/fr/jetoile/sample/component/Bootstrap.java b/src/main/java/fr/jetoile/sample/component/Bootstrap.java
new file mode 100644
index 00000000..ef1c54f2
--- /dev/null
+++ b/src/main/java/fr/jetoile/sample/component/Bootstrap.java
@@ -0,0 +1,9 @@
+package fr.jetoile.sample.component;
+
+
+public interface Bootstrap {
+
+ Bootstrap start();
+
+ Bootstrap stop();
+}
diff --git a/src/main/java/fr/jetoile/sample/component/HiveMetastoreBootstrap.java b/src/main/java/fr/jetoile/sample/component/HiveMetastoreBootstrap.java
new file mode 100644
index 00000000..5acd8289
--- /dev/null
+++ b/src/main/java/fr/jetoile/sample/component/HiveMetastoreBootstrap.java
@@ -0,0 +1,115 @@
+package fr.jetoile.sample.component;
+
+import com.github.sakserv.minicluster.config.ConfigVars;
+import com.github.sakserv.minicluster.impl.HiveLocalMetaStore;
+import com.github.sakserv.minicluster.impl.ZookeeperLocalCluster;
+import com.github.sakserv.minicluster.util.FileUtils;
+import fr.jetoile.sample.BootstrapException;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public enum HiveMetastoreBootstrap implements Bootstrap {
+ INSTANCE;
+
+ final private Logger LOGGER = LoggerFactory.getLogger(HiveMetastoreBootstrap.class);
+
+ private HiveLocalMetaStore hiveLocalMetaStore;
+
+ private Configuration configuration;
+ private String host;
+ private int port;
+ private String derbyDirectory;
+ private String scratchDirectory;
+ private String warehouseDirectory;
+
+ HiveMetastoreBootstrap() {
+ if (hiveLocalMetaStore == null) {
+ try {
+ loadConfig();
+ } catch (BootstrapException e) {
+ LOGGER.error("unable to load configuration", e);
+ }
+ init();
+ build();
+ }
+ }
+
+ private void loadConfig() throws BootstrapException {
+ try {
+ configuration = new PropertiesConfiguration("default.properties");
+ } catch (ConfigurationException e) {
+ throw new BootstrapException("bad config", e);
+ }
+ host = configuration.getString(ConfigVars.HIVE_METASTORE_HOSTNAME_KEY);
+ port = configuration.getInt(ConfigVars.HIVE_METASTORE_PORT_KEY);
+ derbyDirectory = configuration.getString(ConfigVars.HIVE_METASTORE_DERBY_DB_DIR_KEY);
+ scratchDirectory = configuration.getString(ConfigVars.HIVE_SCRATCH_DIR_KEY);
+ warehouseDirectory = configuration.getString(ConfigVars.HIVE_WAREHOUSE_DIR_KEY);
+
+ }
+
+
+ private void init() {
+ Path path2 = Paths.get(scratchDirectory);
+ Path path3 = Paths.get(warehouseDirectory);
+ try {
+ Files.createDirectories(path2);
+ Files.createDirectories(path3);
+ } catch (IOException e) {
+ LOGGER.error("unable to create mandatory directory", e);
+ }
+
+ }
+
+ private void cleanup() {
+ FileUtils.deleteFolder(derbyDirectory);
+ FileUtils.deleteFolder(derbyDirectory.substring(derbyDirectory.lastIndexOf("/")+1));
+
+ }
+
+ private void build() {
+ hiveLocalMetaStore = new HiveLocalMetaStore.Builder()
+ .setHiveMetastoreDerbyDbDir(derbyDirectory)
+ .setHiveMetastoreHostname(host)
+ .setHiveMetastorePort(port)
+ .setHiveWarehouseDir(warehouseDirectory)
+ .setHiveScratchDir(scratchDirectory)
+ .setHiveConf(buildHiveConf())
+ .build();
+ }
+
+ private HiveConf buildHiveConf() {
+ HiveConf hiveConf = new HiveConf();
+ return hiveConf;
+ }
+
+ @Override
+ public Bootstrap start() {
+ try {
+ hiveLocalMetaStore.start();
+ } catch (Exception e) {
+ LOGGER.error("unable to start hivemetastore", e);
+ }
+ return this;
+ }
+
+ @Override
+ public Bootstrap stop() {
+ try {
+ hiveLocalMetaStore.stop(true);
+ } catch (Exception e) {
+ LOGGER.error("unable to stop hivemetastore", e);
+ }
+ cleanup();
+ return this;
+ }
+}
diff --git a/src/main/java/fr/jetoile/sample/component/HiveServer2Bootstrap.java b/src/main/java/fr/jetoile/sample/component/HiveServer2Bootstrap.java
new file mode 100644
index 00000000..0bd16561
--- /dev/null
+++ b/src/main/java/fr/jetoile/sample/component/HiveServer2Bootstrap.java
@@ -0,0 +1,126 @@
+package fr.jetoile.sample.component;
+
+import com.github.sakserv.minicluster.config.ConfigVars;
+import com.github.sakserv.minicluster.impl.HiveLocalMetaStore;
+import com.github.sakserv.minicluster.impl.HiveLocalServer2;
+import com.github.sakserv.minicluster.util.FileUtils;
+import fr.jetoile.sample.BootstrapException;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public enum HiveServer2Bootstrap implements Bootstrap {
+ INSTANCE;
+
+ final private Logger LOGGER = LoggerFactory.getLogger(HiveServer2Bootstrap.class);
+
+ private HiveLocalServer2 hiveLocalServer2;
+
+ private Configuration configuration;
+ private String host;
+ private int port;
+ private String derbyDirectory;
+ private String scratchDirectory;
+ private String warehouseDirectory;
+ private String zookeeperConnectionString;
+ private String hostMetastore;
+ private int portMetastore;
+
+
+ HiveServer2Bootstrap() {
+ if (hiveLocalServer2 == null) {
+ try {
+ loadConfig();
+ } catch (BootstrapException e) {
+ LOGGER.error("unable to load configuration", e);
+ }
+ init();
+ build();
+ }
+ }
+
+ private void loadConfig() throws BootstrapException {
+ try {
+ configuration = new PropertiesConfiguration("default.properties");
+ } catch (ConfigurationException e) {
+ throw new BootstrapException("bad config", e);
+ }
+ host = configuration.getString(ConfigVars.HIVE_SERVER2_HOSTNAME_KEY);
+ port = configuration.getInt(ConfigVars.HIVE_SERVER2_PORT_KEY);
+ hostMetastore = configuration.getString(ConfigVars.HIVE_METASTORE_HOSTNAME_KEY);
+ portMetastore = configuration.getInt(ConfigVars.HIVE_METASTORE_PORT_KEY);
+ derbyDirectory = configuration.getString(ConfigVars.HIVE_METASTORE_DERBY_DB_DIR_KEY);
+ scratchDirectory = configuration.getString(ConfigVars.HIVE_SCRATCH_DIR_KEY);
+ warehouseDirectory = configuration.getString(ConfigVars.HIVE_WAREHOUSE_DIR_KEY);
+ zookeeperConnectionString = configuration.getString(ConfigVars.ZOOKEEPER_HOST_KEY) + ":" + configuration.getInt(ConfigVars.ZOOKEEPER_PORT_KEY);
+
+ }
+
+
+ private void init() {
+ Path path2 = Paths.get(scratchDirectory);
+ Path path3 = Paths.get(warehouseDirectory);
+ try {
+ Files.createDirectories(path2);
+ Files.createDirectories(path3);
+ } catch (IOException e) {
+ LOGGER.error("unable to create mandatory directory", e);
+ }
+
+ }
+
+ private void cleanup() {
+ FileUtils.deleteFolder(derbyDirectory);
+ FileUtils.deleteFolder(derbyDirectory.substring(derbyDirectory.lastIndexOf("/")+1));
+
+ }
+
+ private void build() {
+ hiveLocalServer2 = new HiveLocalServer2.Builder()
+ .setHiveMetastoreDerbyDbDir(derbyDirectory)
+ .setHiveServer2Hostname(host)
+ .setHiveServer2Port(port)
+ .setHiveMetastoreHostname(hostMetastore)
+ .setHiveMetastorePort(portMetastore)
+ .setHiveWarehouseDir(warehouseDirectory)
+ .setHiveScratchDir(scratchDirectory)
+ .setHiveConf(buildHiveConf())
+ .setZookeeperConnectionString(zookeeperConnectionString)
+ .build();
+
+ }
+
+ private HiveConf buildHiveConf() {
+ HiveConf hiveConf = new HiveConf();
+ return hiveConf;
+ }
+
+ @Override
+ public Bootstrap start() {
+ try {
+ hiveLocalServer2.start();
+ } catch (Exception e) {
+ LOGGER.error("unable to start hiveserver2", e);
+ }
+ return this;
+ }
+
+ @Override
+ public Bootstrap stop() {
+ try {
+ hiveLocalServer2.stop(true);
+ } catch (Exception e) {
+ LOGGER.error("unable to stop hiveserver2", e);
+ }
+ cleanup();
+ return this;
+ }
+}
diff --git a/src/main/java/fr/jetoile/sample/component/ZookeeperBootstrap.java b/src/main/java/fr/jetoile/sample/component/ZookeeperBootstrap.java
new file mode 100644
index 00000000..2317a336
--- /dev/null
+++ b/src/main/java/fr/jetoile/sample/component/ZookeeperBootstrap.java
@@ -0,0 +1,93 @@
+package fr.jetoile.sample.component;
+
+import com.github.sakserv.minicluster.config.ConfigVars;
+import com.github.sakserv.minicluster.impl.ZookeeperLocalCluster;
+import fr.jetoile.sample.BootstrapException;
+import lombok.Setter;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public enum ZookeeperBootstrap implements Bootstrap {
+ INSTANCE;
+
+ final private Logger LOGGER = LoggerFactory.getLogger(ZookeeperBootstrap.class);
+
+ private ZookeeperLocalCluster zookeeperLocalCluster;
+
+ private Configuration configuration;
+
+ private int port;
+ private String localDir;
+ private String host;
+
+ ZookeeperBootstrap() {
+ if (zookeeperLocalCluster == null) {
+ try {
+ loadConfig();
+ } catch (BootstrapException e) {
+ LOGGER.error("unable to load configuration", e);
+ }
+ init();
+ build();
+ }
+ }
+
+ private void loadConfig() throws BootstrapException {
+ try {
+ configuration = new PropertiesConfiguration("default.properties");
+ } catch (ConfigurationException e) {
+ throw new BootstrapException("bad config", e);
+ }
+ port = configuration.getInt(ConfigVars.ZOOKEEPER_PORT_KEY);
+ localDir = configuration.getString(ConfigVars.ZOOKEEPER_TEMP_DIR_KEY);
+ host = configuration.getString(ConfigVars.ZOOKEEPER_HOST_KEY);
+
+ }
+
+
+ private void init() {
+ Path path = Paths.get(localDir);
+ try {
+ Files.createDirectories(path);
+ } catch (IOException e) {
+ LOGGER.error("unable to create mandatory directory", e);
+ }
+
+ }
+
+ private void build() {
+ zookeeperLocalCluster = new ZookeeperLocalCluster.Builder()
+ .setPort(port)
+ .setZookeeperConnectionString(host + ":" + port)
+ .setTempDir(localDir)
+ .build();
+ }
+
+ @Override
+ public Bootstrap start() {
+ try {
+ zookeeperLocalCluster.start();
+ } catch (Exception e) {
+ LOGGER.error("unable to start zookeeper", e);
+ }
+ return this;
+ }
+
+ @Override
+ public Bootstrap stop() {
+ try {
+ zookeeperLocalCluster.stop(true);
+ } catch (Exception e) {
+ LOGGER.error("unable to stop zookeeper", e);
+ }
+ return this;
+ }
+}
diff --git a/src/main/resources/conf.properties b/src/main/resources/conf.properties
new file mode 100755
index 00000000..a2e20679
--- /dev/null
+++ b/src/main/resources/conf.properties
@@ -0,0 +1,7 @@
+swagger.host=localhost
+swagger.port=8081
+swagger.title=jetoile sample app
+swagger.version=1.0.0
+
+undertow.port=8081
+undertow.host=0.0.0.0
\ No newline at end of file
diff --git a/src/main/resources/default.properties b/src/main/resources/default.properties
new file mode 100644
index 00000000..f4f48c01
--- /dev/null
+++ b/src/main/resources/default.properties
@@ -0,0 +1,21 @@
+# Zookeeper
+zookeeper.temp.dir=/tmp/embedded_zk
+zookeeper.host=127.0.0.1
+zookeeper.port=22010
+
+# Hive
+hive.scratch.dir=/tmp/hive_scratch_dir
+hive.warehouse.dir=/tmp/warehouse_dir
+
+# Hive Metastore
+hive.metastore.hostname=localhost
+hive.metastore.port=20102
+hive.metastore.derby.db.dir=/tmp/metastore_db
+
+# Hive Server2
+hive.server2.hostname=localhost
+hive.server2.port=20103
+
+# Hive Test
+hive.test.database.name=default
+hive.test.table.name=test_table
\ No newline at end of file
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
new file mode 100755
index 00000000..1659b4b4
--- /dev/null
+++ b/src/main/resources/logback.xml
@@ -0,0 +1,15 @@
+
+
+
+ %d{HH:mm:ss.SSS} %-5level %logger{36} %X{req.remoteHost} %X{req.requestURI} - C:%X{username} - %msg%n
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/fr/jetoile/sample/component/HiveMetastoreBootstrapTest.java b/src/test/java/fr/jetoile/sample/component/HiveMetastoreBootstrapTest.java
new file mode 100644
index 00000000..a4d066fa
--- /dev/null
+++ b/src/test/java/fr/jetoile/sample/component/HiveMetastoreBootstrapTest.java
@@ -0,0 +1,29 @@
+package fr.jetoile.sample.component;
+
+
+import fr.jetoile.sample.BootstrapException;
+import fr.jetoile.sample.Utils;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+public class HiveMetastoreBootstrapTest {
+
+ @Before
+ public void setup() throws BootstrapException {
+ }
+
+
+ @Test
+ public void hiveMetastoreShouldStart() throws InterruptedException {
+
+ Bootstrap hiveMetastore = HiveMetastoreBootstrap.INSTANCE
+ .start();
+
+ assertThat(Utils.available("127.0.0.1", 20102)).isFalse();
+
+ hiveMetastore.stop(); //TODO : ne veux pas s'arreter
+// assertThat(Utils.available("127.0.0.1", 20102)).isTrue();
+ }
+}
diff --git a/src/test/java/fr/jetoile/sample/component/HiveServer2BootstrapTest.java b/src/test/java/fr/jetoile/sample/component/HiveServer2BootstrapTest.java
new file mode 100644
index 00000000..668d85bf
--- /dev/null
+++ b/src/test/java/fr/jetoile/sample/component/HiveServer2BootstrapTest.java
@@ -0,0 +1,34 @@
+package fr.jetoile.sample.component;
+
+
+import fr.jetoile.sample.BootstrapException;
+import fr.jetoile.sample.Utils;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+public class HiveServer2BootstrapTest {
+
+
+ @Before
+ public void setup() throws BootstrapException {
+ }
+
+
+ @Test
+ public void hiveServer2ShouldStart() throws InterruptedException {
+
+// System.setProperty("HADOOP_HOME", "/opt/hadoop");
+
+ Bootstrap hiveMetastore = HiveMetastoreBootstrap.INSTANCE.start();
+
+ Bootstrap hiveServer2 = HiveServer2Bootstrap.INSTANCE.start();
+
+ assertThat(Utils.available("127.0.0.1", 20103)).isFalse();
+
+ hiveServer2.stop();
+ hiveMetastore.stop(); //TODO : ne veux pas s'arreter
+// assertThat(Utils.available("127.0.0.1", 20103)).isTrue();
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/fr/jetoile/sample/component/ZookeeperBootstrapTest.java b/src/test/java/fr/jetoile/sample/component/ZookeeperBootstrapTest.java
new file mode 100644
index 00000000..41bb1b43
--- /dev/null
+++ b/src/test/java/fr/jetoile/sample/component/ZookeeperBootstrapTest.java
@@ -0,0 +1,29 @@
+package fr.jetoile.sample.component;
+
+
+import fr.jetoile.sample.BootstrapException;
+import fr.jetoile.sample.Utils;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+public class ZookeeperBootstrapTest {
+
+ @Before
+ public void setup() throws BootstrapException {
+ }
+
+
+ @Test
+ public void zookeeperShouldStart() throws InterruptedException {
+
+ Bootstrap zookeeper = ZookeeperBootstrap.INSTANCE
+ .start();
+
+ assertThat(Utils.available("127.0.0.1", 22010)).isFalse();
+
+ zookeeper.stop();
+ assertThat(Utils.available("127.0.0.1", 22010)).isTrue();
+ }
+}
diff --git a/src/test/resources/default.properties b/src/test/resources/default.properties
new file mode 100644
index 00000000..f4f48c01
--- /dev/null
+++ b/src/test/resources/default.properties
@@ -0,0 +1,21 @@
+# Zookeeper
+zookeeper.temp.dir=/tmp/embedded_zk
+zookeeper.host=127.0.0.1
+zookeeper.port=22010
+
+# Hive
+hive.scratch.dir=/tmp/hive_scratch_dir
+hive.warehouse.dir=/tmp/warehouse_dir
+
+# Hive Metastore
+hive.metastore.hostname=localhost
+hive.metastore.port=20102
+hive.metastore.derby.db.dir=/tmp/metastore_db
+
+# Hive Server2
+hive.server2.hostname=localhost
+hive.server2.port=20103
+
+# Hive Test
+hive.test.database.name=default
+hive.test.table.name=test_table
\ No newline at end of file