@Test void testEventIsPublishedThroughoutRecursiveHierarchy() { AggregateModel<SomeRecursiveEntity> inspector = AnnotatedAggregateMetaModelFactory.inspectAggregate(SomeRecursiveEntity.class); String rootId = "root"; String childId1 = "child1"; String childId2 = "child2"; String childId3 = "child3"; String childId4 = "child4"; SomeRecursiveEntity root = new SomeRecursiveEntity(LinkedList::new, null, rootId); assertEquals(0, root.children.size()); inspector.publish(asEventMessage(new CreateChild(rootId, childId1)), root); assertEquals(1, root.children.size()); SomeRecursiveEntity child1 = root.getChild(childId1); assertNotNull(child1); assertEquals(0, child1.children.size()); inspector.publish(asEventMessage(new CreateChild(childId1, childId2)), root); inspector.publish(asEventMessage(new CreateChild(childId1, childId3)), root); assertEquals(2, child1.children.size()); SomeRecursiveEntity child2 = child1.getChild(childId2); assertNotNull(child2); assertEquals(0, child2.children.size()); SomeRecursiveEntity child3 = child1.getChild(childId3); assertNotNull(child3); assertEquals(0, child3.children.size()); inspector.publish(asEventMessage(new CreateChild(childId3, childId4)), root); assertEquals(1, child3.children.size()); SomeRecursiveEntity child4 = child3.getChild(childId4); assertNotNull(child4); assertEquals(0, child4.children.size()); }
public static <T> AggregateModel<T> inspectAggregate(Class<T> aggregateType) { return new AnnotatedAggregateMetaModelFactory().createModel(aggregateType); }
AnnotatedAggregateMetaModelFactory implements AggregateMetaModelFactory { public static <T> AggregateModel<T> inspectAggregate(Class<T> aggregateType) { return new AnnotatedAggregateMetaModelFactory().createModel(aggregateType); } }
AnnotatedAggregateMetaModelFactory implements AggregateMetaModelFactory { public static <T> AggregateModel<T> inspectAggregate(Class<T> aggregateType) { return new AnnotatedAggregateMetaModelFactory().createModel(aggregateType); } AnnotatedAggregateMetaModelFactory();  AnnotatedAggregateMetaModelFactory(ParameterResolverFactory parameterResolverFactory);  AnnotatedAggregateMetaModelFactory(ParameterResolverFactory parameterResolverFactory,
                                              HandlerDefinition handlerDefinition); }
AnnotatedAggregateMetaModelFactory implements AggregateMetaModelFactory { public static <T> AggregateModel<T> inspectAggregate(Class<T> aggregateType) { return new AnnotatedAggregateMetaModelFactory().createModel(aggregateType); } AnnotatedAggregateMetaModelFactory();  AnnotatedAggregateMetaModelFactory(ParameterResolverFactory parameterResolverFactory);  AnnotatedAggregateMetaModelFactory(ParameterResolverFactory parameterResolverFactory,
                                              HandlerDefinition handlerDefinition); static AggregateModel<T> inspectAggregate(Class<T> aggregateType); static AggregateModel<T> inspectAggregate(Class<T> aggregateType, Set<Class<? extends T>> subtypes); static AggregateModel<T> inspectAggregate(Class<T> aggregateType,
                                                         ParameterResolverFactory parameterResolverFactory); static AggregateModel<T> inspectAggregate(Class<T> aggregateType,
                                                         ParameterResolverFactory parameterResolverFactory,
                                                         HandlerDefinition handlerDefinition); static AggregateModel<T> inspectAggregate(Class<T> aggregateType,
                                                         ParameterResolverFactory parameterResolverFactory,
                                                         HandlerDefinition handlerDefinition,
                                                         Set<Class<? extends T>> subtypes); @Override AnnotatedAggregateModel<T> createModel(Class<? extends T> aggregateType,
                                                      Set<Class<? extends T>> subtypes); }
AnnotatedAggregateMetaModelFactory implements AggregateMetaModelFactory { public static <T> AggregateModel<T> inspectAggregate(Class<T> aggregateType) { return new AnnotatedAggregateMetaModelFactory().createModel(aggregateType); } AnnotatedAggregateMetaModelFactory();  AnnotatedAggregateMetaModelFactory(ParameterResolverFactory parameterResolverFactory);  AnnotatedAggregateMetaModelFactory(ParameterResolverFactory parameterResolverFactory,
                                              HandlerDefinition handlerDefinition); static AggregateModel<T> inspectAggregate(Class<T> aggregateType); static AggregateModel<T> inspectAggregate(Class<T> aggregateType, Set<Class<? extends T>> subtypes); static AggregateModel<T> inspectAggregate(Class<T> aggregateType,
                                                         ParameterResolverFactory parameterResolverFactory); static AggregateModel<T> inspectAggregate(Class<T> aggregateType,
                                                         ParameterResolverFactory parameterResolverFactory,
                                                         HandlerDefinition handlerDefinition); static AggregateModel<T> inspectAggregate(Class<T> aggregateType,
                                                         ParameterResolverFactory parameterResolverFactory,
                                                         HandlerDefinition handlerDefinition,
                                                         Set<Class<? extends T>> subtypes); @Override AnnotatedAggregateModel<T> createModel(Class<? extends T> aggregateType,
                                                      Set<Class<? extends T>> subtypes);  }