Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 05D5D101A0 for ; Fri, 19 Jul 2013 20:31:39 +0000 (UTC) Received: (qmail 46211 invoked by uid 500); 19 Jul 2013 20:31:38 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 46128 invoked by uid 500); 19 Jul 2013 20:31:38 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 46053 invoked by uid 99); 19 Jul 2013 20:31:38 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Jul 2013 20:31:38 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id F05478AF31A; Fri, 19 Jul 2013 20:31:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ecn@apache.org To: commits@accumulo.apache.org Date: Fri, 19 Jul 2013 20:31:37 -0000 Message-Id: <2b0049e1291c4aebaa3815f6afa73d30@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/4] git commit: ACCUMULO-1537 convert simpler test to use a common MAC; add option to use HDFS because LocalFileSystem does not support flush/sync semantics Updated Branches: refs/heads/master 3d7a6e71a -> 8513b5560 ACCUMULO-1537 convert simpler test to use a common MAC; add option to use HDFS because LocalFileSystem does not support flush/sync semantics Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/122fa397 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/122fa397 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/122fa397 Branch: refs/heads/master Commit: 122fa39756b895ae0be0c1f3da2725c3cfb49689 Parents: f8b9145 Author: Eric Newton Authored: Fri Jul 19 16:31:10 2013 -0400 Committer: Eric Newton Committed: Fri Jul 19 16:31:10 2013 -0400 ---------------------------------------------------------------------- .../accumulo/test/functional/SimpleMacIT.java | 80 ++++++++++++++++++++ 1 file changed, 80 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/122fa397/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java new file mode 100644 index 0000000..bf37212 --- /dev/null +++ b/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java @@ -0,0 +1,80 @@ +/* + * 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.accumulo.test.functional; + +import java.io.IOException; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.accumulo.core.cli.BatchWriterOpts; +import org.apache.accumulo.core.cli.ScannerOpts; +import org.apache.accumulo.core.client.AccumuloException; +import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.minicluster.MiniAccumuloCluster; +import org.apache.accumulo.minicluster.MiniAccumuloCluster.LogWriter; +import org.apache.accumulo.minicluster.MiniAccumuloConfig; +import org.apache.log4j.Logger; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.rules.TemporaryFolder; + +public class SimpleMacIT { + public static final Logger log = Logger.getLogger(SimpleMacIT.class); + + public static final String ROOT_PASSWORD = "secret"; + + static private TemporaryFolder folder = new TemporaryFolder(); + static private MiniAccumuloCluster cluster; + + public static Connector getConnector() throws AccumuloException, AccumuloSecurityException { + return cluster.getConnector("root", ROOT_PASSWORD); + } + + @BeforeClass + public static void setUp() throws Exception { + folder.create(); + MiniAccumuloConfig cfg = new MiniAccumuloConfig(folder.newFolder("mac"), ROOT_PASSWORD); + cluster = new MiniAccumuloCluster(cfg); + cluster.start(); + } + + + @AfterClass + public static void tearDown() throws Exception { + if (cluster != null) + cluster.stop(); + for (LogWriter log : cluster.getLogWriters()) + log.flush(); + folder.delete(); + } + + static AtomicInteger tableCount = new AtomicInteger(); + static public String makeTableName() { + return "table" + tableCount.getAndIncrement(); + } + + static public String rootPath() { + return cluster.getConfig().getDir().getAbsolutePath(); + } + + static Process exec(Class clazz, String... args) throws IOException { + return cluster.exec(clazz, args); + } + + public static BatchWriterOpts BWOPTS = MacTest.BWOPTS; + public static ScannerOpts SOPTS = MacTest.SOPTS; +}