use of com.hortonworks.registries.storage.StorableTest in project registry by hortonworks.
the class JdbcStorageManagerIntegrationTest method testSearchQueryApi.
@Test
public void testSearchQueryApi() {
for (StorableTest storableTest : storableTests) {
storableTest.addAllToStorage();
String nameSpace = storableTest.getNameSpace();
SearchQuery searchQuery = SearchQuery.searchFrom(nameSpace).where(WhereClause.begin().contains("name", "info").and().gt("id", 1L).combine()).orderBy(OrderBy.asc("name"));
Collection<Storable> storablesWithIdGt1 = getStorageManager().search(searchQuery);
System.out.println("storablesWithIdGt1 = " + storablesWithIdGt1);
for (Storable storable : storablesWithIdGt1) {
Assert.assertTrue(storable.getId() > 1L);
}
Collection<Storable> allStorables = getStorageManager().list(searchQuery.getNameSpace());
System.out.println("list = " + allStorables);
Assert.assertEquals(allStorables.size() - 1, storablesWithIdGt1.size());
}
}
use of com.hortonworks.registries.storage.StorableTest in project registry by hortonworks.
the class JdbcStorageManagerIntegrationTest method testAdd_UnequalExistingStorable_AlreadyExistsException.
// =============== TEST METHODS ===============
@Test(expected = Exception.class)
public void testAdd_UnequalExistingStorable_AlreadyExistsException() {
for (StorableTest test : storableTests) {
Storable storable1 = test.getStorableList().get(0);
Storable storable2 = test.getStorableList().get(1);
Assert.assertEquals(storable1.getStorableKey(), storable2.getStorableKey());
Assert.assertNotEquals(storable1, storable2);
getStorageManager().add(storable1);
// should throw exception
getStorageManager().add(storable2);
}
}
use of com.hortonworks.registries.storage.StorableTest in project registry by hortonworks.
the class JdbcStorageManagerIntegrationTest method testList_EmptyDb_EmptyCollection.
@Test
public void testList_EmptyDb_EmptyCollection() {
for (StorableTest test : storableTests) {
Collection<Storable> found = getStorageManager().list(test.getStorableList().get(0).getStorableKey().getNameSpace());
Assert.assertNotNull(found);
Assert.assertTrue(found.isEmpty());
}
}
Aggregations