Search in sources :

Example 1 with ProjectId

use of io.spine.test.rejection.ProjectId in project core-java by SpineEventEngine.

the class Given method missingOwnerRejection.

public static Rejection missingOwnerRejection() {
    final ProjectId projectId = newProjectId();
    final ProjectRejections.MissingOwner msg = ProjectRejections.MissingOwner.newBuilder().setProjectId(projectId).build();
    final Command command = io.spine.server.commandbus.Given.ACommand.withMessage(Sample.messageOfType(RjRemoveOwner.class));
    return Rejections.createRejection(msg, command);
}
Also used : Command(io.spine.core.Command) ProjectRejections(io.spine.test.rejection.ProjectRejections) RjRemoveOwner(io.spine.test.rejection.command.RjRemoveOwner) ProjectId(io.spine.test.rejection.ProjectId)

Example 2 with ProjectId

use of io.spine.test.rejection.ProjectId in project core-java by SpineEventEngine.

the class Given method cannotModifyDeletedEntity.

public static Rejection cannotModifyDeletedEntity(Class<? extends Message> commandMessage) {
    final ProjectId projectId = newProjectId();
    final Any idAny = AnyPacker.pack(projectId);
    final CannotModifyDeletedEntity rejectionMsg = CannotModifyDeletedEntity.newBuilder().setEntityId(idAny).build();
    final Command command = io.spine.server.commandbus.Given.ACommand.withMessage(Sample.messageOfType(commandMessage));
    return Rejections.createRejection(rejectionMsg, command);
}
Also used : CannotModifyDeletedEntity(io.spine.server.entity.rejection.StandardRejections.CannotModifyDeletedEntity) Command(io.spine.core.Command) ProjectId(io.spine.test.rejection.ProjectId) Any(com.google.protobuf.Any)

Example 3 with ProjectId

use of io.spine.test.rejection.ProjectId in project core-java by SpineEventEngine.

the class Given method invalidProjectNameRejection.

public static Rejection invalidProjectNameRejection() {
    final ProjectId projectId = newProjectId();
    final ProjectRejections.InvalidProjectName invalidProjectName = ProjectRejections.InvalidProjectName.newBuilder().setProjectId(projectId).build();
    final StringChange nameChange = StringChange.newBuilder().setNewValue("Too short").build();
    final RjUpdateProjectName updateProjectName = RjUpdateProjectNameVBuilder.newBuilder().setId(projectId).setNameUpdate(nameChange).build();
    final TenantId generatedTenantId = TenantId.newBuilder().setValue(newUuid()).build();
    final TestActorRequestFactory factory = TestActorRequestFactory.newInstance(RejectionBusShould.class, generatedTenantId);
    final Command command = factory.createCommand(updateProjectName);
    return Rejections.createRejection(invalidProjectName, command);
}
Also used : TestActorRequestFactory(io.spine.client.TestActorRequestFactory) TenantId(io.spine.core.TenantId) Command(io.spine.core.Command) ProjectRejections(io.spine.test.rejection.ProjectRejections) ProjectId(io.spine.test.rejection.ProjectId) RjUpdateProjectName(io.spine.test.rejection.command.RjUpdateProjectName) StringChange(io.spine.change.StringChange)

Aggregations

Command (io.spine.core.Command)3 ProjectId (io.spine.test.rejection.ProjectId)3 ProjectRejections (io.spine.test.rejection.ProjectRejections)2 Any (com.google.protobuf.Any)1 StringChange (io.spine.change.StringChange)1 TestActorRequestFactory (io.spine.client.TestActorRequestFactory)1 TenantId (io.spine.core.TenantId)1 CannotModifyDeletedEntity (io.spine.server.entity.rejection.StandardRejections.CannotModifyDeletedEntity)1 RjRemoveOwner (io.spine.test.rejection.command.RjRemoveOwner)1 RjUpdateProjectName (io.spine.test.rejection.command.RjUpdateProjectName)1