deps: Refactor dependencies (#3224)

* remove spring dep
move junit, logging, mockito under dep mgmt

* upgrade anti-corruption-layer deps

* async method invocation

* balking, bloc

* bridge to bytecode

* caching

* callback - cqrs

* component - health check

* hexagonal - metadata mapping

* rest of the patterns

* remove checkstyle, take spotless into use
This commit is contained in:
Ilkka Seppälä authored and GitHub committed 2025-03-29 19:34:27 +02:00
1 parent 371439aeaa
commit 0ca162a55c
1863 files changed
+14403 -17632

No files matched your search

+8
View File
@@ -34,6 +34,14 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>unit-of-work</artifactId>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
@@ -25,18 +25,14 @@
package com.iluwatar.unitofwork;
import java.util.HashMap;
import java.util.List;
/**
* {@link App} Application demonstrating unit of work pattern.
*/
/** {@link App} Application demonstrating unit of work pattern. */
public class App {
/**
* Program entry point.
*
* @param args no argument sent
*/
public static void main(String[] args) {
// create some weapons
var enchantedHammer = new Weapon(1, "enchanted hammer");
@@ -44,8 +40,7 @@ public class App {
var silverTrident = new Weapon(3, "silver trident");
// create repository
var weaponRepository = new ArmsDealer(new HashMap<>(),
new WeaponDatabase());
var weaponRepository = new ArmsDealer(new HashMap<>(), new WeaponDatabase());
// perform operations on the weapons
weaponRepository.registerNew(enchantedHammer);
@@ -30,9 +30,7 @@ import java.util.Map;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* {@link ArmsDealer} Weapon repository that supports unit of work for weapons.
*/
/** {@link ArmsDealer} Weapon repository that supports unit of work for weapons. */
@Slf4j
@RequiredArgsConstructor
public class ArmsDealer implements UnitOfWork<Weapon> {
@@ -50,7 +48,6 @@ public class ArmsDealer implements UnitOfWork<Weapon> {
public void registerModified(Weapon weapon) {
LOGGER.info("Registering {} for modify in context.", weapon.getName());
register(weapon, UnitActions.MODIFY.getActionValue());
}
@Override
@@ -68,9 +65,7 @@ public class ArmsDealer implements UnitOfWork<Weapon> {
context.put(operation, weaponsToOperate);
}
/**
* All UnitOfWork operations are batched and executed together on commit only.
*/
/** All UnitOfWork operations are batched and executed together on commit only. */
@Override
public void commit() {
if (context == null || context.isEmpty()) {
@@ -27,9 +27,7 @@ package com.iluwatar.unitofwork;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* Enum representing unit actions.
*/
/** Enum representing unit actions. */
@Getter
@RequiredArgsConstructor
public enum UnitActions {
@@ -31,9 +31,7 @@ package com.iluwatar.unitofwork;
*/
public interface UnitOfWork<T> {
/**
* Any register new operation occurring on UnitOfWork is only going to be performed on commit.
*/
/** Any register new operation occurring on UnitOfWork is only going to be performed on commit. */
void registerNew(T entity);
/**
@@ -46,9 +44,6 @@ public interface UnitOfWork<T> {
*/
void registerDeleted(T entity);
/**
* All UnitOfWork operations batched together executed in commit only.
*/
/** All UnitOfWork operations batched together executed in commit only. */
void commit();
}
}
@@ -27,9 +27,7 @@ package com.iluwatar.unitofwork;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* {@link Weapon} is an entity.
*/
/** {@link Weapon} is an entity. */
@Getter
@RequiredArgsConstructor
public class Weapon {
@@ -24,20 +24,18 @@
*/
package com.iluwatar.unitofwork;
/**
* Act as database for weapon records.
*/
/** Act as database for weapon records. */
public class WeaponDatabase {
public void insert(Weapon weapon) {
//Some insert logic to DB
// Some insert logic to DB
}
public void modify(Weapon weapon) {
//Some modify logic to DB
// Some modify logic to DB
}
public void delete(Weapon weapon) {
//Some delete logic to DB
// Some delete logic to DB
}
}
@@ -28,13 +28,11 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import org.junit.jupiter.api.Test;
/**
* AppTest
*/
/** AppTest */
class AppTest {
@Test
void shouldExecuteWithoutException() {
assertDoesNotThrow(() -> App.main(new String[]{}));
assertDoesNotThrow(() -> App.main(new String[] {}));
}
}
@@ -36,10 +36,7 @@ import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
/**
* tests {@link ArmsDealer}
*/
/** tests {@link ArmsDealer} */
class ArmsDealerTest {
private final Weapon weapon1 = new Weapon(1, "battle ram");
private final Weapon weapon2 = new Weapon(1, "wooden lance");