use of org.apache.accumulo.core.client.admin.NewTableConfiguration in project accumulo by apache.
the class NewTableConfigurationIT method testSetLocalityGroupsDisjointCheck.
/**
* Verify checkDisjoint works with locality groups.
*/
@Test(expected = IllegalArgumentException.class)
public void testSetLocalityGroupsDisjointCheck() {
NewTableConfiguration ntc = new NewTableConfiguration();
Map<String, String> props = new HashMap<>();
props.put("table.group.lg1", "cat");
ntc.setProperties(props);
Map<String, Set<Text>> lgroups = new HashMap<>();
lgroups.put("lg1", ImmutableSet.of(new Text("dog")));
ntc.setLocalityGroups(lgroups);
}
use of org.apache.accumulo.core.client.admin.NewTableConfiguration in project accumulo by apache.
the class NewTableConfigurationIT method testIteratorConflictFound2.
@Test(expected = IllegalArgumentException.class)
public void testIteratorConflictFound2() throws AccumuloException, TableNotFoundException, AccumuloSecurityException, TableExistsException {
Connector conn = getConnector();
String tableName = getUniqueNames(2)[0];
NewTableConfiguration ntc = new NewTableConfiguration();
IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
setting = new IteratorSetting(10, "anotherName", "foo2.bar");
ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
conn.tableOperations().create(tableName, ntc);
}
use of org.apache.accumulo.core.client.admin.NewTableConfiguration in project accumulo by apache.
the class NewTableConfigurationIT method testMulitpleCallsToSetLocalityGroups.
/**
* Verify that setting locality groups more than once overwrite initial locality settings.
*/
@Test
public void testMulitpleCallsToSetLocalityGroups() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException {
Connector conn = getConnector();
String tableName = getUniqueNames(2)[0];
NewTableConfiguration ntc = new NewTableConfiguration();
// set first locality groups map
Map<String, Set<Text>> initalGroup = new HashMap<>();
initalGroup.put("lg1", ImmutableSet.of(new Text("dog"), new Text("cat")));
ntc.setLocalityGroups(initalGroup);
// set a second locality groups map and set in method call
Map<String, Set<Text>> secondGroup = new HashMap<>();
secondGroup.put("lg1", ImmutableSet.of(new Text("blue"), new Text("red")));
ntc.setLocalityGroups(secondGroup);
conn.tableOperations().create(tableName, ntc);
// verify
Map<String, Set<Text>> createdLocalityGroups = conn.tableOperations().getLocalityGroups(tableName);
assertEquals(1, createdLocalityGroups.size());
assertEquals(createdLocalityGroups.get("lg1"), ImmutableSet.of(new Text("red"), new Text("blue")));
}
use of org.apache.accumulo.core.client.admin.NewTableConfiguration in project accumulo by apache.
the class NewTableConfigurationIT method testInvalidTablePropertiesSet.
/**
* Verify that properties set using NewTableConfiguration must be table properties.
*/
@Test(expected = IllegalArgumentException.class)
public void testInvalidTablePropertiesSet() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException {
NewTableConfiguration ntc = new NewTableConfiguration();
Map<String, String> props = new HashMap<>();
// These properties should work just with no issue
props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1", "val1");
props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2", "val2");
ntc.setProperties(props);
// These properties should result in an illegalArgumentException
props.put("invalidProp1", "value1");
props.put("invalidProp2", "value2");
ntc.setProperties(props);
}
use of org.apache.accumulo.core.client.admin.NewTableConfiguration in project accumulo by apache.
the class NewTableConfigurationIT method testSetGroupsWithoutDefaultIterators.
/**
* Create table with initial locality groups but no default iterators
*/
@Test
public void testSetGroupsWithoutDefaultIterators() throws AccumuloSecurityException, AccumuloException, TableExistsException, TableNotFoundException {
Connector conn = getConnector();
String tableName = getUniqueNames(2)[0];
NewTableConfiguration ntc = new NewTableConfiguration().withoutDefaultIterators();
Map<String, Set<Text>> lgroups = new HashMap<>();
lgroups.put("lg1", ImmutableSet.of(new Text("colF")));
ntc.setLocalityGroups(lgroups);
conn.tableOperations().create(tableName, ntc);
// verify groups and verify no iterators
Map<String, Set<Text>> createdLocalityGroups = conn.tableOperations().getLocalityGroups(tableName);
assertEquals(1, createdLocalityGroups.size());
assertEquals(createdLocalityGroups.get("lg1"), ImmutableSet.of(new Text("colF")));
Map<String, EnumSet<IteratorScope>> iterators = conn.tableOperations().listIterators(tableName);
assertEquals(0, iterators.size());
}
Aggregations