columnModel.setValue(new GenericType(value, GenericTypeEnum.BYTES_TYPE));
return columnModel;
}
public static DataSet getMockDataSetWithDefinedValues() {
DataSet mockDataSet = mock(DataSet.class);
/* keyspace */
KeyspaceModel keyspace = new KeyspaceModel();
keyspace.setName("otherKeyspaceName");
keyspace.setStrategy(StrategyModel.SIMPLE_STRATEGY);
keyspace.setReplicationFactor(1);
List<ColumnFamilyModel> columnFamilies = new ArrayList<ColumnFamilyModel>();
/* column family 1 */
ColumnFamilyModel beautifulColumnFamily = new ColumnFamilyModel();
beautifulColumnFamily.setName("beautifulColumnFamilyName");
beautifulColumnFamily.setType(ColumnType.SUPER);
beautifulColumnFamily.setKeyType(ComparatorType.TIMEUUIDTYPE);
beautifulColumnFamily.setComparatorType(ComparatorType.UTF8TYPE);
beautifulColumnFamily.setSubComparatorType(ComparatorType.LONGTYPE);
beautifulColumnFamily.setDefaultColumnValueType(ComparatorType.UTF8TYPE);
beautifulColumnFamily.setComment("amazing comment");
beautifulColumnFamily.setCompactionStrategy("LeveledCompactionStrategy");
List<CompactionStrategyOptionModel> compactionStrategyOptions = new ArrayList<CompactionStrategyOptionModel>();
compactionStrategyOptions.add(new CompactionStrategyOptionModel("sstable_size_in_mb", "10"));
beautifulColumnFamily.setCompactionStrategyOptions(compactionStrategyOptions);
beautifulColumnFamily.setGcGraceSeconds(9999);
beautifulColumnFamily.setMaxCompactionThreshold(31);
beautifulColumnFamily.setMinCompactionThreshold(3);
beautifulColumnFamily.setReadRepairChance(0.1d);
beautifulColumnFamily.setReplicationOnWrite(Boolean.FALSE);
List<RowModel> rows = new ArrayList<RowModel>();
/* row1 */
RowModel row1 = new RowModel();
row1.setKey(new GenericType("13816710-1dd2-11b2-879a-782bcb80ff6a", GenericTypeEnum.TIME_UUID_TYPE));
List<SuperColumnModel> superColumns1 = new ArrayList<SuperColumnModel>();
superColumns1.add(constructDefinedSuperColumnForMock(11));
superColumns1.add(constructDefinedSuperColumnForMock(12));
row1.setSuperColumns(superColumns1);
rows.add(row1);
/* row2 */
RowModel row2 = new RowModel();
row2.setKey(new GenericType("13818e20-1dd2-11b2-879a-782bcb80ff6a", GenericTypeEnum.TIME_UUID_TYPE));
List<SuperColumnModel> superColumns2 = new ArrayList<SuperColumnModel>();
superColumns2.add(constructDefinedSuperColumnForMock(21));
superColumns2.add(constructDefinedSuperColumnForMock(22));
superColumns2.add(constructDefinedSuperColumnForMock(23));
row2.setSuperColumns(superColumns2);
rows.add(row2);
beautifulColumnFamily.setRows(rows);
columnFamilies.add(beautifulColumnFamily);
/* column family 2 */
ColumnFamilyModel columnFamily2 = new ColumnFamilyModel();
columnFamily2.setName("amazingColumnFamilyName");
columnFamily2.setType(ColumnType.STANDARD);
columnFamily2.setKeyType(ComparatorType.UTF8TYPE);
columnFamily2.setComparatorType(ComparatorType.UTF8TYPE);
columnFamily2.setDefaultColumnValueType(ComparatorType.UTF8TYPE);
columnFamilies.add(columnFamily2);
/* column family 3 with index */
ColumnFamilyModel columnFamily3 = new ColumnFamilyModel();
columnFamily3.setName("columnFamilyWithSecondaryIndex");
columnFamily3.setType(ColumnType.STANDARD);
columnFamily3.setKeyType(ComparatorType.UTF8TYPE);
columnFamily3.setComparatorType(ComparatorType.UTF8TYPE);
columnFamily3.setDefaultColumnValueType(ComparatorType.UTF8TYPE);
columnFamily3.addColumnMetadata(new ColumnMetadataModel(
newUtf8GenericType("columnWithSecondaryIndexAndValidationClassAsLongType"), ComparatorType.LONGTYPE, ColumnIndexType.KEYS, null));
columnFamilies.add(columnFamily3);
/* column family 4 with index */
ColumnFamilyModel columnFamily4 = new ColumnFamilyModel();
columnFamily4.setName("columnFamilyWithSecondaryIndexAndIndexName");
columnFamily4.setType(ColumnType.STANDARD);
columnFamily4.setKeyType(ComparatorType.UTF8TYPE);
columnFamily4.setComparatorType(ComparatorType.UTF8TYPE);
columnFamily4.setDefaultColumnValueType(ComparatorType.UTF8TYPE);
columnFamily4.addColumnMetadata(new ColumnMetadataModel(
newUtf8GenericType("columnWithSecondaryIndexAndValidationClassAsUTF8Type"), ComparatorType.UTF8TYPE, ColumnIndexType.KEYS,
"columnWithSecondaryIndexHaveIndexNameAndValidationClassAsUTF8Type"));
columnFamilies.add(columnFamily4);
/* column family 5 with column validation class */
ColumnFamilyModel columnFamily5 = new ColumnFamilyModel();
columnFamily5.setName("columnFamilyWithColumnValidationClass");
columnFamily5.setType(ColumnType.STANDARD);
columnFamily5.setKeyType(ComparatorType.UTF8TYPE);
columnFamily5.setComparatorType(ComparatorType.UTF8TYPE);
columnFamily5.setDefaultColumnValueType(ComparatorType.UTF8TYPE);
columnFamily5.addColumnMetadata(new ColumnMetadataModel(
newUtf8GenericType("columnWithValidationClassAsUTF8Type"),
ComparatorType.UTF8TYPE, null, null));
columnFamilies.add(columnFamily5);
keyspace.setColumnFamilies(columnFamilies);
when(mockDataSet.getKeyspace()).thenReturn(keyspace);
when(mockDataSet.getColumnFamilies()).thenReturn(keyspace.getColumnFamilies());
return mockDataSet;
}