public void validateAchillesCounter(KeyspaceMetadata keyspaceMetaData, String keyspaceName) {
log.debug("Validate existing Achilles Counter table");
Name textTypeName = text().getName();
Name counterTypeName = counter().getName();
TableMetadata tableMetaData = keyspaceMetaData.getTable(ACHILLES_COUNTER_TABLE);
Validator.validateTableTrue(tableMetaData != null, "Cannot find table '%s' from keyspace '%s'",ACHILLES_COUNTER_TABLE, keyspaceName);
ColumnMetadata fqcnColumn = tableMetaData.getColumn(ACHILLES_COUNTER_FQCN);
Validator.validateTableTrue(fqcnColumn != null, "Cannot find column '%s' from table '%s'", ACHILLES_COUNTER_FQCN,ACHILLES_COUNTER_TABLE);
Validator.validateTableTrue(fqcnColumn.getType().getName() == textTypeName,
"Column '%s' of type '%s' should be of type '%s'", ACHILLES_COUNTER_FQCN, fqcnColumn.getType().getName(),
textTypeName);
Validator.validateBeanMappingTrue(hasColumnMeta(tableMetaData.getPartitionKey(), fqcnColumn),
"Column '%s' of table '%s' should be a partition key component", ACHILLES_COUNTER_FQCN, ACHILLES_COUNTER_TABLE);
ColumnMetadata pkColumn = tableMetaData.getColumn(ACHILLES_COUNTER_PRIMARY_KEY);
Validator.validateTableTrue(pkColumn != null, "Cannot find column '%s' from table '%s'",ACHILLES_COUNTER_PRIMARY_KEY, ACHILLES_COUNTER_TABLE);
Validator.validateTableTrue(pkColumn.getType().getName() == textTypeName,
"Column '%s' of type '%s' should be of type '%s'", ACHILLES_COUNTER_PRIMARY_KEY, pkColumn.getType()
.getName(), textTypeName);
Validator.validateBeanMappingTrue(hasColumnMeta(tableMetaData.getPartitionKey(), pkColumn),
"Column '%s' of table '%s' should be a partition key component", ACHILLES_COUNTER_PRIMARY_KEY,ACHILLES_COUNTER_TABLE);
ColumnMetadata propertyNameColumn = tableMetaData.getColumn(ACHILLES_COUNTER_PROPERTY_NAME);
Validator.validateTableTrue(propertyNameColumn != null, "Cannot find column '%s' from table '%s'",ACHILLES_COUNTER_PROPERTY_NAME, ACHILLES_COUNTER_TABLE);
Validator.validateTableTrue(propertyNameColumn.getType().getName() == textTypeName,
"Column '%s' of type '%s' should be of type '%s'", ACHILLES_COUNTER_PROPERTY_NAME, propertyNameColumn
.getType().getName(), textTypeName);
Validator.validateBeanMappingTrue(hasColumnMeta(tableMetaData.getClusteringColumns(), propertyNameColumn),
"Column '%s' of table '%s' should be a clustering key component", ACHILLES_COUNTER_PROPERTY_NAME,ACHILLES_COUNTER_TABLE);
ColumnMetadata counterValueColumn = tableMetaData.getColumn(ACHILLES_COUNTER_VALUE);
Validator.validateTableTrue(counterValueColumn != null, "Cannot find column '%s' from table '%s'",ACHILLES_COUNTER_VALUE, ACHILLES_COUNTER_TABLE);
Validator.validateTableTrue(counterValueColumn.getType().getName() == counterTypeName,
"Column '%s' of type '%s' should be of type '%s'", ACHILLES_COUNTER_VALUE, counterValueColumn.getType().getName(), counterTypeName);
}