This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
h1alexbel
committed
Jun 1, 2023
1 parent
f387955
commit 39372ce
Showing
16 changed files
with
401 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
architect: | ||
- h1alexbel | ||
docker: | ||
image: l3r8y/rultor-image:1.0.2 | ||
image: l3r8y/rultor-image:1.0.3 | ||
assets: | ||
settings.xml: eo-cqrs/eo-cqrs-secrets#assets/settings.xml | ||
secring.gpg: eo-cqrs/eo-cqrs-secrets#assets/secring.gpg | ||
pubring.gpg: eo-cqrs/eo-cqrs-secrets#assets/pubring.gpg | ||
merge: | ||
script: | ||
- "mvn -version" | ||
- "mvn clean install --errors --batch-mode" | ||
- "mvn clean install --errors --batch-mode" | ||
release: | ||
pre: false | ||
sensitive: | ||
- settings.xml | ||
script: |- | ||
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1 | ||
mvn versions:set "-DnewVersion=${tag}" | ||
git commit -am "${tag}" | ||
mvn clean deploy -Prelease --errors --settings ../settings.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
MIT License | ||
Copyright (c) 2023 Aliaksei Bialiauski, EO-CQRS | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
--> | ||
<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> | ||
<groupId>io.github.eo-cqrs</groupId> | ||
<artifactId>events</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>events</name> | ||
<properties> | ||
<project.java.version>17</project.java.version> | ||
<maven.compiler.source>${project.java.version}</maven.compiler.source> | ||
<maven.compiler.target>${project.java.version}</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<junit.version>5.9.3</junit.version> | ||
<hamcrest.version>2.2</hamcrest.version> | ||
<commons-lang3.version>3.12.0</commons-lang3.version> | ||
<maven-surefire-plugin.version>3.1.0</maven-surefire-plugin.version> | ||
<mockito-core.version>5.3.1</mockito-core.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>1.18.28</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>3.24.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.rnorth.duct-tape</groupId> | ||
<artifactId>duct-tape</artifactId> | ||
<version>1.0.8</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>2.0.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest</artifactId> | ||
<version>${hamcrest.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<version>${mockito-core.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${maven-surefire-plugin.version}</version> | ||
<configuration> | ||
<includes> | ||
<include>**/*Spec.*</include> | ||
<include>**/*Test.*</include> | ||
</includes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* @author Aliaksei Bialiauski () | ||
* @since 0.0.0 | ||
*/ | ||
public class Entry { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.jupiter.api.Test; | ||
import prep.ChangeUsername; | ||
import prep.EnUser; | ||
import prep.User; | ||
|
||
/** | ||
* Test case for {@link ChangeUsername} | ||
* | ||
* @author Aliaksei Bialiauski ([email protected]) | ||
* @since 0.0.0 | ||
*/ | ||
final class ChangeUsernameTest { | ||
|
||
@Test | ||
void changesUsername() { | ||
final User user = new EnUser(1, "hialexbel"); | ||
final String name = "h1alexbel"; | ||
MatcherAssert.assertThat( | ||
"Name has changed", | ||
new ChangeUsername(name) | ||
.submitTo(user) | ||
.username(), | ||
Matchers.equalTo(name) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package prep; | ||
|
||
import io.github.eocqrs.events.Event; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
/** | ||
* @author Aliaksei Bialiauski ([email protected]) | ||
* @since 0.0.0 | ||
*/ | ||
@RequiredArgsConstructor | ||
public final class ChangeUsername implements Event<User> { | ||
|
||
private final String name; | ||
|
||
@Override | ||
public User submitTo(final User user) { | ||
return new EnUser(user.id(), this.name); | ||
} | ||
|
||
@Override | ||
public String payload() { | ||
return "new username will be: %s" | ||
.formatted( | ||
this.name | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package prep; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
/** | ||
* @author Aliaksei Bialiauski ([email protected]) | ||
* @since 0.0.0 | ||
*/ | ||
@RequiredArgsConstructor | ||
public final class EnUser implements User { | ||
|
||
private final int id; | ||
private final String username; | ||
|
||
@Override | ||
public int id() { | ||
return this.id; | ||
} | ||
|
||
@Override | ||
public String username() { | ||
return this.username; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package prep; | ||
|
||
import io.github.eocqrs.events.Resource; | ||
|
||
/** | ||
* @author Aliaksei Bialiauski ([email protected]) | ||
* @since 0.0.0 | ||
*/ | ||
public interface User extends Resource<User> { | ||
|
||
int id(); | ||
|
||
String username(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package prep; | ||
|
||
import io.github.eocqrs.events.Event; | ||
import io.github.eocqrs.events.EventChain; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
/** | ||
* @author Aliaksei Bialiauski ([email protected]) | ||
* @since 0.0.0 | ||
*/ | ||
@RequiredArgsConstructor | ||
public final class UserChain implements EventChain<User> { | ||
|
||
private final Set<Event<User>> events; | ||
|
||
@Override | ||
public Set<Event<User>> value() { | ||
return Collections.unmodifiableSet(this.events); | ||
} | ||
|
||
@Override | ||
public EventChain<User> append(final Event<User> event) { | ||
this.events.add(event); | ||
return new UserChain(this.events); | ||
} | ||
} |
Oops, something went wrong.
39372ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
6-49a65616
discovered insrc/test/java/io/github/eocqrs/qce/EventTest.java
) and submitted as #38. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.