Permalink
Browse files

Extracted the users from the generic app module into new modules

  • Loading branch information...
1 parent 3ab49f2 commit c9556b72775fde9fa6914a8d81006948cc787808 @jettro jettro committed Feb 13, 2012
Showing with 277 additions and 31 deletions.
  1. +13 −3 app/pom.xml
  2. +0 −8 app/src/main/resources/META-INF/spring/command-context.xml
  3. +33 −4 pom.xml
  4. +0 −3 trade-engine/pom.xml
  5. +38 −0 users-api/pom.xml
  6. 0 ...ers-api}/src/main/java/org/axonframework/samples/trader/app/api/user/AuthenticateUserCommand.java
  7. 0 {app → users-api}/src/main/java/org/axonframework/samples/trader/app/api/user/CreateUserCommand.java
  8. 0 {app → users-api}/src/main/java/org/axonframework/samples/trader/app/api/user/UserAccount.java
  9. 0 ...sers-api}/src/main/java/org/axonframework/samples/trader/app/api/user/UserAuthenticatedEvent.java
  10. 0 {app → users-api}/src/main/java/org/axonframework/samples/trader/app/api/user/UserCreatedEvent.java
  11. +55 −0 users-query/pom.xml
  12. 0 {app → users-query}/src/main/java/org/axonframework/samples/trader/app/query/user/UserEntry.java
  13. 0 {app → users-query}/src/main/java/org/axonframework/samples/trader/app/query/user/UserListener.java
  14. 0 ...c/main/java/org/axonframework/samples/trader/app/query/user/repositories/UserQueryRepository.java
  15. +89 −0 users/pom.xml
  16. +2 −3 {app → users}/src/main/java/org/axonframework/samples/trader/app/command/user/User.java
  17. 0 ... → users}/src/main/java/org/axonframework/samples/trader/app/command/user/UserCommandHandler.java
  18. +1 −1 {app → users}/src/main/java/org/axonframework/samples/trader/app/util/DigestUtils.java
  19. +34 −0 users/src/main/resources/META-INF/spring/users-context.xml
  20. +6 −8 ...sers}/src/test/java/org/axonframework/samples/trader/app/command/user/UserCommandHandlerTest.java
  21. +5 −0 web-ui/pom.xml
  22. +1 −1 web-ui/src/main/webapp/WEB-INF/web.xml
