use of com.hortonworks.registries.storage.StorableKey in project registry by hortonworks.
the class MySqlSelectQueryTest method testSelectQuery.
@Test
public void testSelectQuery() throws Exception {
MySqlSelectQuery mySqlSelectQuery = new MySqlSelectQuery(nameSpace);
String parametrizedSql = mySqlSelectQuery.getParametrizedSql();
Assert.assertEquals("SELECT * FROM topic", parametrizedSql);
Map<Schema.Field, Object> fieldToObjectMap = new HashMap<>();
fieldToObjectMap.put(new Schema.Field("foo", Schema.Type.LONG), 1);
mySqlSelectQuery = new MySqlSelectQuery(new StorableKey(nameSpace, new PrimaryKey(fieldToObjectMap)));
parametrizedSql = mySqlSelectQuery.getParametrizedSql();
Assert.assertEquals("SELECT * FROM topic WHERE `foo` = ?", parametrizedSql);
}
use of com.hortonworks.registries.storage.StorableKey in project registry by hortonworks.
the class PostgresSelectQueryTest method testSelectQuery.
@Test
public void testSelectQuery() throws Exception {
PostgresqlSelectQuery postgresqlSelectQuery = new PostgresqlSelectQuery(nameSpace);
String parametrizedSql = postgresqlSelectQuery.getParametrizedSql();
Assert.assertEquals("SELECT * FROM \"topic\"", parametrizedSql);
Map<Schema.Field, Object> fieldToObjectMap = new HashMap<>();
fieldToObjectMap.put(new Schema.Field("foo", Schema.Type.LONG), 1);
postgresqlSelectQuery = new PostgresqlSelectQuery(new StorableKey(nameSpace, new PrimaryKey(fieldToObjectMap)));
parametrizedSql = postgresqlSelectQuery.getParametrizedSql();
Assert.assertEquals("SELECT * FROM \"topic\" WHERE \"foo\" = ?", parametrizedSql);
}
use of com.hortonworks.registries.storage.StorableKey in project registry by hortonworks.
the class PostgresSelectQueryTest method testSelectQueryWithOrderBy.
@Test
public void testSelectQueryWithOrderBy() throws Exception {
List<OrderByField> orderByFields = Arrays.asList(OrderByField.of("foo", true), OrderByField.of("bar"));
PostgresqlSelectQuery postgresqlSelectQuery = new PostgresqlSelectQuery("topic", orderByFields);
String parametrizedSql = postgresqlSelectQuery.getParametrizedSql();
Assert.assertEquals("SELECT * FROM \"topic\" ORDER BY \"foo\" DESC, ORDER BY \"bar\" ASC", parametrizedSql);
Map<Schema.Field, Object> fieldToObjectMap = new HashMap<>();
fieldToObjectMap.put(new Schema.Field("foo", Schema.Type.LONG), 1);
postgresqlSelectQuery = new PostgresqlSelectQuery(new StorableKey(nameSpace, new PrimaryKey(fieldToObjectMap)), orderByFields);
parametrizedSql = postgresqlSelectQuery.getParametrizedSql();
Assert.assertEquals("SELECT * FROM \"topic\" WHERE \"foo\" = ? ORDER BY \"foo\" DESC, ORDER BY \"bar\" ASC", parametrizedSql);
}
use of com.hortonworks.registries.storage.StorableKey in project registry by hortonworks.
the class GuavaCacheTest method setStorableKey.
private static void setStorableKey() {
Map<Schema.Field, Object> fieldsToVal = new HashMap<>();
fieldsToVal.put(new Schema.Field("fn", Schema.Type.STRING), "fv");
storableKey = new StorableKey("ns", new PrimaryKey(fieldsToVal));
}
use of com.hortonworks.registries.storage.StorableKey in project registry by hortonworks.
the class CatalogTagService method getTag.
@Override
public Tag getTag(Long tagId) {
Tag tag = new Tag();
tag.setId(tagId);
Tag result = this.dao.get(new StorableKey(TAG_NAMESPACE, tag.getPrimaryKey()));
if (result != null) {
result.setTags(getTags(getTaggedEntity(result)));
}
return result;
}
Aggregations