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:34 UTC
[30/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/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java b/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
index 72342f9..eed3dea 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/IteratorSettingTest.java
@@ -31,7 +31,7 @@ import com.google.common.collect.Maps;
* Test cases for the IteratorSetting class
*/
public class IteratorSettingTest {
-
+
IteratorSetting setting1 = new IteratorSetting(500, "combiner", Combiner.class.getName());
IteratorSetting setting2 = new IteratorSetting(500, "combiner", Combiner.class.getName());
IteratorSetting setting3 = new IteratorSetting(500, "combiner", Combiner.class.getName());
@@ -40,45 +40,45 @@ public class IteratorSettingTest {
IteratorSetting setting4 = new IteratorSetting(300, "combiner", Combiner.class.getName());
IteratorSetting setting5 = new IteratorSetting(500, "foocombiner", Combiner.class.getName());
IteratorSetting setting6 = new IteratorSetting(500, "combiner", "MySuperCombiner");
-
+
@Test
public final void testHashCodeSameObject() {
assertEquals(setting1.hashCode(), setting1.hashCode());
}
-
+
@Test
public final void testHashCodeEqualObjects() {
assertEquals(setting1.hashCode(), setting2.hashCode());
}
-
+
@Test
public final void testEqualsObjectReflexive() {
assertEquals(setting1, setting1);
}
-
+
@Test
public final void testEqualsObjectSymmetric() {
assertEquals(setting1, setting2);
assertEquals(setting2, setting1);
}
-
+
@Test
public final void testEqualsObjectTransitive() {
assertEquals(setting1, setting2);
assertEquals(setting2, setting3);
assertEquals(setting1, setting3);
}
-
+
@Test
public final void testEqualsNullSetting() {
assertNotEquals(setting1, nullsetting);
}
-
+
@Test
public final void testEqualsObjectNotEqual() {
assertNotEquals(setting1, devnull);
}
-
+
@Test
public final void testEqualsObjectProperties() {
IteratorSetting mysettings = new IteratorSetting(500, "combiner", Combiner.class.getName());
@@ -86,29 +86,29 @@ public class IteratorSettingTest {
mysettings.addOption("myoption1", "myvalue1");
assertNotEquals(setting1, mysettings);
}
-
+
@Test
public final void testEqualsDifferentMembers() {
assertNotEquals(setting1, setting4);
assertNotEquals(setting1, setting5);
assertNotEquals(setting1, setting6);
}
-
+
@Test
public void testEquivalentConstructor() {
IteratorSetting setting1 = new IteratorSetting(100, Combiner.class);
IteratorSetting setting2 = new IteratorSetting(100, "Combiner", Combiner.class, Maps.<String,String> newHashMap());
-
+
assertEquals(setting1, setting2);
-
+
IteratorSetting notEqual1 = new IteratorSetting(100, "FooCombiner", Combiner.class, Maps.<String,String> newHashMap());
-
+
assertNotEquals(setting1, notEqual1);
-
+
Map<String,String> props = Maps.newHashMap();
props.put("foo", "bar");
IteratorSetting notEquals2 = new IteratorSetting(100, "Combiner", Combiner.class, props);
-
+
assertNotEquals(setting1, notEquals2);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java
index e12e22f..55e21d1 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/RowIteratorTest.java
@@ -34,7 +34,7 @@ import org.apache.accumulo.core.data.Value;
import org.junit.Test;
public class RowIteratorTest {
-
+
Iterator<Entry<Key,Value>> makeIterator(final String... args) {
final Map<Key,Value> result = new TreeMap<Key,Value>();
for (String s : args) {
@@ -45,7 +45,7 @@ public class RowIteratorTest {
}
return result.entrySet().iterator();
}
-
+
List<List<Entry<Key,Value>>> getRows(final Iterator<Entry<Key,Value>> iter) {
final List<List<Entry<Key,Value>>> result = new ArrayList<List<Entry<Key,Value>>>();
final RowIterator riter = new RowIterator(iter);
@@ -58,7 +58,7 @@ public class RowIteratorTest {
}
return result;
}
-
+
@Test
public void testRowIterator() {
List<List<Entry<Key,Value>>> rows = getRows(makeIterator());
@@ -70,13 +70,13 @@ public class RowIteratorTest {
assertEquals(2, rows.size());
assertEquals(3, rows.get(0).size());
assertEquals(1, rows.get(1).size());
-
+
RowIterator i = new RowIterator(makeIterator());
try {
i.next();
fail();
} catch (NoSuchElementException ex) {}
-
+
i = new RowIterator(makeIterator("a b c d", "a 1 2 3"));
assertTrue(i.hasNext());
Iterator<Entry<Key,Value>> row = i.next();
@@ -97,7 +97,7 @@ public class RowIteratorTest {
fail();
} catch (NoSuchElementException ex) {}
}
-
+
@Test
public void testUnreadRow() {
final RowIterator i = new RowIterator(makeIterator("a b c d", "a 1 2 3", "b 1 2 3"));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java b/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java
index 4c732c0..24c2bbc 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java
@@ -37,7 +37,7 @@ import org.apache.thrift.transport.TTransport;
import org.junit.Test;
public class TestThrift1474 {
-
+
static class TestServer implements ThriftTest.Iface {
@Override
@@ -54,9 +54,9 @@ public class TestThrift1474 {
public boolean throwsError() throws ThriftSecurityException, TException {
throw new ThriftSecurityException();
}
-
+
}
-
+
@Test
public void test() throws IOException, TException, InterruptedException {
TServerSocket serverTransport = new TServerSocket(0);
@@ -64,7 +64,7 @@ public class TestThrift1474 {
int port = serverTransport.getServerSocket().getLocalPort();
TestServer handler = new TestServer();
ThriftTest.Processor<ThriftTest.Iface> processor = new ThriftTest.Processor<ThriftTest.Iface>(handler);
-
+
TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverTransport);
args.stopTimeoutVal = 10;
args.stopTimeoutUnit = TimeUnit.MILLISECONDS;
@@ -78,7 +78,7 @@ public class TestThrift1474 {
while (!server.isServing()) {
UtilWaitThread.sleep(10);
}
-
+
TTransport transport = new TSocket("localhost", port);
transport.open();
TProtocol protocol = new TBinaryProtocol(transport);
@@ -94,5 +94,5 @@ public class TestThrift1474 {
server.stop();
thread.join();
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java b/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java
index d9fca47..2dc6ba5 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java
@@ -34,27 +34,27 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.hadoop.io.Text;
public class FindMaxTest extends TestCase {
-
+
private static Mutation nm(byte[] row) {
Mutation m = new Mutation(new Text(row));
m.put("cf", "cq", "v");
return m;
}
-
+
private static Mutation nm(String row) {
Mutation m = new Mutation(row);
m.put("cf", "cq", "v");
return m;
}
-
+
public void test1() throws Exception {
MockInstance mi = new MockInstance();
-
+
Connector conn = mi.getConnector("root", new PasswordToken(""));
conn.tableOperations().create("foo");
-
+
BatchWriter bw = conn.createBatchWriter("foo", new BatchWriterConfig());
-
+
bw.addMutation(nm(new byte[] {0}));
bw.addMutation(nm(new byte[] {0, 0}));
bw.addMutation(nm(new byte[] {0, 1}));
@@ -63,48 +63,48 @@ public class FindMaxTest extends TestCase {
bw.addMutation(nm(new byte[] {'a', 'b', 'c'}));
bw.addMutation(nm(new byte[] {(byte) 0xff}));
bw.addMutation(nm(new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}));
-
+
for (int i = 0; i < 1000; i++) {
bw.addMutation(nm(String.format("r%05d", i)));
}
-
+
bw.close();
-
+
Scanner scanner = conn.createScanner("foo", Authorizations.EMPTY);
-
+
ArrayList<Text> rows = new ArrayList<Text>();
-
+
for (Entry<Key,Value> entry : scanner) {
rows.add(entry.getKey().getRow());
}
-
+
for (int i = rows.size() - 1; i > 0; i--) {
Text max = FindMax.findMax(conn.createScanner("foo", Authorizations.EMPTY), null, true, rows.get(i), false);
assertEquals(rows.get(i - 1), max);
-
+
max = FindMax.findMax(conn.createScanner("foo", Authorizations.EMPTY), rows.get(i - 1), true, rows.get(i), false);
assertEquals(rows.get(i - 1), max);
-
+
max = FindMax.findMax(conn.createScanner("foo", Authorizations.EMPTY), rows.get(i - 1), false, rows.get(i), false);
assertNull(max);
-
+
max = FindMax.findMax(conn.createScanner("foo", Authorizations.EMPTY), null, true, rows.get(i), true);
assertEquals(rows.get(i), max);
-
+
max = FindMax.findMax(conn.createScanner("foo", Authorizations.EMPTY), rows.get(i), true, rows.get(i), true);
assertEquals(rows.get(i), max);
-
+
max = FindMax.findMax(conn.createScanner("foo", Authorizations.EMPTY), rows.get(i - 1), false, rows.get(i), true);
assertEquals(rows.get(i), max);
-
+
}
-
+
Text max = FindMax.findMax(conn.createScanner("foo", Authorizations.EMPTY), null, true, null, true);
assertEquals(rows.get(rows.size() - 1), max);
-
+
max = FindMax.findMax(conn.createScanner("foo", Authorizations.EMPTY), null, true, new Text(new byte[] {0}), false);
assertNull(max);
-
+
max = FindMax.findMax(conn.createScanner("foo", Authorizations.EMPTY), null, true, new Text(new byte[] {0}), true);
assertEquals(rows.get(0), max);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java
index 2e3951d..494eb50 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java
@@ -35,7 +35,7 @@ public class ClientContextTest {
private static boolean isCredentialProviderAvailable = false;
private static final String keystoreName = "/site-cfg.jceks";
- //site-cfg.jceks={'ignored.property'=>'ignored', 'instance.secret'=>'mysecret', 'general.rpc.timeout'=>'timeout'}
+ // site-cfg.jceks={'ignored.property'=>'ignored', 'instance.secret'=>'mysecret', 'general.rpc.timeout'=>'timeout'}
private static File keystore;
@BeforeClass
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java
index be4d467..dec6748 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java
@@ -26,7 +26,7 @@ import org.junit.Assert;
import org.junit.Test;
/**
- *
+ *
*/
public class ScannerImplTest {
@@ -38,10 +38,10 @@ public class ScannerImplTest {
s.setReadaheadThreshold(0);
s.setReadaheadThreshold(10);
s.setReadaheadThreshold(Long.MAX_VALUE);
-
+
Assert.assertEquals(Long.MAX_VALUE, s.getReadaheadThreshold());
}
-
+
@Test(expected = IllegalArgumentException.class)
public void testInValidReadaheadValues() {
MockInstance instance = new MockInstance();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerOptionsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerOptionsTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerOptionsTest.java
index 463822a..123509a 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerOptionsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerOptionsTest.java
@@ -28,7 +28,7 @@ import org.junit.Test;
* Test that scanner options are set/unset correctly
*/
public class ScannerOptionsTest {
-
+
/**
* Test that you properly add and remove iterators from a scanner
*/
@@ -40,7 +40,7 @@ public class ScannerOptionsTest {
options.removeScanIterator("NAME");
assertEquals(0, options.serverSideIteratorList.size());
}
-
+
@Test
public void testIteratorConflict() {
ScannerOptions options = new ScannerOptions();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java
index 2885002..dab7226 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsHelperTest.java
@@ -28,14 +28,13 @@ import java.util.Set;
import java.util.SortedSet;
import java.util.TreeMap;
-import org.apache.accumulo.core.client.admin.CompactionConfig;
-
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.NewTableConfiguration;
import org.apache.accumulo.core.client.TableExistsException;
import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.admin.CompactionConfig;
import org.apache.accumulo.core.client.admin.DiskUsage;
import org.apache.accumulo.core.client.admin.TimeType;
import org.apache.accumulo.core.data.Range;
@@ -234,16 +233,16 @@ public class TableOperationsHelperTest {
}
void check(TableOperationsHelper t, String tablename, String[] values) throws Exception {
- Map<String,String> expected = new TreeMap<String,String>();
- for (String value : values) {
- String parts[] = value.split("=", 2);
- expected.put(parts[0], parts[1]);
- }
- Map<String,String> actual = new TreeMap<String,String>();
- for (Entry<String,String> entry : t.getProperties(tablename)) {
- actual.put(entry.getKey(), entry.getValue());
- }
- Assert.assertEquals(expected, actual);
+ Map<String,String> expected = new TreeMap<String,String>();
+ for (String value : values) {
+ String parts[] = value.split("=", 2);
+ expected.put(parts[0], parts[1]);
+ }
+ Map<String,String> actual = new TreeMap<String,String>();
+ for (Entry<String,String> entry : t.getProperties(tablename)) {
+ actual.put(entry.getKey(), entry.getValue());
+ }
+ Assert.assertEquals(expected, actual);
}
@Test
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/impl/ZookeeperLockCheckerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ZookeeperLockCheckerTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ZookeeperLockCheckerTest.java
index 1749a4b..8e2e79c 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/impl/ZookeeperLockCheckerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/ZookeeperLockCheckerTest.java
@@ -16,6 +16,11 @@
*/
package org.apache.accumulo.core.client.impl;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.zookeeper.ZooUtil;
@@ -23,10 +28,6 @@ import org.apache.accumulo.fate.zookeeper.ZooCache;
import org.apache.accumulo.fate.zookeeper.ZooCacheFactory;
import org.junit.Before;
import org.junit.Test;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
public class ZookeeperLockCheckerTest {
private Instance instance;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java
index 347649c..9d453e3 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java
@@ -20,7 +20,7 @@ import java.math.BigInteger;
import java.util.Arrays;
/**
- *
+ *
*/
public class BigIntegerLexicoderTest extends LexicoderTest {
public void testSortOrder() {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java
index b299896..fc37f04 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java
@@ -19,7 +19,7 @@ package org.apache.accumulo.core.client.lexicoder;
import java.util.Arrays;
/**
- *
+ *
*/
public class DoubleLexicoderTest extends LexicoderTest {
public void testSortOrder() {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java
index be1001d..60a9f79 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java
@@ -28,47 +28,47 @@ public class ListLexicoderTest extends LexicoderTest {
List<Long> data1 = new ArrayList<Long>();
data1.add(1l);
data1.add(2l);
-
+
List<Long> data2 = new ArrayList<Long>();
data2.add(1l);
-
+
List<Long> data3 = new ArrayList<Long>();
data3.add(1l);
data3.add(3l);
-
+
List<Long> data4 = new ArrayList<Long>();
data4.add(1l);
data4.add(2l);
data4.add(3l);
-
+
List<Long> data5 = new ArrayList<Long>();
data5.add(2l);
data5.add(1l);
-
+
List<List<Long>> data = new ArrayList<List<Long>>();
-
+
// add list in expected sort order
data.add(data2);
data.add(data1);
data.add(data4);
data.add(data3);
data.add(data5);
-
+
TreeSet<Text> sortedEnc = new TreeSet<Text>();
-
+
ListLexicoder<Long> listLexicoder = new ListLexicoder<Long>(new LongLexicoder());
-
+
for (List<Long> list : data) {
sortedEnc.add(new Text(listLexicoder.encode(list)));
}
-
+
List<List<Long>> unenc = new ArrayList<List<Long>>();
-
+
for (Text enc : sortedEnc) {
unenc.add(listLexicoder.decode(TextUtil.getBytes(enc)));
}
-
+
assertEquals(data, unenc);
-
+
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java
index a653259..434a603 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java
@@ -21,7 +21,7 @@ import java.util.Arrays;
import org.apache.accumulo.core.util.ComparablePair;
/**
- *
+ *
*/
public class PairLexicoderTest extends LexicoderTest {
public void testSortOrder() {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java
index 58cec6d..bd59237 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java
@@ -19,7 +19,7 @@ package org.apache.accumulo.core.client.lexicoder;
public class UIntegerLexicoderTest extends LexicoderTest {
public void testEncoding() {
UIntegerLexicoder uil = new UIntegerLexicoder();
-
+
assertEqualsB(uil.encode(0), new byte[] {0x00});
assertEqualsB(uil.encode(0x01), new byte[] {0x01, 0x01});
assertEqualsB(uil.encode(0x0102), new byte[] {0x02, 0x01, 0x02});
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
index 9991206..5ed26d4 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
@@ -130,7 +130,7 @@ public class AccumuloInputFormatTest {
/**
* Test adding iterator options where the keys and values contain both the FIELD_SEPARATOR character (':') and ITERATOR_SEPARATOR (',') characters. There
* should be no exceptions thrown when trying to parse these types of option entries.
- *
+ *
* This test makes sure that the expected raw values, as appears in the Job, are equal to what's expected.
*/
@Test
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
index 36054c8..be5b452 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
@@ -51,7 +51,7 @@ import org.apache.hadoop.util.ToolRunner;
import org.junit.Test;
/**
- *
+ *
*/
public class AccumuloOutputFormatTest {
private static AssertionError e1 = null;
@@ -59,13 +59,13 @@ public class AccumuloOutputFormatTest {
private static final String INSTANCE_NAME = PREFIX + "_mapred_instance";
private static final String TEST_TABLE_1 = PREFIX + "_mapred_table_1";
private static final String TEST_TABLE_2 = PREFIX + "_mapred_table_2";
-
+
private static class MRTester extends Configured implements Tool {
private static class TestMapper implements Mapper<Key,Value,Text,Mutation> {
Key key = null;
int count = 0;
OutputCollector<Text,Mutation> finalOutput;
-
+
@Override
public void map(Key k, Value v, OutputCollector<Text,Mutation> output, Reporter reporter) throws IOException {
finalOutput = output;
@@ -80,102 +80,102 @@ public class AccumuloOutputFormatTest {
key = new Key(k);
count++;
}
-
+
@Override
public void configure(JobConf job) {}
-
+
@Override
public void close() throws IOException {
Mutation m = new Mutation("total");
m.put("", "", Integer.toString(count));
finalOutput.collect(new Text(), m);
}
-
+
}
-
+
@Override
public int run(String[] args) throws Exception {
-
+
if (args.length != 4) {
throw new IllegalArgumentException("Usage : " + MRTester.class.getName() + " <user> <pass> <inputtable> <outputtable>");
}
-
+
String user = args[0];
String pass = args[1];
String table1 = args[2];
String table2 = args[3];
-
+
JobConf job = new JobConf(getConf());
job.setJarByClass(this.getClass());
-
+
job.setInputFormat(AccumuloInputFormat.class);
-
+
AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloInputFormat.setInputTableName(job, table1);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
-
+
job.setMapperClass(TestMapper.class);
job.setMapOutputKeyClass(Key.class);
job.setMapOutputValueClass(Value.class);
job.setOutputFormat(AccumuloOutputFormat.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Mutation.class);
-
+
AccumuloOutputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloOutputFormat.setCreateTables(job, false);
AccumuloOutputFormat.setDefaultTableName(job, table2);
AccumuloOutputFormat.setMockInstance(job, INSTANCE_NAME);
-
+
job.setNumReduceTasks(0);
-
+
return JobClient.runJob(job).isSuccessful() ? 0 : 1;
}
-
+
public static void main(String[] args) throws Exception {
assertEquals(0, ToolRunner.run(CachedConfiguration.getInstance(), new MRTester(), args));
}
}
-
+
@Test
public void testBWSettings() throws IOException {
JobConf job = new JobConf();
-
+
// make sure we aren't testing defaults
final BatchWriterConfig bwDefaults = new BatchWriterConfig();
assertNotEquals(7654321l, bwDefaults.getMaxLatency(TimeUnit.MILLISECONDS));
assertNotEquals(9898989l, bwDefaults.getTimeout(TimeUnit.MILLISECONDS));
assertNotEquals(42, bwDefaults.getMaxWriteThreads());
assertNotEquals(1123581321l, bwDefaults.getMaxMemory());
-
+
final BatchWriterConfig bwConfig = new BatchWriterConfig();
bwConfig.setMaxLatency(7654321l, TimeUnit.MILLISECONDS);
bwConfig.setTimeout(9898989l, TimeUnit.MILLISECONDS);
bwConfig.setMaxWriteThreads(42);
bwConfig.setMaxMemory(1123581321l);
AccumuloOutputFormat.setBatchWriterOptions(job, bwConfig);
-
+
AccumuloOutputFormat myAOF = new AccumuloOutputFormat() {
@Override
public void checkOutputSpecs(FileSystem ignored, JobConf job) throws IOException {
BatchWriterConfig bwOpts = getBatchWriterOptions(job);
-
+
// passive check
assertEquals(bwConfig.getMaxLatency(TimeUnit.MILLISECONDS), bwOpts.getMaxLatency(TimeUnit.MILLISECONDS));
assertEquals(bwConfig.getTimeout(TimeUnit.MILLISECONDS), bwOpts.getTimeout(TimeUnit.MILLISECONDS));
assertEquals(bwConfig.getMaxWriteThreads(), bwOpts.getMaxWriteThreads());
assertEquals(bwConfig.getMaxMemory(), bwOpts.getMaxMemory());
-
+
// explicit check
assertEquals(7654321l, bwOpts.getMaxLatency(TimeUnit.MILLISECONDS));
assertEquals(9898989l, bwOpts.getTimeout(TimeUnit.MILLISECONDS));
assertEquals(42, bwOpts.getMaxWriteThreads());
assertEquals(1123581321l, bwOpts.getMaxMemory());
-
+
}
};
myAOF.checkOutputSpecs(null, job);
}
-
+
@Test
public void testMR() throws Exception {
MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
@@ -189,10 +189,10 @@ public class AccumuloOutputFormatTest {
bw.addMutation(m);
}
bw.close();
-
+
MRTester.main(new String[] {"root", "", TEST_TABLE_1, TEST_TABLE_2});
assertNull(e1);
-
+
Scanner scanner = c.createScanner(TEST_TABLE_2, new Authorizations());
Iterator<Entry<Key,Value>> iter = scanner.iterator();
assertTrue(iter.hasNext());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java
index a0ae0b3..219e4f0 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java
@@ -55,7 +55,7 @@ public class AccumuloRowInputFormatTest {
private static final String PREFIX = AccumuloRowInputFormatTest.class.getSimpleName();
private static final String INSTANCE_NAME = PREFIX + "_mapred_instance";
private static final String TEST_TABLE_1 = PREFIX + "_mapred_table_1";
-
+
private static final String ROW1 = "row1";
private static final String ROW2 = "row2";
private static final String ROW3 = "row3";
@@ -65,7 +65,7 @@ public class AccumuloRowInputFormatTest {
private static List<Entry<Key,Value>> row3;
private static AssertionError e1 = null;
private static AssertionError e2 = null;
-
+
public AccumuloRowInputFormatTest() {
row1 = new ArrayList<Entry<Key,Value>>();
row1.add(new KeyValue(new Key(ROW1, COLF1, "colq1"), "v1".getBytes()));
@@ -76,7 +76,7 @@ public class AccumuloRowInputFormatTest {
row3 = new ArrayList<Entry<Key,Value>>();
row3.add(new KeyValue(new Key(ROW3, COLF1, "colq5"), "v5".getBytes()));
}
-
+
public static void checkLists(final List<Entry<Key,Value>> first, final List<Entry<Key,Value>> second) {
assertEquals("Sizes should be the same.", first.size(), second.size());
for (int i = 0; i < first.size(); i++) {
@@ -84,7 +84,7 @@ public class AccumuloRowInputFormatTest {
assertEquals("Values should be equal.", first.get(i).getValue(), second.get(i).getValue());
}
}
-
+
public static void checkLists(final List<Entry<Key,Value>> first, final Iterator<Entry<Key,Value>> second) {
int entryIndex = 0;
while (second.hasNext()) {
@@ -94,7 +94,7 @@ public class AccumuloRowInputFormatTest {
entryIndex++;
}
}
-
+
public static void insertList(final BatchWriter writer, final List<Entry<Key,Value>> list) throws MutationsRejectedException {
for (Entry<Key,Value> e : list) {
final Key key = e.getKey();
@@ -104,11 +104,11 @@ public class AccumuloRowInputFormatTest {
writer.addMutation(mutation);
}
}
-
+
private static class MRTester extends Configured implements Tool {
public static class TestMapper implements Mapper<Text,PeekingIterator<Entry<Key,Value>>,Key,Value> {
int count = 0;
-
+
@Override
public void map(Text k, PeekingIterator<Entry<Key,Value>> v, OutputCollector<Key,Value> output, Reporter reporter) throws IOException {
try {
@@ -133,10 +133,10 @@ public class AccumuloRowInputFormatTest {
}
count++;
}
-
+
@Override
public void configure(JobConf job) {}
-
+
@Override
public void close() throws IOException {
try {
@@ -145,44 +145,44 @@ public class AccumuloRowInputFormatTest {
e2 = e;
}
}
-
+
}
-
+
@Override
public int run(String[] args) throws Exception {
-
+
if (args.length != 3) {
throw new IllegalArgumentException("Usage : " + MRTester.class.getName() + " <user> <pass> <table>");
}
-
+
String user = args[0];
String pass = args[1];
String table = args[2];
-
+
JobConf job = new JobConf(getConf());
job.setJarByClass(this.getClass());
-
+
job.setInputFormat(AccumuloRowInputFormat.class);
-
+
AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloRowInputFormat.setMockInstance(job, INSTANCE_NAME);
-
+
job.setMapperClass(TestMapper.class);
job.setMapOutputKeyClass(Key.class);
job.setMapOutputValueClass(Value.class);
job.setOutputFormat(NullOutputFormat.class);
-
+
job.setNumReduceTasks(0);
-
+
return JobClient.runJob(job).isSuccessful() ? 0 : 1;
}
-
+
public static void main(String[] args) throws Exception {
assertEquals(0, ToolRunner.run(CachedConfiguration.getInstance(), new MRTester(), args));
}
}
-
+
@Test
public void test() throws Exception {
final MockInstance instance = new MockInstance(INSTANCE_NAME);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java
index 88f5527..f567454 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java
@@ -43,28 +43,28 @@ public class RangeInputSplitTest {
@Test
public void testSimpleWritable() throws IOException {
- RangeInputSplit split = new RangeInputSplit("table", "1", new Range(new Key("a"), new Key("b")), new String[]{"localhost"});
-
+ RangeInputSplit split = new RangeInputSplit("table", "1", new Range(new Key("a"), new Key("b")), new String[] {"localhost"});
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
split.write(dos);
-
+
RangeInputSplit newSplit = new RangeInputSplit();
-
+
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
DataInputStream dis = new DataInputStream(bais);
newSplit.readFields(dis);
-
+
Assert.assertEquals(split.getRange(), newSplit.getRange());
Assert.assertTrue(Arrays.equals(split.getLocations(), newSplit.getLocations()));
}
@Test
public void testAllFieldsWritable() throws IOException {
- RangeInputSplit split = new RangeInputSplit("table", "1", new Range(new Key("a"), new Key("b")), new String[]{"localhost"});
-
+ RangeInputSplit split = new RangeInputSplit("table", "1", new Range(new Key("a"), new Key("b")), new String[] {"localhost"});
+
Set<Pair<Text,Text>> fetchedColumns = new HashSet<Pair<Text,Text>>();
-
+
fetchedColumns.add(new Pair<Text,Text>(new Text("colf1"), new Text("colq1")));
fetchedColumns.add(new Pair<Text,Text>(new Text("colf2"), new Text("colq2")));
@@ -77,7 +77,7 @@ public class RangeInputSplitTest {
setting = new IteratorSetting(100, WholeRowIterator.class);
setting.addOption("bar", "foo");
iterators.add(setting);
-
+
split.setAuths(new Authorizations("foo"));
split.setOffline(true);
split.setIsolatedScan(true);
@@ -90,20 +90,20 @@ public class RangeInputSplitTest {
split.setZooKeepers("localhost");
split.setIterators(iterators);
split.setLogLevel(Level.WARN);
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
split.write(dos);
-
+
RangeInputSplit newSplit = new RangeInputSplit();
-
+
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
DataInputStream dis = new DataInputStream(bais);
newSplit.readFields(dis);
-
+
Assert.assertEquals(split.getRange(), newSplit.getRange());
Assert.assertArrayEquals(split.getLocations(), newSplit.getLocations());
-
+
Assert.assertEquals(split.getAuths(), newSplit.getAuths());
Assert.assertEquals(split.isOffline(), newSplit.isOffline());
Assert.assertEquals(split.isIsolatedScan(), newSplit.isOffline());
@@ -117,5 +117,5 @@ public class RangeInputSplitTest {
Assert.assertEquals(split.getIterators(), newSplit.getIterators());
Assert.assertEquals(split.getLogLevel(), newSplit.getLogLevel());
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java
index 0e1fe39..2fcaf34 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java
@@ -54,7 +54,7 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
/**
- *
+ *
*/
public class TokenFileTest {
private static AssertionError e1 = null;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
index 869ae9d..9d74182 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
@@ -122,7 +122,7 @@ public class AccumuloInputFormatTest {
/**
* Test adding iterator options where the keys and values contain both the FIELD_SEPARATOR character (':') and ITERATOR_SEPARATOR (',') characters. There
* should be no exceptions thrown when trying to parse these types of option entries.
- *
+ *
* This test makes sure that the expected raw values, as appears in the Job, are equal to what's expected.
*/
@Test
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
index a0cb4e3..0be7b0a 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
@@ -48,7 +48,7 @@ import org.apache.hadoop.util.ToolRunner;
import org.junit.Test;
/**
- *
+ *
*/
public class AccumuloOutputFormatTest {
private static AssertionError e1 = null;
@@ -56,12 +56,12 @@ public class AccumuloOutputFormatTest {
private static final String INSTANCE_NAME = PREFIX + "_mapreduce_instance";
private static final String TEST_TABLE_1 = PREFIX + "_mapreduce_table_1";
private static final String TEST_TABLE_2 = PREFIX + "_mapreduce_table_2";
-
+
private static class MRTester extends Configured implements Tool {
private static class TestMapper extends Mapper<Key,Value,Text,Mutation> {
Key key = null;
int count = 0;
-
+
@Override
protected void map(Key k, Value v, Context context) throws IOException, InterruptedException {
try {
@@ -75,7 +75,7 @@ public class AccumuloOutputFormatTest {
key = new Key(k);
count++;
}
-
+
@Override
protected void cleanup(Context context) throws IOException, InterruptedException {
Mutation m = new Mutation("total");
@@ -83,14 +83,14 @@ public class AccumuloOutputFormatTest {
context.write(new Text(), m);
}
}
-
+
@Override
public int run(String[] args) throws Exception {
-
+
if (args.length != 4) {
throw new IllegalArgumentException("Usage : " + MRTester.class.getName() + " <user> <pass> <inputtable> <outputtable>");
}
-
+
String user = args[0];
String pass = args[1];
String table1 = args[2];
@@ -99,78 +99,78 @@ public class AccumuloOutputFormatTest {
@SuppressWarnings("deprecation")
Job job = new Job(getConf(), this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
job.setJarByClass(this.getClass());
-
+
job.setInputFormatClass(AccumuloInputFormat.class);
-
+
AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloInputFormat.setInputTableName(job, table1);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
-
+
job.setMapperClass(TestMapper.class);
job.setMapOutputKeyClass(Key.class);
job.setMapOutputValueClass(Value.class);
job.setOutputFormatClass(AccumuloOutputFormat.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Mutation.class);
-
+
AccumuloOutputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloOutputFormat.setCreateTables(job, false);
AccumuloOutputFormat.setDefaultTableName(job, table2);
AccumuloOutputFormat.setMockInstance(job, INSTANCE_NAME);
-
+
job.setNumReduceTasks(0);
-
+
job.waitForCompletion(true);
-
+
return job.isSuccessful() ? 0 : 1;
}
-
+
public static void main(String[] args) throws Exception {
assertEquals(0, ToolRunner.run(CachedConfiguration.getInstance(), new MRTester(), args));
}
}
-
+
@Test
public void testBWSettings() throws IOException {
@SuppressWarnings("deprecation")
Job job = new Job();
-
+
// make sure we aren't testing defaults
final BatchWriterConfig bwDefaults = new BatchWriterConfig();
assertNotEquals(7654321l, bwDefaults.getMaxLatency(TimeUnit.MILLISECONDS));
assertNotEquals(9898989l, bwDefaults.getTimeout(TimeUnit.MILLISECONDS));
assertNotEquals(42, bwDefaults.getMaxWriteThreads());
assertNotEquals(1123581321l, bwDefaults.getMaxMemory());
-
+
final BatchWriterConfig bwConfig = new BatchWriterConfig();
bwConfig.setMaxLatency(7654321l, TimeUnit.MILLISECONDS);
bwConfig.setTimeout(9898989l, TimeUnit.MILLISECONDS);
bwConfig.setMaxWriteThreads(42);
bwConfig.setMaxMemory(1123581321l);
AccumuloOutputFormat.setBatchWriterOptions(job, bwConfig);
-
+
AccumuloOutputFormat myAOF = new AccumuloOutputFormat() {
@Override
public void checkOutputSpecs(JobContext job) throws IOException {
BatchWriterConfig bwOpts = getBatchWriterOptions(job);
-
+
// passive check
assertEquals(bwConfig.getMaxLatency(TimeUnit.MILLISECONDS), bwOpts.getMaxLatency(TimeUnit.MILLISECONDS));
assertEquals(bwConfig.getTimeout(TimeUnit.MILLISECONDS), bwOpts.getTimeout(TimeUnit.MILLISECONDS));
assertEquals(bwConfig.getMaxWriteThreads(), bwOpts.getMaxWriteThreads());
assertEquals(bwConfig.getMaxMemory(), bwOpts.getMaxMemory());
-
+
// explicit check
assertEquals(7654321l, bwOpts.getMaxLatency(TimeUnit.MILLISECONDS));
assertEquals(9898989l, bwOpts.getTimeout(TimeUnit.MILLISECONDS));
assertEquals(42, bwOpts.getMaxWriteThreads());
assertEquals(1123581321l, bwOpts.getMaxMemory());
-
+
}
};
myAOF.checkOutputSpecs(job);
}
-
+
@Test
public void testMR() throws Exception {
MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
@@ -184,10 +184,10 @@ public class AccumuloOutputFormatTest {
bw.addMutation(m);
}
bw.close();
-
+
MRTester.main(new String[] {"root", "", TEST_TABLE_1, TEST_TABLE_2});
assertNull(e1);
-
+
Scanner scanner = c.createScanner(TEST_TABLE_2, new Authorizations());
Iterator<Entry<Key,Value>> iter = scanner.iterator();
assertTrue(iter.hasNext());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java
index 2207437..e8920eb 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java
@@ -52,7 +52,7 @@ public class AccumuloRowInputFormatTest {
private static final String PREFIX = AccumuloRowInputFormatTest.class.getSimpleName();
private static final String INSTANCE_NAME = PREFIX + "_mapreduce_instance";
private static final String TEST_TABLE_1 = PREFIX + "_mapreduce_table_1";
-
+
private static final String ROW1 = "row1";
private static final String ROW2 = "row2";
private static final String ROW3 = "row3";
@@ -62,7 +62,7 @@ public class AccumuloRowInputFormatTest {
private static List<Entry<Key,Value>> row3;
private static AssertionError e1 = null;
private static AssertionError e2 = null;
-
+
public AccumuloRowInputFormatTest() {
row1 = new ArrayList<Entry<Key,Value>>();
row1.add(new KeyValue(new Key(ROW1, COLF1, "colq1"), "v1".getBytes()));
@@ -73,7 +73,7 @@ public class AccumuloRowInputFormatTest {
row3 = new ArrayList<Entry<Key,Value>>();
row3.add(new KeyValue(new Key(ROW3, COLF1, "colq5"), "v5".getBytes()));
}
-
+
public static void checkLists(final List<Entry<Key,Value>> first, final List<Entry<Key,Value>> second) {
assertEquals("Sizes should be the same.", first.size(), second.size());
for (int i = 0; i < first.size(); i++) {
@@ -81,7 +81,7 @@ public class AccumuloRowInputFormatTest {
assertEquals("Values should be equal.", first.get(i).getValue(), second.get(i).getValue());
}
}
-
+
public static void checkLists(final List<Entry<Key,Value>> first, final Iterator<Entry<Key,Value>> second) {
int entryIndex = 0;
while (second.hasNext()) {
@@ -91,7 +91,7 @@ public class AccumuloRowInputFormatTest {
entryIndex++;
}
}
-
+
public static void insertList(final BatchWriter writer, final List<Entry<Key,Value>> list) throws MutationsRejectedException {
for (Entry<Key,Value> e : list) {
final Key key = e.getKey();
@@ -101,11 +101,11 @@ public class AccumuloRowInputFormatTest {
writer.addMutation(mutation);
}
}
-
+
private static class MRTester extends Configured implements Tool {
private static class TestMapper extends Mapper<Text,PeekingIterator<Entry<Key,Value>>,Key,Value> {
int count = 0;
-
+
@Override
protected void map(Text k, PeekingIterator<Entry<Key,Value>> v, Context context) throws IOException, InterruptedException {
try {
@@ -130,7 +130,7 @@ public class AccumuloRowInputFormatTest {
}
count++;
}
-
+
@Override
protected void cleanup(Context context) throws IOException, InterruptedException {
try {
@@ -140,14 +140,14 @@ public class AccumuloRowInputFormatTest {
}
}
}
-
+
@Override
public int run(String[] args) throws Exception {
-
+
if (args.length != 3) {
throw new IllegalArgumentException("Usage : " + MRTester.class.getName() + " <user> <pass> <table>");
}
-
+
String user = args[0];
String pass = args[1];
String table = args[2];
@@ -155,30 +155,30 @@ public class AccumuloRowInputFormatTest {
@SuppressWarnings("deprecation")
Job job = new Job(getConf(), this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
job.setJarByClass(this.getClass());
-
+
job.setInputFormatClass(AccumuloRowInputFormat.class);
-
+
AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloRowInputFormat.setMockInstance(job, INSTANCE_NAME);
-
+
job.setMapperClass(TestMapper.class);
job.setMapOutputKeyClass(Key.class);
job.setMapOutputValueClass(Value.class);
job.setOutputFormatClass(NullOutputFormat.class);
-
+
job.setNumReduceTasks(0);
-
+
job.waitForCompletion(true);
-
+
return job.isSuccessful() ? 0 : 1;
}
-
+
public static void main(String[] args) throws Exception {
assertEquals(0, ToolRunner.run(CachedConfiguration.getInstance(), new MRTester(), args));
}
}
-
+
@Test
public void test() throws Exception {
final MockInstance instance = new MockInstance(INSTANCE_NAME);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapreduce/BadPasswordSplitsAccumuloInputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/BadPasswordSplitsAccumuloInputFormat.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/BadPasswordSplitsAccumuloInputFormat.java
index fce7781..9028d94 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/BadPasswordSplitsAccumuloInputFormat.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/BadPasswordSplitsAccumuloInputFormat.java
@@ -27,16 +27,16 @@ import org.apache.hadoop.mapreduce.JobContext;
* AccumuloInputFormat which returns an "empty" RangeInputSplit
*/
public class BadPasswordSplitsAccumuloInputFormat extends AccumuloInputFormat {
-
+
@Override
public List<InputSplit> getSplits(JobContext context) throws IOException {
List<InputSplit> splits = super.getSplits(context);
-
+
for (InputSplit split : splits) {
org.apache.accumulo.core.client.mapreduce.RangeInputSplit rangeSplit = (org.apache.accumulo.core.client.mapreduce.RangeInputSplit) split;
rangeSplit.setToken(new PasswordToken("anythingelse"));
}
-
+
return splits;
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java
index 4855094..4953654 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/InputTableConfigTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.accumulo.core.client.mapreduce;
+import static org.junit.Assert.assertEquals;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
@@ -33,22 +35,20 @@ import org.apache.hadoop.io.Text;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-
public class InputTableConfigTest {
-
+
private InputTableConfig tableQueryConfig;
-
+
@Before
public void setUp() {
tableQueryConfig = new InputTableConfig();
}
-
+
@Test
public void testSerialization_OnlyTable() throws IOException {
byte[] serialized = serialize(tableQueryConfig);
InputTableConfig actualConfig = deserialize(serialized);
-
+
assertEquals(tableQueryConfig, actualConfig);
}
@@ -64,33 +64,32 @@ public class InputTableConfigTest {
assertEquals(tableQueryConfig, actualConfig);
}
-
@Test
public void testSerialization_ranges() throws IOException {
List<Range> ranges = new ArrayList<Range>();
ranges.add(new Range("a", "b"));
ranges.add(new Range("c", "d"));
tableQueryConfig.setRanges(ranges);
-
+
byte[] serialized = serialize(tableQueryConfig);
InputTableConfig actualConfig = deserialize(serialized);
-
+
assertEquals(ranges, actualConfig.getRanges());
}
-
+
@Test
public void testSerialization_columns() throws IOException {
Set<Pair<Text,Text>> columns = new HashSet<Pair<Text,Text>>();
columns.add(new Pair<Text,Text>(new Text("cf1"), new Text("cq1")));
columns.add(new Pair<Text,Text>(new Text("cf2"), null));
tableQueryConfig.fetchColumns(columns);
-
+
byte[] serialized = serialize(tableQueryConfig);
InputTableConfig actualConfig = deserialize(serialized);
-
+
assertEquals(actualConfig.getFetchedColumns(), columns);
}
-
+
@Test
public void testSerialization_iterators() throws IOException {
List<IteratorSetting> settings = new ArrayList<IteratorSetting>();
@@ -100,16 +99,16 @@ public class InputTableConfigTest {
byte[] serialized = serialize(tableQueryConfig);
InputTableConfig actualConfig = deserialize(serialized);
assertEquals(actualConfig.getIterators(), settings);
-
+
}
-
+
private byte[] serialize(InputTableConfig tableQueryConfig) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
tableQueryConfig.write(new DataOutputStream(baos));
baos.close();
return baos.toByteArray();
}
-
+
private InputTableConfig deserialize(byte[] bytes) throws IOException {
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
InputTableConfig actualConfig = new InputTableConfig(new DataInputStream(bais));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java
index fd207a1..8359b89 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java
@@ -51,7 +51,7 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
/**
- *
+ *
*/
public class TokenFileTest {
private static AssertionError e1 = null;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java
index 7c1f98b..bcbc236 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java
@@ -37,7 +37,7 @@ import org.apache.log4j.Logger;
import org.junit.Test;
/**
- *
+ *
*/
public class ConfiguratorBaseTest {
@@ -128,10 +128,10 @@ public class ConfiguratorBaseTest {
}
@Test
- public void testSetVisibiltyCacheSize(){
- Configuration conf = new Configuration();
- assertEquals(Constants.DEFAULT_VISIBILITY_CACHE_SIZE,ConfiguratorBase.getVisibilityCacheSize(conf));
- ConfiguratorBase.setVisibilityCacheSize(conf, 2000);
- assertEquals(2000,ConfiguratorBase.getVisibilityCacheSize(conf));
+ public void testSetVisibiltyCacheSize() {
+ Configuration conf = new Configuration();
+ assertEquals(Constants.DEFAULT_VISIBILITY_CACHE_SIZE, ConfiguratorBase.getVisibilityCacheSize(conf));
+ ConfiguratorBase.setVisibilityCacheSize(conf, 2000);
+ assertEquals(2000, ConfiguratorBase.getVisibilityCacheSize(conf));
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java
index 8fca169..13a09d6 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitionerTest.java
@@ -25,9 +25,9 @@ import org.apache.hadoop.mapreduce.Job;
import org.junit.Test;
public class RangePartitionerTest {
-
+
private static Text[] cutArray = new Text[] {new Text("A"), new Text("B"), new Text("C")};
-
+
@Test
public void testNoSubBins() throws IOException {
for (int i = -2; i < 2; ++i) {
@@ -36,22 +36,22 @@ public class RangePartitionerTest {
checkExpectedBins(i, new String[] {"", "AA", "BB", "CC"}, new int[] {0, 1, 2, 3});
}
}
-
+
@Test
public void testSubBins() throws IOException {
checkExpectedRangeBins(2, new String[] {"A", "B", "C"}, new int[] {1, 3, 5});
checkExpectedRangeBins(2, new String[] {"C", "A", "B"}, new int[] {5, 1, 3});
checkExpectedRangeBins(2, new String[] {"", "AA", "BB", "CC"}, new int[] {1, 3, 5, 7});
-
+
checkExpectedRangeBins(3, new String[] {"A", "B", "C"}, new int[] {2, 5, 8});
checkExpectedRangeBins(3, new String[] {"C", "A", "B"}, new int[] {8, 2, 5});
checkExpectedRangeBins(3, new String[] {"", "AA", "BB", "CC"}, new int[] {2, 5, 8, 11});
-
+
checkExpectedRangeBins(10, new String[] {"A", "B", "C"}, new int[] {9, 19, 29});
checkExpectedRangeBins(10, new String[] {"C", "A", "B"}, new int[] {29, 9, 19});
checkExpectedRangeBins(10, new String[] {"", "AA", "BB", "CC"}, new int[] {9, 19, 29, 39});
}
-
+
private RangePartitioner prepPartitioner(int numSubBins) throws IOException {
@SuppressWarnings("deprecation")
Job job = new Job();
@@ -60,7 +60,7 @@ public class RangePartitionerTest {
rp.setConf(job.getConfiguration());
return rp;
}
-
+
private void checkExpectedRangeBins(int numSubBins, String[] strings, int[] rangeEnds) throws IOException {
assertTrue(strings.length == rangeEnds.length);
for (int i = 0; i < strings.length; ++i) {
@@ -71,7 +71,7 @@ public class RangePartitionerTest {
assertTrue(part <= endRange);
}
}
-
+
private void checkExpectedBins(int numSubBins, String[] strings, int[] bins) throws IOException {
assertTrue(strings.length == bins.length);
for (int i = 0; i < strings.length; ++i) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java b/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
index 7ccae0a..4b90d72 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
@@ -53,11 +53,11 @@ import org.junit.Test;
public class MockConnectorTest {
Random random = new Random();
-
+
static Text asText(int i) {
return new Text(Integer.toHexString(i));
}
-
+
@Test
public void testSunnyDay() throws Exception {
Connector c = new MockConnector("root", new MockInstance());
@@ -83,7 +83,7 @@ public class MockConnectorTest {
}
assertEquals(100, count);
}
-
+
@Test
public void testChangeAuths() throws Exception {
Connector c = new MockConnector("root", new MockInstance());
@@ -95,14 +95,14 @@ public class MockConnectorTest {
assertTrue(c.securityOperations().getUserAuthorizations("greg").contains("X".getBytes()));
assertFalse(c.securityOperations().getUserAuthorizations("greg").contains("A".getBytes()));
}
-
+
@Test
public void testBadMutations() throws Exception {
Connector c = new MockConnector("root", new MockInstance());
c.tableOperations().create("test");
BatchWriter bw = c
.createBatchWriter("test", new BatchWriterConfig().setMaxMemory(10000L).setMaxLatency(1000L, TimeUnit.MILLISECONDS).setMaxWriteThreads(4));
-
+
try {
bw.addMutation(null);
Assert.fail("addMutation should throw IAE for null mutation");
@@ -111,15 +111,15 @@ public class MockConnectorTest {
bw.addMutations(null);
Assert.fail("addMutations should throw IAE for null iterable");
} catch (IllegalArgumentException iae) {}
-
+
bw.addMutations(Collections.<Mutation> emptyList());
-
+
Mutation bad = new Mutation("bad");
try {
bw.addMutation(bad);
Assert.fail("addMutation should throw IAE for empty mutation");
} catch (IllegalArgumentException iae) {}
-
+
Mutation good = new Mutation("good");
good.put(asText(random.nextInt()), asText(random.nextInt()), new Value("good".getBytes()));
List<Mutation> mutations = new ArrayList<Mutation>();
@@ -129,10 +129,10 @@ public class MockConnectorTest {
bw.addMutations(mutations);
Assert.fail("addMutations should throw IAE if it contains empty mutation");
} catch (IllegalArgumentException iae) {}
-
+
bw.close();
}
-
+
@Test
public void testAggregation() throws Exception {
MockInstance mockInstance = new MockInstance();
@@ -152,7 +152,7 @@ public class MockConnectorTest {
bw.addMutation(m);
}
bw.close();
-
+
Scanner s = c.createScanner("perDayCounts", Authorizations.EMPTY);
Iterator<Entry<Key,Value>> iterator = s.iterator();
assertTrue(iterator.hasNext());
@@ -163,75 +163,75 @@ public class MockConnectorTest {
checkEntry(iterator.next(), "foo", "day", "20080103", "1");
assertFalse(iterator.hasNext());
}
-
+
@Test
public void testDelete() throws Exception {
Connector c = new MockConnector("root", new MockInstance());
c.tableOperations().create("test");
BatchWriter bw = c.createBatchWriter("test", new BatchWriterConfig());
-
+
Mutation m1 = new Mutation("r1");
-
+
m1.put("cf1", "cq1", 1, "v1");
-
+
bw.addMutation(m1);
bw.flush();
-
+
Mutation m2 = new Mutation("r1");
-
+
m2.putDelete("cf1", "cq1", 2);
-
+
bw.addMutation(m2);
bw.flush();
-
+
Scanner scanner = c.createScanner("test", Authorizations.EMPTY);
-
+
int count = 0;
for (@SuppressWarnings("unused")
Entry<Key,Value> entry : scanner) {
count++;
}
-
+
assertEquals(0, count);
-
+
try {
c.tableOperations().create("test_this_$tableName");
assertTrue(false);
-
+
} catch (IllegalArgumentException iae) {
-
+
}
}
-
+
@Test
public void testDeletewithBatchDeleter() throws Exception {
Connector c = new MockConnector("root", new MockInstance());
-
+
// make sure we are using a clean table
if (c.tableOperations().exists("test"))
c.tableOperations().delete("test");
c.tableOperations().create("test");
-
+
BatchDeleter deleter = c.createBatchDeleter("test", Authorizations.EMPTY, 2, new BatchWriterConfig());
// first make sure it deletes fine when its empty
deleter.setRanges(Collections.singletonList(new Range(("r1"))));
deleter.delete();
this.checkRemaining(c, "test", 0);
-
+
// test deleting just one row
BatchWriter writer = c.createBatchWriter("test", new BatchWriterConfig());
Mutation m = new Mutation("r1");
m.put("fam", "qual", "value");
writer.addMutation(m);
-
+
// make sure the write goes through
writer.flush();
writer.close();
-
+
deleter.setRanges(Collections.singletonList(new Range(("r1"))));
deleter.delete();
this.checkRemaining(c, "test", 0);
-
+
// test multi row deletes
writer = c.createBatchWriter("test", new BatchWriterConfig());
m = new Mutation("r1");
@@ -240,19 +240,19 @@ public class MockConnectorTest {
Mutation m2 = new Mutation("r2");
m2.put("fam", "qual", "value");
writer.addMutation(m2);
-
+
// make sure the write goes through
writer.flush();
writer.close();
-
+
deleter.setRanges(Collections.singletonList(new Range(("r1"))));
deleter.delete();
checkRemaining(c, "test", 1);
}
-
+
/**
* Test to make sure that a certain number of rows remain
- *
+ *
* @param c
* connector to the {@link MockInstance}
* @param tableName
@@ -262,7 +262,7 @@ public class MockConnectorTest {
*/
private void checkRemaining(Connector c, String tableName, int count) throws Exception {
Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
-
+
int total = 0;
for (@SuppressWarnings("unused")
Entry<Key,Value> entry : scanner) {
@@ -270,24 +270,24 @@ public class MockConnectorTest {
}
assertEquals(count, total);
}
-
+
@Test
public void testCMod() throws Exception {
// test writing to a table that the is being scanned
Connector c = new MockConnector("root", new MockInstance());
c.tableOperations().create("test");
BatchWriter bw = c.createBatchWriter("test", new BatchWriterConfig());
-
+
for (int i = 0; i < 10; i++) {
Mutation m1 = new Mutation("r" + i);
m1.put("cf1", "cq1", 1, "v" + i);
bw.addMutation(m1);
}
-
+
bw.flush();
-
+
int count = 10;
-
+
Scanner scanner = c.createScanner("test", Authorizations.EMPTY);
for (Entry<Key,Value> entry : scanner) {
Key key = entry.getKey();
@@ -296,33 +296,33 @@ public class MockConnectorTest {
count++;
bw.addMutation(m);
}
-
+
bw.flush();
-
+
count = 10;
-
+
for (Entry<Key,Value> entry : scanner) {
assertEquals(entry.getValue().toString(), "v" + (count++));
}
-
+
assertEquals(count, 20);
-
+
try {
c.tableOperations().create("test_this_$tableName");
assertTrue(false);
-
+
} catch (IllegalArgumentException iae) {
-
+
}
}
-
+
private void checkEntry(Entry<Key,Value> next, String row, String cf, String cq, String value) {
assertEquals(row, next.getKey().getRow().toString());
assertEquals(cf, next.getKey().getColumnFamily().toString());
assertEquals(cq, next.getKey().getColumnQualifier().toString());
assertEquals(value, next.getValue().toString());
}
-
+
@Test
public void testMockMultiTableBatchWriter() throws Exception {
Connector c = new MockConnector("root", new MockInstance());
@@ -337,7 +337,7 @@ public class MockConnectorTest {
b = bw.getBatchWriter("b");
b.addMutation(m1);
b.flush();
-
+
Scanner scanner = c.createScanner("a", Authorizations.EMPTY);
int count = 0;
for (@SuppressWarnings("unused")
@@ -352,31 +352,31 @@ public class MockConnectorTest {
count++;
}
assertEquals(1, count);
-
+
}
-
+
@Test
public void testUpdate() throws Exception {
Connector c = new MockConnector("root", new MockInstance());
c.tableOperations().create("test");
BatchWriter bw = c.createBatchWriter("test", new BatchWriterConfig());
-
+
for (int i = 0; i < 10; i++) {
Mutation m = new Mutation("r1");
m.put("cf1", "cq1", "" + i);
bw.addMutation(m);
}
-
+
bw.close();
-
+
Scanner scanner = c.createScanner("test", Authorizations.EMPTY);
-
+
Entry<Key,Value> entry = scanner.iterator().next();
-
+
assertEquals("9", entry.getValue().toString());
-
+
}
-
+
@Test
public void testMockConnectorReturnsCorrectInstance() throws AccumuloException, AccumuloSecurityException {
String name = "an-interesting-instance-name";
@@ -384,5 +384,5 @@ public class MockConnectorTest {
assertEquals(mockInstance, mockInstance.getConnector("foo", new PasswordToken("bar")).getInstance());
assertEquals(name, mockInstance.getConnector("foo", new PasswordToken("bar")).getInstance().getInstanceName());
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java b/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java
index b45054a..77b989f 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java
@@ -115,9 +115,9 @@ public class MockNamespacesTest {
/**
* This test creates a namespace, modifies it's properties, and checks to make sure that those properties are applied to its tables. To do something on a
* namespace-wide level, use {@link NamespaceOperations}.
- *
+ *
* Checks to make sure namespace-level properties are overridden by table-level properties.
- *
+ *
* Checks to see if the default namespace's properties work as well.
*/
@@ -212,7 +212,7 @@ public class MockNamespacesTest {
// TODO implement clone in mock
/*
* c.tableOperations().clone(tableName1, tableName2, false, null, null);
- *
+ *
* assertTrue(c.tableOperations().exists(tableName1)); assertTrue(c.tableOperations().exists(tableName2));
*/
return;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java b/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
index c15fded..193973a 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
@@ -334,7 +334,6 @@ public class MockTableOperationsTest {
}
-
@Test
public void testTableIdMap() throws Exception {
Instance inst = new MockInstance("testTableIdMap");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java b/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java
index 368bc29..b03bda9 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java
@@ -35,7 +35,7 @@ import org.apache.accumulo.core.security.Authorizations;
import org.junit.Test;
public class TestBatchScanner821 {
-
+
@Test
public void test() throws Exception {
MockInstance inst = new MockInstance();
@@ -61,5 +61,5 @@ public class TestBatchScanner821 {
}
assertEquals("a,b,c,d", sb.toString());
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/mock/TransformIterator.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/TransformIterator.java b/core/src/test/java/org/apache/accumulo/core/client/mock/TransformIterator.java
index bac9a17..a7e7eef 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/TransformIterator.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/TransformIterator.java
@@ -28,5 +28,3 @@ public class TransformIterator extends WrappingIterator {
return new Key(new Text(k.getRow().toString().toLowerCase()), k.getColumnFamily(), k.getColumnQualifier(), k.getColumnVisibility(), k.getTimestamp());
}
}
-
-
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java b/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java
index 7554a49..75d4c35 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/security/SecurityErrorCodeTest.java
@@ -22,21 +22,21 @@ import org.junit.Assert;
import org.junit.Test;
/**
- *
+ *
*/
public class SecurityErrorCodeTest {
-
+
@Test
public void testEnumsSame() {
HashSet<String> secNames1 = new HashSet<String>();
HashSet<String> secNames2 = new HashSet<String>();
-
+
for (SecurityErrorCode sec : SecurityErrorCode.values())
secNames1.add(sec.name());
-
+
for (org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode sec : org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.values())
secNames2.add(sec.name());
-
+
Assert.assertEquals(secNames1, secNames2);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java
index bbed50c..d6c7025 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderTokenTest.java
@@ -21,6 +21,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.File;
import java.io.IOException;
import java.net.URL;
+
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.Properties;
import org.apache.accumulo.core.conf.CredentialProviderFactoryShim;
import org.junit.Assert;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/client/security/tokens/PasswordTokenTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/PasswordTokenTest.java b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/PasswordTokenTest.java
index 3751f02..2d8a603 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/PasswordTokenTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/PasswordTokenTest.java
@@ -24,10 +24,10 @@ import org.junit.Assert;
import org.junit.Test;
/**
- *
+ *
*/
public class PasswordTokenTest {
-
+
@Test
public void testMultiByte() throws DestroyFailedException {
PasswordToken pt = new PasswordToken();
@@ -37,7 +37,7 @@ public class PasswordTokenTest {
props.destroy();
String s = new String(pt.getPassword(), UTF_8);
Assert.assertEquals("五六", s);
-
+
pt = new PasswordToken("五六");
s = new String(pt.getPassword(), UTF_8);
Assert.assertEquals("五六", s);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
index a115215..c8d17f5 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
@@ -33,16 +33,16 @@ public class AccumuloConfigurationTest {
assertEquals(42l * 1024l * 1024l, AccumuloConfiguration.getMemoryInBytes("42m"));
assertEquals(42l * 1024l * 1024l * 1024l, AccumuloConfiguration.getMemoryInBytes("42G"));
assertEquals(42l * 1024l * 1024l * 1024l, AccumuloConfiguration.getMemoryInBytes("42g"));
-
+
}
-
- @Test(expected = IllegalArgumentException.class)
+
+ @Test(expected = IllegalArgumentException.class)
public void testGetMemoryInBytesFailureCases1() throws Exception {
AccumuloConfiguration.getMemoryInBytes("42x");
}
-
- @Test(expected = IllegalArgumentException.class)
+
+ @Test(expected = IllegalArgumentException.class)
public void testGetMemoryInBytesFailureCases2() throws Exception {
AccumuloConfiguration.getMemoryInBytes("FooBar");
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/conf/ConfigSanityCheckTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/ConfigSanityCheckTest.java b/core/src/test/java/org/apache/accumulo/core/conf/ConfigSanityCheckTest.java
index 88bbe64..f34bf3b 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/ConfigSanityCheckTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/ConfigSanityCheckTest.java
@@ -17,6 +17,7 @@
package org.apache.accumulo.core.conf;
import java.util.Map;
+
import org.apache.accumulo.core.conf.ConfigSanityCheck.SanityCheckException;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java
index beb63a7..3823dda 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java
@@ -16,11 +16,13 @@
*/
package org.apache.accumulo.core.conf;
-import org.apache.accumulo.core.conf.AccumuloConfiguration.AllFilter;
+import static org.junit.Assert.assertEquals;
+
import java.util.Map;
+
+import org.apache.accumulo.core.conf.AccumuloConfiguration.AllFilter;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
public class DefaultConfigurationTest {
private DefaultConfiguration c;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/conf/ObservableConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/ObservableConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/conf/ObservableConfigurationTest.java
index 3534b6c..b92fac6 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/ObservableConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/ObservableConfigurationTest.java
@@ -16,15 +16,17 @@
*/
package org.apache.accumulo.core.conf;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.util.Collection;
import java.util.Map;
+
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
public class ObservableConfigurationTest {
private static class TestObservableConfig extends ObservableConfiguration {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java
index e1accb5..b70806d 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java
@@ -16,8 +16,11 @@
*/
package org.apache.accumulo.core.conf;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
-import static org.junit.Assert.*;
public class PropertyTypeTest {
@Test
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java
index 1783a28..f54adb1 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/SiteConfigurationTest.java
@@ -31,7 +31,6 @@ import org.junit.Test;
public class SiteConfigurationTest {
private static boolean isCredentialProviderAvailable;
-
@BeforeClass
public static void checkCredentialProviderAvailable() {
try {
@@ -52,25 +51,25 @@ public class SiteConfigurationTest {
.withConstructor(AccumuloConfiguration.class).withArgs(DefaultConfiguration.getInstance()).createMock();
siteCfg.set(Property.INSTANCE_SECRET, "ignored");
-
+
// site-cfg.jceks={'ignored.property'=>'ignored', 'instance.secret'=>'mysecret', 'general.rpc.timeout'=>'timeout'}
URL keystore = SiteConfigurationTest.class.getResource("/site-cfg.jceks");
Assert.assertNotNull(keystore);
String keystorePath = new File(keystore.getFile()).getAbsolutePath();
-
+
Configuration hadoopConf = new Configuration();
hadoopConf.set(CredentialProviderFactoryShim.CREDENTIAL_PROVIDER_PATH, "jceks://file" + keystorePath);
-
+
EasyMock.expect(siteCfg.getHadoopConfiguration()).andReturn(hadoopConf).once();
EasyMock.replay(siteCfg);
-
+
Map<String,String> props = new HashMap<String,String>();
siteCfg.getProperties(props, new AllFilter());
-
+
Assert.assertEquals("mysecret", props.get(Property.INSTANCE_SECRET.getKey()));
Assert.assertEquals(null, props.get("ignored.property"));
Assert.assertEquals(Property.GENERAL_RPC_TIMEOUT.getDefaultValue(), props.get(Property.GENERAL_RPC_TIMEOUT.getKey()));
}
-
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java b/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
index 915188f..dce0ae1 100644
--- a/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/constraints/DefaultKeySizeConstraintTest.java
@@ -26,33 +26,33 @@ import org.apache.hadoop.io.Text;
import org.junit.Test;
public class DefaultKeySizeConstraintTest {
-
+
Constraint constraint = new DefaultKeySizeConstraint();
-
+
byte[] oversized = new byte[1048577];
byte[] large = new byte[419430];
-
+
@Test
public void testConstraint() {
// pass constraints
Mutation m = new Mutation("rowId");
- m.put("colf", "colq", new Value(new byte[]{}));
+ m.put("colf", "colq", new Value(new byte[] {}));
assertEquals(Collections.emptyList(), constraint.check(null, m));
// test with row id > 1mb
m = new Mutation(oversized);
- m.put("colf", "colq", new Value(new byte[]{}));
+ m.put("colf", "colq", new Value(new byte[] {}));
assertEquals(Collections.singletonList(DefaultKeySizeConstraint.MAX__KEY_SIZE_EXCEEDED_VIOLATION), constraint.check(null, m));
// test with colf > 1mb
m = new Mutation("rowid");
- m.put(new Text(oversized), new Text("colq"), new Value(new byte[]{}));
+ m.put(new Text(oversized), new Text("colq"), new Value(new byte[] {}));
assertEquals(Collections.singletonList(DefaultKeySizeConstraint.MAX__KEY_SIZE_EXCEEDED_VIOLATION), constraint.check(null, m));
// test with colf > 1mb
m = new Mutation("rowid");
- m.put(new Text(oversized), new Text("colq"), new Value(new byte[]{}));
+ m.put(new Text(oversized), new Text("colq"), new Value(new byte[] {}));
assertEquals(Collections.singletonList(DefaultKeySizeConstraint.MAX__KEY_SIZE_EXCEEDED_VIOLATION), constraint.check(null, m));
// test sum of smaller sizes violates 1mb constraint
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/core/src/test/java/org/apache/accumulo/core/data/ColumnTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/data/ColumnTest.java b/core/src/test/java/org/apache/accumulo/core/data/ColumnTest.java
index 9071248..aceddb4 100644
--- a/core/src/test/java/org/apache/accumulo/core/data/ColumnTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/data/ColumnTest.java
@@ -44,7 +44,6 @@ public class ColumnTest {
col[4] = new Column("colfam".getBytes(), "cq".getBytes(), "cv".getBytes());
}
-
@Test
public void testEquals() {
for (int i = 0; i < col.length; i++) {
@@ -56,7 +55,7 @@ public class ColumnTest {
}
}
}
-
+
@Test
public void testCompare() {
for (int i = 0; i < col.length; i++) {
@@ -75,7 +74,7 @@ public class ColumnTest {
for (int j = 0; j < col.length; j++)
assertEquals(col[i].equals(col[j]), col[i].compareTo(col[j]) == 0);
}
-
+
@Test
public void testWriteReadFields() throws IOException {
for (Column c : col) {