Refactoring all integration tests to run as a test suite in their own project. This is an effort to get the tests to run faster.
diff --git a/blur-command/src/test/java/org/apache/blur/command/IntegrationTestSuite.java b/blur-command/src/test/java/org/apache/blur/command/IntegrationTestSuite.java
index e619bec..2412a61 100644
--- a/blur-command/src/test/java/org/apache/blur/command/IntegrationTestSuite.java
+++ b/blur-command/src/test/java/org/apache/blur/command/IntegrationTestSuite.java
@@ -36,28 +36,21 @@
@ClassRule
public static ExternalResource testCluster = new ExternalResource() {
- private boolean _managing;
-
@Override
protected void after() {
- if (_managing) {
- try {
- SuiteCluster.shutdownMiniCluster();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
+ try {
+ SuiteCluster.shutdownMiniCluster(IntegrationTestSuite.class);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}
@Override
protected void before() throws Throwable {
- if (!SuiteCluster.isClusterSetup()) {
- _managing = true;
- try {
- SuiteCluster.setupMiniCluster();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
+ try {
+ SuiteCluster.setupMiniCluster(IntegrationTestSuite.class);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}
};
diff --git a/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java b/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
index 7ae5761..421477b 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatus.java
@@ -100,24 +100,10 @@
}
}
- public ZookeeperClusterStatus(String connectionStr, BlurConfiguration configuration, Configuration config)
- throws IOException {
- this(new ZooKeeper(connectionStr, 30000, new Watcher() {
- @Override
- public void process(WatchedEvent event) {
-
- }
- }), configuration, config);
- }
-
public ZookeeperClusterStatus(ZooKeeper zooKeeper) throws IOException {
this(zooKeeper, new BlurConfiguration(), new Configuration());
}
- public ZookeeperClusterStatus(String connectionStr) throws IOException {
- this(connectionStr, new BlurConfiguration(), new Configuration());
- }
-
class Clusters extends OnChange {
@Override
public void action(List<String> clusters) {
diff --git a/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java b/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
index 6972abb..d995c80 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedIndexServer.java
@@ -75,7 +75,7 @@
public class DistributedIndexServer extends AbstractDistributedIndexServer {
private static final Log LOG = LogFactory.getLog(DistributedIndexServer.class);
- private static final long _delay = TimeUnit.SECONDS.toMillis(10);
+ private static final long _delay = TimeUnit.SECONDS.toMillis(1);
private static final AtomicLong _pauseWarmup = new AtomicLong();
private static final Set<String> EMPTY = new HashSet<String>();
diff --git a/blur-core/src/main/java/org/apache/blur/server/IndexSearcherCloseableSecureBase.java b/blur-core/src/main/java/org/apache/blur/server/IndexSearcherCloseableSecureBase.java
index ac58229..cd3e0b1 100644
--- a/blur-core/src/main/java/org/apache/blur/server/IndexSearcherCloseableSecureBase.java
+++ b/blur-core/src/main/java/org/apache/blur/server/IndexSearcherCloseableSecureBase.java
@@ -85,6 +85,8 @@
Throwable cause = e.getCause();
if (cause instanceof IOException) {
throw (IOException) cause;
+ } else if (cause instanceof RuntimeException) {
+ throw (RuntimeException) cause;
} else {
throw new RuntimeException(cause);
}
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java b/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
index c55ce0a..56c5aeb 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
@@ -71,6 +71,7 @@
public abstract class TableAdmin implements Iface {
+ private static final long WAIT_BETWEEN_POLLS = 500;
private static final Log LOG = LogFactory.getLog(TableAdmin.class);
protected ZooKeeper _zookeeper;
protected ClusterStatus _clusterStatus;
@@ -204,7 +205,7 @@
return;
}
try {
- Thread.sleep(3000);
+ Thread.sleep(WAIT_BETWEEN_POLLS);
} catch (InterruptedException e) {
LOG.error("Unknown error while enabling table [" + table + "]", e);
throw new BException("Unknown error while enabling table [" + table + "]", e);
@@ -222,14 +223,7 @@
LOG.info("Waiting for shards to engage on table [" + table + "]");
while (true) {
try {
- Thread.sleep(3000);
- } catch (InterruptedException e) {
- LOG.error("Unknown error while engaging table [" + table + "]", e);
- throw new BException("Unknown error while engaging table [" + table + "]", e);
- }
- try {
Map<String, Map<String, ShardState>> shardServerLayoutState = shardServerLayoutState(table);
-
int countNumberOfOpen = 0;
int countNumberOfOpening = 0;
for (Entry<String, Map<String, ShardState>> shardEntry : shardServerLayoutState.entrySet()) {
@@ -249,6 +243,12 @@
if (countNumberOfOpen == shardCount && countNumberOfOpening == 0) {
return;
}
+ try {
+ Thread.sleep(WAIT_BETWEEN_POLLS);
+ } catch (InterruptedException e) {
+ LOG.error("Unknown error while engaging table [" + table + "]", e);
+ throw new BException("Unknown error while engaging table [" + table + "]", e);
+ }
} catch (BlurException e) {
LOG.info("Stilling waiting", e);
} catch (TException e) {
@@ -264,12 +264,7 @@
private void waitForTheTableToDisengage(String cluster, String table) throws BlurException, TException {
LOG.info("Waiting for shards to disengage on table [" + table + "]");
while (true) {
- try {
- Thread.sleep(3000);
- } catch (InterruptedException e) {
- LOG.error("Unknown error while disengaging table [" + table + "]", e);
- throw new BException("Unknown error while disengaging table [" + table + "]", e);
- }
+
try {
Map<String, Map<String, ShardState>> shardServerLayoutState = shardServerLayoutState(table);
@@ -277,13 +272,16 @@
int countNumberOfClosing = 0;
for (Entry<String, Map<String, ShardState>> shardEntry : shardServerLayoutState.entrySet()) {
Map<String, ShardState> value = shardEntry.getValue();
- for (ShardState state : value.values()) {
+ for (Entry<String, ShardState> e : value.entrySet()) {
+ String server = e.getKey();
+ ShardState state = e.getValue();
if (state == ShardState.OPEN) {
countNumberOfOpen++;
+ LOG.info("Shard [{0}] of table [{1}] from server [{2}] still reporting open.", shardEntry.getKey(),
+ table, server);
} else if (state == ShardState.CLOSING) {
countNumberOfClosing++;
} else if (state == ShardState.CLOSED) {
- LOG.info("Shard [{0}] of table [{1}] now reporting closed.", shardEntry.getKey(), table);
} else {
LOG.warn("Unexpected state of [{0}] for shard [{1}].", state, shardEntry.getKey());
}
@@ -294,6 +292,12 @@
if (countNumberOfOpen == 0 && countNumberOfClosing == 0) {
return;
}
+ try {
+ Thread.sleep(WAIT_BETWEEN_POLLS);
+ } catch (InterruptedException e) {
+ LOG.error("Unknown error while disengaging table [" + table + "]", e);
+ throw new BException("Unknown error while disengaging table [" + table + "]", e);
+ }
} catch (BlurException e) {
LOG.info("Stilling waiting", e);
} catch (TException e) {
@@ -309,7 +313,7 @@
return;
}
try {
- Thread.sleep(3000);
+ Thread.sleep(WAIT_BETWEEN_POLLS);
} catch (InterruptedException e) {
LOG.error("Unknown error while enabling table [" + table + "]", e);
throw new BException("Unknown error while enabling table [" + table + "]", e);
diff --git a/blur-core/src/test/java/org/apache/blur/MiniCluster.java b/blur-core/src/test/java/org/apache/blur/MiniCluster.java
index 2cc805a..68f2718 100644
--- a/blur-core/src/test/java/org/apache/blur/MiniCluster.java
+++ b/blur-core/src/test/java/org/apache/blur/MiniCluster.java
@@ -43,6 +43,7 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Random;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
@@ -182,7 +183,7 @@
}
}
- public void stopMrMiniCluster() throws IOException {
+ public void shutdownMrMiniCluster() throws IOException {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("js");
if (useYarn()) {
@@ -219,7 +220,7 @@
ScriptEngine engine = manager.getEngineByName("js");
if (useYarn()) {
- int nodeManagers = 2;
+ int nodeManagers = 4;
Class<?> c = getClass();
engine.put("c", c);
engine.put("nodeManagers", nodeManagers);
@@ -503,6 +504,7 @@
private Process _process;
private AtomicBoolean _online = new AtomicBoolean();
+ private boolean _dead;
@Override
public void close() throws IOException {
@@ -555,8 +557,14 @@
public void kill() {
if (_process != null) {
_process.destroy();
+ _dead = true;
}
}
+
+ @Override
+ public boolean isDead() {
+ return _dead;
+ }
};
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
@@ -581,6 +589,13 @@
}
return new MiniClusterServer() {
+ private boolean _dead;
+
+ @Override
+ public boolean isDead() {
+ return _dead;
+ }
+
@Override
public void close() throws IOException {
thriftServer.close();
@@ -604,6 +619,7 @@
String path = onlineShardsPath + "/" + nodeName;
zk.delete(path, -1);
zk.close();
+ _dead = true;
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
@@ -900,4 +916,16 @@
throw new RuntimeException(e);
}
}
+
+ public void killRandomShardServer() {
+ Random random = new Random();
+ for (int i = 0; i < shards.size(); i++) {
+ int index = random.nextInt(shards.size());
+ MiniClusterServer miniClusterServer = shards.get(index);
+ if (!miniClusterServer.isDead()) {
+ miniClusterServer.kill();
+ return;
+ }
+ }
+ }
}
diff --git a/blur-core/src/test/java/org/apache/blur/MiniClusterServer.java b/blur-core/src/test/java/org/apache/blur/MiniClusterServer.java
index 99ccf49..d085774 100644
--- a/blur-core/src/test/java/org/apache/blur/MiniClusterServer.java
+++ b/blur-core/src/test/java/org/apache/blur/MiniClusterServer.java
@@ -20,6 +20,8 @@
public interface MiniClusterServer extends Closeable {
+ boolean isDead();
+
void kill();
void start();
diff --git a/blur-core/src/test/java/org/apache/blur/analysis/ThriftFieldManagerTest.java b/blur-core/src/test/java/org/apache/blur/analysis/ThriftFieldManagerTestIT.java
similarity index 89%
rename from blur-core/src/test/java/org/apache/blur/analysis/ThriftFieldManagerTest.java
rename to blur-core/src/test/java/org/apache/blur/analysis/ThriftFieldManagerTestIT.java
index 3243006..0c4b959 100644
--- a/blur-core/src/test/java/org/apache/blur/analysis/ThriftFieldManagerTest.java
+++ b/blur-core/src/test/java/org/apache/blur/analysis/ThriftFieldManagerTestIT.java
@@ -29,24 +29,18 @@
import org.junit.Before;
import org.junit.BeforeClass;
-public class ThriftFieldManagerTest extends BaseFieldManagerTest {
+public class ThriftFieldManagerTestIT extends BaseFieldManagerTest {
- private static boolean _managing;
private static TableDescriptor _tableDescriptor;
@BeforeClass
public static void startup() throws IOException, BlurException, TException {
- if (!SuiteCluster.isClusterSetup()) {
- SuiteCluster.setupMiniCluster();
- _managing = true;
- }
+ SuiteCluster.setupMiniCluster(ThriftFieldManagerTestIT.class);
}
@AfterClass
public static void shutdown() throws IOException {
- if (_managing) {
- SuiteCluster.shutdownMiniCluster();
- }
+ SuiteCluster.shutdownMiniCluster(ThriftFieldManagerTestIT.class);
}
public Iface getClient() throws IOException {
diff --git a/blur-core/src/test/java/org/apache/blur/command/ReconnectWhileCommandIsRunningIntTests.java b/blur-core/src/test/java/org/apache/blur/command/ReconnectWhileCommandIsRunningIntTestsIT.java
similarity index 89%
rename from blur-core/src/test/java/org/apache/blur/command/ReconnectWhileCommandIsRunningIntTests.java
rename to blur-core/src/test/java/org/apache/blur/command/ReconnectWhileCommandIsRunningIntTestsIT.java
index a38c5ab..00238c7 100644
--- a/blur-core/src/test/java/org/apache/blur/command/ReconnectWhileCommandIsRunningIntTests.java
+++ b/blur-core/src/test/java/org/apache/blur/command/ReconnectWhileCommandIsRunningIntTestsIT.java
@@ -8,6 +8,7 @@
import org.apache.blur.thrift.BaseClusterTest;
import org.apache.blur.thrift.TableGen;
import org.apache.blur.thrift.generated.BlurException;
+import org.junit.Test;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -26,9 +27,13 @@
* the License.
*/
-public class ReconnectWhileCommandIsRunningIntTests extends BaseClusterTest {
+public class ReconnectWhileCommandIsRunningIntTestsIT extends BaseClusterTest {
+ @Test
+ public void voidTest() {
-// @Test Slow test
+ }
+
+ // @Test Slow test
public void testWaitForSecondsIntTest() throws BlurException, TException, IOException, InterruptedException {
final String tableName = "testWaitForSecondsIntTest";
TableGen.define(tableName).cols("test", "col1").addRows(100, 20, "r1", "rec-###", "value").build(getClient());
diff --git a/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java b/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTestIT.java
similarity index 90%
rename from blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java
rename to blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTestIT.java
index deb930d..e5e7514 100644
--- a/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java
+++ b/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTestIT.java
@@ -28,9 +28,11 @@
import java.util.List;
import java.util.concurrent.TimeUnit;
-import org.apache.blur.MiniCluster;
import org.apache.blur.log.Log;
import org.apache.blur.log.LogFactory;
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.SuiteCluster;
+import org.apache.blur.thrift.generated.BlurException;
import org.apache.blur.thrift.generated.TableDescriptor;
import org.apache.blur.utils.BlurUtil;
import org.apache.blur.zookeeper.ZooKeeperClient;
@@ -48,13 +50,12 @@
import org.junit.BeforeClass;
import org.junit.Test;
-public class ZookeeperClusterStatusTest {
+public class ZookeeperClusterStatusTestIT {
private static final String TEST = "test";
private static final String DEFAULT = "default";
- private static final Log LOG = LogFactory.getLog(ZookeeperClusterStatusTest.class);
- private static MiniCluster miniCluster;
+ private static final Log LOG = LogFactory.getLog(ZookeeperClusterStatusTestIT.class);
private ZooKeeper zooKeeper1;
private ZooKeeper zooKeeper2;
private ZookeeperClusterStatus clusterStatus1;
@@ -68,31 +69,32 @@
}
@BeforeClass
- public static void setupOnce() throws InterruptedException, IOException, KeeperException {
- miniCluster = new MiniCluster();
- miniCluster.startZooKeeper("./target/zk_test", true);
+ public static void startup() throws IOException, BlurException, TException {
+ SuiteCluster.setupMiniCluster(ZookeeperClusterStatusTestIT.class);
}
@AfterClass
- public static void teardownOnce() {
- miniCluster.shutdownZooKeeper();
+ public static void shutdown() throws IOException {
+ SuiteCluster.shutdownMiniCluster(ZookeeperClusterStatusTestIT.class);
}
@Before
public void setup() throws KeeperException, InterruptedException, IOException {
- zooKeeper1 = new ZooKeeperClient(miniCluster.getZkConnectionString(), 30000, new Watcher() {
- @Override
- public void process(WatchedEvent event) {
+ zooKeeper1 = new ZooKeeperClient(SuiteCluster.getZooKeeperConnStr(ZookeeperClusterStatusTestIT.class), 30000,
+ new Watcher() {
+ @Override
+ public void process(WatchedEvent event) {
- }
- });
+ }
+ });
BlurUtil.setupZookeeper(zooKeeper1, DEFAULT);
- zooKeeper2 = new ZooKeeperClient(miniCluster.getZkConnectionString(), 30000, new Watcher() {
- @Override
- public void process(WatchedEvent event) {
+ zooKeeper2 = new ZooKeeperClient(SuiteCluster.getZooKeeperConnStr(ZookeeperClusterStatusTestIT.class), 30000,
+ new Watcher() {
+ @Override
+ public void process(WatchedEvent event) {
- }
- });
+ }
+ });
BlurUtil.setupZookeeper(zooKeeper1, DEFAULT);
BlurUtil.setupZookeeper(zooKeeper2, DEFAULT);
clusterStatus1 = new ZookeeperClusterStatus(zooKeeper1);
diff --git a/blur-core/src/test/java/org/apache/blur/manager/indexserver/MasterBasedDistributedLayoutFactoryTest.java b/blur-core/src/test/java/org/apache/blur/manager/indexserver/MasterBasedDistributedLayoutFactoryTestIT.java
similarity index 85%
rename from blur-core/src/test/java/org/apache/blur/manager/indexserver/MasterBasedDistributedLayoutFactoryTest.java
rename to blur-core/src/test/java/org/apache/blur/manager/indexserver/MasterBasedDistributedLayoutFactoryTestIT.java
index 1f834d3..be9f011 100644
--- a/blur-core/src/test/java/org/apache/blur/manager/indexserver/MasterBasedDistributedLayoutFactoryTest.java
+++ b/blur-core/src/test/java/org/apache/blur/manager/indexserver/MasterBasedDistributedLayoutFactoryTestIT.java
@@ -18,15 +18,15 @@
import static org.junit.Assert.assertEquals;
-import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
-import org.apache.blur.MiniCluster;
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.SuiteCluster;
+import org.apache.blur.thrift.generated.BlurException;
import org.apache.blur.zookeeper.ZooKeeperClient;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
@@ -42,33 +42,30 @@
import com.google.common.collect.Lists;
@SuppressWarnings("unchecked")
-public class MasterBasedDistributedLayoutFactoryTest {
- private static String path = "./target/test-zk-MasterBasedDistributedLayoutFactoryTest";
- private static MiniCluster miniCluster;
+public class MasterBasedDistributedLayoutFactoryTestIT {
private ZooKeeper _zooKeeper;
private String cluster = "default";
@BeforeClass
- public static void startZooKeeper() throws IOException {
- new File(path).mkdirs();
- miniCluster = new MiniCluster();
- miniCluster.startZooKeeper(path, true);
+ public static void startup() throws IOException, BlurException, TException {
+ SuiteCluster.setupMiniCluster(MasterBasedDistributedLayoutFactoryTestIT.class);
}
@AfterClass
- public static void stopZooKeeper() throws InterruptedException {
- miniCluster.shutdownZooKeeper();
+ public static void shutdown() throws IOException {
+ SuiteCluster.shutdownMiniCluster(MasterBasedDistributedLayoutFactoryTestIT.class);
}
@Before
public void setup() throws IOException, KeeperException, InterruptedException {
- _zooKeeper = new ZooKeeperClient(miniCluster.getZkConnectionString(), 50000, new Watcher() {
- @Override
- public void process(WatchedEvent event) {
+ _zooKeeper = new ZooKeeperClient(SuiteCluster.getZooKeeperConnStr(MasterBasedDistributedLayoutFactoryTestIT.class),
+ 50000, new Watcher() {
+ @Override
+ public void process(WatchedEvent event) {
- }
- });
+ }
+ });
rmr(_zooKeeper, "/blur");
}
@@ -82,8 +79,9 @@
MasterBasedDistributedLayoutFactory factory = new MasterBasedDistributedLayoutFactory(_zooKeeper, cluster);
List<String> shardList = Lists.newArrayList("shard-0", "shard-1", "shard-2", "shard-3", "shard-4", "shard-5");
- List<String> shardServerList = Lists.newArrayList("server-0", "server-1", "server-2", "server-3", "server-4", "server-5");
-
+ List<String> shardServerList = Lists.newArrayList("server-0", "server-1", "server-2", "server-3", "server-4",
+ "server-5");
+
String table = "t1";
DistributedLayout layout1 = factory.createDistributedLayout(table, shardList, shardServerList);
@@ -95,7 +93,7 @@
assertEquals(expected1, actual1);
List<String> newShardServerList = Lists.newArrayList("server-0", "server-1", "server-2", "server-3");
-
+
DistributedLayout layout2 = factory.createDistributedLayout(table, shardList, newShardServerList);
Map<String, String> expected2 = map(e("shard-0", "server-0"), e("shard-1", "server-1"), e("shard-2", "server-2"),
@@ -110,7 +108,7 @@
List<String> shardList = Lists.newArrayList("shard-0", "shard-1", "shard-2", "shard-3", "shard-4", "shard-5");
List<String> shardServerList = Lists.newArrayList("server-0", "server-1", "server-2", "server-3");
-
+
String table = "t1";
DistributedLayout layout1 = factory.createDistributedLayout(table, shardList, shardServerList);
@@ -121,8 +119,9 @@
assertEquals(expected1, actual1);
- List<String> newShardServerList = Lists.newArrayList("server-0", "server-1", "server-2", "server-3", "server-4", "server-5");
-
+ List<String> newShardServerList = Lists.newArrayList("server-0", "server-1", "server-2", "server-3", "server-4",
+ "server-5");
+
DistributedLayout layout2 = factory.createDistributedLayout(table, shardList, newShardServerList);
Map<String, String> expected2 = map(e("shard-0", "server-4"), e("shard-1", "server-5"), e("shard-2", "server-2"),
diff --git a/blur-core/src/test/java/org/apache/blur/manager/indexserver/SafeModeTest.java b/blur-core/src/test/java/org/apache/blur/manager/indexserver/SafeModeTestIT.java
similarity index 91%
rename from blur-core/src/test/java/org/apache/blur/manager/indexserver/SafeModeTest.java
rename to blur-core/src/test/java/org/apache/blur/manager/indexserver/SafeModeTestIT.java
index ed5a301..c0f6591 100644
--- a/blur-core/src/test/java/org/apache/blur/manager/indexserver/SafeModeTest.java
+++ b/blur-core/src/test/java/org/apache/blur/manager/indexserver/SafeModeTestIT.java
@@ -21,7 +21,6 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -29,7 +28,9 @@
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
-import org.apache.blur.MiniCluster;
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.SuiteCluster;
+import org.apache.blur.thrift.generated.BlurException;
import org.apache.blur.zookeeper.ZooKeeperClient;
import org.apache.blur.zookeeper.ZooKeeperLockManager;
import org.apache.zookeeper.KeeperException;
@@ -42,28 +43,23 @@
import org.junit.BeforeClass;
import org.junit.Test;
-public class SafeModeTest {
-
- private static String path = "./target/test-zk";
- private static MiniCluster miniCluster;
+public class SafeModeTestIT {
@BeforeClass
- public static void startZooKeeper() throws IOException {
- new File(path).mkdirs();
- miniCluster = new MiniCluster();
- miniCluster.startZooKeeper(path, true);
+ public static void startup() throws IOException, BlurException, TException {
+ SuiteCluster.setupMiniCluster(SafeModeTestIT.class);
}
@AfterClass
- public static void stopZooKeeper() throws InterruptedException {
- miniCluster.shutdownZooKeeper();
+ public static void shutdown() throws IOException {
+ SuiteCluster.shutdownMiniCluster(SafeModeTestIT.class);
}
private ZooKeeper zk;
@Before
public void setup() throws IOException {
- zk = new ZooKeeperClient(miniCluster.getZkConnectionString(), 20000, new Watcher() {
+ zk = new ZooKeeperClient(SuiteCluster.getZooKeeperConnStr(SafeModeTestIT.class), 20000, new Watcher() {
@Override
public void process(WatchedEvent event) {
@@ -181,7 +177,7 @@
@Test
public void testExtraNodeStartup() throws IOException, InterruptedException, KeeperException {
- ZooKeeper zk = new ZooKeeper(miniCluster.getZkConnectionString(), 20000, new Watcher() {
+ ZooKeeper zk = new ZooKeeperClient(SuiteCluster.getZooKeeperConnStr(SafeModeTestIT.class), 20000, new Watcher() {
@Override
public void process(WatchedEvent event) {
@@ -204,7 +200,7 @@
@Test
public void testSecondNodeStartup() throws IOException, InterruptedException, KeeperException {
- ZooKeeper zk = new ZooKeeper(miniCluster.getZkConnectionString(), 20000, new Watcher() {
+ ZooKeeper zk = new ZooKeeperClient(SuiteCluster.getZooKeeperConnStr(SafeModeTestIT.class), 20000, new Watcher() {
@Override
public void process(WatchedEvent event) {
diff --git a/blur-core/src/test/java/org/apache/blur/manager/writer/SharedMergeSchedulerThroughputTest.java b/blur-core/src/test/java/org/apache/blur/manager/writer/SharedMergeSchedulerThroughputTestIT.java
similarity index 96%
rename from blur-core/src/test/java/org/apache/blur/manager/writer/SharedMergeSchedulerThroughputTest.java
rename to blur-core/src/test/java/org/apache/blur/manager/writer/SharedMergeSchedulerThroughputTestIT.java
index 630cda2..f527bbe 100644
--- a/blur-core/src/test/java/org/apache/blur/manager/writer/SharedMergeSchedulerThroughputTest.java
+++ b/blur-core/src/test/java/org/apache/blur/manager/writer/SharedMergeSchedulerThroughputTestIT.java
@@ -37,9 +37,13 @@
import org.apache.lucene.util.Version;
import org.junit.Test;
-public class SharedMergeSchedulerThroughputTest {
+public class SharedMergeSchedulerThroughputTestIT {
-// @Test
+ @Test
+ public void voidTest() {
+
+ }
+
public void test() throws IOException {
MiniCluster miniCluster = new MiniCluster();
miniCluster.startDfs("./tmp/hdfs");
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/BaseClusterTest.java b/blur-core/src/test/java/org/apache/blur/thrift/BaseClusterTest.java
index 2934f31..e7f8cac 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/BaseClusterTest.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/BaseClusterTest.java
@@ -24,15 +24,12 @@
import org.junit.BeforeClass;
public class BaseClusterTest {
+
protected static String TABLE_PATH = new File("./target/tmp/test-data/test-tables").getAbsolutePath();
- private static boolean _managing;
@BeforeClass
public static void startup() throws IOException {
- if (!SuiteCluster.isClusterSetup()) {
- SuiteCluster.setupMiniCluster();
- _managing = true;
- }
+ SuiteCluster.setupMiniCluster(BaseClusterTest.class);
File file = new File("test-data");
if (file.exists()) {
rmr(file);
@@ -53,15 +50,13 @@
@AfterClass
public static void shutdown() throws IOException {
- if (_managing) {
- SuiteCluster.shutdownMiniCluster();
- }
+ SuiteCluster.shutdownMiniCluster(BaseClusterTest.class);
}
public Iface getClient() throws IOException {
return SuiteCluster.getClient();
}
-
+
protected String getZkConnString() {
return SuiteCluster.getZooKeeperConnStr();
}
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/BlurClientTest.java b/blur-core/src/test/java/org/apache/blur/thrift/BlurClientTestMultipleQuorumsIT.java
similarity index 79%
rename from blur-core/src/test/java/org/apache/blur/thrift/BlurClientTest.java
rename to blur-core/src/test/java/org/apache/blur/thrift/BlurClientTestMultipleQuorumsIT.java
index dd8cf65..b314309 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/BlurClientTest.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/BlurClientTestMultipleQuorumsIT.java
@@ -16,9 +16,11 @@
*/
package org.apache.blur.thrift;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -27,28 +29,44 @@
import org.apache.blur.thirdparty.thrift_0_9_0.TException;
import org.apache.blur.thrift.generated.Blur.Iface;
import org.apache.blur.thrift.generated.BlurException;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
import com.google.common.base.Splitter;
-public class BlurClientTest {
+public class BlurClientTestMultipleQuorumsIT {
private static final File TMPDIR = new File(System.getProperty("blur.tmp.dir", "./target/tmp_BlurClientTest"));
+ @BeforeClass
+ public static void startup() throws IOException, BlurException, TException {
+ SuiteCluster.setupMiniCluster(BlurClientTestMultipleQuorumsIT.class);
+ }
+
+ @AfterClass
+ public static void shutdown() throws IOException {
+ SuiteCluster.shutdownMiniCluster(BlurClientTestMultipleQuorumsIT.class);
+ }
+
+ @After
+ public void teadown() {
+ BlurClient.closeZooKeeper();
+ }
+
@Test
public void testMultipleQuorums() throws BlurException, TException {
File testDirectory = new File(TMPDIR, "testMultipleQuorums").getAbsoluteFile();
testDirectory.mkdirs();
- MiniCluster cluster1 = new MiniCluster();
- cluster1.startBlurCluster(new File(testDirectory, "cluster1").getAbsolutePath(), 1, 1, true, false);
MiniCluster cluster2 = new MiniCluster();
cluster2.startBlurCluster(new File(testDirectory, "cluster2").getAbsolutePath(), 2, 1, true, false);
- Iface client1 = BlurClient.getClientFromZooKeeperConnectionStr(cluster1.getZkConnectionString());
+ Iface client1 = BlurClient.getClientFromZooKeeperConnectionStr(SuiteCluster.getZooKeeperConnStr());
Iface client2 = BlurClient.getClientFromZooKeeperConnectionStr(cluster2.getZkConnectionString());
List<String> controllerServerList1 = client1.controllerServerList();
- List<String> controllerServerList1FromConnectionStr = getList(cluster1.getControllerConnectionStr());
+ List<String> controllerServerList1FromConnectionStr = getList(SuiteCluster.getControllerConnectionStr());
List<String> controllerServerList2 = client2.controllerServerList();
List<String> controllerServerList2FromConnectionStr = getList(cluster2.getControllerConnectionStr());
@@ -57,7 +75,6 @@
Collections.sort(controllerServerList2);
Collections.sort(controllerServerList2FromConnectionStr);
- cluster1.shutdownBlurCluster();
cluster2.shutdownBlurCluster();
assertEquals(controllerServerList1FromConnectionStr, controllerServerList1);
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestBase.java b/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestBase.java
index f0e4a12..76b6791 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestBase.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestBase.java
@@ -79,14 +79,10 @@
import org.apache.blur.user.User;
import org.apache.blur.user.UserContext;
import org.apache.blur.utils.BlurConstants;
-import org.apache.blur.utils.GCWatcher;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.LocalFileSystem;
import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.permission.FsAction;
-import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.zookeeper.KeeperException;
import org.junit.After;
import org.junit.AfterClass;
@@ -103,33 +99,52 @@
protected int numberOfDocs = 1000;
protected String controllerConnectionStr;
+ // These setting were here before this test used the SuiteCluster class...
+ // Will remove at some point in the future once we are sure we will no longer
+ // need them.
+
+ // @BeforeClass
+ // public static void startCluster() throws IOException {
+ // GCWatcher.init(0.60);
+ // LocalFileSystem localFS = FileSystem.getLocal(new Configuration());
+ // File testDirectory = new File(TMPDIR,
+ // "blur-cluster-test").getAbsoluteFile();
+ // testDirectory.mkdirs();
+ //
+ // Path directory = new Path(testDirectory.getPath());
+ // FsPermission dirPermissions =
+ // localFS.getFileStatus(directory).getPermission();
+ // FsAction userAction = dirPermissions.getUserAction();
+ // FsAction groupAction = dirPermissions.getGroupAction();
+ // FsAction otherAction = dirPermissions.getOtherAction();
+ //
+ // StringBuilder builder = new StringBuilder();
+ // builder.append(userAction.ordinal());
+ // builder.append(groupAction.ordinal());
+ // builder.append(otherAction.ordinal());
+ // String dirPermissionNum = builder.toString();
+ // System.setProperty("dfs.datanode.data.dir.perm", dirPermissionNum);
+ // testDirectory.delete();
+ // miniCluster = new MiniCluster();
+ // miniCluster.startBlurCluster(new File(testDirectory,
+ // "cluster").getAbsolutePath(), 2, 3, true, externalProcesses);
+ // }
+ //
+ // @AfterClass
+ // public static void shutdownCluster() {
+ // miniCluster.shutdownBlurCluster();
+ // }
+
@BeforeClass
- public static void startCluster() throws IOException {
- GCWatcher.init(0.60);
- LocalFileSystem localFS = FileSystem.getLocal(new Configuration());
- File testDirectory = new File(TMPDIR, "blur-cluster-test").getAbsoluteFile();
- testDirectory.mkdirs();
-
- Path directory = new Path(testDirectory.getPath());
- FsPermission dirPermissions = localFS.getFileStatus(directory).getPermission();
- FsAction userAction = dirPermissions.getUserAction();
- FsAction groupAction = dirPermissions.getGroupAction();
- FsAction otherAction = dirPermissions.getOtherAction();
-
- StringBuilder builder = new StringBuilder();
- builder.append(userAction.ordinal());
- builder.append(groupAction.ordinal());
- builder.append(otherAction.ordinal());
- String dirPermissionNum = builder.toString();
- System.setProperty("dfs.datanode.data.dir.perm", dirPermissionNum);
- testDirectory.delete();
- miniCluster = new MiniCluster();
- miniCluster.startBlurCluster(new File(testDirectory, "cluster").getAbsolutePath(), 2, 3, true, externalProcesses);
+ public static void startup() throws IOException, BlurException, TException {
+ SuiteCluster.setupMiniCluster(BlurClusterTestBase.class);
+ externalProcesses = SuiteCluster.externalProcesses;
+ miniCluster = SuiteCluster.getMiniCluster();
}
@AfterClass
- public static void shutdownCluster() {
- miniCluster.shutdownBlurCluster();
+ public static void shutdown() throws IOException {
+ SuiteCluster.shutdownMiniCluster(BlurClusterTestBase.class);
}
@Before
@@ -231,7 +246,7 @@
assertEquals(5, shardServerLayoutState.size());
List<String> shardServerList = client.shardServerList(BlurConstants.DEFAULT);
- assertEquals(3, shardServerList.size());
+ assertEquals(2, shardServerList.size());
}
@Test
@@ -627,6 +642,7 @@
client.query(tableName, blurQueryRow);
fail.set(true);
} catch (BlurException e) {
+ e.printStackTrace();
error.set(e);
} catch (TException e) {
e.printStackTrace();
@@ -640,7 +656,7 @@
if (fail.get()) {
fail("Unknown error, failing test.");
}
- assertEquals(blurException.getErrorType(), ErrorType.QUERY_CANCEL);
+ assertEquals(ErrorType.QUERY_CANCEL, blurException.getErrorType());
} finally {
setDebugRunSlow(tableName, false);
}
@@ -799,7 +815,7 @@
assertEquals(numberOfDocs, results1.getTotalResults());
assertRowResults(results1);
- miniCluster.killShardServer(1);
+ miniCluster.killRandomShardServer();
// make sure the WAL syncs
Thread.sleep(TimeUnit.SECONDS.toMillis(1));
@@ -807,13 +823,13 @@
// This should block until shards have failed over
client.shardServerLayout(tableName);
- assertEquals("We should have lost a node.", 2, client.shardServerList(BlurConstants.DEFAULT).size());
+ assertEquals("We should have lost a node.", 1, client.shardServerList(BlurConstants.DEFAULT).size());
assertEquals(numberOfDocs, client.query(tableName, blurQuery).getTotalResults());
miniCluster.startShards(1, true, externalProcesses);
Thread.sleep(TimeUnit.SECONDS.toMillis(1));
- assertEquals("We should have the cluster back where we started.", 3, client.shardServerList(BlurConstants.DEFAULT)
+ assertEquals("We should have the cluster back where we started.", 2, client.shardServerList(BlurConstants.DEFAULT)
.size());
}
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestNoSecurity.java b/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestNoSecurityIT.java
similarity index 95%
rename from blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestNoSecurity.java
rename to blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestNoSecurityIT.java
index 1504f01..521a4a4 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestNoSecurity.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestNoSecurityIT.java
@@ -24,7 +24,7 @@
import org.apache.blur.thrift.generated.TableDescriptor;
import org.apache.blur.user.User;
-public class BlurClusterTestNoSecurity extends BlurClusterTestBase {
+public class BlurClusterTestNoSecurityIT extends BlurClusterTestBase {
@Override
protected void setupTableProperties(TableDescriptor tableDescriptor) {
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestSecurity.java b/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestSecurityIT.java
similarity index 98%
rename from blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestSecurity.java
rename to blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestSecurityIT.java
index f3e01bf..12e66fb 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestSecurity.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTestSecurityIT.java
@@ -52,7 +52,7 @@
import org.apache.blur.utils.BlurConstants;
import org.junit.Test;
-public class BlurClusterTestSecurity extends BlurClusterTestBase {
+public class BlurClusterTestSecurityIT extends BlurClusterTestBase {
private static final String ACL_DISCOVER = "acl-discover";
private static final String TEST = "test";
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/FacetTests.java b/blur-core/src/test/java/org/apache/blur/thrift/FacetTestsIT.java
similarity index 97%
rename from blur-core/src/test/java/org/apache/blur/thrift/FacetTests.java
rename to blur-core/src/test/java/org/apache/blur/thrift/FacetTestsIT.java
index d6f858e..25ab875 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/FacetTests.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/FacetTestsIT.java
@@ -26,7 +26,7 @@
import org.apache.blur.thrift.generated.BlurResults;
import org.junit.Test;
-public class FacetTests extends BaseClusterTest {
+public class FacetTestsIT extends BaseClusterTest {
@Test
public void testQueryWithFacets() throws BlurException, TException, IOException, InterruptedException {
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/IntegrationTestSuite.java b/blur-core/src/test/java/org/apache/blur/thrift/IntegrationTestSuite.java
index 6ded4ea..828ea0b 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/IntegrationTestSuite.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/IntegrationTestSuite.java
@@ -1,4 +1,5 @@
package org.apache.blur.thrift;
+
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -28,37 +29,30 @@
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses({ TermsTests.class, FacetTests.class })
+@Suite.SuiteClasses({ TermsTestsIT.class, FacetTestsIT.class })
public class IntegrationTestSuite {
@ClassRule
public static ExternalResource testCluster = new ExternalResource() {
- private boolean _managing;
-
@Override
protected void after() {
- if (_managing) {
- try {
- SuiteCluster.shutdownMiniCluster();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
+ try {
+ SuiteCluster.shutdownMiniCluster(IntegrationTestSuite.class);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}
@Override
protected void before() throws Throwable {
- if (!SuiteCluster.isClusterSetup()) {
- _managing = true;
- try {
- SuiteCluster.setupMiniCluster();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
+ try {
+ SuiteCluster.setupMiniCluster(IntegrationTestSuite.class);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}
};
-
+
@After
public void tearDown() throws BlurException, TException, IOException {
Iface client = SuiteCluster.getClient();
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/SuiteCluster.java b/blur-core/src/test/java/org/apache/blur/thrift/SuiteCluster.java
index 26f7494..c04f670 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/SuiteCluster.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/SuiteCluster.java
@@ -1,4 +1,5 @@
package org.apache.blur.thrift;
+
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -16,23 +17,48 @@
* limitations under the License.
*/
import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.blur.BlurConfiguration;
import org.apache.blur.MiniCluster;
import org.apache.blur.thrift.generated.Blur.Iface;
import org.apache.blur.utils.BlurConstants;
+import org.apache.blur.utils.GCWatcher;
+import org.apache.blur.utils.JavaHome;
+import org.apache.blur.zookeeper.ZkUtils;
+import org.apache.blur.zookeeper.ZooKeeperClient;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
+
+import com.google.common.base.Splitter;
public class SuiteCluster {
- private static final Log log = LogFactory.getLog(SuiteCluster.class);
+
+ private static final String SEPARATOR = ":";
+ private static final String JAVA_CLASS_PATH = "java.class.path";
+ private static final String TEST_CLASSES = "test-classes";
+
+ public static final String YARN_SITE_XML = "yarn-site.xml";
+ public static final String MAPRED_SITE_XML = "mapred-site.xml";
+
private static final File TMPDIR = new File(System.getProperty("blur.tmp.dir", "./target/tmp_SuiteCluster"));
private static MiniCluster cluster;
+ public static boolean externalProcesses = false;
+ private static Class<?> _setupClass = null;
- public static void shutdownMiniCluster() throws IOException {
- if (cluster != null) {
+ static {
+ GCWatcher.init(0.60);
+ }
+
+ public static void shutdownMiniCluster(Class<?> setupClass) throws IOException {
+ if (cluster != null && _setupClass.equals(setupClass)) {
+ removeSiteFiles();
+ cluster.shutdownMrMiniCluster();
cluster.shutdownBlurCluster();
File file = new File(TMPDIR, "blur-cluster-test");
if (file.exists()) {
@@ -42,17 +68,57 @@
}
}
- public static void setupMiniCluster() throws IOException {
+ public synchronized static void setupMiniCluster(Class<?> setupClass) throws IOException {
+ if (SuiteCluster.isClusterSetup()) {
+ return;
+ }
+ JavaHome.checkJavaHome();
File testDirectory = new File(TMPDIR, "blur-cluster-test").getAbsoluteFile();
testDirectory.mkdirs();
-
testDirectory.delete();
if (cluster == null) {
+ _setupClass = setupClass;
+ removeSiteFiles();
cluster = new MiniCluster();
- cluster.startBlurCluster(new File(testDirectory, "cluster").getAbsolutePath(), 2, 3, true, false);
-
+ cluster.startBlurCluster(new File(testDirectory, "cluster").getAbsolutePath(), 2, 2, true, externalProcesses);
+ cluster.startMrMiniCluster();
+ writeSiteFiles(cluster.getMRConfiguration());
System.out.println("MiniCluster started at " + cluster.getControllerConnectionStr());
+ }
+ }
+ private static void writeSiteFiles(Configuration configuration) throws IOException {
+ String name = MAPRED_SITE_XML;
+ if (cluster.useYarn()) {
+ name = YARN_SITE_XML;
+ }
+ String classPath = System.getProperty(JAVA_CLASS_PATH);
+ for (String path : Splitter.on(SEPARATOR).split(classPath)) {
+ File file = new File(path);
+ if (file.getName().equals(TEST_CLASSES)) {
+ writeFile(new File(file, name), configuration);
+ return;
+ }
+ }
+ }
+
+ private static void writeFile(File file, Configuration configuration) throws FileNotFoundException, IOException {
+ FileOutputStream outputStream = new FileOutputStream(file);
+ configuration.writeXml(outputStream);
+ outputStream.close();
+ }
+
+ private static void removeSiteFiles() throws IOException {
+ String classPath = System.getProperty(JAVA_CLASS_PATH);
+ for (String path : Splitter.on(SEPARATOR).split(classPath)) {
+ File file = new File(path);
+ if (file.getName().equals(TEST_CLASSES)) {
+ File f1 = new File(file, MAPRED_SITE_XML);
+ File f2 = new File(file, YARN_SITE_XML);
+ f1.delete();
+ f2.delete();
+ return;
+ }
}
}
@@ -63,20 +129,56 @@
return BlurClient.getClient(blurConfiguration);
}
+ public Configuration getMRConfiguration() {
+ return cluster.getMRConfiguration();
+ }
+
+ public Configuration getHdfsConfiguration() {
+ return cluster.getConfiguration();
+ }
+
public static boolean isClusterSetup() {
return cluster != null;
}
- public static String getFileSystemUri() {
- try {
- return cluster.getFileSystemUri().toString();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
+ public static FileSystem getFileSystem() throws IOException {
+ return cluster.getFileSystem();
+ }
+
+ public static String getFileSystemUri() throws IOException {
+ return cluster.getFileSystemUri().toString();
}
public static String getZooKeeperConnStr() {
return cluster.getZkConnectionString();
}
+ public static String getControllerConnectionStr() {
+ return cluster.getControllerConnectionStr();
+ }
+
+ public static MiniCluster getMiniCluster() {
+ return cluster;
+ }
+
+ public static String getZooKeeperConnStr(Class<?> clazz) throws IOException {
+ String name = clazz.getName();
+ String zooKeeperConnStr = getZooKeeperConnStr();
+ ZooKeeperClient zk = new ZooKeeperClient(zooKeeperConnStr, 30000, new Watcher() {
+ @Override
+ public void process(WatchedEvent event) {
+
+ }
+ });
+ String path = "/" + name.replace(".", "_");
+ ZkUtils.mkNodesStr(zk, path);
+ try {
+ zk.close();
+ } catch (InterruptedException e) {
+ throw new IOException(e);
+ }
+ String zkConn = zooKeeperConnStr + path;
+ return zkConn;
+ }
+
}
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/TableGen.java b/blur-core/src/test/java/org/apache/blur/thrift/TableGen.java
index b925ce4..216b701 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/TableGen.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/TableGen.java
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -138,7 +139,7 @@
return this;
}
- public void build(Iface client) throws BlurException, TException {
+ public void build(Iface client) throws BlurException, TException, IOException {
TableDescriptor tbl = new TableDescriptor();
tbl.setName(table);
tbl.setShardCount(shardCount);
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/TermsTests.java b/blur-core/src/test/java/org/apache/blur/thrift/TermsTestsIT.java
similarity index 98%
rename from blur-core/src/test/java/org/apache/blur/thrift/TermsTests.java
rename to blur-core/src/test/java/org/apache/blur/thrift/TermsTestsIT.java
index a17236a..122a744 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/TermsTests.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/TermsTestsIT.java
@@ -27,7 +27,7 @@
import com.google.common.collect.Lists;
-public class TermsTests extends BaseClusterTest {
+public class TermsTestsIT extends BaseClusterTest {
@Test
public void testTermsList() throws BlurException, TException, IOException, InterruptedException {
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/ThriftServerTest.java b/blur-core/src/test/java/org/apache/blur/thrift/ThriftServerTestIT.java
similarity index 97%
rename from blur-core/src/test/java/org/apache/blur/thrift/ThriftServerTest.java
rename to blur-core/src/test/java/org/apache/blur/thrift/ThriftServerTestIT.java
index e451c20..5ab3b43 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/ThriftServerTest.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/ThriftServerTestIT.java
@@ -28,7 +28,7 @@
import org.apache.zookeeper.ZooKeeper;
import org.junit.Test;
-public class ThriftServerTest extends BaseClusterTest {
+public class ThriftServerTestIT extends BaseClusterTest {
@Test
public void testRootedZkPath() throws IOException, KeeperException, InterruptedException {
diff --git a/blur-hive/pom.xml b/blur-hive/pom.xml
index 8d2044f..4ed3cc1 100644
--- a/blur-hive/pom.xml
+++ b/blur-hive/pom.xml
@@ -105,12 +105,24 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
+ <goal>test-jar</goal>
</goals>
</execution>
</executions>
diff --git a/blur-hive/src/test/java/org/apache/blur/hive/BlurSerDeTest.java b/blur-hive/src/test/java/org/apache/blur/hive/BlurSerDeTestIT.java
similarity index 86%
rename from blur-hive/src/test/java/org/apache/blur/hive/BlurSerDeTest.java
rename to blur-hive/src/test/java/org/apache/blur/hive/BlurSerDeTestIT.java
index 53209a1..4e2484c 100644
--- a/blur-hive/src/test/java/org/apache/blur/hive/BlurSerDeTest.java
+++ b/blur-hive/src/test/java/org/apache/blur/hive/BlurSerDeTestIT.java
@@ -19,8 +19,6 @@
import static org.junit.Assert.assertEquals;
import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Field;
@@ -44,6 +42,7 @@
import org.apache.blur.mapreduce.lib.BlurRecord;
import org.apache.blur.thirdparty.thrift_0_9_0.TException;
import org.apache.blur.thrift.BlurClient;
+import org.apache.blur.thrift.SuiteCluster;
import org.apache.blur.thrift.generated.Blur.Iface;
import org.apache.blur.thrift.generated.BlurException;
import org.apache.blur.thrift.generated.BlurQuery;
@@ -52,13 +51,7 @@
import org.apache.blur.thrift.generated.Query;
import org.apache.blur.thrift.generated.TableDescriptor;
import org.apache.blur.utils.BlurConstants;
-import org.apache.blur.utils.GCWatcher;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.LocalFileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.permission.FsAction;
-import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.serde2.SerDeException;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
@@ -71,9 +64,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
-import com.google.common.base.Splitter;
-
-public class BlurSerDeTest {
+public class BlurSerDeTestIT {
public static final File WAREHOUSE = new File("./target/tmp/warehouse");
public static final String COLUMN_SEP = new String(new char[] { 1 });
@@ -85,40 +76,18 @@
private static final String YYYYMMDD = "yyyyMMdd";
private static final String YYYY_MM_DD = "yyyy-MM-dd";
private static final String TEST = "test";
- private static final File TMPDIR = new File(System.getProperty("blur.tmp.dir", "./target/tmp_BlurSerDeTest"));
+
private static MiniCluster miniCluster;
- private static boolean externalProcesses = false;
@BeforeClass
- public static void startCluster() throws IOException {
- System.setProperty("hadoop.log.dir", "./target/tmp_BlurSerDeTest_hadoop_log");
- GCWatcher.init(0.60);
- LocalFileSystem localFS = FileSystem.getLocal(new Configuration());
- File testDirectory = new File(TMPDIR, "blur-SerDe-test").getAbsoluteFile();
- testDirectory.mkdirs();
-
- Path directory = new Path(testDirectory.getPath());
- FsPermission dirPermissions = localFS.getFileStatus(directory).getPermission();
- FsAction userAction = dirPermissions.getUserAction();
- FsAction groupAction = dirPermissions.getGroupAction();
- FsAction otherAction = dirPermissions.getOtherAction();
-
- StringBuilder builder = new StringBuilder();
- builder.append(userAction.ordinal());
- builder.append(groupAction.ordinal());
- builder.append(otherAction.ordinal());
- String dirPermissionNum = builder.toString();
- System.setProperty("dfs.datanode.data.dir.perm", dirPermissionNum);
- testDirectory.delete();
- miniCluster = new MiniCluster();
- miniCluster.startBlurCluster(new File(testDirectory, "cluster").getAbsolutePath(), 2, 3, true, externalProcesses);
- miniCluster.startMrMiniCluster();
+ public static void startup() throws IOException, BlurException, TException {
+ SuiteCluster.setupMiniCluster(BlurSerDeTestIT.class);
+ miniCluster = SuiteCluster.getMiniCluster();
}
@AfterClass
- public static void shutdownCluster() throws IOException {
- miniCluster.stopMrMiniCluster();
- miniCluster.shutdownBlurCluster();
+ public static void shutdown() throws IOException {
+ SuiteCluster.shutdownMiniCluster(BlurSerDeTestIT.class);
}
private String _mrWorkingPath;
@@ -296,7 +265,6 @@
SQLException {
Configuration configuration = miniCluster.getMRConfiguration();
- writeSiteFiles(configuration);
HiveConf hiveConf = new HiveConf(configuration, getClass());
hiveConf.set("hive.server2.thrift.port", "0");
HiveServer2 hiveServer2 = new HiveServer2();
@@ -336,27 +304,6 @@
return totalRecords;
}
- private void writeSiteFiles(Configuration configuration) throws FileNotFoundException, IOException {
- String name = BlurHiveMRLoaderOutputCommitter.MAPRED_SITE_XML;
- if (miniCluster.useYarn()) {
- name = BlurHiveMRLoaderOutputCommitter.YARN_SITE_XML;
- }
- String classPath = System.getProperty("java.class.path");
- for (String path : Splitter.on(":").split(classPath)) {
- File file = new File(path);
- if (file.getName().equals("test-classes")) {
- writeFile(new File(file, name), configuration);
- return;
- }
- }
- }
-
- private void writeFile(File file, Configuration configuration) throws FileNotFoundException, IOException {
- FileOutputStream outputStream = new FileOutputStream(file);
- configuration.writeXml(outputStream);
- outputStream.close();
- }
-
private void generateData(File file, int totalRecords) throws IOException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(YYYY_MM_DD);
file.mkdirs();
diff --git a/blur-integration-tests/pom.xml b/blur-integration-tests/pom.xml
new file mode 100644
index 0000000..f48eb48
--- /dev/null
+++ b/blur-integration-tests/pom.xml
@@ -0,0 +1,331 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ you 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur</artifactId>
+ <version>0.2.4-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-integration-tests</artifactId>
+ <version>${projectVersion}</version>
+ <packaging>jar</packaging>
+ <name>Blur Integration Tests</name>
+ <description>The Blur integration tests module contains integration tests that use the mini-cluster.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-command</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-command</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-console</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-console</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-core</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-mapred</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-mapred</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-query</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-query</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-shell</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-shell</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-status</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-status</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-thrift</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-thrift</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-util</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>libdir</id>
+ <url>file://${basedir}/../lib</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-help-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>effective-pom</goal>
+ </goals>
+ <configuration>
+ <output>${project.build.directory}/effective-pom.xml</output>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.3.1</version>
+ <executions>
+ <execution>
+ <phase>install</phase>
+ <goals>
+ <goal>install-file</goal>
+ </goals>
+ <configuration>
+ <file>${project.build.directory}/${artifactId}-${project.version}.jar</file>
+ <pomFile>${project.build.directory}/effective-pom.xml</pomFile>
+ <!-- sources></sources -->
+ <!-- javadoc></javadoc -->
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <version>${project.version}</version>
+ <packaging>jar</packaging>
+ <!--classifier></classifier -->
+ <generatePom>true</generatePom>
+ <createChecksum>true</createChecksum>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/RunIntegrationTests.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>hadoop1</id>
+ <activation>
+ <property>
+ <name>hadoop1</name>
+ </property>
+ </activation>
+ <properties>
+ <projectHiveVersion>hadoop1-${hadoop.version}-${hive.version}-${project.parent.version}</projectHiveVersion>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-hive</artifactId>
+ <version>${projectHiveVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-hive</artifactId>
+ <version>${projectHiveVersion}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-test</artifactId>
+ <version>${hadoop.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>hadoop2-mr1</id>
+ <activation>
+ <property>
+ <name>hadoop2-mr1</name>
+ </property>
+ </activation>
+ <properties>
+ <projectHiveVersion>hadoop2-mr1-${hadoop.version}-${hive.version}-${project.parent.version}</projectHiveVersion>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-hive</artifactId>
+ <version>${projectHiveVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-hive</artifactId>
+ <version>${projectHiveVersion}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-minicluster</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>hadoop2</id>
+ <activation>
+ <property>
+ <name>hadoop2</name>
+ </property>
+ </activation>
+ <properties>
+ <projectHiveVersion>hadoop2-${hadoop.version}-${hive.version}-${project.parent.version}</projectHiveVersion>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-hive</artifactId>
+ <version>${projectHiveVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.blur</groupId>
+ <artifactId>blur-hive</artifactId>
+ <version>${projectHiveVersion}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-minicluster</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+</project>
diff --git a/blur-integration-tests/src/test/java/org/apache/blur/tests/RunIntegrationTests.java b/blur-integration-tests/src/test/java/org/apache/blur/tests/RunIntegrationTests.java
new file mode 100644
index 0000000..c6d7df4
--- /dev/null
+++ b/blur-integration-tests/src/test/java/org/apache/blur/tests/RunIntegrationTests.java
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.blur.tests;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.blur.analysis.ThriftFieldManagerTestIT;
+import org.apache.blur.command.ReconnectWhileCommandIsRunningIntTestsIT;
+import org.apache.blur.hive.BlurSerDeTestIT;
+import org.apache.blur.manager.clusterstatus.ZookeeperClusterStatusTestIT;
+import org.apache.blur.manager.indexserver.MasterBasedDistributedLayoutFactoryTestIT;
+import org.apache.blur.manager.indexserver.SafeModeTestIT;
+import org.apache.blur.manager.writer.SharedMergeSchedulerThroughputTestIT;
+import org.apache.blur.mapreduce.lib.BlurInputFormatTestIT;
+import org.apache.blur.mapreduce.lib.BlurOutputFormatMiniClusterTestIT;
+import org.apache.blur.mapreduce.lib.BlurOutputFormatTestIT;
+import org.apache.blur.mapreduce.lib.update.DriverTestIT;
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.BlurClientTestMultipleQuorumsIT;
+import org.apache.blur.thrift.BlurClusterTestNoSecurityIT;
+import org.apache.blur.thrift.BlurClusterTestSecurityIT;
+import org.apache.blur.thrift.FacetTestsIT;
+import org.apache.blur.thrift.SuiteCluster;
+import org.apache.blur.thrift.TermsTestsIT;
+import org.apache.blur.thrift.ThriftServerTestIT;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.thrift.generated.Blur.Iface;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({ ThriftFieldManagerTestIT.class, ReconnectWhileCommandIsRunningIntTestsIT.class,
+ ZookeeperClusterStatusTestIT.class, MasterBasedDistributedLayoutFactoryTestIT.class, SafeModeTestIT.class,
+ SharedMergeSchedulerThroughputTestIT.class, BlurClientTestMultipleQuorumsIT.class,
+ BlurClusterTestNoSecurityIT.class, BlurClusterTestSecurityIT.class, FacetTestsIT.class, TermsTestsIT.class,
+ ThriftServerTestIT.class, BlurSerDeTestIT.class, DriverTestIT.class, BlurInputFormatTestIT.class,
+ BlurOutputFormatMiniClusterTestIT.class, BlurOutputFormatTestIT.class })
+public class RunIntegrationTests {
+
+ @BeforeClass
+ public static void startup() throws IOException, BlurException, TException {
+ SuiteCluster.setupMiniCluster(RunIntegrationTests.class);
+ }
+
+ @AfterClass
+ public static void shutdown() throws IOException {
+ SuiteCluster.shutdownMiniCluster(RunIntegrationTests.class);
+ }
+
+ @After
+ public void tearDown() throws BlurException, TException, IOException {
+ Iface client = SuiteCluster.getClient();
+ List<String> tableList = client.tableList();
+ for (String table : tableList) {
+ client.disableTable(table);
+ client.removeTable(table, true);
+ }
+ }
+
+}
diff --git a/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurInputFormatTest.java b/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurInputFormatTestIT.java
similarity index 91%
rename from blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurInputFormatTest.java
rename to blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurInputFormatTestIT.java
index f7d5d1e..b052731 100644
--- a/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurInputFormatTest.java
+++ b/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurInputFormatTestIT.java
@@ -29,9 +29,9 @@
import java.util.UUID;
import org.apache.blur.MiniCluster;
-import org.apache.blur.store.buffer.BufferStore;
import org.apache.blur.thirdparty.thrift_0_9_0.TException;
import org.apache.blur.thrift.BlurClient;
+import org.apache.blur.thrift.SuiteCluster;
import org.apache.blur.thrift.generated.Blur.Iface;
import org.apache.blur.thrift.generated.BlurException;
import org.apache.blur.thrift.generated.Column;
@@ -58,24 +58,19 @@
import org.junit.BeforeClass;
import org.junit.Test;
-public class BlurInputFormatTest {
+public class BlurInputFormatTestIT {
- private static Configuration conf = new Configuration();
private static MiniCluster miniCluster;
@BeforeClass
- public static void setupTest() throws Exception {
- setupJavaHome();
- File file = new File("./target/tmp/BlurInputFormatTest_tmp");
- String pathStr = file.getAbsoluteFile().toURI().toString();
- System.setProperty("test.build.data", pathStr + "/data");
- System.setProperty("hadoop.log.dir", pathStr + "/hadoop_log");
- miniCluster = new MiniCluster();
- miniCluster.startBlurCluster(pathStr + "/blur", 2, 2);
- miniCluster.startMrMiniCluster();
- conf = miniCluster.getMRConfiguration();
+ public static void startup() throws IOException, BlurException, TException {
+ SuiteCluster.setupMiniCluster(BlurInputFormatTestIT.class);
+ miniCluster = SuiteCluster.getMiniCluster();
+ }
- BufferStore.initNewBuffer(128, 128 * 128);
+ @AfterClass
+ public static void shutdown() throws IOException {
+ SuiteCluster.shutdownMiniCluster(BlurInputFormatTestIT.class);
}
public static void setupJavaHome() {
@@ -92,7 +87,7 @@
@AfterClass
public static void teardown() throws IOException {
if (miniCluster != null) {
- miniCluster.stopMrMiniCluster();
+ miniCluster.shutdownMrMiniCluster();
}
rm(new File("build"));
}
@@ -167,8 +162,8 @@
TableDescriptor tableDescriptor = client.describe(tableName);
- Job job = Job.getInstance(conf, "Read Data");
- job.setJarByClass(BlurInputFormatTest.class);
+ Job job = Job.getInstance(getMrConf(), "Read Data");
+ job.setJarByClass(BlurInputFormatTestIT.class);
job.setMapperClass(TestMapper.class);
job.setInputFormatClass(BlurInputFormat.class);
job.setOutputFormatClass(SequenceFileOutputFormat.class);
@@ -195,7 +190,7 @@
}
final Map<Text, TableBlurRecord> results = new TreeMap<Text, TableBlurRecord>();
- walkOutput(output, conf, new ResultReader() {
+ walkOutput(output, getMrConf(), new ResultReader() {
@Override
public void read(Text rowId, TableBlurRecord tableBlurRecord) {
results.put(new Text(rowId), new TableBlurRecord(tableBlurRecord));
@@ -218,6 +213,10 @@
assertEquals(200, rowId);
}
+ private Configuration getMrConf() {
+ return miniCluster.getMRConfiguration();
+ }
+
public interface ResultReader {
void read(Text rowId, TableBlurRecord tableBlurRecord);
diff --git a/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatMiniClusterTest.java b/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatMiniClusterTestIT.java
similarity index 67%
rename from blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatMiniClusterTest.java
rename to blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatMiniClusterTestIT.java
index d3bd4e7..cccb8c0 100644
--- a/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatMiniClusterTest.java
+++ b/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatMiniClusterTestIT.java
@@ -23,30 +23,23 @@
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
-import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import org.apache.blur.MiniCluster;
import org.apache.blur.server.TableContext;
-import org.apache.blur.store.buffer.BufferStore;
import org.apache.blur.thirdparty.thrift_0_9_0.TException;
import org.apache.blur.thrift.BlurClient;
+import org.apache.blur.thrift.SuiteCluster;
import org.apache.blur.thrift.generated.Blur.Iface;
import org.apache.blur.thrift.generated.BlurException;
import org.apache.blur.thrift.generated.TableDescriptor;
import org.apache.blur.thrift.generated.TableStats;
-import org.apache.blur.utils.GCWatcher;
-import org.apache.blur.utils.JavaHome;
import org.apache.blur.utils.ShardUtil;
-import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.LocalFileSystem;
import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.permission.FsAction;
-import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.mapreduce.Counters;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
@@ -56,75 +49,77 @@
import org.junit.BeforeClass;
import org.junit.Test;
-public class BlurOutputFormatMiniClusterTest {
+public class BlurOutputFormatMiniClusterTestIT {
- private static Configuration conf = new Configuration();
private static FileSystem fileSystem;
private static Path TEST_ROOT_DIR;
private static MiniCluster miniCluster;
private Path inDir = new Path(TEST_ROOT_DIR + "/in");
- private static final File TMPDIR = new File(System.getProperty("blur.tmp.dir",
- "./target/tmp_BlurOutputFormatMiniClusterTest"));
+
+ // @BeforeClass
+ // public static void setupTest() throws Exception {
+ // GCWatcher.init(0.60);
+ // JavaHome.checkJavaHome();
+ // LocalFileSystem localFS = FileSystem.getLocal(new Configuration());
+ // File testDirectory = new File(TMPDIR,
+ // "blur-cluster-test").getAbsoluteFile();
+ // testDirectory.mkdirs();
+ //
+ // Path directory = new Path(testDirectory.getPath());
+ // FsPermission dirPermissions =
+ // localFS.getFileStatus(directory).getPermission();
+ // FsAction userAction = dirPermissions.getUserAction();
+ // FsAction groupAction = dirPermissions.getGroupAction();
+ // FsAction otherAction = dirPermissions.getOtherAction();
+ //
+ // StringBuilder builder = new StringBuilder();
+ // builder.append(userAction.ordinal());
+ // builder.append(groupAction.ordinal());
+ // builder.append(otherAction.ordinal());
+ // String dirPermissionNum = builder.toString();
+ // System.setProperty("dfs.datanode.data.dir.perm", dirPermissionNum);
+ // testDirectory.delete();
+ // miniCluster = new MiniCluster();
+ // miniCluster.startBlurCluster(new File(testDirectory,
+ // "cluster").getAbsolutePath(), 2, 3, true, false);
+ //
+ // TEST_ROOT_DIR = new Path(miniCluster.getFileSystemUri().toString() +
+ // "/blur_test");
+ // System.setProperty("hadoop.log.dir",
+ // "./target/BlurOutputFormatTest/hadoop_log");
+ // try {
+ // fileSystem = TEST_ROOT_DIR.getFileSystem(conf);
+ // } catch (IOException io) {
+ // throw new RuntimeException("problem getting local fs", io);
+ // }
+ //
+ // FileSystem.setDefaultUri(conf, miniCluster.getFileSystemUri());
+ //
+ // miniCluster.startMrMiniCluster();
+ // conf = miniCluster.getMRConfiguration();
+ //
+ // BufferStore.initNewBuffer(128, 128 * 128);
+ // }
+ //
+ // @AfterClass
+ // public static void teardown() throws IOException {
+ // if (miniCluster != null) {
+ // miniCluster.shutdownMrMiniCluster();
+ // }
+ // miniCluster.shutdownBlurCluster();
+ // rm(new File("build"));
+ // }
@BeforeClass
- public static void setupTest() throws Exception {
- GCWatcher.init(0.60);
- JavaHome.checkJavaHome();
- LocalFileSystem localFS = FileSystem.getLocal(new Configuration());
- File testDirectory = new File(TMPDIR, "blur-cluster-test").getAbsoluteFile();
- testDirectory.mkdirs();
-
- Path directory = new Path(testDirectory.getPath());
- FsPermission dirPermissions = localFS.getFileStatus(directory).getPermission();
- FsAction userAction = dirPermissions.getUserAction();
- FsAction groupAction = dirPermissions.getGroupAction();
- FsAction otherAction = dirPermissions.getOtherAction();
-
- StringBuilder builder = new StringBuilder();
- builder.append(userAction.ordinal());
- builder.append(groupAction.ordinal());
- builder.append(otherAction.ordinal());
- String dirPermissionNum = builder.toString();
- System.setProperty("dfs.datanode.data.dir.perm", dirPermissionNum);
- testDirectory.delete();
- miniCluster = new MiniCluster();
- miniCluster.startBlurCluster(new File(testDirectory, "cluster").getAbsolutePath(), 2, 3, true, false);
-
- TEST_ROOT_DIR = new Path(miniCluster.getFileSystemUri().toString() + "/blur_test");
- System.setProperty("hadoop.log.dir", "./target/BlurOutputFormatTest/hadoop_log");
- try {
- fileSystem = TEST_ROOT_DIR.getFileSystem(conf);
- } catch (IOException io) {
- throw new RuntimeException("problem getting local fs", io);
- }
-
- FileSystem.setDefaultUri(conf, miniCluster.getFileSystemUri());
-
- miniCluster.startMrMiniCluster();
- conf = miniCluster.getMRConfiguration();
-
- BufferStore.initNewBuffer(128, 128 * 128);
+ public static void startup() throws IOException, BlurException, TException {
+ SuiteCluster.setupMiniCluster(BlurOutputFormatMiniClusterTestIT.class);
+ miniCluster = SuiteCluster.getMiniCluster();
+ fileSystem = miniCluster.getFileSystem();
}
@AfterClass
- public static void teardown() throws IOException {
- if (miniCluster != null) {
- miniCluster.stopMrMiniCluster();
- }
- miniCluster.shutdownBlurCluster();
- rm(new File("build"));
- }
-
- private static void rm(File file) {
- if (!file.exists()) {
- return;
- }
- if (file.isDirectory()) {
- for (File f : file.listFiles()) {
- rm(f);
- }
- }
- file.delete();
+ public static void shutdown() throws IOException {
+ SuiteCluster.shutdownMiniCluster(BlurOutputFormatMiniClusterTestIT.class);
}
@Before
@@ -140,8 +135,8 @@
writeRecordsFile("in/part1", 1, 1, 1, 1, "cf1");
writeRecordsFile("in/part2", 1, 1, 2, 1, "cf1");
- Job job = Job.getInstance(conf, "blur index");
- job.setJarByClass(BlurOutputFormatMiniClusterTest.class);
+ Job job = Job.getInstance(miniCluster.getMRConfiguration(), "blur index");
+ job.setJarByClass(BlurOutputFormatMiniClusterTestIT.class);
job.setMapperClass(CsvBlurMapper.class);
job.setInputFormatClass(TextInputFormat.class);
diff --git a/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatTest.java b/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatTestIT.java
similarity index 87%
rename from blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatTest.java
rename to blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatTestIT.java
index f4e7074..25310ad 100644
--- a/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatTest.java
+++ b/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatTestIT.java
@@ -23,7 +23,6 @@
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
-import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
@@ -32,10 +31,11 @@
import org.apache.blur.MiniCluster;
import org.apache.blur.server.TableContext;
-import org.apache.blur.store.buffer.BufferStore;
import org.apache.blur.store.hdfs.HdfsDirectory;
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.SuiteCluster;
+import org.apache.blur.thrift.generated.BlurException;
import org.apache.blur.thrift.generated.TableDescriptor;
-import org.apache.blur.utils.JavaHome;
import org.apache.blur.utils.ShardUtil;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
@@ -51,52 +51,58 @@
import org.junit.BeforeClass;
import org.junit.Test;
-public class BlurOutputFormatTest {
+public class BlurOutputFormatTestIT {
- private static Configuration _conf = new Configuration();
- private static FileSystem _fileSystem;
+ // private static Configuration _conf = new Configuration();
+ // private static FileSystem _fileSystem;
+ // private static MiniCluster _miniCluster;
+ // private static Path _root;
+
+ // @BeforeClass
+ // public static void setupTest() throws Exception {
+ // JavaHome.checkJavaHome();
+ // File file = new File("./target/tmp/BlurOutputFormatTest_tmp");
+ // String pathStr = file.getAbsoluteFile().toURI().toString();
+ // String hdfsPath = pathStr + "/hdfs";
+ // System.setProperty("test.build.data", hdfsPath);
+ // System.setProperty("hadoop.log.dir", pathStr + "/hadoop_log");
+ //
+ // _miniCluster = new MiniCluster();
+ // _miniCluster.startDfs(hdfsPath);
+ // _fileSystem = _miniCluster.getFileSystem();
+ // _root = new Path(_fileSystem.getUri() + "/testroot");
+ // _miniCluster.startMrMiniCluster();
+ // _conf = _miniCluster.getMRConfiguration();
+ //
+ // BufferStore.initNewBuffer(128, 128 * 128);
+ // }
+ //
+ // @AfterClass
+ // public static void teardown() throws IOException {
+ // if (_miniCluster != null) {
+ // _miniCluster.shutdownMrMiniCluster();
+ // _miniCluster.shutdownDfs();
+ // }
+ // rm(new File("build"));
+ // }
+
private static MiniCluster _miniCluster;
-
+ private static FileSystem _fileSystem;
+ private static Configuration _conf;
private static Path _root;
@BeforeClass
- public static void setupTest() throws Exception {
- JavaHome.checkJavaHome();
- File file = new File("./target/tmp/BlurOutputFormatTest_tmp");
- String pathStr = file.getAbsoluteFile().toURI().toString();
- String hdfsPath = pathStr + "/hdfs";
- System.setProperty("test.build.data", hdfsPath);
- System.setProperty("hadoop.log.dir", pathStr + "/hadoop_log");
-
- _miniCluster = new MiniCluster();
- _miniCluster.startDfs(hdfsPath);
+ public static void startup() throws IOException, BlurException, TException {
+ SuiteCluster.setupMiniCluster(BlurOutputFormatTestIT.class);
+ _miniCluster = SuiteCluster.getMiniCluster();
_fileSystem = _miniCluster.getFileSystem();
- _root = new Path(_fileSystem.getUri() + "/testroot");
- _miniCluster.startMrMiniCluster();
_conf = _miniCluster.getMRConfiguration();
-
- BufferStore.initNewBuffer(128, 128 * 128);
+ _root = new Path(_fileSystem.getUri() + "/testroot");
}
@AfterClass
- public static void teardown() throws IOException {
- if (_miniCluster != null) {
- _miniCluster.stopMrMiniCluster();
- _miniCluster.shutdownDfs();
- }
- rm(new File("build"));
- }
-
- private static void rm(File file) {
- if (!file.exists()) {
- return;
- }
- if (file.isDirectory()) {
- for (File f : file.listFiles()) {
- rm(f);
- }
- }
- file.delete();
+ public static void shutdown() throws IOException {
+ SuiteCluster.shutdownMiniCluster(BlurOutputFormatTestIT.class);
}
@Before
@@ -114,7 +120,7 @@
writeRecordsFile(new Path(input, "part2"), 1, 1, 2, 1, "cf1");
Job job = Job.getInstance(_conf, "blur index");
- job.setJarByClass(BlurOutputFormatTest.class);
+ job.setJarByClass(BlurOutputFormatTestIT.class);
job.setMapperClass(CsvBlurMapper.class);
job.setInputFormatClass(TextInputFormat.class);
@@ -190,7 +196,7 @@
writeRecordsFile(new Path(input, "part2"), 1, 50, 2000, 100, "cf1");
Job job = Job.getInstance(_conf, "blur index");
- job.setJarByClass(BlurOutputFormatTest.class);
+ job.setJarByClass(BlurOutputFormatTestIT.class);
job.setMapperClass(CsvBlurMapper.class);
job.setInputFormatClass(TextInputFormat.class);
@@ -237,7 +243,7 @@
writeRecordsFile(new Path(input, "part2"), 1, 50, 2000, 100, "cf1");
Job job = Job.getInstance(_conf, "blur index");
- job.setJarByClass(BlurOutputFormatTest.class);
+ job.setJarByClass(BlurOutputFormatTestIT.class);
job.setMapperClass(CsvBlurMapper.class);
job.setInputFormatClass(TextInputFormat.class);
@@ -291,7 +297,7 @@
writeRecordsFile(new Path(input, "part2"), 1, 50, 2000, 100, "cf1");
Job job = Job.getInstance(_conf, "blur index");
- job.setJarByClass(BlurOutputFormatTest.class);
+ job.setJarByClass(BlurOutputFormatTestIT.class);
job.setMapperClass(CsvBlurMapper.class);
job.setInputFormatClass(TextInputFormat.class);
@@ -343,7 +349,7 @@
writeRecordsFile(new Path(input, "part2"), 1, 1, 2, 1, "cf1");
Job job = Job.getInstance(_conf, "blur index");
- job.setJarByClass(BlurOutputFormatTest.class);
+ job.setJarByClass(BlurOutputFormatTestIT.class);
job.setMapperClass(CsvBlurMapper.class);
job.setInputFormatClass(TextInputFormat.class);
@@ -381,7 +387,7 @@
writeRecordsFile(new Path(input, "part2"), 1, 5000, 2000, 100, "cf1");
Job job = Job.getInstance(_conf, "blur index");
- job.setJarByClass(BlurOutputFormatTest.class);
+ job.setJarByClass(BlurOutputFormatTestIT.class);
job.setMapperClass(CsvBlurMapper.class);
job.setInputFormatClass(TextInputFormat.class);
diff --git a/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/update/DriverTest.java b/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/update/DriverTestIT.java
similarity index 89%
rename from blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/update/DriverTest.java
rename to blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/update/DriverTestIT.java
index 8c8de6e..f9b839c 100644
--- a/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/update/DriverTest.java
+++ b/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/update/DriverTestIT.java
@@ -18,7 +18,6 @@
import static org.junit.Assert.assertEquals;
-import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -26,9 +25,9 @@
import org.apache.blur.MiniCluster;
import org.apache.blur.mapreduce.lib.BlurRecord;
-import org.apache.blur.store.buffer.BufferStore;
import org.apache.blur.thirdparty.thrift_0_9_0.TException;
import org.apache.blur.thrift.BlurClient;
+import org.apache.blur.thrift.SuiteCluster;
import org.apache.blur.thrift.generated.Blur.Iface;
import org.apache.blur.thrift.generated.BlurException;
import org.apache.blur.thrift.generated.Column;
@@ -54,55 +53,21 @@
import org.junit.BeforeClass;
import org.junit.Test;
-public class DriverTest {
+public class DriverTestIT {
- private static Configuration conf = new Configuration();
private static MiniCluster miniCluster;
+ private static Configuration conf;
@BeforeClass
- public static void setupTest() throws Exception {
- setupJavaHome();
- File file = new File("./target/tmp/BlurInputFormatTest_tmp");
- String pathStr = file.getAbsoluteFile().toURI().toString();
- System.setProperty("test.build.data", pathStr + "/data");
- System.setProperty("hadoop.log.dir", pathStr + "/hadoop_log");
- miniCluster = new MiniCluster();
- miniCluster.startBlurCluster(pathStr + "/blur", 2, 2);
- miniCluster.startMrMiniCluster();
+ public static void startup() throws IOException, BlurException, TException {
+ SuiteCluster.setupMiniCluster(DriverTestIT.class);
+ miniCluster = SuiteCluster.getMiniCluster();
conf = miniCluster.getMRConfiguration();
-
- BufferStore.initNewBuffer(128, 128 * 128);
- }
-
- public static void setupJavaHome() {
- String str = System.getenv("JAVA_HOME");
- if (str == null) {
- String property = System.getProperty("java.home");
- if (property != null) {
- throw new RuntimeException("JAVA_HOME not set should probably be [" + property + "].");
- }
- throw new RuntimeException("JAVA_HOME not set.");
- }
}
@AfterClass
- public static void teardown() throws IOException {
- if (miniCluster != null) {
- miniCluster.stopMrMiniCluster();
- }
- rm(new File("build"));
- }
-
- private static void rm(File file) {
- if (!file.exists()) {
- return;
- }
- if (file.isDirectory()) {
- for (File f : file.listFiles()) {
- rm(f);
- }
- }
- file.delete();
+ public static void shutdown() throws IOException {
+ SuiteCluster.shutdownMiniCluster(DriverTestIT.class);
}
@Test
diff --git a/blur-query/src/main/java/org/apache/blur/lucene/search/IndexSearcherCloseableBase.java b/blur-query/src/main/java/org/apache/blur/lucene/search/IndexSearcherCloseableBase.java
index 829fef5..4d473c4 100644
--- a/blur-query/src/main/java/org/apache/blur/lucene/search/IndexSearcherCloseableBase.java
+++ b/blur-query/src/main/java/org/apache/blur/lucene/search/IndexSearcherCloseableBase.java
@@ -78,6 +78,8 @@
Throwable cause = e.getCause();
if (cause instanceof IOException) {
throw (IOException) cause;
+ } else if (cause instanceof RuntimeException) {
+ throw (RuntimeException) cause;
} else {
throw new RuntimeException(cause);
}
diff --git a/blur-shell/pom.xml b/blur-shell/pom.xml
index abc720c..af351ee 100644
--- a/blur-shell/pom.xml
+++ b/blur-shell/pom.xml
@@ -55,12 +55,24 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
+ <goal>test-jar</goal>
</goals>
</execution>
</executions>
diff --git a/blur-shell/src/main/java/org/apache/blur/shell/RemoveShardServerCommand.java b/blur-shell/src/main/java/org/apache/blur/shell/RemoveShardServerCommand.java
index e1c3941..9c022e3 100644
--- a/blur-shell/src/main/java/org/apache/blur/shell/RemoveShardServerCommand.java
+++ b/blur-shell/src/main/java/org/apache/blur/shell/RemoveShardServerCommand.java
@@ -28,6 +28,7 @@
import org.apache.blur.thrift.generated.Blur;
import org.apache.blur.thrift.generated.BlurException;
import org.apache.blur.utils.BlurConstants;
+import org.apache.blur.zookeeper.ZooKeeperClient;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
@@ -46,7 +47,7 @@
BlurConfiguration configuration = new BlurConfiguration();
String connectString = configuration.get(BlurConstants.BLUR_ZOOKEEPER_CONNECTION);
int sessionTimeout = configuration.getInt(BlurConstants.BLUR_ZOOKEEPER_TIMEOUT, 30000);
- zooKeeper = new ZooKeeper(connectString, sessionTimeout, new Watcher() {
+ zooKeeper = new ZooKeeperClient(connectString, sessionTimeout, new Watcher() {
@Override
public void process(WatchedEvent event) {
diff --git a/blur-status/pom.xml b/blur-status/pom.xml
index 5c3fb38..021e120 100644
--- a/blur-status/pom.xml
+++ b/blur-status/pom.xml
@@ -73,12 +73,24 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
+ <goal>test-jar</goal>
</goals>
</execution>
</executions>
diff --git a/blur-util/pom.xml b/blur-util/pom.xml
index 462f5f8..a238b7d 100644
--- a/blur-util/pom.xml
+++ b/blur-util/pom.xml
@@ -98,24 +98,20 @@
</repositories>
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
diff --git a/blur-util/src/main/java/org/apache/blur/concurrent/Executors.java b/blur-util/src/main/java/org/apache/blur/concurrent/Executors.java
index 05a1153..5e47aa8 100644
--- a/blur-util/src/main/java/org/apache/blur/concurrent/Executors.java
+++ b/blur-util/src/main/java/org/apache/blur/concurrent/Executors.java
@@ -43,7 +43,7 @@
public static ExecutorService newThreadPool(BlockingQueue<Runnable> workQueue, String prefix, int threadCount,
boolean watch) {
- BlurThreadPoolExecutor executorService = new BlurThreadPoolExecutor(threadCount, threadCount, 60L,
+ BlurThreadPoolExecutor executorService = new BlurThreadPoolExecutor(threadCount, threadCount, 10L,
TimeUnit.SECONDS, workQueue, new BlurThreadFactory(prefix));
executorService.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executorService.add(new UserThreadBoundaryProcessor());
diff --git a/blur-util/src/test/java/org/apache/blur/zookeeper/ZkMiniCluster.java b/blur-util/src/test/java/org/apache/blur/zookeeper/ZkMiniCluster.java
index 6dbbd93..c299d50 100644
--- a/blur-util/src/test/java/org/apache/blur/zookeeper/ZkMiniCluster.java
+++ b/blur-util/src/test/java/org/apache/blur/zookeeper/ZkMiniCluster.java
@@ -168,7 +168,7 @@
if (zkConnectionString == null) {
continue;
}
- ZooKeeper zk = new ZooKeeper(getZkConnectionString(), 30000, new Watcher() {
+ ZooKeeper zk = new ZooKeeperClient(getZkConnectionString(), 30000, new Watcher() {
@Override
public void process(WatchedEvent event) {
diff --git a/blur-util/src/test/java/org/apache/blur/zookeeper/ZkUtilsTest.java b/blur-util/src/test/java/org/apache/blur/zookeeper/ZkUtilsTest.java
index 6506e64..b0506e6 100644
--- a/blur-util/src/test/java/org/apache/blur/zookeeper/ZkUtilsTest.java
+++ b/blur-util/src/test/java/org/apache/blur/zookeeper/ZkUtilsTest.java
@@ -58,7 +58,7 @@
public void setUp() throws IOException, InterruptedException {
final Object lock = new Object();
synchronized (lock) {
- _zooKeeper = new ZooKeeper(_zkMiniCluster.getZkConnectionString(), 10000, new Watcher() {
+ _zooKeeper = new ZooKeeperClient(_zkMiniCluster.getZkConnectionString(), 10000, new Watcher() {
@Override
public void process(WatchedEvent event) {
synchronized (lock) {
diff --git a/pom.xml b/pom.xml
index ec4766a..40d90aa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -425,6 +425,9 @@
<environmentVariables>
<JAVA_HOME>${java.home}</JAVA_HOME>
</environmentVariables>
+ <excludes>
+ <exclude>**/*IT.java</exclude>
+ </excludes>
</configuration>
</plugin>
<!-- Ignore/Execute plugin execution -->
@@ -512,6 +515,7 @@
<module>blur-util</module>
<module>blur-status</module>
<module>blur-shell</module>
+ <module>blur-integration-tests</module>
<module>distribution</module>
</modules>
</profile>
@@ -538,6 +542,7 @@
<module>blur-util</module>
<module>blur-status</module>
<module>blur-shell</module>
+ <module>blur-integration-tests</module>
<module>distribution</module>
</modules>
</profile>
@@ -564,6 +569,7 @@
<module>blur-util</module>
<module>blur-status</module>
<module>blur-shell</module>
+ <module>blur-integration-tests</module>
<module>distribution</module>
</modules>
</profile>