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/01/09 03:44:07 UTC
[03/66] [abbrv] accumulo git commit: ACCUMULO-3451 Format master
branch (1.7.0-SNAPSHOT)
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/scalability/Ingest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/scalability/Ingest.java b/test/src/main/java/org/apache/accumulo/test/scalability/Ingest.java
index 238a88d..dfb5547 100644
--- a/test/src/main/java/org/apache/accumulo/test/scalability/Ingest.java
+++ b/test/src/main/java/org/apache/accumulo/test/scalability/Ingest.java
@@ -21,6 +21,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
+
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.client.Connector;
@@ -32,56 +33,56 @@ import org.apache.accumulo.test.continuous.ContinuousIngest;
import org.apache.log4j.Logger;
public class Ingest extends ScaleTest {
-
+
private static final Logger log = Logger.getLogger(Ingest.class);
-
+
@Override
public void setup() {
-
+
Connector conn = getConnector();
String tableName = getTestProperty("TABLE");
-
+
// delete existing table
if (conn.tableOperations().exists(tableName)) {
System.out.println("Deleting existing table: " + tableName);
try {
conn.tableOperations().delete(tableName);
} catch (Exception e) {
- log.error("Failed to delete table '"+tableName+"'.", e);
+ log.error("Failed to delete table '" + tableName + "'.", e);
}
}
-
+
// create table
try {
conn.tableOperations().create(tableName);
conn.tableOperations().addSplits(tableName, calculateSplits());
conn.tableOperations().setProperty(tableName, "table.split.threshold", "256M");
} catch (Exception e) {
- log.error("Failed to create table '"+tableName+"'.", e);
+ log.error("Failed to create table '" + tableName + "'.", e);
}
-
+
}
-
+
@Override
public void client() {
-
+
Connector conn = getConnector();
String tableName = getTestProperty("TABLE");
-
+
// get batch writer configuration
long maxMemory = Long.parseLong(getTestProperty("MAX_MEMORY"));
long maxLatency = Long.parseLong(getTestProperty("MAX_LATENCY"));
int maxWriteThreads = Integer.parseInt(getTestProperty("NUM_THREADS"));
-
+
// create batch writer
BatchWriter bw = null;
try {
bw = conn.createBatchWriter(tableName, new BatchWriterConfig().setMaxMemory(maxMemory).setMaxLatency(maxLatency, TimeUnit.MILLISECONDS)
.setMaxWriteThreads(maxWriteThreads));
} catch (TableNotFoundException e) {
- log.error("Table '"+tableName+"' not found.", e);
+ log.error("Table '" + tableName + "' not found.", e);
}
-
+
// configure writing
Random r = new Random();
String ingestInstanceId = UUID.randomUUID().toString();
@@ -92,12 +93,12 @@ public class Ingest extends ScaleTest {
int maxColQ = 32767;
long count = 0;
long totalBytes = 0;
-
+
ColumnVisibility cv = new ColumnVisibility();
// start timer
startTimer();
-
+
// write specified number of entries
while (count < numIngestEntries) {
count++;
@@ -111,7 +112,7 @@ public class Ingest extends ScaleTest {
System.exit(-1);
}
}
-
+
// close writer
try {
bw.close();
@@ -119,22 +120,22 @@ public class Ingest extends ScaleTest {
log.error("Could not close BatchWriter due to mutations being rejected.", e);
System.exit(-1);
}
-
+
// stop timer
stopTimer(count, totalBytes);
}
-
+
@Override
public void teardown() {
-
+
Connector conn = getConnector();
String tableName = getTestProperty("TABLE");
-
+
try {
conn.tableOperations().delete(tableName);
} catch (Exception e) {
- log.error("Failed to delete table '"+tableName+"'", e);
+ log.error("Failed to delete table '" + tableName + "'", e);
}
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/scalability/Run.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/scalability/Run.java b/test/src/main/java/org/apache/accumulo/test/scalability/Run.java
index 42c5ec3..f7af2ff 100644
--- a/test/src/main/java/org/apache/accumulo/test/scalability/Run.java
+++ b/test/src/main/java/org/apache/accumulo/test/scalability/Run.java
@@ -16,10 +16,10 @@
*/
package org.apache.accumulo.test.scalability;
-import com.beust.jcommander.Parameter;
import java.io.FileInputStream;
import java.net.InetAddress;
import java.util.Properties;
+
import org.apache.accumulo.core.cli.Help;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.hadoop.conf.Configuration;
@@ -27,33 +27,35 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.log4j.Logger;
+import com.beust.jcommander.Parameter;
+
public class Run {
-
+
private static final Logger log = Logger.getLogger(Run.class);
-
+
static class Opts extends Help {
- @Parameter(names="--testId", required=true)
+ @Parameter(names = "--testId", required = true)
String testId;
- @Parameter(names="--action", required=true, description="one of 'setup', 'teardown' or 'client'")
+ @Parameter(names = "--action", required = true, description = "one of 'setup', 'teardown' or 'client'")
String action;
- @Parameter(names="--count", description="number of tablet servers", required=true)
- int numTabletServers;
+ @Parameter(names = "--count", description = "number of tablet servers", required = true)
+ int numTabletServers;
}
-
+
public static void main(String[] args) throws Exception {
-
+
final String sitePath = "/tmp/scale-site.conf";
final String testPath = "/tmp/scale-test.conf";
Opts opts = new Opts();
opts.parseArgs(Run.class.getName(), args);
-
+
Configuration conf = CachedConfiguration.getInstance();
FileSystem fs;
fs = FileSystem.get(conf);
-
+
fs.copyToLocalFile(new Path("/accumulo-scale/conf/site.conf"), new Path(sitePath));
fs.copyToLocalFile(new Path(String.format("/accumulo-scale/conf/%s.conf", opts.testId)), new Path(testPath));
-
+
// load configuration file properties
Properties scaleProps = new Properties();
Properties testProps = new Properties();
@@ -69,11 +71,11 @@ public class Run {
} catch (Exception e) {
log.error("Error loading config file.", e);
}
-
+
ScaleTest test = (ScaleTest) Class.forName(String.format("org.apache.accumulo.test.scalability.%s", opts.testId)).newInstance();
-
+
test.init(scaleProps, testProps, opts.numTabletServers);
-
+
if (opts.action.equalsIgnoreCase("setup")) {
test.setup();
} else if (opts.action.equalsIgnoreCase("client")) {
@@ -86,5 +88,5 @@ public class Run {
test.teardown();
}
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/scalability/ScaleTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/scalability/ScaleTest.java b/test/src/main/java/org/apache/accumulo/test/scalability/ScaleTest.java
index 46377d6..f908296 100644
--- a/test/src/main/java/org/apache/accumulo/test/scalability/ScaleTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/scalability/ScaleTest.java
@@ -28,44 +28,44 @@ import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.hadoop.io.Text;
public abstract class ScaleTest {
-
+
private Connector conn;
private Properties scaleProps;
private Properties testProps;
private int numTabletServers;
private long startTime;
-
+
public void init(Properties scaleProps, Properties testProps, int numTabletServers) throws AccumuloException, AccumuloSecurityException {
-
+
this.scaleProps = scaleProps;
this.testProps = testProps;
this.numTabletServers = numTabletServers;
-
+
// get properties to create connector
String instanceName = this.scaleProps.getProperty("INSTANCE_NAME");
String zookeepers = this.scaleProps.getProperty("ZOOKEEPERS");
String user = this.scaleProps.getProperty("USER");
String password = this.scaleProps.getProperty("PASSWORD");
System.out.println(password);
-
+
conn = new ZooKeeperInstance(new ClientConfiguration().withInstance(instanceName).withZkHosts(zookeepers)).getConnector(user, new PasswordToken(password));
}
-
+
protected void startTimer() {
startTime = System.currentTimeMillis();
}
-
+
protected void stopTimer(long numEntries, long numBytes) {
long endTime = System.currentTimeMillis();
System.out.printf("ELAPSEDMS %d %d %d%n", endTime - startTime, numEntries, numBytes);
}
-
+
public abstract void setup();
-
+
public abstract void client();
-
+
public abstract void teardown();
-
+
public TreeSet<Text> calculateSplits() {
int numSplits = numTabletServers - 1;
long distance = (Long.MAX_VALUE / numTabletServers) + 1;
@@ -77,11 +77,11 @@ public abstract class ScaleTest {
}
return keys;
}
-
+
public Connector getConnector() {
return conn;
}
-
+
public String getTestProperty(String key) {
return testProps.getProperty(key);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/stress/random/DataWriter.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/stress/random/DataWriter.java b/test/src/main/java/org/apache/accumulo/test/stress/random/DataWriter.java
index 33a3984..e7158e2 100644
--- a/test/src/main/java/org/apache/accumulo/test/stress/random/DataWriter.java
+++ b/test/src/main/java/org/apache/accumulo/test/stress/random/DataWriter.java
@@ -22,12 +22,12 @@ import org.apache.accumulo.core.client.MutationsRejectedException;
public class DataWriter extends Stream<Void> {
private final BatchWriter writer;
private final RandomMutations mutations;
-
+
public DataWriter(BatchWriter writer, RandomMutations mutations) {
this.writer = writer;
this.mutations = mutations;
}
-
+
@Override
public Void next() {
try {
@@ -37,7 +37,7 @@ public class DataWriter extends Stream<Void> {
}
return null;
}
-
+
@Override
public void finalize() {
try {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/stress/random/IntArgValidator.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/stress/random/IntArgValidator.java b/test/src/main/java/org/apache/accumulo/test/stress/random/IntArgValidator.java
index 6ba6ca9..1582f0d 100644
--- a/test/src/main/java/org/apache/accumulo/test/stress/random/IntArgValidator.java
+++ b/test/src/main/java/org/apache/accumulo/test/stress/random/IntArgValidator.java
@@ -22,11 +22,11 @@ import com.beust.jcommander.ParameterException;
import com.google.common.base.Preconditions;
public class IntArgValidator implements IValueValidator<Integer> {
-
+
@Override
public void validate(String name, Integer value) throws ParameterException {
Preconditions.checkNotNull(value);
Preconditions.checkArgument(value > 0);
}
-
-}
\ No newline at end of file
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/stress/random/RandomByteArrays.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/stress/random/RandomByteArrays.java b/test/src/main/java/org/apache/accumulo/test/stress/random/RandomByteArrays.java
index 0b6b36a..a3bdd43 100644
--- a/test/src/main/java/org/apache/accumulo/test/stress/random/RandomByteArrays.java
+++ b/test/src/main/java/org/apache/accumulo/test/stress/random/RandomByteArrays.java
@@ -21,11 +21,11 @@ package org.apache.accumulo.test.stress.random;
*/
public class RandomByteArrays extends Stream<byte[]> {
private final RandomWithinRange random_arrays;
-
+
public RandomByteArrays(RandomWithinRange random_arrays) {
this.random_arrays = random_arrays;
}
-
+
public byte[] next() {
return random_arrays.next_bytes();
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/stress/random/RandomMutations.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/stress/random/RandomMutations.java b/test/src/main/java/org/apache/accumulo/test/stress/random/RandomMutations.java
index 679b983..db5da55 100644
--- a/test/src/main/java/org/apache/accumulo/test/stress/random/RandomMutations.java
+++ b/test/src/main/java/org/apache/accumulo/test/stress/random/RandomMutations.java
@@ -24,10 +24,9 @@ public class RandomMutations extends Stream<Mutation> {
private final int max_cells_per_mutation;
private byte[] current_row;
private int cells_remaining_in_row;
-
- public RandomMutations(RandomByteArrays rows, RandomByteArrays column_families,
- RandomByteArrays column_qualifiers, RandomByteArrays values, RandomWithinRange row_widths,
- int max_cells_per_mutation) {
+
+ public RandomMutations(RandomByteArrays rows, RandomByteArrays column_families, RandomByteArrays column_qualifiers, RandomByteArrays values,
+ RandomWithinRange row_widths, int max_cells_per_mutation) {
this.rows = rows;
this.column_families = column_families;
this.column_qualifiers = column_qualifiers;
@@ -48,7 +47,7 @@ public class RandomMutations extends Stream<Mutation> {
}
Mutation m = new Mutation(current_row);
final int cells = Math.min(cells_remaining_in_row, max_cells_per_mutation);
- for(int i = 1; i <= cells; i++) {
+ for (int i = 1; i <= cells; i++) {
m.put(column_families.next(), column_qualifiers.next(), values.next());
}
cells_remaining_in_row -= cells;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/stress/random/RandomWithinRange.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/stress/random/RandomWithinRange.java b/test/src/main/java/org/apache/accumulo/test/stress/random/RandomWithinRange.java
index 8eb978b..8da9a37 100644
--- a/test/src/main/java/org/apache/accumulo/test/stress/random/RandomWithinRange.java
+++ b/test/src/main/java/org/apache/accumulo/test/stress/random/RandomWithinRange.java
@@ -21,18 +21,17 @@ import java.util.Random;
import com.google.common.base.Preconditions;
/**
- * Class that returns positive integers between some minimum
- * and maximum.
+ * Class that returns positive integers between some minimum and maximum.
*
*/
public class RandomWithinRange {
private final Random random;
private final int min, max;
-
+
public RandomWithinRange(int seed, int min, int max) {
this(new Random(seed), min, max);
}
-
+
public RandomWithinRange(Random random, int min, int max) {
Preconditions.checkArgument(min > 0, "Min must be positive.");
Preconditions.checkArgument(max >= min, "Max must be greater than or equal to min.");
@@ -40,7 +39,7 @@ public class RandomWithinRange {
this.min = min;
this.max = max;
}
-
+
public int next() {
if (min == max) {
return min;
@@ -50,7 +49,7 @@ public class RandomWithinRange {
return random.nextInt(max - min) + min;
}
}
-
+
public byte[] next_bytes() {
byte[] b = new byte[next()];
random.nextBytes(b);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/stress/random/Scan.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/stress/random/Scan.java b/test/src/main/java/org/apache/accumulo/test/stress/random/Scan.java
index 9408770..c59cd1c 100644
--- a/test/src/main/java/org/apache/accumulo/test/stress/random/Scan.java
+++ b/test/src/main/java/org/apache/accumulo/test/stress/random/Scan.java
@@ -33,26 +33,24 @@ import org.apache.hadoop.io.Text;
import com.google.common.collect.Lists;
public class Scan {
-
+
public static void main(String[] args) throws Exception {
ScanOpts opts = new ScanOpts();
opts.parseArgs(Scan.class.getName(), args);
-
+
Connector connector = opts.getConnector();
Scanner scanner = connector.createScanner(opts.getTableName(), new Authorizations());
-
+
if (opts.isolate) {
scanner.enableIsolation();
}
-
+
Random tablet_index_generator = new Random(opts.scan_seed);
-
- LoopControl scanning_condition = opts.continuous ? new ContinuousLoopControl() :
- new IterativeLoopControl(opts.scan_iterations);
-
- while(scanning_condition.keepScanning()) {
- Range range = pickRange(connector.tableOperations(), opts.getTableName(),
- tablet_index_generator);
+
+ LoopControl scanning_condition = opts.continuous ? new ContinuousLoopControl() : new IterativeLoopControl(opts.scan_iterations);
+
+ while (scanning_condition.keepScanning()) {
+ Range range = pickRange(connector.tableOperations(), opts.getTableName(), tablet_index_generator);
scanner.setRange(range);
if (opts.batch_size > 0) {
scanner.setBatchSize(opts.batch_size);
@@ -60,24 +58,20 @@ public class Scan {
try {
consume(scanner);
} catch (Exception e) {
- System.err.println(
- String.format(
- "Exception while scanning range %s. Check the state of Accumulo for errors.",
- range));
+ System.err.println(String.format("Exception while scanning range %s. Check the state of Accumulo for errors.", range));
throw e;
}
}
}
-
+
public static void consume(Iterable<?> iterable) {
Iterator<?> itr = iterable.iterator();
while (itr.hasNext()) {
itr.next();
}
}
-
- public static Range pickRange(TableOperations tops, String table, Random r)
- throws TableNotFoundException, AccumuloSecurityException, AccumuloException {
+
+ public static Range pickRange(TableOperations tops, String table, Random r) throws TableNotFoundException, AccumuloSecurityException, AccumuloException {
ArrayList<Text> splits = Lists.newArrayList(tops.listSplits(table));
if (splits.isEmpty()) {
return new Range();
@@ -88,28 +82,26 @@ public class Scan {
return new Range(startRow, false, endRow, true);
}
}
-
+
/*
- * These interfaces + implementations are used to determine
- * how many times the scanner should look up a random tablet
- * and scan it.
+ * These interfaces + implementations are used to determine how many times the scanner should look up a random tablet and scan it.
*/
static interface LoopControl {
public boolean keepScanning();
}
-
+
// Does a finite number of iterations
static class IterativeLoopControl implements LoopControl {
private final int max;
private int current;
-
+
public IterativeLoopControl(int max) {
this.max = max;
this.current = 0;
}
-
+
public boolean keepScanning() {
- if(current < max) {
+ if (current < max) {
++current;
return true;
} else {
@@ -117,7 +109,7 @@ public class Scan {
}
}
}
-
+
// Does an infinite number of iterations
static class ContinuousLoopControl implements LoopControl {
public boolean keepScanning() {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/stress/random/ScanOpts.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/stress/random/ScanOpts.java b/test/src/main/java/org/apache/accumulo/test/stress/random/ScanOpts.java
index 86e7920..e3f73f7 100644
--- a/test/src/main/java/org/apache/accumulo/test/stress/random/ScanOpts.java
+++ b/test/src/main/java/org/apache/accumulo/test/stress/random/ScanOpts.java
@@ -21,26 +21,25 @@ import org.apache.accumulo.core.cli.ClientOnDefaultTable;
import com.beust.jcommander.Parameter;
class ScanOpts extends ClientOnDefaultTable {
- @Parameter(names = "--isolate",
- description = "true to turn on scan isolation, false to turn off. default is false.")
+ @Parameter(names = "--isolate", description = "true to turn on scan isolation, false to turn off. default is false.")
boolean isolate = false;
-
+
@Parameter(names = "--num-iterations", description = "number of scan iterations")
int scan_iterations = 1024;
-
+
@Parameter(names = "--continuous", description = "continuously scan the table. note that this overrides --num-iterations")
boolean continuous;
-
+
@Parameter(names = "--scan-seed", description = "seed for randomly choosing tablets to scan")
int scan_seed = 1337;
- @Parameter(names = "--scan-batch-size", description="scanner batch size")
+ @Parameter(names = "--scan-batch-size", description = "scanner batch size")
int batch_size = -1;
public ScanOpts() {
this(WriteOptions.DEFAULT_TABLE);
}
-
+
public ScanOpts(String table) {
super(table);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/stress/random/Stream.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/stress/random/Stream.java b/test/src/main/java/org/apache/accumulo/test/stress/random/Stream.java
index adacfb8..72b31e5 100644
--- a/test/src/main/java/org/apache/accumulo/test/stress/random/Stream.java
+++ b/test/src/main/java/org/apache/accumulo/test/stress/random/Stream.java
@@ -20,21 +20,21 @@ import java.util.Iterator;
/**
* Base class to model an infinite stream of data. A stream implements an iterator whose {{@link #hasNext()} method will always return true.
- *
+ *
*/
public abstract class Stream<T> implements Iterator<T> {
-
+
@Override
public final boolean hasNext() {
return true;
}
-
+
@Override
public abstract T next();
-
+
@Override
public final void remove() {
throw new UnsupportedOperationException();
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/stress/random/Write.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/stress/random/Write.java b/test/src/main/java/org/apache/accumulo/test/stress/random/Write.java
index bb679ad..ea6f164 100644
--- a/test/src/main/java/org/apache/accumulo/test/stress/random/Write.java
+++ b/test/src/main/java/org/apache/accumulo/test/stress/random/Write.java
@@ -22,25 +22,25 @@ import org.apache.accumulo.core.client.TableExistsException;
import org.apache.accumulo.core.client.TableNotFoundException;
public class Write {
-
+
public static void main(String[] args) throws Exception {
WriteOptions opts = new WriteOptions();
BatchWriterOpts batch_writer_opts = new BatchWriterOpts();
opts.parseArgs(Write.class.getName(), args, batch_writer_opts);
-
+
opts.check();
-
+
Connector c = opts.getConnector();
-
- if(opts.clear_table && c.tableOperations().exists(opts.getTableName())) {
+
+ if (opts.clear_table && c.tableOperations().exists(opts.getTableName())) {
try {
- c.tableOperations().delete(opts.getTableName());
- } catch(TableNotFoundException e) {
+ c.tableOperations().delete(opts.getTableName());
+ } catch (TableNotFoundException e) {
System.err.println("Couldn't delete the table because it doesn't exist any more.");
}
}
-
- if(!c.tableOperations().exists(opts.getTableName())) {
+
+ if (!c.tableOperations().exists(opts.getTableName())) {
try {
c.tableOperations().create(opts.getTableName());
} catch (TableExistsException e) {
@@ -53,42 +53,21 @@ public class Write {
writeDelay = 0;
}
- DataWriter dw = new DataWriter(c.createBatchWriter(opts.getTableName(), batch_writer_opts.getBatchWriterConfig()),
- new RandomMutations(
- //rows
- new RandomByteArrays(
- new RandomWithinRange(
- opts.row_seed,
- opts.rowMin(),
- opts.rowMax())),
- //cfs
- new RandomByteArrays(
- new RandomWithinRange(
- opts.cf_seed,
- opts.cfMin(),
- opts.cfMax())),
- //cqs
- new RandomByteArrays(
- new RandomWithinRange(
- opts.cq_seed,
- opts.cqMin(),
- opts.cqMax())),
- //vals
- new RandomByteArrays(
- new RandomWithinRange(
- opts.value_seed,
- opts.valueMin(),
- opts.valueMax())),
- //number of cells per row
- new RandomWithinRange(
- opts.row_width_seed,
- opts.rowWidthMin(),
- opts.rowWidthMax()),
- // max cells per mutation
- opts.max_cells_per_mutation)
- );
-
- while(true) {
+ DataWriter dw = new DataWriter(c.createBatchWriter(opts.getTableName(), batch_writer_opts.getBatchWriterConfig()), new RandomMutations(
+ // rows
+ new RandomByteArrays(new RandomWithinRange(opts.row_seed, opts.rowMin(), opts.rowMax())),
+ // cfs
+ new RandomByteArrays(new RandomWithinRange(opts.cf_seed, opts.cfMin(), opts.cfMax())),
+ // cqs
+ new RandomByteArrays(new RandomWithinRange(opts.cq_seed, opts.cqMin(), opts.cqMax())),
+ // vals
+ new RandomByteArrays(new RandomWithinRange(opts.value_seed, opts.valueMin(), opts.valueMax())),
+ // number of cells per row
+ new RandomWithinRange(opts.row_width_seed, opts.rowWidthMin(), opts.rowWidthMax()),
+ // max cells per mutation
+ opts.max_cells_per_mutation));
+
+ while (true) {
dw.next();
if (writeDelay > 0) {
Thread.sleep(writeDelay);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/stress/random/WriteOptions.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/stress/random/WriteOptions.java b/test/src/main/java/org/apache/accumulo/test/stress/random/WriteOptions.java
index 3e6e647..f92a9eb 100644
--- a/test/src/main/java/org/apache/accumulo/test/stress/random/WriteOptions.java
+++ b/test/src/main/java/org/apache/accumulo/test/stress/random/WriteOptions.java
@@ -23,52 +23,52 @@ import com.beust.jcommander.Parameter;
class WriteOptions extends ClientOnDefaultTable {
static final String DEFAULT_TABLE = "stress_test";
static final int DEFAULT_MIN = 1, DEFAULT_MAX = 128, DEFAULT_SPREAD = DEFAULT_MAX - DEFAULT_MIN;
-
+
@Parameter(validateValueWith = IntArgValidator.class, names = "--min-row-size", description = "minimum row size")
Integer row_min;
-
+
@Parameter(validateValueWith = IntArgValidator.class, names = "--max-row-size", description = "maximum row size")
Integer row_max;
-
+
@Parameter(validateValueWith = IntArgValidator.class, names = "--min-cf-size", description = "minimum column family size")
Integer cf_min;
-
+
@Parameter(validateValueWith = IntArgValidator.class, names = "--max-cf-size", description = "maximum column family size")
Integer cf_max;
-
+
@Parameter(validateValueWith = IntArgValidator.class, names = "--min-cq-size", description = "minimum column qualifier size")
Integer cq_min;
-
+
@Parameter(validateValueWith = IntArgValidator.class, names = "--max-cq-size", description = "maximum column qualifier size")
Integer cq_max;
-
+
@Parameter(validateValueWith = IntArgValidator.class, names = "--min-value-size", description = "minimum value size")
Integer value_min;
-
+
@Parameter(validateValueWith = IntArgValidator.class, names = "--max-value-size", description = "maximum value size")
Integer value_max;
-
+
@Parameter(validateValueWith = IntArgValidator.class, names = "--min-row-width", description = "minimum row width")
Integer row_width_min;
-
+
@Parameter(validateValueWith = IntArgValidator.class, names = "--max-row-width", description = "maximum row width")
Integer row_width_max;
-
+
@Parameter(names = "--clear-table", description = "clears the table before ingesting")
boolean clear_table;
-
+
@Parameter(names = "--row-seed", description = "seed for generating rows")
int row_seed = 87;
-
+
@Parameter(names = "--cf-seed", description = "seed for generating column families")
int cf_seed = 7;
-
+
@Parameter(names = "--cq-seed", description = "seed for generating column qualifiers")
int cq_seed = 43;
-
+
@Parameter(names = "--value-seed", description = "seed for generating values")
int value_seed = 99;
-
+
@Parameter(names = "--row-width-seed", description = "seed for generating the number of cells within a row (a row's \"width\")")
int row_width_seed = 444;
@@ -81,15 +81,15 @@ class WriteOptions extends ClientOnDefaultTable {
public WriteOptions(String table) {
super(table);
}
-
+
public WriteOptions() {
this(DEFAULT_TABLE);
}
-
+
private static int minOrDefault(Integer ref) {
return ref == null ? DEFAULT_MIN : ref;
}
-
+
private static int calculateMax(Integer min_ref, Integer max_ref) {
if (max_ref == null) {
if (min_ref == null) {
@@ -101,74 +101,68 @@ class WriteOptions extends ClientOnDefaultTable {
return max_ref;
}
}
-
+
public void check() {
checkPair("ROW", row_min, row_max);
checkPair("COLUMN FAMILY", cf_min, cf_max);
checkPair("COLUMN QUALIFIER", cq_min, cq_max);
checkPair("VALUE", value_min, value_max);
}
-
+
public void checkPair(String label, Integer min_ref, Integer max_ref) {
// we've already asserted that the numbers will either be
// 1) null
// 2) positive
// need to verify that they're coherent here
-
- if(min_ref == null && max_ref != null) {
+
+ if (min_ref == null && max_ref != null) {
// we don't support just specifying a max yet
- throw new IllegalArgumentException(
- String.format("[%s] Maximum value supplied, but no minimum. Must supply a minimum with a maximum value.",
- label));
- } else if(min_ref != null && max_ref != null) {
+ throw new IllegalArgumentException(String.format("[%s] Maximum value supplied, but no minimum. Must supply a minimum with a maximum value.", label));
+ } else if (min_ref != null && max_ref != null) {
// if a user supplied lower and upper bounds, we need to verify
// that min <= max
- if(min_ref.compareTo(max_ref) > 0) {
- throw new IllegalArgumentException(
- String.format("[%s] Min value (%d) is greater than max value (%d)",
- label,
- min_ref,
- max_ref));
+ if (min_ref.compareTo(max_ref) > 0) {
+ throw new IllegalArgumentException(String.format("[%s] Min value (%d) is greater than max value (%d)", label, min_ref, max_ref));
}
}
}
-
+
public int rowMin() {
return minOrDefault(row_min);
}
-
+
public int rowMax() {
return calculateMax(row_min, row_max);
}
-
+
public int cfMin() {
return minOrDefault(cf_min);
}
-
+
public int cfMax() {
return calculateMax(cf_min, cf_max);
}
-
+
public int cqMin() {
return minOrDefault(cq_min);
}
-
+
public int cqMax() {
return calculateMax(cq_min, cq_max);
}
-
+
public int valueMin() {
return minOrDefault(value_min);
}
-
+
public int valueMax() {
return calculateMax(value_min, value_max);
}
-
+
public int rowWidthMin() {
return minOrDefault(row_width_min);
}
-
+
public int rowWidthMax() {
return calculateMax(row_width_min, row_width_max);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/main/java/org/apache/accumulo/test/stress/random/package-info.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/stress/random/package-info.java b/test/src/main/java/org/apache/accumulo/test/stress/random/package-info.java
index 488a279..fdbf72e 100644
--- a/test/src/main/java/org/apache/accumulo/test/stress/random/package-info.java
+++ b/test/src/main/java/org/apache/accumulo/test/stress/random/package-info.java
@@ -17,19 +17,20 @@
/**
* This package contains utility classes designed to test Accumulo when large cells are being written. This is an attempt to observe the behavior Accumulo
* displays when compacting and reading these cells.
- *
+ *
* There are two components to this package: {@link org.apache.accumulo.test.stress.random.Write} and {@link org.apache.accumulo.test.stress.random.Scan}.
- *
+ *
* The {@link org.apache.accumulo.test.stress.random.Write} provides facilities for writing random sized cells. Users can configure minimum and maximum
* sized portions of a cell. The portions users can configure are the row, column family, column qualifier and value. Note that the sizes are uniformly
* distributed between the minimum and maximum values. See {@link org.apache.accumulo.test.stress.random.WriteOptions} for available options and default sizing
* information.
- *
+ *
* The Scan provides users with the ability to query tables generated by the Write. It will pick a tablet at random and scan the entire range. The
* amount of times this process is done is user configurable. By default, it happens 1,024 times. Users can also specify whether or not the scan should be
* isolated or not.
- *
+ *
* There is no shared state intended by either of these services. This allows multiple clients to be run in parallel, either on the same host or distributed
* across hosts.
*/
package org.apache.accumulo.test.stress.random;
+
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java b/test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java
index 4045087..2ad8161 100644
--- a/test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java
+++ b/test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java
@@ -40,7 +40,7 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
/**
- *
+ *
*/
public class ZooLockTest {
@@ -155,7 +155,7 @@ public class ZooLockTest {
@Test(timeout = 10000)
public void testNoParent() throws Exception {
String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
-
+
ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
Assert.assertFalse(zl.isLocked());
@@ -175,7 +175,7 @@ public class ZooLockTest {
@Test(timeout = 10000)
public void testDeleteLock() throws Exception {
String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
-
+
ZooReaderWriter zk = ZooReaderWriter.getInstance(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes());
zk.mkdirs(parent);
@@ -206,7 +206,7 @@ public class ZooLockTest {
@Test(timeout = 10000)
public void testDeleteWaiting() throws Exception {
String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
-
+
ZooReaderWriter zk = ZooReaderWriter.getInstance(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes());
zk.mkdirs(parent);
@@ -280,7 +280,7 @@ public class ZooLockTest {
while (!watcher.isConnected()) {
Thread.sleep(200);
}
-
+
zk.create(parent, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
@@ -318,7 +318,7 @@ public class ZooLockTest {
String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 1000, "digest", "secret".getBytes(), parent);
-
+
ConnectedWatcher watcher = new ConnectedWatcher();
ZooKeeper zk = new ZooKeeper(accumulo.getZooKeepers(), 1000, watcher);
zk.addAuthInfo("digest", "secret".getBytes());
@@ -326,7 +326,7 @@ public class ZooLockTest {
while (!watcher.isConnected()) {
Thread.sleep(200);
}
-
+
for (int i = 0; i < 10; i++) {
zk.create(parent, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zk.delete(parent, -1);
@@ -360,7 +360,7 @@ public class ZooLockTest {
while (!watcher.isConnected()) {
Thread.sleep(200);
}
-
+
zk.create(parent, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 1000, "digest", "secret".getBytes(), parent);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java b/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java
index f8bcbfb..c632b47 100644
--- a/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java
+++ b/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java
@@ -54,18 +54,18 @@ import org.apache.thrift.server.TServer;
import org.junit.Test;
public class ProxyDurabilityIT extends ConfigurableMacIT {
-
+
@Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
cfg.setNumTservers(1);
}
-
+
private static ByteBuffer bytes(String value) {
return ByteBuffer.wrap(value.getBytes());
}
-
+
@Test
public void testDurability() throws Exception {
Connector c = getConnector();
@@ -77,8 +77,8 @@ public class ProxyDurabilityIT extends ConfigurableMacIT {
Class<Factory> protocolClass = org.apache.thrift.protocol.TJSONProtocol.Factory.class;
int proxyPort = PortUtils.getRandomFreePort();
- final TServer proxyServer = Proxy.createProxyServer(org.apache.accumulo.proxy.thrift.AccumuloProxy.class, org.apache.accumulo.proxy.ProxyServer.class, proxyPort,
- protocolClass, props);
+ final TServer proxyServer = Proxy.createProxyServer(org.apache.accumulo.proxy.thrift.AccumuloProxy.class, org.apache.accumulo.proxy.ProxyServer.class,
+ proxyPort, protocolClass, props);
Thread thread = new Thread() {
@Override
public void run() {
@@ -92,15 +92,15 @@ public class ProxyDurabilityIT extends ConfigurableMacIT {
Map<String,String> properties = new TreeMap<String,String>();
properties.put("password", ROOT_PASSWORD);
ByteBuffer login = client.login("root", properties);
-
+
String tableName = getUniqueNames(1)[0];
client.createTable(login, tableName, true, TimeType.MILLIS);
assertTrue(c.tableOperations().exists(tableName));
-
+
WriterOptions options = new WriterOptions();
options.setDurability(Durability.NONE);
String writer = client.createWriter(login, tableName, options);
- Map<ByteBuffer,List<ColumnUpdate>> cells = new TreeMap<ByteBuffer, List<ColumnUpdate>>();
+ Map<ByteBuffer,List<ColumnUpdate>> cells = new TreeMap<ByteBuffer,List<ColumnUpdate>>();
ColumnUpdate column = new ColumnUpdate(bytes("cf"), bytes("cq"));
column.setValue("value".getBytes());
cells.put(bytes("row"), Collections.singletonList(column));
@@ -109,7 +109,7 @@ public class ProxyDurabilityIT extends ConfigurableMacIT {
assertEquals(1, count(tableName));
restartTServer();
assertEquals(0, count(tableName));
-
+
ConditionalWriterOptions cfg = new ConditionalWriterOptions();
cfg.setDurability(Durability.LOG);
String cwriter = client.createConditionalWriter(login, tableName, cfg);
@@ -121,7 +121,7 @@ public class ProxyDurabilityIT extends ConfigurableMacIT {
assertEquals(1, count(tableName));
restartTServer();
assertEquals(0, count(tableName));
-
+
proxyServer.stop();
thread.join();
}
@@ -137,5 +137,5 @@ public class ProxyDurabilityIT extends ConfigurableMacIT {
Connector c = getConnector();
return FunctionalTestUtils.count(c.createScanner(tableName, Authorizations.EMPTY));
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
index c075075..f55e593 100644
--- a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
+++ b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyIT.java
@@ -186,8 +186,9 @@ public class SimpleProxyIT {
// wait for accumulo to be up and functional
ZooKeeperInstance zoo = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
Connector c = zoo.getConnector("root", new PasswordToken(secret.getBytes()));
- for (@SuppressWarnings("unused") Entry<org.apache.accumulo.core.data.Key,Value> entry : c.createScanner(MetadataTable.NAME, Authorizations.EMPTY))
- ;
+ for (@SuppressWarnings("unused")
+ Entry<org.apache.accumulo.core.data.Key,Value> entry : c.createScanner(MetadataTable.NAME, Authorizations.EMPTY))
+ ;
Properties props = new Properties();
props.put("instance", accumulo.getConfig().getInstanceName());
@@ -1599,8 +1600,8 @@ public class SimpleProxyIT {
client.createTable(creds, tableName, true, TimeType.MILLIS);
- client.setProperty(creds, Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1",
- System.getProperty("user.dir") + "/src/test/resources/TestCompactionStrat.jar");
+ client.setProperty(creds, Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1", System.getProperty("user.dir")
+ + "/src/test/resources/TestCompactionStrat.jar");
client.setTableProperty(creds, tableName, Property.TABLE_CLASSPATH.getKey(), "context1");
client.addSplits(creds, tableName, Collections.singleton(s2bb("efg")));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java b/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
index ad21f91..92d065f 100644
--- a/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
+++ b/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
@@ -38,14 +38,14 @@ public class TestProxyInstanceOperations {
protected static TestProxyClient tpc;
protected static ByteBuffer userpass;
protected static final int port = 10197;
-
+
@SuppressWarnings("serial")
@BeforeClass
public static void setup() throws Exception {
Properties prop = new Properties();
prop.setProperty("useMockInstance", "true");
prop.put("tokenClass", PasswordToken.class.getName());
-
+
proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"), Class.forName("org.apache.accumulo.proxy.ProxyServer"),
port, TCompactProtocol.Factory.class, prop);
thread = new Thread() {
@@ -56,28 +56,32 @@ public class TestProxyInstanceOperations {
};
thread.start();
tpc = new TestProxyClient("localhost", port);
- userpass = tpc.proxy.login("root", new TreeMap<String, String>() {{ put("password",""); }});
+ userpass = tpc.proxy.login("root", new TreeMap<String,String>() {
+ {
+ put("password", "");
+ }
+ });
}
-
+
@AfterClass
public static void tearDown() throws InterruptedException {
proxy.stop();
thread.join();
}
-
+
@Test
public void properties() throws TException {
tpc.proxy().setProperty(userpass, "test.systemprop", "whistletips");
-
+
assertEquals(tpc.proxy().getSystemConfiguration(userpass).get("test.systemprop"), "whistletips");
tpc.proxy().removeProperty(userpass, "test.systemprop");
assertNull(tpc.proxy().getSystemConfiguration(userpass).get("test.systemprop"));
-
+
}
-
+
@Test
public void testClassLoad() throws TException {
assertTrue(tpc.proxy().testClassLoad(userpass, "org.apache.accumulo.core.iterators.user.RegExFilter", "org.apache.accumulo.core.iterators.Filter"));
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java b/test/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
index c0049a0..4528a0e 100644
--- a/test/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
+++ b/test/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
@@ -55,14 +55,14 @@ public class TestProxyReadWrite {
protected static ByteBuffer userpass;
protected static final int port = 10194;
protected static final String testtable = "testtable";
-
+
@SuppressWarnings("serial")
@BeforeClass
public static void setup() throws Exception {
Properties prop = new Properties();
prop.setProperty("useMockInstance", "true");
prop.put("tokenClass", PasswordToken.class.getName());
-
+
proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"), Class.forName("org.apache.accumulo.proxy.ProxyServer"),
port, TCompactProtocol.Factory.class, prop);
thread = new Thread() {
@@ -73,38 +73,42 @@ public class TestProxyReadWrite {
};
thread.start();
tpc = new TestProxyClient("localhost", port);
- userpass = tpc.proxy().login("root", new TreeMap<String, String>() {{put("password",""); }});
+ userpass = tpc.proxy().login("root", new TreeMap<String,String>() {
+ {
+ put("password", "");
+ }
+ });
}
-
+
@AfterClass
public static void tearDown() throws InterruptedException {
proxy.stop();
thread.join();
}
-
+
@Before
public void makeTestTable() throws Exception {
tpc.proxy().createTable(userpass, testtable, true, TimeType.MILLIS);
}
-
+
@After
public void deleteTestTable() throws Exception {
tpc.proxy().deleteTable(userpass, testtable);
}
-
+
private static void addMutation(Map<ByteBuffer,List<ColumnUpdate>> mutations, String row, String cf, String cq, String value) {
ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()));
update.setValue(value.getBytes());
mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
}
-
+
private static void addMutation(Map<ByteBuffer,List<ColumnUpdate>> mutations, String row, String cf, String cq, String vis, String value) {
ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()));
update.setValue(value.getBytes());
update.setColVisibility(vis.getBytes());
mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
}
-
+
/**
* Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a range so only the entries between -Inf...5 come back (there should be
* 50,000)
@@ -116,22 +120,22 @@ public class TestProxyReadWrite {
String format = "%1$05d";
for (int i = 0; i < maxInserts; i++) {
addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
-
+
if (i % 1000 == 0 || i == maxInserts - 1) {
tpc.proxy().updateAndFlush(userpass, testtable, mutations);
mutations.clear();
}
}
-
+
Key stop = new Key();
stop.setRow("5".getBytes());
BatchScanOptions options = new BatchScanOptions();
options.ranges = Collections.singletonList(new Range(null, false, stop, false));
String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options);
-
+
int i = 0;
boolean hasNext = true;
-
+
int k = 1000;
while (hasNext) {
ScanResult kvList = tpc.proxy().nextK(cookie, k);
@@ -142,8 +146,8 @@ public class TestProxyReadWrite {
}
/**
- * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a columnFamily so only the entries with specified column family come back (there should be
- * 50,000)
+ * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a columnFamily so only the entries with specified column family come back
+ * (there should be 50,000)
*/
@Test
public void readWriteBatchOneShotWithColumnFamilyOnly() throws Exception {
@@ -151,26 +155,26 @@ public class TestProxyReadWrite {
Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
String format = "%1$05d";
for (int i = 0; i < maxInserts; i++) {
-
- addMutation(mutations, String.format(format, i), "cf" + (i % 2) , "cq" + (i % 2), Util.randString(10));
-
+
+ addMutation(mutations, String.format(format, i), "cf" + (i % 2), "cq" + (i % 2), Util.randString(10));
+
if (i % 1000 == 0 || i == maxInserts - 1) {
tpc.proxy().updateAndFlush(userpass, testtable, mutations);
mutations.clear();
}
}
-
+
BatchScanOptions options = new BatchScanOptions();
- ScanColumn sc = new ScanColumn();
- sc.colFamily = ByteBuffer.wrap("cf0".getBytes());
+ ScanColumn sc = new ScanColumn();
+ sc.colFamily = ByteBuffer.wrap("cf0".getBytes());
options.columns = Collections.singletonList(sc);
String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options);
-
+
int i = 0;
boolean hasNext = true;
-
+
int k = 1000;
while (hasNext) {
ScanResult kvList = tpc.proxy().nextK(cookie, k);
@@ -180,9 +184,8 @@ public class TestProxyReadWrite {
assertEquals(i, 50000);
}
-
/**
- * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a columnFamily + columnQualififer so only the entries with specified column
+ * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a columnFamily + columnQualififer so only the entries with specified column
* come back (there should be 50,000)
*/
@Test
@@ -191,27 +194,27 @@ public class TestProxyReadWrite {
Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
String format = "%1$05d";
for (int i = 0; i < maxInserts; i++) {
-
- addMutation(mutations, String.format(format, i), "cf" + (i % 2) , "cq" + (i % 2), Util.randString(10));
-
+
+ addMutation(mutations, String.format(format, i), "cf" + (i % 2), "cq" + (i % 2), Util.randString(10));
+
if (i % 1000 == 0 || i == maxInserts - 1) {
tpc.proxy().updateAndFlush(userpass, testtable, mutations);
mutations.clear();
}
}
-
+
BatchScanOptions options = new BatchScanOptions();
- ScanColumn sc = new ScanColumn();
- sc.colFamily = ByteBuffer.wrap("cf0".getBytes());
- sc.colQualifier = ByteBuffer.wrap("cq0".getBytes());
+ ScanColumn sc = new ScanColumn();
+ sc.colFamily = ByteBuffer.wrap("cf0".getBytes());
+ sc.colQualifier = ByteBuffer.wrap("cq0".getBytes());
options.columns = Collections.singletonList(sc);
String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options);
-
+
int i = 0;
boolean hasNext = true;
-
+
int k = 1000;
while (hasNext) {
ScanResult kvList = tpc.proxy().nextK(cookie, k);
@@ -221,7 +224,6 @@ public class TestProxyReadWrite {
assertEquals(i, 50000);
}
-
/**
* Insert 100000 cells which have as the row [0..99999] (padded with zeros). Filter the results so only the even numbers come back.
*/
@@ -232,39 +234,39 @@ public class TestProxyReadWrite {
String format = "%1$05d";
for (int i = 0; i < maxInserts; i++) {
addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
-
+
if (i % 1000 == 0 || i == maxInserts - 1) {
tpc.proxy().updateAndFlush(userpass, testtable, mutations);
mutations.clear();
}
-
+
}
-
+
String regex = ".*[02468]";
-
+
org.apache.accumulo.core.client.IteratorSetting is = new org.apache.accumulo.core.client.IteratorSetting(50, regex, RegExFilter.class);
RegExFilter.setRegexs(is, regex, null, null, null, false);
-
+
IteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
ScanOptions opts = new ScanOptions();
opts.iterators = Collections.singletonList(pis);
String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
-
+
int i = 0;
boolean hasNext = true;
-
+
int k = 1000;
while (hasNext) {
ScanResult kvList = tpc.proxy().nextK(cookie, k);
for (KeyValue kv : kvList.getResults()) {
assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
-
+
i += 2;
}
hasNext = kvList.isMore();
}
}
-
+
@Test
public void readWriteOneShotWithRange() throws Exception {
int maxInserts = 100000;
@@ -272,22 +274,22 @@ public class TestProxyReadWrite {
String format = "%1$05d";
for (int i = 0; i < maxInserts; i++) {
addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
-
+
if (i % 1000 == 0 || i == maxInserts - 1) {
tpc.proxy().updateAndFlush(userpass, testtable, mutations);
mutations.clear();
}
}
-
+
Key stop = new Key();
stop.setRow("5".getBytes());
ScanOptions opts = new ScanOptions();
opts.range = new Range(null, false, stop, false);
String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
-
+
int i = 0;
boolean hasNext = true;
-
+
int k = 1000;
while (hasNext) {
ScanResult kvList = tpc.proxy().nextK(cookie, k);
@@ -296,7 +298,7 @@ public class TestProxyReadWrite {
}
assertEquals(i, 50000);
}
-
+
/**
* Insert 100000 cells which have as the row [0..99999] (padded with zeros). Filter the results so only the even numbers come back.
*/
@@ -307,41 +309,41 @@ public class TestProxyReadWrite {
String format = "%1$05d";
for (int i = 0; i < maxInserts; i++) {
addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
-
+
if (i % 1000 == 0 || i == maxInserts - 1) {
-
+
tpc.proxy().updateAndFlush(userpass, testtable, mutations);
mutations.clear();
-
+
}
-
+
}
-
+
String regex = ".*[02468]";
-
+
org.apache.accumulo.core.client.IteratorSetting is = new org.apache.accumulo.core.client.IteratorSetting(50, regex, RegExFilter.class);
RegExFilter.setRegexs(is, regex, null, null, null, false);
-
+
IteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
ScanOptions opts = new ScanOptions();
opts.iterators = Collections.singletonList(pis);
String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
-
+
int i = 0;
boolean hasNext = true;
-
+
int k = 1000;
while (hasNext) {
ScanResult kvList = tpc.proxy().nextK(cookie, k);
for (KeyValue kv : kvList.getResults()) {
assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
-
+
i += 2;
}
hasNext = kvList.isMore();
}
}
-
+
// @Test
// This test takes kind of a long time. Enable it if you think you may have memory issues.
public void manyWritesAndReads() throws Exception {
@@ -351,24 +353,24 @@ public class TestProxyReadWrite {
String writer = tpc.proxy().createWriter(userpass, testtable, null);
for (int i = 0; i < maxInserts; i++) {
addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
-
+
if (i % 1000 == 0 || i == maxInserts - 1) {
-
+
tpc.proxy().update(writer, mutations);
mutations.clear();
-
+
}
-
+
}
-
+
tpc.proxy().flush(writer);
tpc.proxy().closeWriter(writer);
-
+
String cookie = tpc.proxy().createScanner(userpass, testtable, null);
-
+
int i = 0;
boolean hasNext = true;
-
+
int k = 1000;
while (hasNext) {
ScanResult kvList = tpc.proxy().nextK(cookie, k);
@@ -382,7 +384,7 @@ public class TestProxyReadWrite {
}
assertEquals(maxInserts, i);
}
-
+
@Test
public void asynchReadWrite() throws Exception {
int maxInserts = 10000;
@@ -391,29 +393,29 @@ public class TestProxyReadWrite {
String writer = tpc.proxy().createWriter(userpass, testtable, null);
for (int i = 0; i < maxInserts; i++) {
addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
-
+
if (i % 1000 == 0 || i == maxInserts - 1) {
tpc.proxy().update(writer, mutations);
mutations.clear();
}
}
-
+
tpc.proxy().flush(writer);
tpc.proxy().closeWriter(writer);
-
+
String regex = ".*[02468]";
-
+
org.apache.accumulo.core.client.IteratorSetting is = new org.apache.accumulo.core.client.IteratorSetting(50, regex, RegExFilter.class);
RegExFilter.setRegexs(is, regex, null, null, null, false);
-
+
IteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
ScanOptions opts = new ScanOptions();
opts.iterators = Collections.singletonList(pis);
String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
-
+
int i = 0;
boolean hasNext = true;
-
+
int k = 1000;
int numRead = 0;
while (hasNext) {
@@ -427,14 +429,14 @@ public class TestProxyReadWrite {
}
assertEquals(maxInserts / 2, numRead);
}
-
+
@Test
public void testVisibility() throws Exception {
-
+
Set<ByteBuffer> auths = new HashSet<ByteBuffer>();
auths.add(ByteBuffer.wrap("even".getBytes()));
tpc.proxy().changeUserAuthorizations(userpass, "root", auths);
-
+
int maxInserts = 10000;
Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
String format = "%1$05d";
@@ -444,22 +446,22 @@ public class TestProxyReadWrite {
addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, "even", Util.randString(10));
else
addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, "odd", Util.randString(10));
-
+
if (i % 1000 == 0 || i == maxInserts - 1) {
tpc.proxy().update(writer, mutations);
mutations.clear();
}
}
-
+
tpc.proxy().flush(writer);
tpc.proxy().closeWriter(writer);
ScanOptions opts = new ScanOptions();
opts.authorizations = auths;
String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
-
+
int i = 0;
boolean hasNext = true;
-
+
int k = 1000;
int numRead = 0;
while (hasNext) {
@@ -470,9 +472,9 @@ public class TestProxyReadWrite {
numRead++;
}
hasNext = kvList.isMore();
-
+
}
assertEquals(maxInserts / 2, numRead);
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java b/test/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
index e0b17ac..1a87200 100644
--- a/test/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
+++ b/test/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
@@ -50,13 +50,13 @@ public class TestProxySecurityOperations {
protected static final String testtable = "testtable";
protected static final String testuser = "VonJines";
protected static final ByteBuffer testpw = ByteBuffer.wrap("fiveones".getBytes());
-
+
@BeforeClass
public static void setup() throws Exception {
Properties prop = new Properties();
prop.setProperty("useMockInstance", "true");
prop.put("tokenClass", PasswordToken.class.getName());
-
+
proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"), Class.forName("org.apache.accumulo.proxy.ProxyServer"),
port, TCompactProtocol.Factory.class, prop);
thread = new Thread() {
@@ -66,35 +66,35 @@ public class TestProxySecurityOperations {
}
};
thread.start();
-
+
tpc = new TestProxyClient("localhost", port);
userpass = tpc.proxy().login("root", new TreeMap<String,String>() {
private static final long serialVersionUID = 1L;
-
+
{
put("password", "");
}
});
}
-
+
@AfterClass
public static void tearDown() throws InterruptedException {
proxy.stop();
thread.join();
}
-
+
@Before
public void makeTestTableAndUser() throws Exception {
tpc.proxy().createTable(userpass, testtable, true, TimeType.MILLIS);
tpc.proxy().createLocalUser(userpass, testuser, testpw);
}
-
+
@After
public void deleteTestTable() throws Exception {
tpc.proxy().deleteTable(userpass, testtable);
tpc.proxy().dropLocalUser(userpass, testuser);
}
-
+
@Test
public void create() throws TException {
tpc.proxy().createLocalUser(userpass, testuser + "2", testpw);
@@ -102,38 +102,38 @@ public class TestProxySecurityOperations {
tpc.proxy().dropLocalUser(userpass, testuser + "2");
assertTrue(!tpc.proxy().listLocalUsers(userpass).contains(testuser + "2"));
}
-
+
@Test
public void authenticate() throws TException {
assertTrue(tpc.proxy().authenticateUser(userpass, testuser, bb2pp(testpw)));
assertFalse(tpc.proxy().authenticateUser(userpass, "EvilUser", bb2pp(testpw)));
-
+
tpc.proxy().changeLocalUserPassword(userpass, testuser, ByteBuffer.wrap("newpass".getBytes()));
assertFalse(tpc.proxy().authenticateUser(userpass, testuser, bb2pp(testpw)));
assertTrue(tpc.proxy().authenticateUser(userpass, testuser, bb2pp(ByteBuffer.wrap("newpass".getBytes()))));
-
+
}
-
+
@Test
public void tablePermissions() throws TException {
tpc.proxy().grantTablePermission(userpass, testuser, testtable, TablePermission.ALTER_TABLE);
assertTrue(tpc.proxy().hasTablePermission(userpass, testuser, testtable, TablePermission.ALTER_TABLE));
-
+
tpc.proxy().revokeTablePermission(userpass, testuser, testtable, TablePermission.ALTER_TABLE);
assertFalse(tpc.proxy().hasTablePermission(userpass, testuser, testtable, TablePermission.ALTER_TABLE));
-
+
}
-
+
@Test
public void systemPermissions() throws TException {
tpc.proxy().grantSystemPermission(userpass, testuser, SystemPermission.ALTER_USER);
assertTrue(tpc.proxy().hasSystemPermission(userpass, testuser, SystemPermission.ALTER_USER));
-
+
tpc.proxy().revokeSystemPermission(userpass, testuser, SystemPermission.ALTER_USER);
assertFalse(tpc.proxy().hasSystemPermission(userpass, testuser, SystemPermission.ALTER_USER));
-
+
}
-
+
@Test
public void auths() throws TException {
HashSet<ByteBuffer> newauths = new HashSet<ByteBuffer>();
@@ -142,16 +142,16 @@ public class TestProxySecurityOperations {
tpc.proxy().changeUserAuthorizations(userpass, testuser, newauths);
List<ByteBuffer> actualauths = tpc.proxy().getUserAuthorizations(userpass, testuser);
assertEquals(actualauths.size(), newauths.size());
-
+
for (ByteBuffer auth : actualauths) {
assertTrue(newauths.contains(auth));
}
}
-
+
private Map<String,String> bb2pp(ByteBuffer cf) {
Map<String,String> toRet = new TreeMap<String,String>();
toRet.put("password", ByteBufferUtil.toString(cf));
return toRet;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java b/test/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
index 87d3454..dd01af9 100644
--- a/test/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
+++ b/test/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
@@ -44,21 +44,21 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class TestProxyTableOperations {
-
+
protected static TServer proxy;
protected static Thread thread;
protected static TestProxyClient tpc;
protected static ByteBuffer userpass;
protected static final int port = 10195;
protected static final String testtable = "testtable";
-
+
@SuppressWarnings("serial")
@BeforeClass
public static void setup() throws Exception {
Properties prop = new Properties();
prop.setProperty("useMockInstance", "true");
prop.put("tokenClass", PasswordToken.class.getName());
-
+
proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"), Class.forName("org.apache.accumulo.proxy.ProxyServer"),
port, TCompactProtocol.Factory.class, prop);
thread = new Thread() {
@@ -75,23 +75,23 @@ public class TestProxyTableOperations {
}
});
}
-
+
@AfterClass
public static void tearDown() throws InterruptedException {
proxy.stop();
thread.join();
}
-
+
@Before
public void makeTestTable() throws Exception {
tpc.proxy().createTable(userpass, testtable, true, TimeType.MILLIS);
}
-
+
@After
public void deleteTestTable() throws Exception {
tpc.proxy().deleteTable(userpass, testtable);
}
-
+
@Test
public void createExistsDelete() throws TException {
assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
@@ -100,7 +100,7 @@ public class TestProxyTableOperations {
tpc.proxy().deleteTable(userpass, "testtable2");
assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
}
-
+
@Test
public void listRename() throws TException {
assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
@@ -108,9 +108,9 @@ public class TestProxyTableOperations {
assertTrue(tpc.proxy().tableExists(userpass, "testtable2"));
tpc.proxy().renameTable(userpass, "testtable2", testtable);
assertTrue(tpc.proxy().listTables(userpass).contains("testtable"));
-
+
}
-
+
// This test does not yet function because the backing Mock instance does not yet support merging
@Test
public void merge() throws TException {
@@ -119,19 +119,19 @@ public class TestProxyTableOperations {
splits.add(ByteBuffer.wrap("c".getBytes()));
splits.add(ByteBuffer.wrap("z".getBytes()));
tpc.proxy().addSplits(userpass, testtable, splits);
-
+
tpc.proxy().mergeTablets(userpass, testtable, ByteBuffer.wrap("b".getBytes()), ByteBuffer.wrap("d".getBytes()));
-
+
splits.remove(ByteBuffer.wrap("c".getBytes()));
-
+
List<ByteBuffer> tableSplits = tpc.proxy().listSplits(userpass, testtable, 10);
-
+
for (ByteBuffer split : tableSplits)
assertTrue(splits.contains(split));
assertTrue(tableSplits.size() == splits.size());
-
+
}
-
+
@Test
public void splits() throws TException {
Set<ByteBuffer> splits = new HashSet<ByteBuffer>();
@@ -139,14 +139,14 @@ public class TestProxyTableOperations {
splits.add(ByteBuffer.wrap("b".getBytes()));
splits.add(ByteBuffer.wrap("z".getBytes()));
tpc.proxy().addSplits(userpass, testtable, splits);
-
+
List<ByteBuffer> tableSplits = tpc.proxy().listSplits(userpass, testtable, 10);
-
+
for (ByteBuffer split : tableSplits)
assertTrue(splits.contains(split));
assertTrue(tableSplits.size() == splits.size());
}
-
+
@Test
public void constraints() throws TException {
int cid = tpc.proxy().addConstraint(userpass, testtable, "org.apache.accumulo.TestConstraint");
@@ -156,7 +156,7 @@ public class TestProxyTableOperations {
constraints = tpc.proxy().listConstraints(userpass, testtable);
assertNull(constraints.get("org.apache.accumulo.TestConstraint"));
}
-
+
@Test
public void localityGroups() throws TException {
Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
@@ -168,9 +168,9 @@ public class TestProxyTableOperations {
group2.add("cf3");
groups.put("group2", group2);
tpc.proxy().setLocalityGroups(userpass, testtable, groups);
-
+
Map<String,Set<String>> actualGroups = tpc.proxy().getLocalityGroups(userpass, testtable);
-
+
assertEquals(groups.size(), actualGroups.size());
for (String groupName : groups.keySet()) {
assertTrue(actualGroups.containsKey(groupName));
@@ -180,7 +180,7 @@ public class TestProxyTableOperations {
}
}
}
-
+
@Test
public void tableProperties() throws TException {
tpc.proxy().setTableProperty(userpass, testtable, "test.property1", "wharrrgarbl");
@@ -188,13 +188,13 @@ public class TestProxyTableOperations {
tpc.proxy().removeTableProperty(userpass, testtable, "test.property1");
assertNull(tpc.proxy().getTableProperties(userpass, testtable).get("test.property1"));
}
-
+
private static void addMutation(Map<ByteBuffer,List<ColumnUpdate>> mutations, String row, String cf, String cq, String value) {
ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()));
update.setValue(value.getBytes());
mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
}
-
+
@Test
public void tableOperationsRowMethods() throws TException {
Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
@@ -202,11 +202,11 @@ public class TestProxyTableOperations {
addMutation(mutations, "" + i, "cf", "cq", "");
}
tpc.proxy().updateAndFlush(userpass, testtable, mutations);
-
+
assertEquals(tpc.proxy().getMaxRow(userpass, testtable, null, null, true, null, true), ByteBuffer.wrap("9".getBytes()));
-
+
tpc.proxy().deleteRows(userpass, testtable, ByteBuffer.wrap("51".getBytes()), ByteBuffer.wrap("99".getBytes()));
assertEquals(tpc.proxy().getMaxRow(userpass, testtable, null, null, true, null, true), ByteBuffer.wrap("5".getBytes()));
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java b/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
index fb71f5f..abbe5e6 100644
--- a/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
+++ b/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
@@ -127,9 +127,10 @@ public class SystemCredentialsIT extends ConfigurableMacIT {
}
} catch (RuntimeException e) {
// catch the runtime exception from the scanner iterator
- if (e.getCause() instanceof AccumuloSecurityException && ((AccumuloSecurityException) e.getCause()).getSecurityErrorCode() == SecurityErrorCode.BAD_CREDENTIALS) {
- e.printStackTrace(System.err);
- System.exit(FAIL_CODE);
+ if (e.getCause() instanceof AccumuloSecurityException
+ && ((AccumuloSecurityException) e.getCause()).getSecurityErrorCode() == SecurityErrorCode.BAD_CREDENTIALS) {
+ e.printStackTrace(System.err);
+ System.exit(FAIL_CODE);
}
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/test/AssignmentThreadsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/AssignmentThreadsIT.java b/test/src/test/java/org/apache/accumulo/test/AssignmentThreadsIT.java
index d7a5ac2..ccf234d 100644
--- a/test/src/test/java/org/apache/accumulo/test/AssignmentThreadsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/AssignmentThreadsIT.java
@@ -14,7 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- package org.apache.accumulo.test;
+package org.apache.accumulo.test;
+
+import static org.junit.Assert.assertTrue;
import java.util.Random;
import java.util.SortedSet;
@@ -29,8 +31,6 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.junit.Test;
-import static org.junit.Assert.assertTrue;
-
// ACCUMULO-1177
public class AssignmentThreadsIT extends ConfigurableMacIT {
@@ -41,7 +41,7 @@ public class AssignmentThreadsIT extends ConfigurableMacIT {
}
// [0-9a-f]
- private final static byte[] HEXCHARS = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66 };
+ private final static byte[] HEXCHARS = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66};
private final static Random random = new Random();
public static byte[] randomHex(int n) {
@@ -50,8 +50,8 @@ public class AssignmentThreadsIT extends ConfigurableMacIT {
random.nextBytes(binary);
int count = 0;
for (byte x : binary) {
- hex[count++] = HEXCHARS[(x >> 4)&0xf];
- hex[count++] = HEXCHARS[x&0xf];
+ hex[count++] = HEXCHARS[(x >> 4) & 0xf];
+ hex[count++] = HEXCHARS[x & 0xf];
}
return hex;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java b/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java
index d4de5e7..2cc5d34 100644
--- a/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java
@@ -16,7 +16,7 @@
*/
package org.apache.accumulo.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Iterator;
@@ -41,13 +41,13 @@ import org.junit.Test;
// ACCUMULO-2952
public class BalanceFasterIT extends ConfigurableMacIT {
-
+
@Override
public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
cfg.setNumTservers(3);
}
- @Test(timeout=90*1000)
+ @Test(timeout = 90 * 1000)
public void test() throws Exception {
// create a table, add a bunch of splits
String tableName = getUniqueNames(1)[0];
@@ -59,12 +59,12 @@ public class BalanceFasterIT extends ConfigurableMacIT {
}
conn.tableOperations().addSplits(tableName, splits);
// give a short wait for balancing
- UtilWaitThread.sleep(10*1000);
+ UtilWaitThread.sleep(10 * 1000);
// find out where the tabets are
Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
s.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
s.setRange(MetadataSchema.TabletsSection.getRange());
- Map<String, Integer> counts = new HashMap<String, Integer>();
+ Map<String,Integer> counts = new HashMap<String,Integer>();
while (true) {
int total = 0;
counts.clear();
@@ -90,5 +90,5 @@ public class BalanceFasterIT extends ConfigurableMacIT {
assertTrue(Math.abs(a - c) < 3);
assertTrue(a > 330);
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java b/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java
index 78cdfe6..62031d5 100644
--- a/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java
@@ -90,5 +90,4 @@ public class BulkImportVolumeIT extends AccumuloClusterIT {
assertEquals(1, fs.listStatus(err).length);
}
-
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java b/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
index 262acb6..b68870d 100644
--- a/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
@@ -104,7 +104,7 @@ public class ConditionalWriterIT extends AccumuloClusterIT {
}
public static long abs(long l) {
- l = Math.abs(l); // abs(Long.MIN_VALUE) == Long.MIN_VALUE...
+ l = Math.abs(l); // abs(Long.MIN_VALUE) == Long.MIN_VALUE...
if (l < 0)
return 0;
return l;
@@ -1264,8 +1264,7 @@ public class ConditionalWriterIT extends AccumuloClusterIT {
final Scanner scanner = conn.createScanner("trace", Authorizations.EMPTY);
scanner.setRange(new Range(new Text(Long.toHexString(root.traceId()))));
- loop:
- while (true) {
+ loop: while (true) {
final StringBuffer finalBuffer = new StringBuffer();
int traceCount = TraceDump.printTrace(scanner, new Printer() {
@Override
@@ -1281,8 +1280,7 @@ public class ConditionalWriterIT extends AccumuloClusterIT {
log.info("Trace output:" + traceOutput);
if (traceCount > 0) {
int lastPos = 0;
- for (String part : "traceTest, startScan,startConditionalUpdate,conditionalUpdate,Check conditions,apply conditional mutations".split(","))
- {
+ for (String part : "traceTest, startScan,startConditionalUpdate,conditionalUpdate,Check conditions,apply conditional mutations".split(",")) {
log.info("Looking in trace output for '" + part + "'");
int pos = traceOutput.indexOf(part);
if (-1 == pos) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/test/InterruptibleScannersIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/InterruptibleScannersIT.java b/test/src/test/java/org/apache/accumulo/test/InterruptibleScannersIT.java
index 4c8bcba..5f9b97a 100644
--- a/test/src/test/java/org/apache/accumulo/test/InterruptibleScannersIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/InterruptibleScannersIT.java
@@ -93,11 +93,10 @@ public class InterruptibleScannersIT extends AccumuloClusterIT {
thread.start();
try {
// Use the scanner, expect problems
- for (@SuppressWarnings("unused") Entry<Key,Value> entry : scanner) {
- }
+ for (@SuppressWarnings("unused")
+ Entry<Key,Value> entry : scanner) {}
Assert.fail("Scan should not succeed");
- } catch (Exception ex) {
- } finally {
+ } catch (Exception ex) {} finally {
thread.join();
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/test/KeyValueEqualityIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/KeyValueEqualityIT.java b/test/src/test/java/org/apache/accumulo/test/KeyValueEqualityIT.java
index 7dd7e52..1bcd82c 100644
--- a/test/src/test/java/org/apache/accumulo/test/KeyValueEqualityIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/KeyValueEqualityIT.java
@@ -63,7 +63,8 @@ public class KeyValueEqualityIT extends AccumuloClusterIT {
bw1.close();
bw2.close();
- Iterator<Entry<Key,Value>> t1 = conn.createScanner(table1, Authorizations.EMPTY).iterator(), t2 = conn.createScanner(table2, Authorizations.EMPTY).iterator();
+ Iterator<Entry<Key,Value>> t1 = conn.createScanner(table1, Authorizations.EMPTY).iterator(), t2 = conn.createScanner(table2, Authorizations.EMPTY)
+ .iterator();
while (t1.hasNext() && t2.hasNext()) {
// KeyValue, the implementation of Entry<Key,Value>, should support equality and hashCode properly
Entry<Key,Value> e1 = t1.next(), e2 = t2.next();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/test/MetaGetsReadersIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MetaGetsReadersIT.java b/test/src/test/java/org/apache/accumulo/test/MetaGetsReadersIT.java
index 7bf88bc..7f9983a 100644
--- a/test/src/test/java/org/apache/accumulo/test/MetaGetsReadersIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MetaGetsReadersIT.java
@@ -17,6 +17,9 @@
package org.apache.accumulo.test;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Random;
@@ -39,9 +42,6 @@ import org.apache.accumulo.test.functional.SlowIterator;
import org.apache.hadoop.conf.Configuration;
import org.junit.Test;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
public class MetaGetsReadersIT extends ConfigurableMacIT {
@Override
@@ -50,7 +50,7 @@ public class MetaGetsReadersIT extends ConfigurableMacIT {
cfg.setProperty(Property.TSERV_SCAN_MAX_OPENFILES, "2");
cfg.setProperty(Property.TABLE_BLOCKCACHE_ENABLED, "false");
}
-
+
private static Thread slowScan(final Connector c, final String tableName, final AtomicBoolean stop) {
Thread thread = new Thread() {
public void run() {
@@ -73,7 +73,7 @@ public class MetaGetsReadersIT extends ConfigurableMacIT {
};
return thread;
}
-
+
@Test(timeout = 2 * 60 * 1000)
public void test() throws Exception {
final String tableName = getUniqueNames(1)[0];
@@ -98,8 +98,8 @@ public class MetaGetsReadersIT extends ConfigurableMacIT {
UtilWaitThread.sleep(500);
long now = System.currentTimeMillis();
Scanner m = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
- for (@SuppressWarnings("unused") Entry<Key,Value> entry : m) {
- }
+ for (@SuppressWarnings("unused")
+ Entry<Key,Value> entry : m) {}
long delay = System.currentTimeMillis() - now;
System.out.println("Delay = " + delay);
assertTrue("metadata table scan was slow", delay < 1000);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
index 5bf68c2..c6b9b23 100644
--- a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java
@@ -116,7 +116,7 @@ public class NamespacesIT extends AccumuloIT {
cluster.getConfig().setNumTservers(1);
cluster.start();
}
-
+
@Before
public void setupConnectorAndNamespace() throws Exception {
// prepare a unique namespace and get a new root connector for each test
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java b/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java
index b2b24fa..10b8810 100644
--- a/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/NoMutationRecoveryIT.java
@@ -59,7 +59,7 @@ public class NoMutationRecoveryIT extends AccumuloClusterIT {
cfg.setNumTservers(1);
}
- public boolean equals(Entry<Key, Value> a, Entry<Key, Value> b) {
+ public boolean equals(Entry<Key,Value> a, Entry<Key,Value> b) {
// comparison, without timestamp
Key akey = a.getKey();
Key bkey = b.getKey();
@@ -73,7 +73,7 @@ public class NoMutationRecoveryIT extends AccumuloClusterIT {
conn.tableOperations().create(table);
String tableId = conn.tableOperations().tableIdMap().get(table);
update(conn, table, new Text("row"), new Text("cf"), new Text("cq"), new Value("value".getBytes()));
- Entry<Key, Value> logRef = getLogRef(conn, MetadataTable.NAME);
+ Entry<Key,Value> logRef = getLogRef(conn, MetadataTable.NAME);
conn.tableOperations().flush(table, null, null, true);
assertEquals("should not have any refs", 0, FunctionalTestUtils.count(getLogRefs(conn, MetadataTable.NAME, Range.prefix(tableId))));
conn.securityOperations().grantTablePermission(conn.whoami(), MetadataTable.NAME, TablePermission.WRITE);
@@ -96,7 +96,7 @@ public class NoMutationRecoveryIT extends AccumuloClusterIT {
count++;
}
assertEquals(1, count);
- for (Entry<Key, Value> ref : getLogRefs(conn, MetadataTable.NAME)) {
+ for (Entry<Key,Value> ref : getLogRefs(conn, MetadataTable.NAME)) {
assertFalse(equals(ref, logRef));
}
}
@@ -106,7 +106,7 @@ public class NoMutationRecoveryIT extends AccumuloClusterIT {
update(conn, name, k.getRow(), k.getColumnFamily(), k.getColumnQualifier(), logRef.getValue());
}
- private Iterable<Entry<Key, Value>> getLogRefs(Connector conn, String table) throws Exception {
+ private Iterable<Entry<Key,Value>> getLogRefs(Connector conn, String table) throws Exception {
return getLogRefs(conn, table, new Range());
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java b/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
index b78e724..49ed92f 100644
--- a/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
@@ -84,18 +84,17 @@ public class RecoveryCompactionsAreFlushesIT extends AccumuloClusterIT {
control.startAllServers(ServerType.TABLET_SERVER);
// ensure the table is readable
- for (@SuppressWarnings("unused") Entry<Key,Value> entry : c.createScanner(tableName, Authorizations.EMPTY)) {
- }
+ for (@SuppressWarnings("unused")
+ Entry<Key,Value> entry : c.createScanner(tableName, Authorizations.EMPTY)) {}
// ensure that the recovery was not a merging minor compaction
Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
- for (Entry<Key, Value> entry : s) {
+ for (Entry<Key,Value> entry : s) {
String filename = entry.getKey().getColumnQualifier().toString();
String parts[] = filename.split("/");
- Assert.assertFalse(parts[parts.length-1].startsWith("M"));
+ Assert.assertFalse(parts[parts.length - 1].startsWith("M"));
}
}
-
}