use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.
the class Entity method setToFailure.
void setToFailure(Failure failure) {
final CommandRecord.Builder builder = getState().toBuilder();
builder.getStatusBuilder().setCode(FAILURE).setFailure(failure);
final CommandRecord record = builder.build();
updateState(record);
}
use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.
the class Entity method setError.
private void setError(CommandId id, Command command, Error error) {
final CommandRecord.Builder builder = Records.newRecordBuilder(command, ERROR, id);
builder.getStatusBuilder().setError(error);
final CommandRecord record = builder.build();
updateState(record);
}
use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.
the class StorageShould method store_command_with_status.
// We get right after we store.
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Test
public void store_command_with_status() {
final Command command = Given.Command.createProject();
final CommandId commandId = command.getId();
final CommandStatus status = SCHEDULED;
storage.store(command, status);
final CommandRecord record = read(commandId).get();
checkRecord(record, command, status);
}
use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.
the class StorageShould method set_failure_command_status.
// We get right after we update status.
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Test
public void set_failure_command_status() {
givenNewRecord();
final Failure failure = newFailure();
storage.updateStatus(id, failure);
final CommandRecord actual = read(id).get();
assertEquals(FAILURE, actual.getStatus().getCode());
assertEquals(failure, actual.getStatus().getFailure());
}
use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.
the class StorageShould method set_ok_command_status.
/*
* Update command status tests.
******************************/
// We get right after we update status.
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Test
public void set_ok_command_status() {
givenNewRecord();
storage.setOkStatus(id);
final CommandRecord actual = read(id).get();
assertEquals(OK, actual.getStatus().getCode());
}
Aggregations