EventSourcing: licensing, formatting, some fixes in documentation
Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/3a2f6c94 Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/3a2f6c94 Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/3a2f6c94 Branch: refs/heads/develop Commit: 3a2f6c948faf2c1a10b9f4d8c20b18578a7d99be Parents: 80c2895 Author: Paul Merlin <[email protected]> Authored: Sun Jul 19 18:38:33 2015 +0200 Committer: Paul Merlin <[email protected]> Committed: Sun Jul 19 18:38:33 2015 +0200 ---------------------------------------------------------------------- libraries/eventsourcing-jdbm/dev-status.xml | 2 +- libraries/eventsourcing-rest/dev-status.xml | 2 +- libraries/eventsourcing/dev-status.xml | 2 +- .../eventsourcing/src/docs/eventsourcing.txt | 41 ++++---- .../MemoryApplicationEventStoreService.java | 78 ++++++++------ .../bootstrap/EventsourcingAssembler.java | 45 +++++--- .../application/ApplicationEventTest.java | 102 ++++++++++--------- .../src/docs/tutorials/howto-build-system.txt | 4 +- manual/src/docs/userguide/libraries.txt | 8 -- 9 files changed, 159 insertions(+), 125 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing-jdbm/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/eventsourcing-jdbm/dev-status.xml b/libraries/eventsourcing-jdbm/dev-status.xml index 73eb6db..5adebd7 100644 --- a/libraries/eventsourcing-jdbm/dev-status.xml +++ b/libraries/eventsourcing-jdbm/dev-status.xml @@ -24,7 +24,7 @@ <codebase>beta</codebase> <!-- none, brief, good, complete --> - <documentation>none</documentation> + <documentation>brief</documentation> <!-- none, some, good, complete --> <unittests>some</unittests> http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing-rest/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/eventsourcing-rest/dev-status.xml b/libraries/eventsourcing-rest/dev-status.xml index 73eb6db..5adebd7 100644 --- a/libraries/eventsourcing-rest/dev-status.xml +++ b/libraries/eventsourcing-rest/dev-status.xml @@ -24,7 +24,7 @@ <codebase>beta</codebase> <!-- none, brief, good, complete --> - <documentation>none</documentation> + <documentation>brief</documentation> <!-- none, some, good, complete --> <unittests>some</unittests> http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/eventsourcing/dev-status.xml b/libraries/eventsourcing/dev-status.xml index 73eb6db..5adebd7 100644 --- a/libraries/eventsourcing/dev-status.xml +++ b/libraries/eventsourcing/dev-status.xml @@ -24,7 +24,7 @@ <codebase>beta</codebase> <!-- none, brief, good, complete --> - <documentation>none</documentation> + <documentation>brief</documentation> <!-- none, some, good, complete --> <unittests>some</unittests> http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing/src/docs/eventsourcing.txt ---------------------------------------------------------------------- diff --git a/libraries/eventsourcing/src/docs/eventsourcing.txt b/libraries/eventsourcing/src/docs/eventsourcing.txt index d6a6263..6936ea5 100644 --- a/libraries/eventsourcing/src/docs/eventsourcing.txt +++ b/libraries/eventsourcing/src/docs/eventsourcing.txt @@ -25,26 +25,27 @@ source=libraries/eventsourcing/dev-status.xml -------------- -The Event Sourcing Library supports generating, storing and replying two types of events: application-events and domain-events. +The Event Sourcing Library supports generating, storing and replaying two types of events: application-events and domain-events. -Application events are bound to usecase and are produced by execution of specific methods (ones with ApplicationEvent as their first parameter). -Each application event holds information about usecase, method name and json serialized values of method parameters. +Application events are bound to Usecase and are produced by execution of specific methods (ones with `ApplicationEvent` as their first parameter). +Each application event holds information about Usecase, method name and JSON serialized values of method parameters. -Domain events are bound to entity instances and are produced by execution of annotated (see @DomainEvent) method that belongs to EntityComposite. -Each domain event (see DomainEventValue) holds information about entity type, identity, method name and json serialized values of method parameters. +Domain events are bound to entity instances and are produced by execution of annotated (see `@DomainEvent`) methods that belongs to `EntityComposite`. +Each domain event (see `DomainEventValue`) holds information about entity type, identity, method name and JSON serialized values of method parameters. -Both application and domain events are captured during UnitOfWork lifetime and are stored in event store after successfully completed UnitOfWork as collection together (see UnitOfWorkDomainEventsValue and TransactionApplicationEvents). +Both application and domain events are captured during `UnitOfWork` lifetime and are stored in `EventStore` after successfully completed `UnitOfWork` as collection together (see `UnitOfWorkDomainEventsValue` and `TransactionApplicationEvents`). -There is support for replying events. When events are replied the same code is executed but no new events are generated. +There is support for replaying events. +When events are replayed the same code is executed but no new events are generated. -There are helper classes that enables a service to easily track event feed, and -for domain events there is event router that allow specify specification->receiver routes. +There are helper classes that enables a service to easily track events feed, and for domain events there is `EventRouter` that allow to specify specification->receiver routes. include::../../build/docs/buildinfo/artifact.txt[] *JDBM backed store* -Event store supports indexed and streamed access to events feed. There is in-memory and JDBM backed implementation. +EventStore supports indexed and streamed access to events feed. +There is in-memory and JDBM backed implementations. [devstatus] -------------- @@ -55,7 +56,7 @@ include::../../../eventsourcing-jdbm/build/docs/buildinfo/artifact.txt[] *REST access* -For remote access to feed there is eventsourcing-rest library that exposes events as Atom feeds. +For remote access to feed there is `eventsourcing-rest` library that exposes events as Atom feeds. [devstatus] -------------- @@ -75,21 +76,23 @@ source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/appl tag=assemblyAE ---- -configure application events store: +Configure application events store: [snippet,java] ---- source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java tag=storeAE ---- -Actual method on composite which execution emits application event. First parameter is null on "normal" execution. If it is not null, then the method call is a replay of previously created events. +Actual method on composite which execution emits application event. +First parameter is `null` on "normal" execution. +If it is not `null`, then the method call is a replay of previously created events. [snippet,java] ---- source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java tag=methodAE ---- -to enable execution capturing, you have to configure composite with concern: +To enable execution capturing, you have to configure composite with concern: [snippet,java] ---- source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java @@ -106,7 +109,7 @@ source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/doma tag=assemblyDE ---- -configure domain events store: +Configure domain events store: [snippet,java] ---- @@ -114,19 +117,19 @@ source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/doma tag=storeDE ---- -annotate your entity state changing methods. Event methods may only change state. They may not fail or thrown exceptions: +Annotate your entity state changing methods. +Event methods may only change state. +They may not fail or thrown exceptions: [snippet,java] ---- source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java tag=methodDE ---- -to enable method execution capturing, you have to configure entity with concern: +To enable method execution capturing, you have to configure entity with concern: [snippet,java] ---- source=libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/domain/DomainEventTest.java tag=concernDE ---- - - http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java ---------------------------------------------------------------------- diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java index 698607f..cce6cf4 100644 --- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java +++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/application/source/memory/MemoryApplicationEventStoreService.java @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.qi4j.library.eventsourcing.application.source.memory; import org.qi4j.api.activation.Activators; @@ -14,89 +32,89 @@ import org.qi4j.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue; import java.io.IOException; import java.util.*; - /** * In-Memory ApplicationEventStore. Mainly used for testing. */ -@Mixins(MemoryApplicationEventStoreService.MemoryStoreMixin.class) -@Activators(ApplicationEventStoreActivation.Activator.class) +@Mixins( MemoryApplicationEventStoreService.MemoryStoreMixin.class ) +@Activators( ApplicationEventStoreActivation.Activator.class ) public interface MemoryApplicationEventStoreService - extends ApplicationEventSource, ApplicationEventStore, ApplicationEventStream, ApplicationEventStoreActivation, ServiceComposite + extends ApplicationEventSource, ApplicationEventStore, ApplicationEventStream, ApplicationEventStoreActivation, ServiceComposite { - abstract class MemoryStoreMixin - extends AbstractApplicationEventStoreMixin - implements ApplicationEventSource, ApplicationEventStoreActivation + extends AbstractApplicationEventStoreMixin + implements ApplicationEventSource, ApplicationEventStoreActivation { - // This list holds all transactions private LinkedList<TransactionApplicationEvents> store = new LinkedList<TransactionApplicationEvents>(); @Override - public Input<TransactionApplicationEvents, IOException> transactionsAfter(final long afterTimestamp, final long maxTransactions) + public Input<TransactionApplicationEvents, IOException> transactionsAfter( final long afterTimestamp, final long maxTransactions ) { return new Input<TransactionApplicationEvents, IOException>() { @Override - public <ReceiverThrowableType extends Throwable> void transferTo(Output<? super TransactionApplicationEvents, ReceiverThrowableType> output) throws IOException, ReceiverThrowableType + public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super TransactionApplicationEvents, ReceiverThrowableType> output ) + throws IOException, ReceiverThrowableType { // Lock store first lock.lock(); try { - output.receiveFrom(new Sender<TransactionApplicationEvents, IOException>() + output.receiveFrom( new Sender<TransactionApplicationEvents, IOException>() { @Override - public <ReceiverThrowableType extends Throwable> void sendTo(Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver) throws ReceiverThrowableType, IOException + public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver ) + throws ReceiverThrowableType, IOException { Iterator<TransactionApplicationEvents> iterator = store.iterator(); long count = 0; - while (iterator.hasNext() && count < maxTransactions) + while( iterator.hasNext() && count < maxTransactions ) { TransactionApplicationEvents next = iterator.next(); - if (next.timestamp().get() > afterTimestamp) + if( next.timestamp().get() > afterTimestamp ) { - receiver.receive(next); + receiver.receive( next ); count++; } } } }); - } finally + } + finally { lock.unlock(); } } }; - } @Override - public Input<TransactionApplicationEvents, IOException> transactionsBefore(final long beforeTimestamp, final long maxTransactions) + public Input<TransactionApplicationEvents, IOException> transactionsBefore( final long beforeTimestamp, final long maxTransactions ) { return new Input<TransactionApplicationEvents, IOException>() { @Override - public <ReceiverThrowableType extends Throwable> void transferTo(Output<? super TransactionApplicationEvents, ReceiverThrowableType> output) throws IOException, ReceiverThrowableType + public <ReceiverThrowableType extends Throwable> void transferTo( Output<? super TransactionApplicationEvents, ReceiverThrowableType> output ) + throws IOException, ReceiverThrowableType { // Lock store first lock.lock(); try { - output.receiveFrom(new Sender<TransactionApplicationEvents, IOException>() + output.receiveFrom( new Sender<TransactionApplicationEvents, IOException>() { @Override - public <ReceiverThrowableType extends Throwable> void sendTo(Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver) throws ReceiverThrowableType, IOException + public <ReceiverThrowableType extends Throwable> void sendTo( Receiver<? super TransactionApplicationEvents, ReceiverThrowableType> receiver ) + throws ReceiverThrowableType, IOException { - ListIterator<TransactionApplicationEvents> iterator = store.listIterator(); - while (iterator.hasNext()) + while( iterator.hasNext() ) { TransactionApplicationEvents next = iterator.next(); - if (next.timestamp().get() >= beforeTimestamp) + if( next.timestamp().get() >= beforeTimestamp ) { break; } @@ -104,29 +122,27 @@ public interface MemoryApplicationEventStoreService long count = 0; - while (iterator.hasPrevious() && count < maxTransactions) + while( iterator.hasPrevious() && count < maxTransactions ) { TransactionApplicationEvents next = iterator.previous(); - receiver.receive(next); + receiver.receive( next ); count++; } } }); - } finally + } + finally { lock.unlock(); } } }; - } @Override - protected void storeEvents(TransactionApplicationEvents transactionDomain) throws IOException + protected void storeEvents( TransactionApplicationEvents transactionDomain ) throws IOException { store.add(transactionDomain); } - } - } http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java ---------------------------------------------------------------------- diff --git a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java index 26d1af0..228d6de 100644 --- a/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java +++ b/libraries/eventsourcing/src/main/java/org/qi4j/library/eventsourcing/bootstrap/EventsourcingAssembler.java @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.qi4j.library.eventsourcing.bootstrap; import org.qi4j.bootstrap.Assemblers; @@ -12,12 +30,9 @@ import org.qi4j.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue; import org.qi4j.library.eventsourcing.domain.factory.CurrentUserUoWPrincipal; import org.qi4j.library.eventsourcing.domain.factory.DomainEventFactoryService; - public class EventsourcingAssembler - extends Assemblers.Visibility<EventsourcingAssembler> + extends Assemblers.Visibility<EventsourcingAssembler> { - - private boolean domainEvents; private boolean applicationEvents; @@ -41,28 +56,26 @@ public class EventsourcingAssembler return this; } - @Override public void assemble(ModuleAssembly module) throws AssemblyException { - - if (domainEvents) + if( domainEvents ) { - module.values(DomainEventValue.class, UnitOfWorkDomainEventsValue.class); - module.services(DomainEventFactoryService.class).visibleIn(visibility()); + module.values( DomainEventValue.class, UnitOfWorkDomainEventsValue.class ); + module.services( DomainEventFactoryService.class).visibleIn(visibility() ); } - if (applicationEvents) + if( applicationEvents ) { - module.values(ApplicationEvent.class, TransactionApplicationEvents.class); - module.services(ApplicationEventFactoryService.class).visibleIn(visibility()); + module.values( ApplicationEvent.class, TransactionApplicationEvents.class ); + module.services( ApplicationEventFactoryService.class ).visibleIn( visibility() ); } - if (uowPrincipal) + if( uowPrincipal ) { - module.importedServices(CurrentUserUoWPrincipal.class).importedBy(ImportedServiceDeclaration.NEW_OBJECT); - module.objects(CurrentUserUoWPrincipal.class); + module.importedServices( CurrentUserUoWPrincipal.class ) + .importedBy( ImportedServiceDeclaration.NEW_OBJECT ); + module.objects( CurrentUserUoWPrincipal.class ); } - } } http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java ---------------------------------------------------------------------- diff --git a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java index 480b7f3..f566db8 100644 --- a/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java +++ b/libraries/eventsourcing/src/test/java/org/qi4j/library/eventsourcing/application/ApplicationEventTest.java @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.qi4j.library.eventsourcing.application; import org.junit.Test; @@ -43,17 +61,14 @@ import static org.junit.Assert.assertEquals; * Subscription is not stored in domain model but is available via application events feed. */ public class ApplicationEventTest - extends AbstractQi4jTest + extends AbstractQi4jTest { - @Service ApplicationEventSource eventSource; - @Override - public void assemble(ModuleAssembly module) throws AssemblyException + public void assemble( ModuleAssembly module ) throws AssemblyException { - // START SNIPPET: assemblyAE new EventsourcingAssembler() .withApplicationEvents() @@ -62,16 +77,16 @@ public class ApplicationEventTest // END SNIPPET: assemblyAE // START SNIPPET: storeAE - module.services(MemoryApplicationEventStoreService.class); + module.services( MemoryApplicationEventStoreService.class ); // END SNIPPET: storeAE - new EntityTestAssembler().assemble(module); + new EntityTestAssembler().assemble( module ); // START SNIPPET: concernAE - module.transients(Users.class).withConcerns(ApplicationEventCreationConcern.class); + module.transients( Users.class ).withConcerns( ApplicationEventCreationConcern.class ); // END SNIPPET: concernAE - module.entities(UserEntity.class); + module.entities( UserEntity.class ); } @@ -79,83 +94,84 @@ public class ApplicationEventTest @Test public void testApplicationEvent() throws UnitOfWorkCompletionException, IOException { - Users users = module.newTransient(Users.class); + Users users = module.newTransient( Users.class ); Principal administratorPrincipal = new Principal() { + @Override public String getName() { return "administrator"; } }; - UnitOfWork uow1 = module.newUnitOfWork(UsecaseBuilder.newUsecase("User signup")); - uow1.setMetaInfo(administratorPrincipal); - users.signup(null, "user1", Arrays.asList("news1", "news2")); + UnitOfWork uow1 = module.newUnitOfWork( UsecaseBuilder.newUsecase( "User signup" ) ); + uow1.setMetaInfo( administratorPrincipal ); + users.signup( null, "user1", Arrays.asList( "news1", "news2" ) ); uow1.complete(); UnitOfWork uow2 = module.newUnitOfWork(); - uow2.setMetaInfo(administratorPrincipal); - users.signup(null, "user2", Collections.EMPTY_LIST); + uow2.setMetaInfo( administratorPrincipal ); + users.signup( null, "user2", Collections.EMPTY_LIST ); uow2.complete(); UnitOfWork uow3 = module.newUnitOfWork(); - uow3.setMetaInfo(administratorPrincipal); - users.signup(null, "user3", Collections.singletonList("news1")); + uow3.setMetaInfo( administratorPrincipal ); + users.signup( null, "user3", Collections.singletonList( "news1" ) ); uow3.complete(); // receive events from uow2 and later forwards EventsInbox afterInbox = new EventsInbox(); - eventSource.transactionsAfter(uow2.currentTime() - 1, Integer.MAX_VALUE).transferTo(afterInbox); + eventSource.transactionsAfter( uow2.currentTime() - 1, Integer.MAX_VALUE ).transferTo( afterInbox ); - assertEquals(2, afterInbox.getEvents().size()); + assertEquals( 2, afterInbox.getEvents().size() ); - ApplicationEvent signupEvent2 = afterInbox.getEvents().get(0).events().get().get(0); + ApplicationEvent signupEvent2 = afterInbox.getEvents().get( 0 ).events().get().get( 0 ); - assertEquals("signup", signupEvent2.name().get()); - assertEquals("user2", ApplicationEventParameters.getParameter(signupEvent2, "param1")); - assertEquals("[]", ApplicationEventParameters.getParameter(signupEvent2, "param2")); + assertEquals( "signup", signupEvent2.name().get() ); + assertEquals( "user2", ApplicationEventParameters.getParameter( signupEvent2, "param1" ) ); + assertEquals( "[]", ApplicationEventParameters.getParameter( signupEvent2, "param2" ) ); // receive events from uow2 backwards EventsInbox beforeInbox = new EventsInbox(); - eventSource.transactionsBefore(uow3.currentTime(), Integer.MAX_VALUE).transferTo(beforeInbox); + eventSource.transactionsBefore( uow3.currentTime(), Integer.MAX_VALUE ).transferTo( beforeInbox ); - assertEquals(2, beforeInbox.getEvents().size()); + assertEquals( 2, beforeInbox.getEvents().size() ); - ApplicationEvent signupEvent1 = beforeInbox.getEvents().get(1).events().get().get(0); + ApplicationEvent signupEvent1 = beforeInbox.getEvents().get( 1 ).events().get().get( 0 ); - assertEquals("signup", signupEvent1.name().get()); - assertEquals("user1", ApplicationEventParameters.getParameter(signupEvent1, "param1")); - assertEquals("[\"news1\",\"news2\"]", ApplicationEventParameters.getParameter(signupEvent1, "param2")); + assertEquals( "signup", signupEvent1.name().get()); + assertEquals( "user1", ApplicationEventParameters.getParameter( signupEvent1, "param1" ) ); + assertEquals( "[\"news1\",\"news2\"]", ApplicationEventParameters.getParameter( signupEvent1, "param2" ) ); } static class EventsInbox implements Output<TransactionApplicationEvents, RuntimeException> { - private List<TransactionApplicationEvents> events = new LinkedList<>(); @Override - public <SenderThrowableType extends Throwable> void receiveFrom(Sender<? extends TransactionApplicationEvents, SenderThrowableType> sender) throws RuntimeException, SenderThrowableType + public <SenderThrowableType extends Throwable> void receiveFrom( Sender<? extends TransactionApplicationEvents, SenderThrowableType> sender ) + throws RuntimeException, SenderThrowableType { try { - sender.sendTo(new Receiver<TransactionApplicationEvents, Throwable>() + sender.sendTo( new Receiver<TransactionApplicationEvents, Throwable>() { @Override - public void receive(TransactionApplicationEvents item) throws Throwable + public void receive( TransactionApplicationEvents item ) throws Throwable { events.add(item); } }); - } catch (Throwable throwable) + } + catch( Throwable throwable ) { throwable.printStackTrace(); } - } public List<TransactionApplicationEvents> getEvents() @@ -165,30 +181,27 @@ public class ApplicationEventTest } // START SNIPPET: methodAE - @Mixins(Users.Mixin.class) + @Mixins( Users.Mixin.class ) public interface Users extends TransientComposite { - - void signup(@Optional ApplicationEvent evt, String username, List<String> mailinglists); + void signup( @Optional ApplicationEvent evt, String username, List<String> mailinglists ); // END SNIPPET: methodAE abstract class Mixin implements Users { - @Structure UnitOfWorkFactory uowFactory; @Override - public void signup(ApplicationEvent evt, String username, List<String> mailinglists) + public void signup( ApplicationEvent evt, String username, List<String> mailinglists ) { if (evt == null) { UnitOfWork uow = uowFactory.currentUnitOfWork(); - EntityBuilder<UserEntity> builder = uow.newEntityBuilder(UserEntity.class); - builder.instance().username().set(username); + EntityBuilder<UserEntity> builder = uow.newEntityBuilder( UserEntity.class ); + builder.instance().username().set( username ); builder.newInstance(); - } } } @@ -197,10 +210,7 @@ public class ApplicationEventTest public interface UserEntity extends EntityComposite { - @UseDefaults Property<String> username(); - } - } http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/manual/src/docs/tutorials/howto-build-system.txt ---------------------------------------------------------------------- diff --git a/manual/src/docs/tutorials/howto-build-system.txt b/manual/src/docs/tutorials/howto-build-system.txt index 2fa78b5..f5e3a2b 100644 --- a/manual/src/docs/tutorials/howto-build-system.txt +++ b/manual/src/docs/tutorials/howto-build-system.txt @@ -131,11 +131,11 @@ If a +version+ property is not defined, the build system will refuse to make a r == Tests == +NOTE: See the https://builds.apache.org/view/S-Z/view/Zest/[Zest⢠Continuous Integration] for current tests results + Unit and integration tests are located near the code under test. You'll find theses tests across the whole SDK. -NOTE: See the https://builds.apache.org/view/S-Z/view/Zest/[Zest⢠Continuous Integration] for current tests results - === Unit tests requiring external services === Among unit tests, some require an external service to be run. http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/3a2f6c94/manual/src/docs/userguide/libraries.txt ---------------------------------------------------------------------- diff --git a/manual/src/docs/userguide/libraries.txt b/manual/src/docs/userguide/libraries.txt index 7157e37..b13ac39 100644 --- a/manual/src/docs/userguide/libraries.txt +++ b/manual/src/docs/userguide/libraries.txt @@ -63,14 +63,6 @@ include::../../../../libraries/eventsourcing/src/docs/eventsourcing.txt[] :leveloffset: 2 -include::../../../../libraries/eventsourcing-jdbm/src/docs/eventsourcing-jdbm.txt[] - -:leveloffset: 2 - -include::../../../../libraries/eventsourcing-rest/src/docs/eventsourcing-rest.txt[] - -:leveloffset: 2 - include::../../../../libraries/fileconfig/src/docs/fileconfig.txt[] :leveloffset: 2
