You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2015/04/18 03:13:14 UTC
[1/4] accumulo git commit: ACCUMULO-3709 Fix minor test issues
Repository: accumulo
Updated Branches:
refs/heads/1.6 8b88ceb8e -> f0b3487bb
refs/heads/master 7480eedf6 -> 21a57fbc2
ACCUMULO-3709 Fix minor test issues
* Make AccumuloOutputFormatTest an IT instead (resource intensive MAC test)
* Use @Rule for temporary folders in target directory (findbugs issue)
* Ensure temporary folder is in target/ (fixed in LocalWALRecoveryTest also)
* Use @Rule for expected exception (makes check more strict)
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f0b3487b
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f0b3487b
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f0b3487b
Branch: refs/heads/1.6
Commit: f0b3487bbe226714435643559eb898b5baa95a44
Parents: 8b88ceb
Author: Christopher Tubbs <ct...@apache.org>
Authored: Fri Apr 17 20:34:49 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Fri Apr 17 20:34:49 2015 -0400
----------------------------------------------------------------------
.../tserver/log/LocalWALRecoveryTest.java | 2 +-
.../accumulo/test/AccumuloOutputFormatIT.java | 125 +++++++++++++++++++
.../accumulo/test/AccumuloOutputFormatTest.java | 114 -----------------
3 files changed, 126 insertions(+), 115 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f0b3487b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LocalWALRecoveryTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LocalWALRecoveryTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LocalWALRecoveryTest.java
index df6ec2d..8261a17 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LocalWALRecoveryTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LocalWALRecoveryTest.java
@@ -45,7 +45,7 @@ import org.junit.rules.TemporaryFolder;
public class LocalWALRecoveryTest {
@Rule
- public TemporaryFolder folder = new TemporaryFolder();
+ public TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
LocalWALRecovery recovery;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f0b3487b/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatIT.java b/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatIT.java
new file mode 100644
index 0000000..9d00584
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatIT.java
@@ -0,0 +1,125 @@
+/*
+ * 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;
+
+import static com.google.common.base.Charsets.UTF_8;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.ZooKeeperInstance;
+import org.apache.accumulo.core.client.mapred.AccumuloOutputFormat;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.TablePermission;
+import org.apache.accumulo.minicluster.MiniAccumuloCluster;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.mapred.JobConf;
+import org.apache.hadoop.mapred.RecordWriter;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TemporaryFolder;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Prevent regression of ACCUMULO-3709. Exists as a mini test because mock instance doesn't produce this error when dynamically changing the table permissions.
+ */
+public class AccumuloOutputFormatIT {
+
+ private static final String TABLE = "abc";
+ private MiniAccumuloCluster accumulo;
+ private String secret = "secret";
+
+ @Rule
+ public TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+
+ @Rule
+ public ExpectedException exception = ExpectedException.none();
+
+ @Before
+ public void setUp() throws Exception {
+ folder.create();
+ MiniAccumuloConfig config = new MiniAccumuloConfig(folder.getRoot(), secret);
+ Map<String,String> configMap = Maps.newHashMap();
+ configMap.put(Property.TSERV_SESSION_MAXIDLE.toString(), "1");
+ config.setSiteConfig(configMap);
+ config.setNumTservers(1);
+ accumulo = new MiniAccumuloCluster(config);
+ accumulo.start();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ accumulo.stop();
+ folder.delete();
+ }
+
+ @Test
+ public void testMapred() throws Exception {
+
+ ZooKeeperInstance instance = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
+ Connector connector = instance.getConnector("root", new PasswordToken(secret));
+ // create a table and put some data in it
+ connector.tableOperations().create(TABLE);
+
+ JobConf job = new JobConf();
+ BatchWriterConfig batchConfig = new BatchWriterConfig();
+ // no flushes!!!!!
+ batchConfig.setMaxLatency(0, TimeUnit.MILLISECONDS);
+ // use a single thread to ensure our update session times out
+ batchConfig.setMaxWriteThreads(1);
+ // set the max memory so that we ensure we don't flush on the write.
+ batchConfig.setMaxMemory(Long.MAX_VALUE);
+ AccumuloOutputFormat outputFormat = new AccumuloOutputFormat();
+ AccumuloOutputFormat.setBatchWriterOptions(job, batchConfig);
+ AccumuloOutputFormat.setZooKeeperInstance(job, new ClientConfiguration().withInstance(instance.getInstanceName()).withZkHosts(instance.getZooKeepers()));
+ AccumuloOutputFormat.setConnectorInfo(job, "root", new PasswordToken(secret));
+ RecordWriter<Text,Mutation> writer = outputFormat.getRecordWriter(null, job, "Test", null);
+
+ try {
+ for (int i = 0; i < 3; i++) {
+ Mutation m = new Mutation(new Text(String.format("%08d", i)));
+ for (int j = 0; j < 3; j++) {
+ m.put(new Text("cf1"), new Text("cq" + j), new Value((i + "_" + j).getBytes(UTF_8)));
+ writer.write(new Text(TABLE), m);
+ }
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ // we don't want the exception to come from write
+ }
+
+ connector.securityOperations().revokeTablePermission("root", TABLE, TablePermission.WRITE);
+
+ exception.expect(IOException.class);
+ exception.expectMessage("PERMISSION_DENIED");
+ writer.close(null);
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f0b3487b/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatTest.java b/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatTest.java
deleted file mode 100644
index 73215de..0000000
--- a/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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;
-
-import static com.google.common.base.Charsets.UTF_8;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.accumulo.core.client.BatchWriterConfig;
-import org.apache.accumulo.core.client.ClientConfiguration;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
-import org.apache.accumulo.core.client.mapred.AccumuloOutputFormat;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.security.TablePermission;
-import org.apache.accumulo.minicluster.MiniAccumuloCluster;
-import org.apache.accumulo.minicluster.MiniAccumuloConfig;
-import org.apache.hadoop.io.Text;
-import org.apache.hadoop.mapred.JobConf;
-import org.apache.hadoop.mapred.RecordWriter;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import com.google.common.collect.Maps;
-
-/**
- * Exists because mock instance doesn't produce this error when dynamically changing the table permissions.
- */
-public class AccumuloOutputFormatTest {
-
- private static final String TABLE = "abc";
- public static TemporaryFolder folder = new TemporaryFolder();
- private MiniAccumuloCluster accumulo;
- private String secret = "secret";
-
- @Before
- public void setUp() throws Exception {
- folder.create();
- MiniAccumuloConfig config = new MiniAccumuloConfig(folder.getRoot(), secret);
- Map<String,String> configMap = Maps.newHashMap();
- configMap.put(Property.TSERV_SESSION_MAXIDLE.toString(), "1");
- config.setSiteConfig(configMap);
- config.setNumTservers(1);
- accumulo = new MiniAccumuloCluster(config);
- accumulo.start();
- }
-
- @After
- public void tearDown() throws Exception {
- accumulo.stop();
- folder.delete();
- }
-
- @Test(expected = IOException.class)
- public void testMapred() throws Exception {
-
- ZooKeeperInstance instance = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
- Connector connector = instance.getConnector("root", new PasswordToken(secret));
- // create a table and put some data in it
- connector.tableOperations().create(TABLE);
-
- JobConf job = new JobConf();
- BatchWriterConfig batchConfig = new BatchWriterConfig();
- // no flushes!!!!!
- batchConfig.setMaxLatency(0, TimeUnit.MILLISECONDS);
- // use a single thread to ensure our update session times out
- batchConfig.setMaxWriteThreads(1);
- // set the max memory so that we ensure we don't flush on the write.
- batchConfig.setMaxMemory(Long.MAX_VALUE);
- AccumuloOutputFormat outputFormat = new AccumuloOutputFormat();
- AccumuloOutputFormat.setBatchWriterOptions(job, batchConfig);
- AccumuloOutputFormat.setZooKeeperInstance(job, new ClientConfiguration().withInstance(instance.getInstanceName()).withZkHosts(instance.getZooKeepers()));
- AccumuloOutputFormat.setConnectorInfo(job, "root", new PasswordToken(secret));
- RecordWriter<Text,Mutation> writer = outputFormat.getRecordWriter(null, job, "Test", null);
-
- try {
- for (int i = 0; i < 3; i++) {
- Mutation m = new Mutation(new Text(String.format("%08d", i)));
- for (int j = 0; j < 3; j++) {
- m.put(new Text("cf1"), new Text("cq" + j), new Value((i + "_" + j).getBytes(UTF_8)));
- writer.write(new Text(TABLE), m);
- }
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- // we don't want the exception to come from write
- }
-
- connector.securityOperations().revokeTablePermission("root", TABLE, TablePermission.WRITE);
- writer.close(null);
- }
-}
\ No newline at end of file
[4/4] accumulo git commit: ACCUMULO-3602 Add import for javadoc link
Posted by ct...@apache.org.
ACCUMULO-3602 Add import for javadoc link
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/21a57fbc
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/21a57fbc
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/21a57fbc
Branch: refs/heads/master
Commit: 21a57fbc2ca3e7c6474168af4e28de020e7943d7
Parents: d9391bc
Author: Christopher Tubbs <ct...@apache.org>
Authored: Fri Apr 17 20:48:17 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Fri Apr 17 20:50:16 2015 -0400
----------------------------------------------------------------------
.../core/client/mapreduce/lib/impl/InputConfigurator.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/21a57fbc/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
index 6b8fe34..238539b 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
@@ -36,6 +36,7 @@ import java.util.StringTokenizer;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.BatchScanner;
import org.apache.accumulo.core.client.ClientConfiguration;
import org.apache.accumulo.core.client.ClientSideIteratorScanner;
import org.apache.accumulo.core.client.Connector;
@@ -517,8 +518,8 @@ public class InputConfigurator extends ConfiguratorBase {
}
/**
- * Controls the use of the {@link BatchScanner} in this job.
- * Using this feature will group ranges by their source tablet per InputSplit and use BatchScanner to read them.
+ * Controls the use of the {@link BatchScanner} in this job. Using this feature will group ranges by their source tablet per InputSplit and use BatchScanner
+ * to read them.
*
* <p>
* By default, this feature is <b>disabled</b>.
[2/4] accumulo git commit: ACCUMULO-3709 Fix minor test issues
Posted by ct...@apache.org.
ACCUMULO-3709 Fix minor test issues
* Make AccumuloOutputFormatTest an IT instead (resource intensive MAC test)
* Use @Rule for temporary folders in target directory (findbugs issue)
* Ensure temporary folder is in target/ (fixed in LocalWALRecoveryTest also)
* Use @Rule for expected exception (makes check more strict)
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f0b3487b
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f0b3487b
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f0b3487b
Branch: refs/heads/master
Commit: f0b3487bbe226714435643559eb898b5baa95a44
Parents: 8b88ceb
Author: Christopher Tubbs <ct...@apache.org>
Authored: Fri Apr 17 20:34:49 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Fri Apr 17 20:34:49 2015 -0400
----------------------------------------------------------------------
.../tserver/log/LocalWALRecoveryTest.java | 2 +-
.../accumulo/test/AccumuloOutputFormatIT.java | 125 +++++++++++++++++++
.../accumulo/test/AccumuloOutputFormatTest.java | 114 -----------------
3 files changed, 126 insertions(+), 115 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f0b3487b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LocalWALRecoveryTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LocalWALRecoveryTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LocalWALRecoveryTest.java
index df6ec2d..8261a17 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LocalWALRecoveryTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/LocalWALRecoveryTest.java
@@ -45,7 +45,7 @@ import org.junit.rules.TemporaryFolder;
public class LocalWALRecoveryTest {
@Rule
- public TemporaryFolder folder = new TemporaryFolder();
+ public TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
LocalWALRecovery recovery;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f0b3487b/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatIT.java b/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatIT.java
new file mode 100644
index 0000000..9d00584
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatIT.java
@@ -0,0 +1,125 @@
+/*
+ * 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;
+
+import static com.google.common.base.Charsets.UTF_8;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.ZooKeeperInstance;
+import org.apache.accumulo.core.client.mapred.AccumuloOutputFormat;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.TablePermission;
+import org.apache.accumulo.minicluster.MiniAccumuloCluster;
+import org.apache.accumulo.minicluster.MiniAccumuloConfig;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.mapred.JobConf;
+import org.apache.hadoop.mapred.RecordWriter;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TemporaryFolder;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Prevent regression of ACCUMULO-3709. Exists as a mini test because mock instance doesn't produce this error when dynamically changing the table permissions.
+ */
+public class AccumuloOutputFormatIT {
+
+ private static final String TABLE = "abc";
+ private MiniAccumuloCluster accumulo;
+ private String secret = "secret";
+
+ @Rule
+ public TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+
+ @Rule
+ public ExpectedException exception = ExpectedException.none();
+
+ @Before
+ public void setUp() throws Exception {
+ folder.create();
+ MiniAccumuloConfig config = new MiniAccumuloConfig(folder.getRoot(), secret);
+ Map<String,String> configMap = Maps.newHashMap();
+ configMap.put(Property.TSERV_SESSION_MAXIDLE.toString(), "1");
+ config.setSiteConfig(configMap);
+ config.setNumTservers(1);
+ accumulo = new MiniAccumuloCluster(config);
+ accumulo.start();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ accumulo.stop();
+ folder.delete();
+ }
+
+ @Test
+ public void testMapred() throws Exception {
+
+ ZooKeeperInstance instance = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
+ Connector connector = instance.getConnector("root", new PasswordToken(secret));
+ // create a table and put some data in it
+ connector.tableOperations().create(TABLE);
+
+ JobConf job = new JobConf();
+ BatchWriterConfig batchConfig = new BatchWriterConfig();
+ // no flushes!!!!!
+ batchConfig.setMaxLatency(0, TimeUnit.MILLISECONDS);
+ // use a single thread to ensure our update session times out
+ batchConfig.setMaxWriteThreads(1);
+ // set the max memory so that we ensure we don't flush on the write.
+ batchConfig.setMaxMemory(Long.MAX_VALUE);
+ AccumuloOutputFormat outputFormat = new AccumuloOutputFormat();
+ AccumuloOutputFormat.setBatchWriterOptions(job, batchConfig);
+ AccumuloOutputFormat.setZooKeeperInstance(job, new ClientConfiguration().withInstance(instance.getInstanceName()).withZkHosts(instance.getZooKeepers()));
+ AccumuloOutputFormat.setConnectorInfo(job, "root", new PasswordToken(secret));
+ RecordWriter<Text,Mutation> writer = outputFormat.getRecordWriter(null, job, "Test", null);
+
+ try {
+ for (int i = 0; i < 3; i++) {
+ Mutation m = new Mutation(new Text(String.format("%08d", i)));
+ for (int j = 0; j < 3; j++) {
+ m.put(new Text("cf1"), new Text("cq" + j), new Value((i + "_" + j).getBytes(UTF_8)));
+ writer.write(new Text(TABLE), m);
+ }
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ // we don't want the exception to come from write
+ }
+
+ connector.securityOperations().revokeTablePermission("root", TABLE, TablePermission.WRITE);
+
+ exception.expect(IOException.class);
+ exception.expectMessage("PERMISSION_DENIED");
+ writer.close(null);
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/f0b3487b/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatTest.java b/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatTest.java
deleted file mode 100644
index 73215de..0000000
--- a/test/src/test/java/org/apache/accumulo/test/AccumuloOutputFormatTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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;
-
-import static com.google.common.base.Charsets.UTF_8;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.accumulo.core.client.BatchWriterConfig;
-import org.apache.accumulo.core.client.ClientConfiguration;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
-import org.apache.accumulo.core.client.mapred.AccumuloOutputFormat;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.security.TablePermission;
-import org.apache.accumulo.minicluster.MiniAccumuloCluster;
-import org.apache.accumulo.minicluster.MiniAccumuloConfig;
-import org.apache.hadoop.io.Text;
-import org.apache.hadoop.mapred.JobConf;
-import org.apache.hadoop.mapred.RecordWriter;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import com.google.common.collect.Maps;
-
-/**
- * Exists because mock instance doesn't produce this error when dynamically changing the table permissions.
- */
-public class AccumuloOutputFormatTest {
-
- private static final String TABLE = "abc";
- public static TemporaryFolder folder = new TemporaryFolder();
- private MiniAccumuloCluster accumulo;
- private String secret = "secret";
-
- @Before
- public void setUp() throws Exception {
- folder.create();
- MiniAccumuloConfig config = new MiniAccumuloConfig(folder.getRoot(), secret);
- Map<String,String> configMap = Maps.newHashMap();
- configMap.put(Property.TSERV_SESSION_MAXIDLE.toString(), "1");
- config.setSiteConfig(configMap);
- config.setNumTservers(1);
- accumulo = new MiniAccumuloCluster(config);
- accumulo.start();
- }
-
- @After
- public void tearDown() throws Exception {
- accumulo.stop();
- folder.delete();
- }
-
- @Test(expected = IOException.class)
- public void testMapred() throws Exception {
-
- ZooKeeperInstance instance = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
- Connector connector = instance.getConnector("root", new PasswordToken(secret));
- // create a table and put some data in it
- connector.tableOperations().create(TABLE);
-
- JobConf job = new JobConf();
- BatchWriterConfig batchConfig = new BatchWriterConfig();
- // no flushes!!!!!
- batchConfig.setMaxLatency(0, TimeUnit.MILLISECONDS);
- // use a single thread to ensure our update session times out
- batchConfig.setMaxWriteThreads(1);
- // set the max memory so that we ensure we don't flush on the write.
- batchConfig.setMaxMemory(Long.MAX_VALUE);
- AccumuloOutputFormat outputFormat = new AccumuloOutputFormat();
- AccumuloOutputFormat.setBatchWriterOptions(job, batchConfig);
- AccumuloOutputFormat.setZooKeeperInstance(job, new ClientConfiguration().withInstance(instance.getInstanceName()).withZkHosts(instance.getZooKeepers()));
- AccumuloOutputFormat.setConnectorInfo(job, "root", new PasswordToken(secret));
- RecordWriter<Text,Mutation> writer = outputFormat.getRecordWriter(null, job, "Test", null);
-
- try {
- for (int i = 0; i < 3; i++) {
- Mutation m = new Mutation(new Text(String.format("%08d", i)));
- for (int j = 0; j < 3; j++) {
- m.put(new Text("cf1"), new Text("cq" + j), new Value((i + "_" + j).getBytes(UTF_8)));
- writer.write(new Text(TABLE), m);
- }
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- // we don't want the exception to come from write
- }
-
- connector.securityOperations().revokeTablePermission("root", TABLE, TablePermission.WRITE);
- writer.close(null);
- }
-}
\ No newline at end of file
[3/4] accumulo git commit: Merge branch '1.6'
Posted by ct...@apache.org.
Merge branch '1.6'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/d9391bc4
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d9391bc4
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d9391bc4
Branch: refs/heads/master
Commit: d9391bc4defab20f488e5d507d3a78e7a3e3bdbd
Parents: 7480eed f0b3487
Author: Christopher Tubbs <ct...@apache.org>
Authored: Fri Apr 17 20:47:20 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Fri Apr 17 20:47:20 2015 -0400
----------------------------------------------------------------------
.../tserver/log/LocalWALRecoveryTest.java | 2 +-
.../accumulo/test/AccumuloOutputFormatIT.java | 125 +++++++++++++++++++
.../accumulo/test/AccumuloOutputFormatTest.java | 114 -----------------
3 files changed, 126 insertions(+), 115 deletions(-)
----------------------------------------------------------------------