View
@@ -34,6 +34,16 @@
<artifactId>axon-trader-trade-engine-api</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axon-trader-users-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axon-trader-users-query</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.axonframework</groupId>
@@ -49,7 +59,7 @@
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
- <version>2.6.5</version>
+ <version>${mongodb.java.version}</version>
</dependency>
<dependency>
@@ -61,7 +71,7 @@
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
- <version>1.0.0.M4</version>
+ <version>${springdata.mongodb.version}</version>
</dependency>
<dependency>
@@ -98,7 +108,7 @@
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
- </dependency>
+ </dependency>
<!-- test dependencies -->
<dependency>
@@ -37,14 +37,6 @@
<axon:snapshotter-trigger event-count-threshold="50" snapshotter-ref="snapshotter"/>
</axon:event-sourcing-repository>
- <axon:event-sourcing-repository id="userRepository"
- aggregate-type="org.axonframework.samples.trader.app.command.user.User"
- cache-ref="ehcache"
- event-bus="eventBus"
- event-store="eventStore">
- <axon:snapshotter-trigger event-count-threshold="50" snapshotter-ref="snapshotter"/>
- </axon:event-sourcing-repository>
-
<axon:event-sourcing-repository id="portfolioRepository"
aggregate-type="org.axonframework.samples.trader.app.command.trading.Portfolio"
cache-ref="ehcache"
View
@@ -26,18 +26,27 @@
<name>Axon Trader Sample Project</name>
<properties>
- <slf4j.version>1.6.1</slf4j.version>
- <spring.version>3.1.0.RC1</spring.version>
- <spring.security.version>3.1.0.RC3</spring.security.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <axon.version>1.3-SNAPSHOT</axon.version>
+ <axon.version>1.3</axon.version>
+
+ <slf4j.version>1.6.1</slf4j.version>
+ <spring.version>3.1.0.RELEASE</spring.version>
+ <spring.security.version>3.1.0.RELEASE</spring.security.version>
+ <junit.version>4.8.1</junit.version>
+ <mockito.version>1.8.5</mockito.version>
+ <hamcrest.version>1.1</hamcrest.version>
+ <mongodb.java.version>2.7.2</mongodb.java.version>
+ <springdata.mongodb.version>1.0.0.RELEASE</springdata.mongodb.version>
</properties>
<modules>
<module>app</module>
<module>web-ui</module>
<module>trade-engine-api</module>
<module>trade-engine</module>
+ <module>users-api</module>
+ <module>users</module>
+ <module>users-query</module>
</modules>
<build>
@@ -130,6 +139,26 @@
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
+ <!-- Testing -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>${mockito.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-all</artifactId>
+ <version>${hamcrest.version}</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</dependencyManagement>
@@ -43,19 +43,16 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
- <version>1.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
- <version>1.1</version>
<scope>test</scope>
</dependency>
</dependencies>
View
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright (c) 2012. Gridshore
+ ~ Licensed 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.axonframework.samples</groupId>
+ <artifactId>axon-trader</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>axon-trader-users-api</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.axonframework</groupId>
+ <artifactId>axon-core</artifactId>
+ <version>${axon.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
View
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright (c) 2012. Gridshore
+ ~ Licensed 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.axonframework.samples</groupId>
+ <artifactId>axon-trader</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>axon-trader-users-query</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axon-trader-users-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mongodb</groupId>
+ <artifactId>mongo-java-driver</artifactId>
+ <version>${mongodb.java.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.data</groupId>
+ <artifactId>spring-data-mongodb</artifactId>
+ <version>${springdata.mongodb.version}</version>
+ </dependency>
+
+ </dependencies>
+</project>
View
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright (c) 2012. Gridshore
+ ~ Licensed 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.axonframework.samples</groupId>
+ <artifactId>axon-trader</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>axon-trader-users</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axon-trader-users-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axon-trader-users-query</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mongodb</groupId>
+ <artifactId>mongo-java-driver</artifactId>
+ <version>${mongodb.java.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.data</groupId>
+ <artifactId>spring-data-mongodb</artifactId>
+ <version>${springdata.mongodb.version}</version>
+ </dependency>
+
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.axonframework</groupId>
+ <artifactId>axon-test</artifactId>
+ <version>${axon.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
@@ -20,8 +20,7 @@
import org.axonframework.eventsourcing.annotation.AbstractAnnotatedAggregateRoot;
import org.axonframework.samples.trader.app.api.user.UserAuthenticatedEvent;
import org.axonframework.samples.trader.app.api.user.UserCreatedEvent;
-
-import static org.axonframework.samples.trader.app.util.DigestUtils.sha1;
+import org.axonframework.samples.trader.app.util.DigestUtils;
/**
* @author Jettro Coenradie
@@ -58,7 +57,7 @@ public void onUserAuthenticated(UserAuthenticatedEvent event) {
}
private String hashOf(char[] password) {
- return sha1(String.valueOf(password));
+ return DigestUtils.sha1(String.valueOf(password));
}
}
@@ -96,7 +96,7 @@ public static String hex(byte[] data, int offset, int length) {
Assert.state(offset < data.length, "The offset must be lower than the length of the data");
Assert.state(length >= 0, "The requested length must be positive");
Assert.state(length <= data.length,
- "The requested length must be equal to or lower than the length of the data");
+ "The requested length must be equal to or lower than the length of the data");
StringBuilder buf = new StringBuilder(length * 2);
for (int i = offset; i < (offset + length); i++) {
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright (c) 2012. Gridshore
+ ~ Licensed 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.
+ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:axon="http://www.axonframework.org/schema/core"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.axonframework.org/schema/core http://www.axonframework.org/schema/axon-core-1.2.xsd">
+
+ <bean class="org.axonframework.samples.trader.app.command.user.UserCommandHandler">
+ <property name="repository" ref="userRepository"/>
+ </bean>
+
+ <axon:event-sourcing-repository id="userRepository"
+ aggregate-type="org.axonframework.samples.trader.app.command.user.User"
+ cache-ref="ehcache"
+ event-bus="eventBus"
+ event-store="eventStore">
+ <axon:snapshotter-trigger event-count-threshold="50" snapshotter-ref="snapshotter"/>
+ </axon:event-sourcing-repository>
+
+</beans>
Oops, something went wrong.

0 comments on commit c9556b7

Please sign in to comment.