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;
}
Aggregations