Search in sources :

Example 1 with ProjectCreationRepository

use of io.spine.server.bc.given.ProjectCreationRepository in project core-java by SpineEventEngine.

the class BoundedContextTest method sameStateRepositories.

/**
 * Returns all combinations of repositories that manage entities of the same state.
 *
 * <p>To check whether a {@link io.spine.server.BoundedContext} really throws
 * an {@code IllegalStateException} upon an attempt to register a repository that manages an
 * entity of a state that a registered entity repository is already managing, all combinations
 * of entities that take state as a type parameter need to be checked.
 *
 * <p>This method returns a stream of pairs of all such combinations, which is a Cartesian
 * product of:
 * <ul>
 *     <li>{@linkplain io.spine.server.procman.ProcessManagerRepository process manager};
 *     <li>{@linkplain io.spine.server.aggregate.AggregateRepository aggregate};
 *     <li>{@linkplain io.spine.server.projection.ProjectionRepository projection}.
 * </ul>
 * All of the returned repositories manage entities of the same state type.
 */
@SuppressWarnings("unused")
private static /* A method source. */
Stream<Arguments> sameStateRepositories() {
    Set<Repository<?, ?>> repositories = ImmutableSet.of(DefaultRepository.of(ProjectAggregate.class), DefaultRepository.of(ProjectProjection.class), new ProjectCreationRepository());
    Set<Repository<?, ?>> sameStateRepositories = ImmutableSet.of(DefaultRepository.of(AnotherProjectAggregate.class), DefaultRepository.of(FinishedProjectProjection.class), DefaultRepository.of(ProjectRemovalProcman.class));
    var cartesianProduct = Sets.cartesianProduct(repositories, sameStateRepositories);
    var result = cartesianProduct.stream().map(repos -> Arguments.of(repos.get(0), repos.get(1)));
    return result;
}
Also used : AnotherProjectAggregate(io.spine.server.bc.given.AnotherProjectAggregate) ProjectAggregate(io.spine.server.bc.given.ProjectAggregate) Repository(io.spine.server.entity.Repository) SecretProjectRepository(io.spine.server.bc.given.SecretProjectRepository) ProjectCreationRepository(io.spine.server.bc.given.ProjectCreationRepository) ProjectCreationRepository(io.spine.server.bc.given.ProjectCreationRepository) ProjectRemovalProcman(io.spine.server.bc.given.ProjectRemovalProcman) FinishedProjectProjection(io.spine.server.bc.given.FinishedProjectProjection) ProjectProjection(io.spine.server.bc.given.ProjectProjection) FinishedProjectProjection(io.spine.server.bc.given.FinishedProjectProjection) AnotherProjectAggregate(io.spine.server.bc.given.AnotherProjectAggregate)

Aggregations

AnotherProjectAggregate (io.spine.server.bc.given.AnotherProjectAggregate)1 FinishedProjectProjection (io.spine.server.bc.given.FinishedProjectProjection)1 ProjectAggregate (io.spine.server.bc.given.ProjectAggregate)1 ProjectCreationRepository (io.spine.server.bc.given.ProjectCreationRepository)1 ProjectProjection (io.spine.server.bc.given.ProjectProjection)1 ProjectRemovalProcman (io.spine.server.bc.given.ProjectRemovalProcman)1 SecretProjectRepository (io.spine.server.bc.given.SecretProjectRepository)1 Repository (io.spine.server.entity.Repository)1