use of io.spine.server.entity.LifecycleFlags in project core-java by SpineEventEngine.
the class AggregateStorageVisibilityHandlingShould method write_entity_status_of_aggregate.
// Checked in an assertion
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Test
public void write_entity_status_of_aggregate() {
final LifecycleFlags status = LifecycleFlags.newBuilder().setArchived(true).build();
storage.writeLifecycleFlags(id, status);
final Optional<LifecycleFlags> readStatus = storage.readLifecycleFlags(id);
assertTrue(readStatus.isPresent());
assertEquals(status, readStatus.get());
}
use of io.spine.server.entity.LifecycleFlags in project core-java by SpineEventEngine.
the class RecordStorageShould method load_visibility_when_updated.
// We verify in assertion.
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Test
public void load_visibility_when_updated() {
final I id = newId();
final EntityRecord record = newStorageRecord(id);
final RecordStorage<I> storage = getStorage();
storage.write(id, EntityRecordWithColumns.of(record));
storage.writeLifecycleFlags(id, archived());
final Optional<LifecycleFlags> optional = storage.readLifecycleFlags(id);
assertTrue(optional.isPresent());
assertTrue(optional.get().getArchived());
}
use of io.spine.server.entity.LifecycleFlags in project core-java by SpineEventEngine.
the class RecordStorageShould method return_default_visibility_for_new_record.
// Converter nullability issues
@SuppressWarnings("ConstantConditions")
@Test
public void return_default_visibility_for_new_record() {
final I id = newId();
final EntityRecord record = newStorageRecord(id);
final RecordStorage<I> storage = getStorage();
storage.write(id, record);
final Optional<LifecycleFlags> optional = storage.readLifecycleFlags(id);
assertTrue(optional.isPresent());
assertEquals(LifecycleFlags.getDefaultInstance(), optional.get());
}
use of io.spine.server.entity.LifecycleFlags in project core-java by SpineEventEngine.
the class AggregateStorageShould method read_history_of_archived_aggregate.
@Test
public void read_history_of_archived_aggregate() {
final LifecycleFlags archivedRecordFlags = LifecycleFlags.newBuilder().setArchived(true).build();
storage.writeLifecycleFlags(id, archivedRecordFlags);
writeAndReadEventTest(id, storage);
}
use of io.spine.server.entity.LifecycleFlags in project core-java by SpineEventEngine.
the class AggregateStorageShould method index_deleted_aggregate.
@Test
public void index_deleted_aggregate() {
final LifecycleFlags deletedRecordFlags = LifecycleFlags.newBuilder().setDeleted(true).build();
storage.writeRecord(id, StorageRecord.create(getCurrentTime()));
storage.writeLifecycleFlags(id, deletedRecordFlags);
assertTrue(storage.index().hasNext());
}
Aggregations