Skip to content

Commit

Permalink
Introduce 3pigs subpackege
Browse files Browse the repository at this point in the history
  • Loading branch information
mat3e committed Jun 25, 2022
1 parent 5943877 commit 57e13f5
Show file tree
Hide file tree
Showing 47 changed files with 212 additions and 205 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.mat3e.fairytales.app;
package io.github.mat3e.fairytales.pigs3.app;

import io.github.mat3e.ddd.event.DomainEventPublisher;
import io.github.mat3e.fairytales.model.HouseRepository;
import io.github.mat3e.fairytales.model.event.HouseEvent;
import io.github.mat3e.fairytales.pigs3.model.HouseRepository;
import io.github.mat3e.fairytales.pigs3.model.event.HouseEvent;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.mat3e.fairytales.app;
package io.github.mat3e.fairytales.pigs3.app;

import io.github.mat3e.fairytales.model.vo.HouseId;
import io.github.mat3e.fairytales.model.vo.Material;
import io.github.mat3e.fairytales.model.vo.Pig;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId;
import io.github.mat3e.fairytales.pigs3.model.vo.Material;
import io.github.mat3e.fairytales.pigs3.model.vo.Pig;
import org.jetbrains.annotations.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.repository.query.Query;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.github.mat3e.fairytales.in.console;
package io.github.mat3e.fairytales.pigs3.in.console;

import io.github.mat3e.fairytales.app.ThreePigsCommandHandler;
import io.github.mat3e.fairytales.app.command.BlowDown;
import io.github.mat3e.fairytales.app.command.BuildHouse;
import io.github.mat3e.fairytales.model.vo.Pig;
import io.github.mat3e.fairytales.pigs3.app.ThreePigsCommandHandler;
import io.github.mat3e.fairytales.pigs3.app.command.BlowDown;
import io.github.mat3e.fairytales.pigs3.app.command.BuildHouse;
import io.github.mat3e.fairytales.pigs3.model.vo.Pig;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.jdbc.core.JdbcTemplate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.github.mat3e.fairytales.in.rest;
package io.github.mat3e.fairytales.pigs3.in.rest;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.github.mat3e.fairytales.model.vo.Pig;
import io.github.mat3e.fairytales.pigs3.model.vo.Pig;

