use of de.invesdwin.util.collections.loadingcache.historical.key.APushingHistoricalCacheAdjustKeyProvider in project invesdwin-context-persistence by subes.
the class ATimeSeriesDBWithNoCacheAndNoQueryCacheTest method testNewEntityIncomingPushingAdjustKeyProviderWithoutInitialPush.
@Test
public void testNewEntityIncomingPushingAdjustKeyProviderWithoutInitialPush() throws IncompleteUpdateFoundException {
final APushingHistoricalCacheAdjustKeyProvider adjustKeyProvider = new APushingHistoricalCacheAdjustKeyProvider(cache) {
@Override
protected FDate getInitialHighestAllowedKey() {
return null;
}
@Override
protected boolean isPullingRecursive() {
return false;
}
};
cache.setAdjustKeyProvider(adjustKeyProvider);
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);
}
}
adjustKeyProvider.pushHighestAllowedKey(newEntity);
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.APushingHistoricalCacheAdjustKeyProvider in project invesdwin-context-persistence by subes.
the class ATimeSeriesDBWithUnlimitedCacheTest method testNewEntityIncomingPushingAdjustKeyProviderWithoutInitialPush.
@Test
public void testNewEntityIncomingPushingAdjustKeyProviderWithoutInitialPush() throws IncompleteUpdateFoundException {
final APushingHistoricalCacheAdjustKeyProvider adjustKeyProvider = new APushingHistoricalCacheAdjustKeyProvider(cache) {
@Override
protected FDate getInitialHighestAllowedKey() {
return null;
}
@Override
protected boolean isPullingRecursive() {
return false;
}
};
cache.setAdjustKeyProvider(adjustKeyProvider);
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);
}
}
adjustKeyProvider.pushHighestAllowedKey(newEntity);
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.APushingHistoricalCacheAdjustKeyProvider in project invesdwin-context-persistence by subes.
the class ALiveSegmentedTimeSeriesDBWithUnlimitedCacheTest method testNewEntityIncomingPushingAdjustKeyProviderWithoutPush.
@Test
public void testNewEntityIncomingPushingAdjustKeyProviderWithoutPush() throws IncompleteUpdateFoundException {
final APushingHistoricalCacheAdjustKeyProvider adjustKeyProvider = new APushingHistoricalCacheAdjustKeyProvider(cache) {
@Override
protected FDate getInitialHighestAllowedKey() {
return entities.get(entities.size() - 1);
}
@Override
protected boolean isPullingRecursive() {
return false;
}
};
cache.setAdjustKeyProvider(adjustKeyProvider);
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);
}
}
adjustKeyProvider.pushHighestAllowedKey(newEntity);
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.APushingHistoricalCacheAdjustKeyProvider in project invesdwin-context-persistence by subes.
the class ALiveSegmentedTimeSeriesDBWithUnlimitedCacheTest method testNewEntityIncomingPushingAdjustKeyProviderWithoutInitialPush.
@Test
public void testNewEntityIncomingPushingAdjustKeyProviderWithoutInitialPush() throws IncompleteUpdateFoundException {
final APushingHistoricalCacheAdjustKeyProvider adjustKeyProvider = new APushingHistoricalCacheAdjustKeyProvider(cache) {
@Override
protected FDate getInitialHighestAllowedKey() {
return null;
}
@Override
protected boolean isPullingRecursive() {
return false;
}
};
cache.setAdjustKeyProvider(adjustKeyProvider);
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);
}
}
adjustKeyProvider.pushHighestAllowedKey(newEntity);
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.APushingHistoricalCacheAdjustKeyProvider in project invesdwin-context-persistence by subes.
the class ALiveSegmentedTimeSeriesDBWithUnlimitedCacheTest method testNewEntityIncomingPushingAdjustKeyProvider.
@Test
public void testNewEntityIncomingPushingAdjustKeyProvider() throws IncompleteUpdateFoundException {
final APushingHistoricalCacheAdjustKeyProvider adjustKeyProvider = new APushingHistoricalCacheAdjustKeyProvider(cache) {
@Override
protected FDate getInitialHighestAllowedKey() {
return null;
}
@Override
protected boolean isPullingRecursive() {
return false;
}
};
cache.setAdjustKeyProvider(adjustKeyProvider);
adjustKeyProvider.pushHighestAllowedKey(entities.get(entities.size() - 1));
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);
}
}
adjustKeyProvider.pushHighestAllowedKey(newEntity);
entities.add(newEntity);
table.putNextLiveValue(KEY, newEntity);
final FDate correctValue = cache.query().getValue(newEntity);
Assertions.assertThat(correctValue).isEqualTo(newEntity);
}
Aggregations