@Test public void checkForNullDefnsWhenRetrievingAllStreamDefns() throws StreamDefinitionStoreException { Collection<StreamDefinition> expectedAllStreamDefinitionFromStore = cassandraConnector.getAllStreamDefinitionFromStore(getCluster()); Collection<StreamDefinition> actualAllStreamDefinitionFromStore = cassandraConnector.getAllStreamDefinitionFromStore(getCluster()); assertEquals( expectedAllStreamDefinitionFromStore.size(), actualAllStreamDefinitionFromStore.size()); }
public static void assertColumns(ColumnFamily cf, String... columnNames) { Collection<IColumn> columns = cf == null ? new TreeSet<IColumn>() : cf.getSortedColumns(); List<String> L = new ArrayList<String>(); for (IColumn column : columns) { L.add(new String(column.name())); } assert Arrays.equals(L.toArray(new String[columns.size()]), columnNames) : "Columns [" + ((cf == null) ? "" : cf.getComparator().getColumnsString(columns)) + "]" + " is not expected [" + StringUtils.join(columnNames, ",") + "]"; }
@Test public void deleteStreamDefinitionAndId() throws StreamDefinitionStoreException { insertEventsFromMultipleStreams(); insertEventsFromTwoVersions(); Collection<StreamDefinition> allStreamDefinitionFromStore = cassandraConnector.getAllStreamDefinitionFromStore(getCluster()); int i = 0; for (StreamDefinition streamDefinition : allStreamDefinitionFromStore) { cassandraConnector.deleteStreamDefinitionFromCassandra( getCluster(), streamDefinition.getStreamId()); i++; Collection<StreamDefinition> newAllStreamDefns = cassandraConnector.getAllStreamDefinitionFromStore(getCluster()); assertEquals(allStreamDefinitionFromStore.size() - i, newAllStreamDefns.size()); } }
@Test public void testGetSliceNoMatch() throws Throwable { Table table = Table.open("Keyspace1"); RowMutation rm = new RowMutation("Keyspace1", "row1000"); ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard2"); cf.addColumn(column("col1", "val1", 1)); rm.add(cf); rm.apply(); validateGetSliceNoMatch(table); table.getColumnFamilyStore("Standard2").forceBlockingFlush(); validateGetSliceNoMatch(table); Collection<SSTableReader> ssTables = table.getColumnFamilyStore("Standard2").getSSTables(); assertEquals(1, ssTables.size()); ssTables.iterator().next().forceBloomFilterFailures(); validateGetSliceNoMatch(table); }