Updated Branches: refs/heads/execwork f1746c92f -> 0d2428fde
added base system test and started working on client system test Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/4f3a1c64 Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/4f3a1c64 Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/4f3a1c64 Branch: refs/heads/execwork Commit: 4f3a1c64546b8f79ce53f20e8a94cfb3d8dffaac Parents: f1746c9 Author: David Ribeiro Alves <[email protected]> Authored: Wed Apr 17 14:14:36 2013 -0500 Committer: David Ribeiro Alves <[email protected]> Committed: Wed Apr 17 14:14:36 2013 -0500 ---------------------------------------------------------------------- .../org/apache/drill/exec/server/Drillbit.java | 18 +++-- .../org/apache/drill/exec/DrillSystemTestBase.java | 61 +++++++++++++++ .../drill/exec/client/DrillClientSystemTest.java | 20 +++++ 3 files changed, 91 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/4f3a1c64/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java ---------------------------------------------------------------------- diff --git a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java index 6cc35e2..99ebe85 100644 --- a/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java +++ b/sandbox/prototype/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java @@ -17,8 +17,7 @@ ******************************************************************************/ package org.apache.drill.exec.server; -import java.net.InetAddress; - +import com.google.common.io.Closeables; import org.apache.drill.common.config.DrillConfig; import org.apache.drill.exec.BufferAllocator; import org.apache.drill.exec.ExecConstants; @@ -31,31 +30,34 @@ import org.apache.drill.exec.exception.DrillbitStartupException; import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint; import org.apache.drill.exec.service.ServiceEngine; -import com.google.common.io.Closeables; +import java.net.InetAddress; public class Drillbit { static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Drillbit.class); - public static void main(String[] cli) throws DrillbitStartupException, InterruptedException { + public static Drillbit start(StartupOptions options) throws DrillbitStartupException { Drillbit bit = null; try { logger.debug("Setting up Drillbit."); - StartupOptions options = StartupOptions.parse(cli); DrillConfig config = DrillConfig.create(options.getConfigLocation()); bit = new Drillbit(config); } catch (Exception ex) { throw new DrillbitStartupException("Failure while initializing values in Drillbit.", ex); } - + try { logger.debug("Starting Drillbit."); bit.run(); } catch (Exception e) { throw new DrillbitStartupException("Failure during initial startup of Drillbit.", e); } - Thread.sleep(10000); - // at this point, the main thread can terminate as we have started all our working threads. + return bit; + } + + public static void main(String[] cli) throws DrillbitStartupException { + StartupOptions options = StartupOptions.parse(cli); + start(options); } private final DrillbitContext context; http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/4f3a1c64/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java ---------------------------------------------------------------------- diff --git a/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java b/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java new file mode 100644 index 0000000..7f5264c --- /dev/null +++ b/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/DrillSystemTestBase.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * 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.drill.exec; + +import com.google.common.collect.ImmutableList; +import org.apache.drill.exec.exception.DrillbitStartupException; +import org.apache.drill.exec.server.Drillbit; +import org.apache.drill.exec.server.StartupOptions; + +import java.util.List; + +import static com.google.common.base.Throwables.propagate; + +/** + * Base class for Drill system tests. + * Starts one or more Drillbits and provides a configured client for testing. + */ +public class DrillSystemTestBase { + + private static List<Drillbit> servers; + + public void startCluster(StartupOptions options, int numServers) { + try { + ImmutableList.Builder<Drillbit> servers = ImmutableList.builder(); + for (int i = 0; i < numServers; i++) { + servers.add(Drillbit.start(options)); + } + this.servers = servers.build(); + } catch (DrillbitStartupException e) { + propagate(e); + } + } + + public void startZookeeper() { + + } + + public void stopCluster() { + + } + + public void stopZookeeper() { + + } + +} http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/4f3a1c64/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/client/DrillClientSystemTest.java ---------------------------------------------------------------------- diff --git a/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/client/DrillClientSystemTest.java b/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/client/DrillClientSystemTest.java new file mode 100644 index 0000000..a8ac41e --- /dev/null +++ b/sandbox/prototype/exec/java-exec/src/test/java/org/apache/drill/exec/client/DrillClientSystemTest.java @@ -0,0 +1,20 @@ +package org.apache.drill.exec.client; + +import org.apache.drill.exec.DrillSystemTestBase; +import org.apache.drill.exec.server.StartupOptions; +import org.junit.Test; + +/** + * @author David Alves + */ +public class DrillClientSystemTest extends DrillSystemTestBase { + + StartupOptions options = new StartupOptions(); + + @Test + public void testSubmitQuery() { + startCluster(options, 1); + + + } +}
