use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.
the class Entity method setToError.
void setToError(Error error) {
final CommandRecord.Builder builder = getState().toBuilder();
builder.getStatusBuilder().setCode(ERROR).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 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();
repository.setOkStatus(id);
final CommandRecord actual = read(id).get();
assertEquals(OK, actual.getStatus().getCode());
}
use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.
the class StorageShould method store_and_read_command.
// We get right after we store.
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Test
public void store_and_read_command() {
final Command command = Given.ACommand.createProject();
final CommandId commandId = command.getId();
repository.store(command);
final CommandRecord record = read(commandId).get();
checkRecord(record, command, RECEIVED);
}
use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.
the class StorageShould method set_rejected_command_status.
// We get right after we update status.
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Test
public void set_rejected_command_status() {
givenNewRecord();
final Rejection rejection = newRejection();
repository.updateStatus(id, rejection);
final CommandRecord actual = read(id).get();
assertEquals(REJECTED, actual.getStatus().getCode());
assertEquals(rejection, actual.getStatus().getRejection());
}
Aggregations