Search in sources :

Example 46 with TableReference

use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.

the class SchemaTest method testIgnoreTableNameLengthFlag.

@Test
public void testIgnoreTableNameLengthFlag() throws IOException {
    Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE);
    schema.ignoreTableNameLengthChecks();
    String longTableName = String.join("", Collections.nCopies(1000, "x"));
    TableReference tableRef = TableReference.createWithEmptyNamespace(longTableName);
    schema.addTableDefinition(longTableName, getSimpleTableDefinition(tableRef));
}
Also used : TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 47 with TableReference

use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.

the class SchemaTest method testLongTableNameLengthFailsCassandra.

@Test
public void testLongTableNameLengthFailsCassandra() throws IOException {
    Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE);
    int longLengthCassandra = AtlasDbConstants.CASSANDRA_TABLE_NAME_CHAR_LIMIT + 1;
    String longTableName = String.join("", Collections.nCopies(longLengthCassandra, "x"));
    TableReference tableRef = TableReference.createWithEmptyNamespace(longTableName);
    List<CharacterLimitType> kvsList = new ArrayList<CharacterLimitType>();
    kvsList.add(CharacterLimitType.CASSANDRA);
    assertThatThrownBy(() -> schema.addTableDefinition(longTableName, getSimpleTableDefinition(tableRef))).isInstanceOf(IllegalArgumentException.class).hasMessage(getErrorMessage(longTableName, kvsList));
}
Also used : TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) ArrayList(java.util.ArrayList) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 48 with TableReference

use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.

the class SchemaTest method testLongIndexNameLengthFailsCassandra.

@Test
public void testLongIndexNameLengthFailsCassandra() throws IOException {
    Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE);
    int longLengthCassandra = AtlasDbConstants.CASSANDRA_TABLE_NAME_CHAR_LIMIT;
    String longTableName = String.join("", Collections.nCopies(longLengthCassandra, "x"));
    TableReference tableRef = TableReference.createWithEmptyNamespace(longTableName);
    List<CharacterLimitType> kvsList = new ArrayList<>();
    kvsList.add(CharacterLimitType.CASSANDRA);
    schema.addTableDefinition(longTableName, getSimpleTableDefinition(tableRef));
    assertThatThrownBy(() -> {
        IndexDefinition id = new IndexDefinition(IndexDefinition.IndexType.ADDITIVE);
        id.onTable(longTableName);
        schema.addIndexDefinition(longTableName, id);
    }).isInstanceOf(IllegalArgumentException.class).hasMessage(getErrorMessage(longTableName + IndexDefinition.IndexType.ADDITIVE.getIndexSuffix(), kvsList));
}
Also used : TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) ArrayList(java.util.ArrayList) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test)

Example 49 with TableReference

use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.

the class StreamTableTypeTest method isStreamStoreValueTableReturnsTrueForTableWithEmptyNamespace.

@Test
public void isStreamStoreValueTableReturnsTrueForTableWithEmptyNamespace() {
    String tableName = StreamTableType.VALUE.getTableName(TEST_TABLE);
    TableReference tableReference = TableReference.createWithEmptyNamespace(tableName);
    assertTrue(StreamTableType.isStreamStoreValueTable(tableReference));
}
Also used : TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) Test(org.junit.Test)

Example 50 with TableReference

use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.

the class SchemasTest method testDeleteTablesForSweepSchema.

@Test
public void testDeleteTablesForSweepSchema() {
    Set<TableReference> allTableNames = Sets.newHashSet();
    allTableNames.add(TableReference.createFromFullyQualifiedName("sweep.priority"));
    mockery.checking(new Expectations() {

        {
            oneOf(kvs).getAllTableNames();
            will(returnValue(allTableNames));
            oneOf(kvs).dropTables(allTableNames);
            oneOf(kvs).getAllTableNames();
        }
    });
    Schemas.deleteTablesAndIndexes(SweepSchema.INSTANCE.getLatestSchema(), kvs);
}
Also used : Expectations(org.jmock.Expectations) TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) Test(org.junit.Test)

Aggregations

TableReference (com.palantir.atlasdb.keyvalue.api.TableReference)112 Cell (com.palantir.atlasdb.keyvalue.api.Cell)41 Test (org.junit.Test)41 Map (java.util.Map)17 ImmutableMap (com.google.common.collect.ImmutableMap)13 Multimap (com.google.common.collect.Multimap)13 Entry (java.util.Map.Entry)13 Set (java.util.Set)13 RowResult (com.palantir.atlasdb.keyvalue.api.RowResult)12 Value (com.palantir.atlasdb.keyvalue.api.Value)12 Collection (java.util.Collection)12 List (java.util.List)12 ImmutableSet (com.google.common.collect.ImmutableSet)11 KeyValueService (com.palantir.atlasdb.keyvalue.api.KeyValueService)11 RangeRequest (com.palantir.atlasdb.keyvalue.api.RangeRequest)11 SortedMap (java.util.SortedMap)11 Lists (com.google.common.collect.Lists)10 AtlasDbConstants (com.palantir.atlasdb.AtlasDbConstants)10 Sets (com.google.common.collect.Sets)9 InsufficientConsistencyException (com.palantir.atlasdb.keyvalue.api.InsufficientConsistencyException)9