abstract class BuildHouseJson {
@JsonCreator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.mat3e.fairytales.in.rest;
package io.github.mat3e.fairytales.pigs3.in.rest;

import io.github.mat3e.fairytales.app.HouseReadModel;
import io.github.mat3e.fairytales.app.command.BuildHouse;
import io.github.mat3e.fairytales.model.vo.HouseId;
import io.github.mat3e.fairytales.pigs3.app.HouseReadModel;
import io.github.mat3e.fairytales.pigs3.app.command.BuildHouse;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId;
import org.jetbrains.annotations.NotNull;
import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.IanaLinkRelations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.mat3e.fairytales.in.rest;
package io.github.mat3e.fairytales.pigs3.in.rest;

import io.github.mat3e.fairytales.app.command.BuildHouse;
import io.github.mat3e.fairytales.model.vo.HouseId;
import io.github.mat3e.fairytales.pigs3.app.command.BuildHouse;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.github.mat3e.fairytales.in.rest;

import io.github.mat3e.fairytales.app.HouseNotFoundException;
import io.github.mat3e.fairytales.app.HouseQueryRepository;
import io.github.mat3e.fairytales.app.HouseReadModel;
import io.github.mat3e.fairytales.app.ThreePigsCommandHandler;
import io.github.mat3e.fairytales.app.command.BlowDown;
import io.github.mat3e.fairytales.app.command.BuildHouse;
import io.github.mat3e.fairytales.model.vo.HouseId;
package io.github.mat3e.fairytales.pigs3.in.rest;

import io.github.mat3e.fairytales.pigs3.app.HouseNotFoundException;
import io.github.mat3e.fairytales.pigs3.app.HouseQueryRepository;
import io.github.mat3e.fairytales.pigs3.app.HouseReadModel;
import io.github.mat3e.fairytales.pigs3.app.ThreePigsCommandHandler;
import io.github.mat3e.fairytales.pigs3.app.command.BlowDown;
import io.github.mat3e.fairytales.pigs3.app.command.BuildHouse;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.hateoas.EntityModel;
import org.springframework.http.ResponseEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.github.mat3e.fairytales.model;
package io.github.mat3e.fairytales.pigs3.model;

import io.github.mat3e.fairytales.model.event.HouseEvent;
import io.github.mat3e.fairytales.model.vo.HouseId;
import io.github.mat3e.fairytales.model.vo.HouseSnapshot;
import io.github.mat3e.fairytales.model.vo.Material;
import io.github.mat3e.fairytales.model.vo.Pig;
import io.github.mat3e.fairytales.pigs3.model.event.HouseEvent;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseSnapshot;
import io.github.mat3e.fairytales.pigs3.model.vo.Material;
import io.github.mat3e.fairytales.pigs3.model.vo.Pig;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.domain.AfterDomainEventPublication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.mat3e.fairytales.model;
package io.github.mat3e.fairytales.pigs3.model;

import io.github.mat3e.ddd.event.DomainEvent;
import io.github.mat3e.ddd.event.DomainEventPublisher;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.github.mat3e.fairytales.out.logging;

import io.github.mat3e.fairytales.app.HouseQueryRepository;
import io.github.mat3e.fairytales.app.HouseReadModel;
import io.github.mat3e.fairytales.app.command.BlowDown;
import io.github.mat3e.fairytales.app.command.BuildHouse;
import io.github.mat3e.fairytales.model.event.WolfResignedFromAttacking;
import io.github.mat3e.fairytales.model.vo.HouseId;
package io.github.mat3e.fairytales.pigs3.out.logging;

import io.github.mat3e.fairytales.pigs3.app.HouseQueryRepository;
import io.github.mat3e.fairytales.pigs3.app.HouseReadModel;
import io.github.mat3e.fairytales.pigs3.app.command.BlowDown;
import io.github.mat3e.fairytales.pigs3.app.command.BuildHouse;
import io.github.mat3e.fairytales.pigs3.model.event.WolfResignedFromAttacking;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -24,15 +24,15 @@ class LoggingAspect {
logger.info("Once upon a time, there were three little pigs");
}

@Pointcut(value = "execution(* io.github.mat3e.fairytales.app.ThreePigsCommandHandler.handle(..)) && args(command)", argNames = "command")
@Pointcut(value = "execution(* io.github.mat3e.fairytales.pigs3.app.ThreePigsCommandHandler.handle(..)) && args(command)", argNames = "command")
static void buildingHouse(BuildHouse command) {
}

@Pointcut(value = "execution(* io.github.mat3e.fairytales.app.ThreePigsCommandHandler.handle(..)) && args(command)", argNames = "command")
@Pointcut(value = "execution(* io.github.mat3e.fairytales.pigs3.app.ThreePigsCommandHandler.handle(..)) && args(command)", argNames = "command")
static void wolfBlowing(BlowDown command) {
}

@Pointcut("execution(* io.github.mat3e.fairytales.app.HouseQueryRepository.findClosestTo(..))")
@Pointcut("execution(* io.github.mat3e.fairytales.pigs3.app.HouseQueryRepository.findClosestTo(..))")
static void findingNearestHouse() {
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.github.mat3e.fairytales.app;
package io.github.mat3e.fairytales.pigs3.app;

import io.github.mat3e.fairytales.app.command.BlowDown;
import io.github.mat3e.fairytales.app.command.BuildHouse;
import io.github.mat3e.fairytales.model.vo.HouseId;
import io.github.mat3e.fairytales.model.vo.Pig;
import io.github.mat3e.fairytales.pigs3.app.command.BlowDown;
import io.github.mat3e.fairytales.pigs3.app.command.BuildHouse;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId;
import io.github.mat3e.fairytales.pigs3.model.vo.Pig;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package io.github.mat3e.fairytales.model;
package io.github.mat3e.fairytales.pigs3.model;

import io.github.mat3e.fairytales.model.event.HouseAbandoned;
import io.github.mat3e.fairytales.model.vo.HouseId;
import io.github.mat3e.fairytales.model.vo.HouseSnapshot;
import io.github.mat3e.fairytales.model.vo.Material;
import io.github.mat3e.fairytales.model.vo.Pig;
import io.github.mat3e.fairytales.pigs3.model.event.HouseAbandoned;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseSnapshot;
import io.github.mat3e.fairytales.pigs3.model.vo.Material;
import io.github.mat3e.fairytales.pigs3.model.vo.Pig;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -45,6 +46,6 @@ void saveAndRead_worksAsExpected() {
.usingRecursiveComparison()
.ignoringFields("id", "events")
.isEqualTo(snapshot);
assertThat(result.events()).isEmpty();
Assertions.assertThat(result.events()).isEmpty();
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.mat3e.fairytales.app
package io.github.mat3e.fairytales.pigs3.app

import io.github.mat3e.fairytales.model.vo.HouseId
import io.github.mat3e.fairytales.model.vo.Material
import io.github.mat3e.fairytales.model.vo.Pig
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId
import io.github.mat3e.fairytales.pigs3.model.vo.Material
import io.github.mat3e.fairytales.pigs3.model.vo.Pig
import java.util.*

interface HouseQueryRepository {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.github.mat3e.fairytales.app
package io.github.mat3e.fairytales.pigs3.app

import io.github.mat3e.ddd.event.DomainEventPublisher
import io.github.mat3e.fairytales.model.BigBadWolfService
import io.github.mat3e.fairytales.model.HouseFactory
import io.github.mat3e.fairytales.model.HouseRepository
import io.github.mat3e.fairytales.pigs3.model.BigBadWolfService
import io.github.mat3e.fairytales.pigs3.model.HouseFactory
import io.github.mat3e.fairytales.pigs3.model.HouseRepository

// accepting just IO adapters
class ThreePigsApp(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.github.mat3e.fairytales.app
package io.github.mat3e.fairytales.pigs3.app

import io.github.mat3e.fairytales.app.command.*
import io.github.mat3e.fairytales.model.BigBadWolfService
import io.github.mat3e.fairytales.model.House
import io.github.mat3e.fairytales.model.HouseFactory
import io.github.mat3e.fairytales.model.HouseRepository
import io.github.mat3e.fairytales.model.vo.HouseId
import io.github.mat3e.fairytales.model.vo.HouseSnapshot
import io.github.mat3e.fairytales.model.vo.Pig
import io.github.mat3e.fairytales.pigs3.app.command.*
import io.github.mat3e.fairytales.pigs3.model.BigBadWolfService
import io.github.mat3e.fairytales.pigs3.model.House
import io.github.mat3e.fairytales.pigs3.model.HouseFactory
import io.github.mat3e.fairytales.pigs3.model.HouseRepository
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId
import io.github.mat3e.fairytales.pigs3.model.vo.HouseSnapshot
import io.github.mat3e.fairytales.pigs3.model.vo.Pig

// seems kotlin-allopen has no effect when annotations are added in the other module
open class ThreePigsCommandHandler(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.github.mat3e.fairytales.app
package io.github.mat3e.fairytales.pigs3.app

import io.github.mat3e.fairytales.app.command.Enter
import io.github.mat3e.fairytales.app.command.ShareKnowledge
import io.github.mat3e.fairytales.model.event.HouseAbandoned
import io.github.mat3e.fairytales.model.event.HouseEvent
import io.github.mat3e.fairytales.model.event.WolfResignedFromAttacking
import io.github.mat3e.fairytales.pigs3.app.command.Enter
import io.github.mat3e.fairytales.pigs3.app.command.ShareKnowledge
import io.github.mat3e.fairytales.pigs3.model.event.HouseAbandoned
import io.github.mat3e.fairytales.pigs3.model.event.HouseEvent
import io.github.mat3e.fairytales.pigs3.model.event.WolfResignedFromAttacking

class ThreePigsEventHandler(
private val queryRepository: HouseQueryRepository,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.mat3e.fairytales.app.command
package io.github.mat3e.fairytales.pigs3.app.command

import io.github.mat3e.fairytales.model.vo.HouseId
import io.github.mat3e.fairytales.model.vo.Pig
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId
import io.github.mat3e.fairytales.pigs3.model.vo.Pig

sealed class ThreePigsCommand {
override fun toString(): String = javaClass.simpleName.toString()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.github.mat3e.fairytales.app;
package io.github.mat3e.fairytales.pigs3.app;

import io.github.mat3e.fairytales.app.command.BlowDown;
import io.github.mat3e.fairytales.app.command.BuildHouse;
import io.github.mat3e.fairytales.model.vo.HouseId;
import io.github.mat3e.fairytales.model.vo.Material;
import io.github.mat3e.fairytales.model.vo.Pig;
import io.github.mat3e.fairytales.pigs3.app.command.BlowDown;
import io.github.mat3e.fairytales.pigs3.app.command.BuildHouse;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId;
import io.github.mat3e.fairytales.pigs3.model.vo.Material;
import io.github.mat3e.fairytales.pigs3.model.vo.Pig;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.github.mat3e.fairytales.app;

import io.github.mat3e.fairytales.app.command.*;
import io.github.mat3e.fairytales.model.BigBadWolfService;
import io.github.mat3e.fairytales.model.House;
import io.github.mat3e.fairytales.model.HouseFactory;
import io.github.mat3e.fairytales.model.HouseRepository;
import io.github.mat3e.fairytales.model.vo.HouseId;
import io.github.mat3e.fairytales.model.vo.HouseSnapshot;
import io.github.mat3e.fairytales.model.vo.Material;
import io.github.mat3e.fairytales.model.vo.Pig;
package io.github.mat3e.fairytales.pigs3.app;

import io.github.mat3e.fairytales.pigs3.app.command.*;
import io.github.mat3e.fairytales.pigs3.model.BigBadWolfService;
import io.github.mat3e.fairytales.pigs3.model.House;
import io.github.mat3e.fairytales.pigs3.model.HouseFactory;
import io.github.mat3e.fairytales.pigs3.model.HouseRepository;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseSnapshot;
import io.github.mat3e.fairytales.pigs3.model.vo.Material;
import io.github.mat3e.fairytales.pigs3.model.vo.Pig;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -80,8 +80,8 @@ void validCommand_shouldSaveUpdatedHouse(ThreePigsCommand command) {

static Stream<Arguments> validCommand_shouldSaveUpdatedHouse() {
return Stream.of(
arguments(new Enter(List.of(Pig.LAZY), HouseId.of(999))),
arguments(new ShareKnowledge(HouseId.of(999)))
Arguments.arguments(new Enter(List.of(Pig.LAZY), HouseId.of(999))),
Arguments.arguments(new ShareKnowledge(HouseId.of(999)))
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.github.mat3e.fairytales.app;

import io.github.mat3e.fairytales.model.BigBadWolfService;
import io.github.mat3e.fairytales.model.HouseFactory;
import io.github.mat3e.fairytales.model.HouseRepository;
import io.github.mat3e.fairytales.model.event.HouseAbandoned;
import io.github.mat3e.fairytales.model.vo.HouseId;
import io.github.mat3e.fairytales.model.vo.Pig;
package io.github.mat3e.fairytales.pigs3.app;

import io.github.mat3e.fairytales.pigs3.model.BigBadWolfService;
import io.github.mat3e.fairytales.pigs3.model.HouseFactory;
import io.github.mat3e.fairytales.pigs3.model.HouseRepository;
import io.github.mat3e.fairytales.pigs3.model.event.HouseAbandoned;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId;
import io.github.mat3e.fairytales.pigs3.model.vo.Pig;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.github.mat3e.fairytales.app;
package io.github.mat3e.fairytales.pigs3.app;

import io.github.mat3e.ddd.event.DomainEvent;
import io.github.mat3e.ddd.event.DomainEventPublisher;
import io.github.mat3e.fairytales.model.InMemoryThreePigsRepository;
import io.github.mat3e.fairytales.model.event.HouseEvent;
import io.github.mat3e.fairytales.pigs3.model.InMemoryThreePigsRepository;
import io.github.mat3e.fairytales.pigs3.model.event.HouseEvent;

import java.util.HashSet;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.github.mat3e.fairytales.model;
package io.github.mat3e.fairytales.pigs3.model;

import io.github.mat3e.ddd.event.DomainEventPublisher;
import io.github.mat3e.fairytales.app.HouseQueryRepository;
import io.github.mat3e.fairytales.app.HouseReadModel;
import io.github.mat3e.fairytales.model.vo.HouseId;
import io.github.mat3e.fairytales.model.vo.HouseSnapshot;
import io.github.mat3e.fairytales.pigs3.app.HouseQueryRepository;
import io.github.mat3e.fairytales.pigs3.app.HouseReadModel;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseId;
import io.github.mat3e.fairytales.pigs3.model.vo.HouseSnapshot;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.mat3e.fairytales.model;
package io.github.mat3e.fairytales.pigs3.model;

import io.github.mat3e.ddd.event.DomainEventPublisher;
import io.github.mat3e.fairytales.model.event.WolfResignedFromAttacking;
import io.github.mat3e.fairytales.pigs3.model.event.WolfResignedFromAttacking;

public class BigBadWolfService {
private final DomainEventPublisher eventPublisher;
Expand Down
Loading

0 comments on commit 57e13f5

Please sign in to comment.