use of com.hortonworks.registries.storage.Storable 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.Storable 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());
}
}
use of com.hortonworks.registries.storage.Storable in project registry by hortonworks.
the class CatalogTagService method getStorableClasses.
public static Collection<Class<? extends Storable>> getStorableClasses() {
InputStream resourceAsStream = CatalogTagService.class.getClassLoader().getResourceAsStream("tagstorables.props");
HashSet<Class<? extends Storable>> classes = new HashSet<>();
try {
List<String> classNames = IOUtils.readLines(resourceAsStream);
for (String className : classNames) {
classes.add((Class<? extends Storable>) Class.forName(className));
}
} catch (IOException | ClassNotFoundException e) {
throw new RuntimeException(e);
}
return classes;
}
use of com.hortonworks.registries.storage.Storable in project registry by hortonworks.
the class GuavaCacheTest method test_put_get_existing_remove_key.
/**
* Asserts that cache has not given key, puts (key,val) pair, retrieves key, and removes key at the end
*/
@Test
public void test_put_get_existing_remove_key() {
try {
Assert.assertNull(cache.get(storableKey));
final Storable putVal = new TestStorable();
cache.put(storableKey, putVal);
Storable retrievedVal = cache.get(storableKey);
Assert.assertEquals(putVal, retrievedVal);
} finally {
cache.remove(storableKey);
Assert.assertNull(cache.get(storableKey));
}
}
Aggregations