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ä
2025-03-29 19:34:27 +02:00
committed by GitHub
parent 371439aeaa
commit 0ca162a55c
1863 changed files with 14408 additions and 17637 deletions
@@ -27,9 +27,7 @@ package com.iluwatar.model.view.viewmodel;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* Book class.
*/
/** Book class. */
@AllArgsConstructor
@Data
public class Book {
@@ -37,5 +35,4 @@ public class Book {
private String name;
private String author;
private String description;
}
@@ -27,9 +27,7 @@ package com.iluwatar.model.view.viewmodel;
import java.util.List;
/**
* Class representing a service to load books.
*/
/** Class representing a service to load books. */
public interface BookService {
/* List all books
* @return all books
@@ -27,39 +27,44 @@ package com.iluwatar.model.view.viewmodel;
import java.util.ArrayList;
import java.util.List;
/**
* Class that actually implement the books to load.
*/
/** Class that actually implement the books to load. */
public class BookServiceImpl implements BookService {
private List<Book> designPatternBooks = new ArrayList<>();
/** Initializes Book Data.
* To be used and passed along in load method
* In this case, list design pattern books are initialized to be loaded.
*/
/**
* Initializes Book Data. To be used and passed along in load method In this case, list design
* pattern books are initialized to be loaded.
*/
public BookServiceImpl() {
designPatternBooks.add(new Book(
"Head First Design Patterns: A Brain-Friendly Guide",
"Eric Freeman, Bert Bates, Kathy Sierra, Elisabeth Robson",
"Head First Design Patterns Description"));
designPatternBooks.add(new Book(
"Design Patterns: Elements of Reusable Object-Oriented Software",
"Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides",
"Design Patterns Description"));
designPatternBooks.add(new Book(
"Patterns of Enterprise Application Architecture", "Martin Fowler",
"Patterns of Enterprise Application Architecture Description"));
designPatternBooks.add(new Book(
"Design Patterns Explained", "Alan Shalloway, James Trott",
"Design Patterns Explained Description"));
designPatternBooks.add(new Book(
"Applying UML and Patterns: An Introduction to "
+ "Object-Oriented Analysis and Design and Iterative Development",
"Craig Larman", "Applying UML and Patterns Description"));
designPatternBooks.add(
new Book(
"Head First Design Patterns: A Brain-Friendly Guide",
"Eric Freeman, Bert Bates, Kathy Sierra, Elisabeth Robson",
"Head First Design Patterns Description"));
designPatternBooks.add(
new Book(
"Design Patterns: Elements of Reusable Object-Oriented Software",
"Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides",
"Design Patterns Description"));
designPatternBooks.add(
new Book(
"Patterns of Enterprise Application Architecture",
"Martin Fowler",
"Patterns of Enterprise Application Architecture Description"));
designPatternBooks.add(
new Book(
"Design Patterns Explained",
"Alan Shalloway, James Trott",
"Design Patterns Explained Description"));
designPatternBooks.add(
new Book(
"Applying UML and Patterns: An Introduction to "
+ "Object-Oriented Analysis and Design and Iterative Development",
"Craig Larman",
"Applying UML and Patterns Description"));
}
public List<Book> load() {
return designPatternBooks;
}
}
@@ -26,22 +26,17 @@ package com.iluwatar.model.view.viewmodel;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable;
/**
* BookViewModel class.
*/
/** BookViewModel class. */
public class BookViewModel {
@WireVariable
private List<Book> bookList;
@Getter
private Book selectedBook;
@WireVariable private List<Book> bookList;
@Getter private Book selectedBook;
private BookService bookService = new BookServiceImpl();
@NotifyChange("selectedBook")
public void setSelectedBook(Book selectedBook) {
this.selectedBook = selectedBook;
@@ -50,11 +45,11 @@ public class BookViewModel {
public List<Book> getBookList() {
return bookService.load();
}
/** Deleting a book.
* When event is triggered on click of Delete button,
* this method will be notified with the selected entry that will be referenced
* and used to delete the selected book from the list of books.
/**
* Deleting a book. When event is triggered on click of Delete button, this method will be
* notified with the selected entry that will be referenced and used to delete the selected book
* from the list of books.
*/
@Command
@NotifyChange({"selectedBook", "bookList"})
@@ -64,5 +59,4 @@ public class BookViewModel {
selectedBook = null;
}
}
}
@@ -30,6 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -41,27 +42,33 @@ class BookTest {
List<Book> testBookList;
Book testBookTwo;
Book testBookThree;
@BeforeEach
void setUp() {
bvm = new BookViewModel();
testBook = new Book("Head First Design Patterns: A Brain-Friendly Guide",
"Eric Freeman, Bert Bates, Kathy Sierra, Elisabeth Robson",
"Head First Design Patterns Description");
testBook =
new Book(
"Head First Design Patterns: A Brain-Friendly Guide",
"Eric Freeman, Bert Bates, Kathy Sierra, Elisabeth Robson",
"Head First Design Patterns Description");
testBookList = bvm.getBookList();
testBookTwo = new Book("Head First Design Patterns: A Brain-Friendly Guide",
"Eric Freeman, Bert Bates, Kathy Sierra, Elisabeth Robson",
"Head First Design Patterns Description");
testBookThree = new Book("Design Patterns: Elements of Reusable Object-Oriented Software",
testBookTwo =
new Book(
"Head First Design Patterns: A Brain-Friendly Guide",
"Eric Freeman, Bert Bates, Kathy Sierra, Elisabeth Robson",
"Head First Design Patterns Description");
testBookThree =
new Book(
"Design Patterns: Elements of Reusable Object-Oriented Software",
"Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides",
"Design Patterns Description");
}
@Test
void testBookModel() {
assertNotNull(testBook);
assertNotNull(testBook);
}
@Test
void testEquals() {
assertEquals(testBook, testBookTwo);
@@ -72,13 +79,13 @@ class BookTest {
assertEquals(testBook.toString(), testBookTwo.toString());
assertNotEquals(testBook.toString(), testBookThree.toString());
}
@Test
void testHashCode() {
assertTrue(testBook.equals(testBookTwo) && testBookTwo.equals(testBook));
assertEquals(testBook.hashCode(), testBookTwo.hashCode());
}
@Test
void testLoadData() {
assertNotNull(testBookList);
@@ -87,7 +94,7 @@ class BookTest {
@Test
void testSelectedData() {
bvm.setSelectedBook(testBook);
bvm.setSelectedBook(testBook);
assertNotNull(bvm.getSelectedBook());
assertEquals(testBook.toString(), bvm.getSelectedBook().toString());
assertTrue(true, bvm.getSelectedBook().toString());
@@ -102,5 +109,4 @@ class BookTest {
assertNull(bvm.getSelectedBook());
assertFalse(testBookList.get(0).toString().contains("Head First Design Patterns"));
}
}
}