use of org.apache.accumulo.proxy.thrift.IteratorSetting in project accumulo by apache.
the class TestProxyNamespaceOperations method namespaceIteratorConflict.
@Test(expected = AccumuloException.class)
public void namespaceIteratorConflict() throws TException {
IteratorSetting setting = new IteratorSetting(40, "DebugTheThings", "org.apache.accumulo.core.iterators.DebugIterator", new HashMap<>());
Set<IteratorScope> scopes = new HashSet<>();
scopes.add(IteratorScope.SCAN);
tpc.proxy().attachNamespaceIterator(userpass, testnamespace, setting, scopes);
tpc.proxy().checkNamespaceIteratorConflicts(userpass, testnamespace, setting, scopes);
}
use of org.apache.accumulo.proxy.thrift.IteratorSetting in project accumulo by apache.
the class TestProxyNamespaceOperations method namespaceIterators.
@Test
public void namespaceIterators() throws TException {
IteratorSetting setting = new IteratorSetting(40, "DebugTheThings", "org.apache.accumulo.core.iterators.DebugIterator", new HashMap<>());
Set<IteratorScope> scopes = new HashSet<>();
scopes.add(IteratorScope.SCAN);
tpc.proxy().attachNamespaceIterator(userpass, testnamespace, setting, scopes);
assertEquals(setting, tpc.proxy().getNamespaceIteratorSetting(userpass, testnamespace, "DebugTheThings", IteratorScope.SCAN));
assertTrue(tpc.proxy().listNamespaceIterators(userpass, testnamespace).containsKey("DebugTheThings"));
Set<IteratorScope> scopes2 = new HashSet<>();
scopes2.add(IteratorScope.MINC);
tpc.proxy().checkNamespaceIteratorConflicts(userpass, testnamespace, setting, scopes2);
tpc.proxy().removeNamespaceIterator(userpass, testnamespace, "DebugTheThings", scopes);
assertFalse(tpc.proxy().listNamespaceIterators(userpass, testnamespace).containsKey("DebugTheThings"));
}
use of org.apache.accumulo.proxy.thrift.IteratorSetting in project accumulo by apache.
the class TestProxyReadWrite method asynchReadWrite.
@Test
public void asynchReadWrite() throws Exception {
int maxInserts = 10000;
Map<ByteBuffer, List<ColumnUpdate>> mutations = new HashMap<>();
String format = "%1$05d";
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) {
ScanResult kvList = tpc.proxy().nextK(cookie, k);
for (KeyValue kv : kvList.getResults()) {
assertEquals(i, Integer.parseInt(new String(kv.getKey().getRow())));
numRead++;
i += 2;
}
hasNext = kvList.isMore();
}
assertEquals(maxInserts / 2, numRead);
}
use of org.apache.accumulo.proxy.thrift.IteratorSetting in project accumulo by apache.
the class TestProxyReadWrite method readWriteBatchOneShotWithFilterIterator.
/**
* Insert 100000 cells which have as the row [0..99999] (padded with zeros). Filter the results so only the even numbers come back.
*/
@Test
public void readWriteBatchOneShotWithFilterIterator() throws Exception {
int maxInserts = 10000;
Map<ByteBuffer, List<ColumnUpdate>> mutations = new HashMap<>();
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();
}
}
use of org.apache.accumulo.proxy.thrift.IteratorSetting in project accumulo by apache.
the class SimpleProxyBase method attachNamespaceIteratorLoginFailure.
@Test(expected = AccumuloSecurityException.class, timeout = 5000)
public void attachNamespaceIteratorLoginFailure() throws Exception {
IteratorSetting setting = new IteratorSetting(100, "DebugTheThings", DebugIterator.class.getName(), Collections.emptyMap());
client.attachNamespaceIterator(badLogin, namespaceName, setting, EnumSet.allOf(IteratorScope.class));
}
Aggregations