@Test @Cassandra(keyspace = "bar") public void testValidateSchemaWithMissingTable() { PojoBinding<SimpleKeyEntity> binding = getBindingFactory().createPojoBinding(SimpleKeyEntity.class); assertHecateException("Table \"foo\" not found in keyspace \"bar\".", verifySchema(binding, "foo")); }
@Override public void verifySchema(KeyspaceMetadata keyspaceMetadata, String tableName) { TableMetadata tableMetadata = keyspaceMetadata.getTable(tableName); if(tableMetadata == null) { throw new SchemaVerificationException("Table \"%s\" not found in keyspace \"%s\".", tableName, keyspaceMetadata.getName()); } keyBinding.verifySchema(keyspaceMetadata, tableMetadata); facetBindings.forEach(facetBinding -> facetBinding.verifySchema(keyspaceMetadata, tableMetadata)); }
DefaultPojoBinding implements PojoBinding<P> { @Override public void verifySchema(KeyspaceMetadata keyspaceMetadata, String tableName) { TableMetadata tableMetadata = keyspaceMetadata.getTable(tableName); if(tableMetadata == null) { throw new SchemaVerificationException("Table \"%s\" not found in keyspace \"%s\".", tableName, keyspaceMetadata.getName()); } keyBinding.verifySchema(keyspaceMetadata, tableMetadata); facetBindings.forEach(facetBinding -> facetBinding.verifySchema(keyspaceMetadata, tableMetadata)); } }
DefaultPojoBinding implements PojoBinding<P> { @Override public void verifySchema(KeyspaceMetadata keyspaceMetadata, String tableName) { TableMetadata tableMetadata = keyspaceMetadata.getTable(tableName); if(tableMetadata == null) { throw new SchemaVerificationException("Table \"%s\" not found in keyspace \"%s\".", tableName, keyspaceMetadata.getName()); } keyBinding.verifySchema(keyspaceMetadata, tableMetadata); facetBindings.forEach(facetBinding -> facetBinding.verifySchema(keyspaceMetadata, tableMetadata)); } DefaultPojoBinding(Class<P> pojoType); }
DefaultPojoBinding implements PojoBinding<P> { @Override public void verifySchema(KeyspaceMetadata keyspaceMetadata, String tableName) { TableMetadata tableMetadata = keyspaceMetadata.getTable(tableName); if(tableMetadata == null) { throw new SchemaVerificationException("Table \"%s\" not found in keyspace \"%s\".", tableName, keyspaceMetadata.getName()); } keyBinding.verifySchema(keyspaceMetadata, tableMetadata); facetBindings.forEach(facetBinding -> facetBinding.verifySchema(keyspaceMetadata, tableMetadata)); } DefaultPojoBinding(Class<P> pojoType); @Override BoundStatement bindInsert(PreparedStatement statement, P pojo, int ttl); @Override BoundStatement bindWhereIdEquals(PreparedStatement statement, List<Object> keys); @Override P createPojo(); @Override Delete.Where deleteFrom(String tableName); @Override void describe(Table table, Schema schema); @Override KeyBinding getKeyBinding(); @Override Map<String, ParameterBinding> getParameterBindings(); @Override Class<P> getPojoType(); @Override void injectValues(P pojo, Row row, PojoQueryContext context); @Override Insert insertInto(String tableName); @Override Select.Where selectFrom(String tableName); @Override Select.Where selectFromByKey(String tableName); @Override void verifySchema(KeyspaceMetadata keyspaceMetadata, String tableName); @Override void visitChildren(P pojo, Predicate<Facet> predicate, PojoVisitor visitor); void setKeyBinding(KeyBinding keyBinding); @Override boolean equals(Object o); @Override int hashCode(); void addFacetBinding(ColumnBinding facetBinding); }
DefaultPojoBinding implements PojoBinding<P> { @Override public void verifySchema(KeyspaceMetadata keyspaceMetadata, String tableName) { TableMetadata tableMetadata = keyspaceMetadata.getTable(tableName); if(tableMetadata == null) { throw new SchemaVerificationException("Table \"%s\" not found in keyspace \"%s\".", tableName, keyspaceMetadata.getName()); } keyBinding.verifySchema(keyspaceMetadata, tableMetadata); facetBindings.forEach(facetBinding -> facetBinding.verifySchema(keyspaceMetadata, tableMetadata)); } DefaultPojoBinding(Class<P> pojoType); @Override BoundStatement bindInsert(PreparedStatement statement, P pojo, int ttl); @Override BoundStatement bindWhereIdEquals(PreparedStatement statement, List<Object> keys); @Override P createPojo(); @Override Delete.Where deleteFrom(String tableName); @Override void describe(Table table, Schema schema); @Override KeyBinding getKeyBinding(); @Override Map<String, ParameterBinding> getParameterBindings(); @Override Class<P> getPojoType(); @Override void injectValues(P pojo, Row row, PojoQueryContext context); @Override Insert insertInto(String tableName); @Override Select.Where selectFrom(String tableName); @Override Select.Where selectFromByKey(String tableName); @Override void verifySchema(KeyspaceMetadata keyspaceMetadata, String tableName); @Override void visitChildren(P pojo, Predicate<Facet> predicate, PojoVisitor visitor); void setKeyBinding(KeyBinding keyBinding); @Override boolean equals(Object o); @Override int hashCode(); void addFacetBinding(ColumnBinding facetBinding);  }