Search in sources :

Example 11 with ProjectId

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

the class ProcessManagerRepositoryShould method dispatch_event_to_archived_process_manager.

@Test
public void dispatch_event_to_archived_process_manager() throws InvocationTargetException {
    final PmArchiveProcess archiveProcess = archiveProcess();
    testDispatchCommand(archiveProcess);
    final ProjectId projectId = archiveProcess.getProjectId();
    TestProcessManager processManager = repository().findOrCreate(projectId);
    assertTrue(processManager.isArchived());
    // Dispatch an event to the archived process manager.
    testDispatchEvent(taskAdded());
    processManager = repository().findOrCreate(projectId);
    final List<Task> addedTasks = processManager.getState().getTaskList();
    assertFalse(addedTasks.isEmpty());
    // Check that the process manager was not re-created before dispatching.
    assertTrue(processManager.isArchived());
}
Also used : Task(io.spine.test.procman.Task) GivenCommandMessage.addTask(io.spine.server.procman.given.ProcessManagerRepositoryTestEnv.GivenCommandMessage.addTask) TestProcessManager(io.spine.server.procman.given.ProcessManagerRepositoryTestEnv.TestProcessManager) PmArchiveProcess(io.spine.test.procman.command.PmArchiveProcess) ProjectId(io.spine.test.procman.ProjectId) Test(org.junit.Test)

Example 12 with ProjectId

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

the class PmMessageDeliveryTestEnv method createProject.

public static Command createProject() {
    final ProjectId projectId = projectId();
    final Command command = createCommand(PmCreateProject.newBuilder().setProjectId(projectId).build());
    return command;
}
Also used : Command(io.spine.core.Command) ProjectId(io.spine.test.procman.ProjectId)

Example 13 with ProjectId

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

the class PmMessageDeliveryTestEnv method projectStarted.

public static Event projectStarted() {
    final ProjectId projectId = projectId();
    final TestEventFactory eventFactory = TestEventFactory.newInstance(AnyPacker.pack(projectId), PmMessageDeliveryTestEnv.class);
    final PmProjectStarted msg = PmProjectStarted.newBuilder().setProjectId(projectId).build();
    final Event result = eventFactory.createEvent(msg);
    return result;
}
Also used : TestEventFactory(io.spine.server.command.TestEventFactory) ProjectId(io.spine.test.procman.ProjectId) Event(io.spine.core.Event) PmProjectStarted(io.spine.test.procman.event.PmProjectStarted)

Example 14 with ProjectId

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

the class PmMessageDeliveryTestEnv method cannotStartProject.

public static Rejection cannotStartProject() {
    final ProjectId projectId = projectId();
    final PmStartProject cmdMessage = PmStartProject.newBuilder().setProjectId(projectId).build();
    final Command command = createCommand(cmdMessage);
    final Rejection result = toRejection(throwableWith(projectId), command);
    return result;
}
Also used : Rejections.toRejection(io.spine.core.Rejections.toRejection) Rejection(io.spine.core.Rejection) PmStartProject(io.spine.test.procman.command.PmStartProject) Command(io.spine.core.Command) ProjectId(io.spine.test.procman.ProjectId)

Aggregations

ProjectId (io.spine.test.procman.ProjectId)14 Test (org.junit.Test)9 TestProcessManager (io.spine.server.procman.given.ProcessManagerRepositoryTestEnv.TestProcessManager)6 Command (io.spine.core.Command)4 GivenCommandMessage.addTask (io.spine.server.procman.given.ProcessManagerRepositoryTestEnv.GivenCommandMessage.addTask)4 Task (io.spine.test.procman.Task)4 Rejection (io.spine.core.Rejection)3 CommandEnvelope (io.spine.core.CommandEnvelope)2 Event (io.spine.core.Event)2 RejectionEnvelope (io.spine.core.RejectionEnvelope)2 EntityAlreadyArchived (io.spine.server.entity.rejection.StandardRejections.EntityAlreadyArchived)2 PmArchiveProcess (io.spine.test.procman.command.PmArchiveProcess)2 PmDeleteProcess (io.spine.test.procman.command.PmDeleteProcess)2 PmThrowEntityAlreadyArchived (io.spine.test.procman.command.PmThrowEntityAlreadyArchived)2 PmProjectStarted (io.spine.test.procman.event.PmProjectStarted)2 EventEnvelope (io.spine.core.EventEnvelope)1 Rejections.createRejection (io.spine.core.Rejections.createRejection)1 Rejections.toRejection (io.spine.core.Rejections.toRejection)1 TestEventFactory (io.spine.server.command.TestEventFactory)1 StandardRejections (io.spine.server.entity.rejection.StandardRejections)1