use of com.searchcode.app.model.SourceResult in project searchcode-server by boyter.
the class SourceTest method testGetSourceByIdCache.
public void testGetSourceByIdCache() {
if (Singleton.getHelpers().isStandaloneInstance())
return;
var cache = CacheSingleton.getSourceCache();
cache.put("d.s.999", Optional.of(new SourceResult().setId(999).setName("ZeName")));
var newSource = new Source(Singleton.getDatabaseConfig(), new Helpers(), Singleton.getLogger(), cache);
var result = newSource.getSourceById(999);
assertThat(result.get().id).isEqualTo(999);
assertThat(result.get().name).isEqualTo("ZeName");
}
use of com.searchcode.app.model.SourceResult in project searchcode-server by boyter.
the class SourceTest method testGetSourceByNameCache.
public void testGetSourceByNameCache() {
if (Singleton.getHelpers().isStandaloneInstance())
return;
var cache = CacheSingleton.getSourceCache();
cache.put("d.s.ZeName", Optional.of(new SourceResult().setId(999).setName("ZeName")));
var newSource = new Source(Singleton.getDatabaseConfig(), new Helpers(), Singleton.getLogger(), cache);
var result = newSource.getSourceByName("ZeName");
assertThat(result.get().id).isEqualTo(999);
assertThat(result.get().name).isEqualTo("ZeName");
}
Aggregations