Search in sources :

Example 6 with CommandRecord

use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.

the class CEntity method setOkStatus.

void setOkStatus() {
    final CommandRecord.Builder builder = getState().toBuilder();
    builder.getStatusBuilder().setCode(OK);
    final CommandRecord record = builder.build();
    updateState(record);
}
Also used : CommandRecord(io.spine.server.commandbus.CommandRecord)

Example 7 with CommandRecord

use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.

the class CEntity method setCommandAndStatus.

private void setCommandAndStatus(Command command, CommandStatus status) {
    final CommandRecord record = Records.newRecordBuilder(command, status, null).build();
    updateState(record);
}
Also used : CommandRecord(io.spine.server.commandbus.CommandRecord)

Example 8 with CommandRecord

use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.

the class RecordsShould method convert_cmd_to_record.

/*
     * Conversion tests.
     *******************/
@Test
public void convert_cmd_to_record() {
    final Command command = Given.ACommand.createProject();
    final CommandStatus status = CommandStatus.RECEIVED;
    final CommandRecord record = newRecordBuilder(command, status, null).build();
    checkRecord(record, command, status);
}
Also used : Command(io.spine.core.Command) CommandStatus(io.spine.core.CommandStatus) CommandRecord(io.spine.server.commandbus.CommandRecord) Test(org.junit.Test)

Example 9 with CommandRecord

use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.

the class StorageShould method set_error_command_status.

// We get right after we update status.
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Test
public void set_error_command_status() {
    givenNewRecord();
    final Error error = newError();
    repository.updateStatus(id, error);
    final CommandRecord actual = read(id).get();
    assertEquals(ERROR, actual.getStatus().getCode());
    assertEquals(error, actual.getStatus().getError());
}
Also used : Error(io.spine.base.Error) CommandRecord(io.spine.server.commandbus.CommandRecord) TenantAwareTest(io.spine.server.tenant.TenantAwareTest) Test(org.junit.Test)

Example 10 with CommandRecord

use of io.spine.server.commandbus.CommandRecord in project core-java by SpineEventEngine.

the class StorageShould method givenNewRecord.

private void givenNewRecord() {
    final CommandRecord record = newStorageRecord();
    id = record.getCommandId();
    repository.store(record.getCommand());
}
Also used : CommandRecord(io.spine.server.commandbus.CommandRecord)

Aggregations

CommandRecord (io.spine.server.commandbus.CommandRecord)23 Test (org.junit.Test)11 TenantAwareTest (io.spine.server.tenant.TenantAwareTest)10 Command (io.spine.core.Command)8 CommandStatus (io.spine.core.CommandStatus)4 Error (io.spine.base.Error)3 CommandId (io.spine.core.CommandId)3 Failure (io.spine.base.Failure)1 TestActorRequestFactory (io.spine.client.TestActorRequestFactory)1 Rejection (io.spine.core.Rejection)1