use of de.invesdwin.util.collections.loadingcache.historical.key.APullingHistoricalCacheAdjustKeyProvider in project invesdwin-context-persistence by subes.
the class ASegmentedTimeSeriesDBWithUnlimitedCacheTest method testNewEntityIncomingPullingAdjustKeyProvider.
@Test
public void testNewEntityIncomingPullingAdjustKeyProvider() throws IncompleteUpdateFoundException {
cache.setAdjustKeyProvider(new APullingHistoricalCacheAdjustKeyProvider(cache) {
@Override
protected FDate innerGetHighestAllowedKey() {
return entities.get(entities.size() - 1);
}
@Override
protected boolean isPullingRecursive() {
return false;
}
});
final List<FDate> newEntities = new ArrayList<FDate>(entities);
final FDate newEntity = FDateBuilder.newDate(1996, 1, 1);
newEntities.add(newEntity);
for (final FDate entity : newEntities) {
final FDate value = cache.query().getValue(entity);
if (newEntity.equals(entity)) {
Assertions.assertThat(value).isNotEqualTo(newEntity);
Assertions.assertThat(value).isEqualTo(entities.get(entities.size() - 1));
} else {
Assertions.assertThat(value).isEqualTo(entity);
}
}
entities.add(newEntity);
final FDate correctValue = cache.query().getValue(newEntity);
Assertions.assertThat(correctValue).isEqualTo(newEntity);
}
use of de.invesdwin.util.collections.loadingcache.historical.key.APullingHistoricalCacheAdjustKeyProvider in project invesdwin-context-persistence by subes.
the class ASegmentedTimeSeriesDBWithoutShiftKeysAndQueryInterceptorTest method testNewEntityIncomingPullingAdjustKeyProvider.
@Test
public void testNewEntityIncomingPullingAdjustKeyProvider() throws IncompleteUpdateFoundException {
cache.setAdjustKeyProvider(new APullingHistoricalCacheAdjustKeyProvider(cache) {
@Override
protected FDate innerGetHighestAllowedKey() {
return entities.get(entities.size() - 1);
}
@Override
protected boolean isPullingRecursive() {
return false;
}
});
final List<FDate> newEntities = new ArrayList<FDate>(entities);
final FDate newEntity = FDateBuilder.newDate(1996, 1, 1);
newEntities.add(newEntity);
for (final FDate entity : newEntities) {
final FDate value = cache.query().getValue(entity);
if (newEntity.equals(entity)) {
Assertions.assertThat(value).isNotEqualTo(newEntity);
Assertions.assertThat(value).isEqualTo(entities.get(entities.size() - 1));
} else {
Assertions.assertThat(value).isEqualTo(entity);
}
}
entities.add(newEntity);
final FDate correctValue = cache.query().getValue(newEntity);
Assertions.assertThat(correctValue).isEqualTo(newEntity);
}
use of de.invesdwin.util.collections.loadingcache.historical.key.APullingHistoricalCacheAdjustKeyProvider in project invesdwin-context-persistence by subes.
the class ATimeSeriesDBWithNoCacheAndNoQueryCacheTest method testNewEntityIncomingPullingAdjustKeyProvider.
@Test
public void testNewEntityIncomingPullingAdjustKeyProvider() throws IncompleteUpdateFoundException {
cache.setAdjustKeyProvider(new APullingHistoricalCacheAdjustKeyProvider(cache) {
@Override
protected FDate innerGetHighestAllowedKey() {
return entities.get(entities.size() - 1);
}
@Override
protected boolean isPullingRecursive() {
return false;
}
});
final List<FDate> newEntities = new ArrayList<FDate>(entities);
final FDate newEntity = FDateBuilder.newDate(1996, 1, 1);
newEntities.add(newEntity);
for (final FDate entity : newEntities) {
final FDate value = cache.query().getValue(entity);
if (newEntity.equals(entity)) {
Assertions.assertThat(value).isNotEqualTo(newEntity);
Assertions.assertThat(value).isEqualTo(entities.get(entities.size() - 1));
} else {
Assertions.assertThat(value).isEqualTo(entity);
}
}
entities.add(newEntity);
updater.update();
final FDate correctValue = cache.query().getValue(newEntity);
Assertions.assertThat(correctValue).isEqualTo(newEntity);
}
use of de.invesdwin.util.collections.loadingcache.historical.key.APullingHistoricalCacheAdjustKeyProvider in project invesdwin-context-persistence by subes.
the class ALiveSegmentedTimeSeriesDBWithUnlimitedCacheTest method testNewEntityIncomingPullingAdjustKeyProvider.
@Test
public void testNewEntityIncomingPullingAdjustKeyProvider() throws IncompleteUpdateFoundException {
cache.setAdjustKeyProvider(new APullingHistoricalCacheAdjustKeyProvider(cache) {
@Override
protected FDate innerGetHighestAllowedKey() {
return entities.get(entities.size() - 1);
}
@Override
protected boolean isPullingRecursive() {
return false;
}
});
final List<FDate> newEntities = new ArrayList<FDate>(entities);
final FDate newEntity = FDateBuilder.newDate(1996, 1, 1);
newEntities.add(newEntity);
for (final FDate entity : newEntities) {
final FDate value = cache.query().getValue(entity);
if (newEntity.equals(entity)) {
Assertions.assertThat(value).isNotEqualTo(newEntity);
Assertions.assertThat(value).isEqualTo(entities.get(entities.size() - 1));
} else {
Assertions.assertThat(value).isEqualTo(entity);
}
}
entities.add(newEntity);
table.putNextLiveValue(KEY, newEntity);
final FDate correctValue = cache.query().getValue(newEntity);
Assertions.assertThat(correctValue).isEqualTo(newEntity);
}
use of de.invesdwin.util.collections.loadingcache.historical.key.APullingHistoricalCacheAdjustKeyProvider in project invesdwin-context-persistence by subes.
the class ATimeSeriesDBWithLimitedCacheTest method testNewEntityIncomingPullingAdjustKeyProvider.
@Test
public void testNewEntityIncomingPullingAdjustKeyProvider() throws IncompleteUpdateFoundException {
cache.setAdjustKeyProvider(new APullingHistoricalCacheAdjustKeyProvider(cache) {
@Override
protected FDate innerGetHighestAllowedKey() {
return entities.get(entities.size() - 1);
}
@Override
protected boolean isPullingRecursive() {
return false;
}
});
final List<FDate> newEntities = new ArrayList<FDate>(entities);
final FDate newEntity = FDateBuilder.newDate(1996, 1, 1);
newEntities.add(newEntity);
for (final FDate entity : newEntities) {
final FDate value = cache.query().getValue(entity);
if (newEntity.equals(entity)) {
Assertions.assertThat(value).isNotEqualTo(newEntity);
Assertions.assertThat(value).isEqualTo(entities.get(entities.size() - 1));
} else {
Assertions.assertThat(value).isEqualTo(entity);
}
}
entities.add(newEntity);
updater.update();
final FDate correctValue = cache.query().getValue(newEntity);
Assertions.assertThat(correctValue).isEqualTo(newEntity);
}
Aggregations