From 0c6237c225584a3a28bdd81cb19a40de698ed7f7 Mon Sep 17 00:00:00 2001 From: AnaghaSasikumar <42939261+AnaghaSasikumar@users.noreply.github.com> Date: Thu, 25 Jul 2019 00:38:30 +0530 Subject: [PATCH 001/197] Type object pattern #555 (#848) * typeobject pattern * fixing errors * fix error cellpool * Update README.md * Update README.md --- pom.xml | 1 + typeobjectpattern/README.md | 29 +++ typeobjectpattern/pom.xml | 31 ++++ .../java/com/iluwatar/typeobject/App.java | 85 +++++++++ .../java/com/iluwatar/typeobject/Candy.java | 60 ++++++ .../com/iluwatar/typeobject/CandyGame.java | 171 ++++++++++++++++++ .../java/com/iluwatar/typeobject/Cell.java | 90 +++++++++ .../com/iluwatar/typeobject/CellPool.java | 96 ++++++++++ .../com/iluwatar/typeobject/JsonParser.java | 87 +++++++++ .../java/com/iluwatar/typeobject/candy.json | 45 +++++ .../iluwatar/typeobject/CandyGameTest.java | 69 +++++++ .../com/iluwatar/typeobject/CellPoolTest.java | 52 ++++++ .../com/iluwatar/typeobject/CellTest.java | 61 +++++++ 13 files changed, 877 insertions(+) create mode 100644 typeobjectpattern/README.md create mode 100644 typeobjectpattern/pom.xml create mode 100644 typeobjectpattern/src/main/java/com/iluwatar/typeobject/App.java create mode 100644 typeobjectpattern/src/main/java/com/iluwatar/typeobject/Candy.java create mode 100644 typeobjectpattern/src/main/java/com/iluwatar/typeobject/CandyGame.java create mode 100644 typeobjectpattern/src/main/java/com/iluwatar/typeobject/Cell.java create mode 100644 typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java create mode 100644 typeobjectpattern/src/main/java/com/iluwatar/typeobject/JsonParser.java create mode 100644 typeobjectpattern/src/main/java/com/iluwatar/typeobject/candy.json create mode 100644 typeobjectpattern/src/test/java/com/iluwatar/typeobject/CandyGameTest.java create mode 100644 typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellPoolTest.java create mode 100644 typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellTest.java diff --git a/pom.xml b/pom.xml index 935efec53b64..014e67bda525 100644 --- a/pom.xml +++ b/pom.xml @@ -166,6 +166,7 @@ collection-pipeline master-worker-pattern spatial-partition + typeobjectpattern diff --git a/typeobjectpattern/README.md b/typeobjectpattern/README.md new file mode 100644 index 000000000000..97aa64e0b603 --- /dev/null +++ b/typeobjectpattern/README.md @@ -0,0 +1,29 @@ +--- +layout: pattern +title: Type-object +folder: typeobjectpattern +permalink: /patterns/typeobjectpattern/ +categories: Game Programming Patterns/Behavioral Patterns +tags: + - Java + - Difficulty-Beginner +--- + +## Intent +As explained in the book Game Programming Patterns by Robert Nystrom, type object pattern helps in + +> Allowing flexible creation of new “classes” by creating a single class, each instance of which represents a different type of object + +## Applicability +This pattern can be used when: +* We don’t know what types we will need up front. +* We want to be able to modify or add new types without having to recompile or change code. +* Only difference between the different 'types' of objects is the data, not the behaviour. + +## Explanation +Say, we are working on a game which has a hero and many monsters which are going to attack the hero. These monsters have certain attributes like attack, points etc. and come in different 'breeds' like zombie or ogres. The obvious answer is to have a base Monster class which has some fields and methods, which may be overriden by subclasses like the Zombie or Ogre class. But as we continue to build the game, there may be more and more breeds of monsters added and certain attributes may need to be changed in the existing monsters too. The OOP solution of inheriting from the base class would not be an efficient method in this case. +Using the type-object pattern, instead of creating many classes inheriting from a base class, we have 1 class with a field which represents the 'type' of object. This makes the code cleaner and object instantiation also becomes as easy as parsing a json file with the object properties. + +## Credits +* [Game Programming Patterns/Type Object](http://gameprogrammingpatterns.com/type-object.html) by Robert Nystrom +* [http://www.cs.sjsu.edu/~pearce/modules/patterns/analysis/top.htm] diff --git a/typeobjectpattern/pom.xml b/typeobjectpattern/pom.xml new file mode 100644 index 000000000000..3377245f30ba --- /dev/null +++ b/typeobjectpattern/pom.xml @@ -0,0 +1,31 @@ + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.21.0-SNAPSHOT + + typeobjectpattern + + + com.googlecode.json-simple + json-simple + 1.1.1 + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.mockito + mockito-core + test + + + \ No newline at end of file diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/App.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/App.java new file mode 100644 index 000000000000..f16777c686a3 --- /dev/null +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/App.java @@ -0,0 +1,85 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.typeobject; + +import java.io.FileNotFoundException; +import java.io.IOException; +import org.json.simple.parser.ParseException; + +/**

Type object pattern is the pattern we use when the OOP concept of creating a base class and + * inheriting from it just doesn't work for the case in hand. This happens when we either don't know + * what types we will need upfront, or want to be able to modify or add new types conveniently w/o + * recompiling repeatedly. The pattern provides a solution by allowing flexible creation of required + * objects by creating one class, which has a field which represents the 'type' of the object.

+ *

In this example, we have a mini candy-crush game in action. There are many different candies + * in the game, which may change over time, as we may want to upgrade the game. To make the object + * creation convenient, we have a class {@link Candy} which has a field name, parent, points and + * Type. We have a json file {@link candy} which contains the details about the candies, and this is + * parsed to get all the different candies in {@link JsonParser}. The {@link Cell} class is what the + * game matrix is made of, which has the candies that are to be crushed, and contains information on + * how crushing can be done, how the matrix is to be reconfigured and how points are to be gained. + * The {@link CellPool} class is a pool which reuses the candy cells that have been crushed instead + * of making new ones repeatedly. The {@link CandyGame} class has the rules for the continuation of + * the game and the {@link App} class has the game itself.

+ */ + +public class App { + + /** + * Program entry point. + * @param args command line args + */ + public static void main(String[] args) throws FileNotFoundException, IOException, ParseException { + int givenTime = 50; //50ms + int toWin = 500; //points + int pointsWon = 0; + int numOfRows = 3; + long start = System.currentTimeMillis(); + long end = System.currentTimeMillis(); + int round = 0; + while (pointsWon < toWin && end - start < givenTime) { + round++; + CellPool pool = new CellPool(numOfRows * numOfRows + 5); + CandyGame cg = new CandyGame(numOfRows, pool); + if (round > 1) { + System.out.println("Refreshing.."); + } else { + System.out.println("Starting game.."); + } + cg.printGameStatus(); + end = System.currentTimeMillis(); + cg.round((int)(end - start), givenTime); + pointsWon += cg.totalPoints; + end = System.currentTimeMillis(); + } + System.out.println("Game Over"); + if (pointsWon >= toWin) { + System.out.println(pointsWon); + System.out.println("You win!!"); + } else { + System.out.println(pointsWon); + System.out.println("Sorry, you lose!"); + } + } +} diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/Candy.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/Candy.java new file mode 100644 index 000000000000..40b276e5bbc5 --- /dev/null +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/Candy.java @@ -0,0 +1,60 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.typeobject; + +/** + * The Candy class has a field type, which represents the 'type' of candy. The objects + * are created by parsing the candy.json file. + */ + +public class Candy { + + enum Type { crushableCandy, rewardFruit }; + + String name; + Candy parent; + String parentName; + private int points; + private Type type; + + Candy(String name, String parentName, Type type, int points) { + this.name = name; + this.parent = null; + this.type = type; + this.points = points; + this.parentName = parentName; + } + + int getPoints() { + return this.points; + } + + void setPoints(int a) { + this.points = a; + } + + Type getType() { + return this.type; + } +} diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CandyGame.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CandyGame.java new file mode 100644 index 000000000000..a2ba452ec03a --- /dev/null +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CandyGame.java @@ -0,0 +1,171 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.typeobject; + +import java.util.ArrayList; +import com.iluwatar.typeobject.Candy.Type; + +/** + * The CandyGame class contains the rules for the continuation of the game and has + * the game matrix (field 'cells') and totalPoints gained during the game. + */ + +public class CandyGame { + Cell[][] cells; + CellPool pool; + int totalPoints; + + CandyGame(int num, CellPool pool) { + this.cells = new Cell[num][num]; + this.pool = pool; + this.totalPoints = 0; + for (int i = 0; i < num; i++) { + for (int j = 0; j < num; j++) { + this.cells[i][j] = this.pool.getNewCell(); + this.cells[i][j].xIndex = j; + this.cells[i][j].yIndex = i; + } + } + } + + static String numOfSpaces(int num) { + String result = ""; + for (int i = 0; i < num; i++) { + result += " "; + } + return result; + } + + void printGameStatus() { + System.out.println(""); + for (int i = 0; i < cells.length; i++) { + for (int j = 0; j < cells.length; j++) { + String candyName = cells[i][j].candy.name; + if (candyName.length() < 20) { + int totalSpaces = 20 - candyName.length(); + System.out.print(numOfSpaces(totalSpaces / 2) + cells[i][j].candy.name + + numOfSpaces(totalSpaces - totalSpaces / 2) + "|"); + } else { + System.out.print(candyName + "|"); + } + } + System.out.println(""); + } + System.out.println(""); + } + + ArrayList adjacentCells(int yIndex, int xIndex) { + ArrayList adjacent = new ArrayList(); + if (yIndex == 0) { + adjacent.add(this.cells[1][xIndex]); + } + if (xIndex == 0) { + adjacent.add(this.cells[yIndex][1]); + } + if (yIndex == cells.length - 1) { + adjacent.add(this.cells[cells.length - 2][xIndex]); + } + if (xIndex == cells.length - 1) { + adjacent.add(this.cells[yIndex][cells.length - 2]); + } + if (yIndex > 0 && yIndex < cells.length - 1) { + adjacent.add(this.cells[yIndex - 1][xIndex]); + adjacent.add(this.cells[yIndex + 1][xIndex]); + } + if (xIndex > 0 && xIndex < cells.length - 1) { + adjacent.add(this.cells[yIndex][xIndex - 1]); + adjacent.add(this.cells[yIndex][xIndex + 1]); + } + return adjacent; + } + + boolean continueRound() { + for (int i = 0; i < this.cells.length; i++) { + if (this.cells[cells.length - 1][i].candy.getType().equals(Type.rewardFruit)) { + return true; + } + } + for (int i = 0; i < this.cells.length; i++) { + for (int j = 0; j < this.cells.length; j++) { + if (!this.cells[i][j].candy.getType().equals(Type.rewardFruit)) { + ArrayList adj = adjacentCells(i,j); + for (int a = 0; a < adj.size(); a++) { + if (this.cells[i][j].candy.name.equals(adj.get(a).candy.name)) { + return true; + } + } + } + } + } + return false; + } + + void handleChange(int points) { + System.out.println("+" + points + " points!"); + this.totalPoints += points; + printGameStatus(); + } + + void round(int timeSoFar, int totalTime) { + long start = System.currentTimeMillis(); + long end = System.currentTimeMillis(); + while (end - start + timeSoFar < totalTime && continueRound()) { + for (int i = 0; i < this.cells.length; i++) { + int points = 0; + int j = this.cells.length - 1; + while (this.cells[j][i].candy.getType().equals(Type.rewardFruit)) { + points = this.cells[j][i].candy.getPoints(); + this.cells[j][i].crush(pool, this.cells); + handleChange(points); + } + } + for (int i = 0; i < this.cells.length; i++) { + int j = cells.length - 1; + int points = 0; + while (j > 0) { + points = this.cells[j][i].interact(this.cells[j - 1][i], this.pool, this.cells); + if (points != 0) { + handleChange(points); + } else { + j = j - 1; + } + } + } + for (int i = 0; i < this.cells.length; i++) { + int j = 0; + int points = 0; + while (j < cells.length - 1) { + points = this.cells[i][j].interact(this.cells[i][j + 1], this.pool, this.cells); + if (points != 0) { + handleChange(points); + } else { + j = j + 1; + } + } + } + end = System.currentTimeMillis(); + } + } + +} diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/Cell.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/Cell.java new file mode 100644 index 000000000000..7d0d696430fd --- /dev/null +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/Cell.java @@ -0,0 +1,90 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.typeobject; + +import com.iluwatar.typeobject.Candy.Type; + +/** + * The Cell object is what the game matrix is made of and contains the candy which is + * to be crushed or collected as reward. + */ + +public class Cell { + Candy candy; + int xIndex; + int yIndex; + + Cell(Candy candy, int xIndex, int yIndex) { + this.candy = candy; + this.xIndex = xIndex; + this.yIndex = yIndex; + } + + Cell() { + this.candy = null; + this.xIndex = 0; + this.yIndex = 0; + } + + void crush(CellPool pool, Cell[][] cellMatrix) { + //take out from this position and put back in pool + pool.addNewCell(this); + this.fillThisSpace(pool, cellMatrix); + } + + void fillThisSpace(CellPool pool, Cell[][] cellMatrix) { + for (int y = this.yIndex; y > 0; y--) { + cellMatrix[y][this.xIndex] = cellMatrix[y - 1][this.xIndex]; + cellMatrix[y][this.xIndex].yIndex = y; + } + Cell newC = pool.getNewCell(); + cellMatrix[0][this.xIndex] = newC; + cellMatrix[0][this.xIndex].xIndex = this.xIndex; + cellMatrix[0][this.xIndex].yIndex = 0; + } + + void handleCrush(Cell c, CellPool pool, Cell[][] cellMatrix) { + if (this.yIndex >= c.yIndex) { + this.crush(pool, cellMatrix); + c.crush(pool, cellMatrix); + } else { + c.crush(pool, cellMatrix); + this.crush(pool, cellMatrix); + } + } + + int interact(Cell c, CellPool pool, Cell[][] cellMatrix) { + if (this.candy.getType().equals(Type.rewardFruit) || c.candy.getType().equals(Type.rewardFruit)) { + return 0; + } else { + if (this.candy.name.equals(c.candy.name)) { + int pointsWon = this.candy.getPoints() + c.candy.getPoints(); + handleCrush(c,pool,cellMatrix); + return pointsWon; + } else { + return 0; + } + } + } +} diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java new file mode 100644 index 000000000000..88263ceab57d --- /dev/null +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java @@ -0,0 +1,96 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.typeobject; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Random; +import org.json.simple.parser.ParseException; +import com.iluwatar.typeobject.Candy.Type; + +/** + * The CellPool class allows the reuse of crushed cells instead of creation of new + * cells each time. The reused cell is given a new candy to hold using the randomCode + * field which holds all the candies available. + */ + +public class CellPool { + ArrayList pool; + int pointer; + Candy[] randomCode; + + CellPool(int num) { + this.pool = new ArrayList(num); + try { + this.randomCode = assignRandomCandytypes(); + } catch (Exception e) { + e.printStackTrace(); + //manually initialising this.randomCode + this.randomCode = new Candy[5]; + randomCode[0] = new Candy("cherry", "fruit", Type.rewardFruit, 20); + randomCode[1] = new Candy("mango", "fruit", Type.rewardFruit, 20); + randomCode[2] = new Candy("purple popsicle", "candy", Type.crushableCandy, 10); + randomCode[3] = new Candy("green jellybean", "candy", Type.crushableCandy, 10); + randomCode[4] = new Candy("orange gum", "candy", Type.crushableCandy, 10); + } + for (int i = 0; i < num; i++) { + Cell c = new Cell(); + Random rand = new Random(); + c.candy = randomCode[rand.nextInt(randomCode.length)]; + this.pool.add(c); + } + this.pointer = num - 1; + } + + Cell getNewCell() { + Cell newCell = this.pool.remove(pointer); + pointer--; + return newCell; + } + + void addNewCell(Cell c) { + Random rand = new Random(); + c.candy = randomCode[rand.nextInt(randomCode.length)]; //changing candytype to new + this.pool.add(c); + pointer++; + } + + Candy[] assignRandomCandytypes() throws FileNotFoundException, IOException, ParseException { + JsonParser jp = new JsonParser(); + jp.parse(); + Candy[] randomCode = new Candy[jp.candies.size() - 2]; //exclude generic types 'fruit' and 'candy' + int i = 0; + for (Enumeration e = jp.candies.keys(); e.hasMoreElements();) { + String s = e.nextElement(); + if (!s.equals("fruit") && !s.equals("candy")) { + //not generic + randomCode[i] = jp.candies.get(s); + i++; + } + } + return randomCode; + } +} diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/JsonParser.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/JsonParser.java new file mode 100644 index 000000000000..6c6bfa616a34 --- /dev/null +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/JsonParser.java @@ -0,0 +1,87 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.typeobject; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.Enumeration; +import java.util.Hashtable; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; +import com.iluwatar.typeobject.Candy.Type; + +/** + * The JsonParser class helps parse the json file candy.json to get all the + * different candies. + */ + +public class JsonParser { + Hashtable candies; + + JsonParser() { + this.candies = new Hashtable(); + } + + void parse() throws FileNotFoundException, IOException, ParseException { + JSONParser parser = new JSONParser(); + JSONObject jo = (JSONObject) parser.parse(new FileReader(new File("").getAbsolutePath() + + "\\src\\main\\java\\com\\iluwatar\\typeobject\\candy.json")); + JSONArray a = (JSONArray) jo.get("candies"); + for (Object o : a) { + JSONObject candy = (JSONObject) o; + String name = (String) candy.get("name"); + String parentName = (String) candy.get("parent"); + String t = (String) candy.get("type"); + Type type = null; + if (t.equals("rewardFruit")) { + type = Type.rewardFruit; + } else { + type = Type.crushableCandy; + } + int points = Integer.parseInt((String) candy.get("points")); + Candy c = new Candy(name, parentName, type, points); + this.candies.put(name, c); + } + setParentAndPoints(); + } + + void setParentAndPoints() { + for (Enumeration e = this.candies.keys(); e.hasMoreElements();) { + Candy c = this.candies.get(e.nextElement()); + if (c.parentName == null) { + c.parent = null; + } else { + c.parent = this.candies.get(c.parentName); + } + if (c.getPoints() == 0 && c.parent != null) { + c.setPoints(c.parent.getPoints()); + } + } + } + +} diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/candy.json b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/candy.json new file mode 100644 index 000000000000..74430c318d72 --- /dev/null +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/candy.json @@ -0,0 +1,45 @@ +{"candies" : [ + { + "name" : "fruit", + "parent" : "null", + "type" : "rewardFruit", + "points" : "20" + }, + { + "name" : "candy", + "parent" : "null", + "type" : "crushableCandy", + "points" : "10" + }, + { + "name" : "cherry", + "parent" : "fruit", + "type" : "rewardFruit", + "points" : "0" + }, + { + "name" : "mango", + "parent" : "fruit", + "type" : "rewardFruit", + "points" : "0" + }, + { + "name" : "purple popsicle", + "parent" : "candy", + "type" : "crushableCandy", + "points" : "0" + }, + { + "name" : "green jellybean", + "parent" : "candy", + "type" : "crushableCandy", + "points" : "0" + }, + { + "name" : "orange gum", + "parent" : "candy", + "type" : "crushableCandy", + "points" : "0" + } + ] +} diff --git a/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CandyGameTest.java b/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CandyGameTest.java new file mode 100644 index 000000000000..d1b2fd359385 --- /dev/null +++ b/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CandyGameTest.java @@ -0,0 +1,69 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.typeobject; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; +import java.util.ArrayList; +import com.iluwatar.typeobject.Candy.Type; + +/** + * The CandyGameTest class tests the methods in the {@link CandyGame} class. + */ + +class CandyGameTest { + + @Test + void adjacentCellsTest() { + CandyGame cg = new CandyGame(3,new CellPool(9)); + ArrayList arr1 = cg.adjacentCells(0, 0); + ArrayList arr2 = cg.adjacentCells(1, 2); + ArrayList arr3 = cg.adjacentCells(1, 1); + assertTrue(arr1.size() == 2 && arr2.size() == 3 && arr3.size() == 4); + } + + @Test + void continueRoundTest() { + Cell[][] matrix = new Cell[2][2]; + Candy c1 = new Candy("green jelly", "jelly", Type.crushableCandy, 5); + Candy c2 = new Candy("purple jelly", "jelly", Type.crushableCandy, 5); + Candy c3 = new Candy("green apple", "apple", Type.rewardFruit, 10); + matrix[0][0] = new Cell(c1,0,0);; + matrix[0][1] = new Cell(c2,1,0); + matrix[1][0] = new Cell(c3,0,1); + matrix[1][1] = new Cell(c2,1,1); + CellPool p = new CellPool(4); + CandyGame cg = new CandyGame(2,p); + cg.cells = matrix; + boolean fruitInLastRow = cg.continueRound(); + matrix[1][0].crush(p, matrix); + matrix[0][0] = new Cell(c3,0,0); + boolean matchingCandy = cg.continueRound(); + matrix[0][1].crush(p,matrix); + matrix[0][1] = new Cell(c3,1,0); + boolean noneLeft = cg.continueRound(); + assertTrue(fruitInLastRow && matchingCandy && !noneLeft); + } + +} diff --git a/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellPoolTest.java b/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellPoolTest.java new file mode 100644 index 000000000000..437e39d1abd3 --- /dev/null +++ b/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellPoolTest.java @@ -0,0 +1,52 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.typeobject; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; +import java.util.Hashtable; + +/** + * The CellPoolTest class tests the methods in the {@link CellPool} class. + */ + +class CellPoolTest { + + @Test + void assignRandomCandyTypesTest() { + CellPool cp = new CellPool(10); + Hashtable ht = new Hashtable(); + int parentTypes = 0; + for (int i = 0; i < cp.randomCode.length; i++) { + if (ht.get(cp.randomCode[i].name) == null) { + ht.put(cp.randomCode[i].name, true); + } + if (cp.randomCode[i].name.equals("fruit") || cp.randomCode[i].name.equals("candy")) { + parentTypes++; + } + } + assertTrue(ht.size() == 5 && parentTypes == 0); + } + +} diff --git a/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellTest.java b/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellTest.java new file mode 100644 index 000000000000..b4118cb48651 --- /dev/null +++ b/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellTest.java @@ -0,0 +1,61 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.typeobject; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; +import com.iluwatar.typeobject.Candy.Type; + +/** + * The CellTest class tests the methods in the {@link Cell} class. + */ + +class CellTest { + + @Test + void interactTest() { + Candy c1 = new Candy("green jelly", "jelly", Type.crushableCandy, 5); + Candy c2 = new Candy("green apple", "apple", Type.rewardFruit, 10); + Cell[][] matrix = new Cell[4][4]; + matrix[0][0] = new Cell(c1,0,0); + matrix[0][1] = new Cell(c1,1,0); + matrix[0][2] = new Cell(c2,2,0); + matrix[0][3] = new Cell(c1,3,0); + CellPool cp = new CellPool(5); + int points1 = matrix[0][0].interact(matrix[0][1], cp, matrix); + int points2 = matrix[0][2].interact(matrix[0][3], cp, matrix); + assertTrue(points1 > 0 && points2 == 0); + } + + @Test + void crushTest() { + Candy c1 = new Candy("green jelly", "jelly", Type.crushableCandy, 5); + Candy c2 = new Candy("purple candy", "candy", Type.crushableCandy, 5); + Cell[][] matrix = new Cell[4][4]; + matrix[0][0] = new Cell(c1,0,0); + matrix[1][0] = new Cell(c2,0,1); + matrix[1][0].crush(new CellPool(5), matrix); + assertTrue(matrix[1][0].candy.name.equals("green jelly")); + } +} From 17bfc91f4532ab06d48bbfed5c2f9ad030a80651 Mon Sep 17 00:00:00 2001 From: ptrax Date: Sun, 28 Jul 2019 06:20:18 -0500 Subject: [PATCH 002/197] Change Travis CI build env. to Trusty (#911) --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 85f53bcd3024..58edddeb416e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: java +dist: trusty # Xenial build environment won't allow installation of Java 8 jdk: - oraclejdk8 From c6ecf58687b8fa76bdfa933f67f25d299b55126c Mon Sep 17 00:00:00 2001 From: kanwarpreet25 <39183641+kanwarpreet25@users.noreply.github.com> Date: Sun, 28 Jul 2019 18:09:40 +0530 Subject: [PATCH 003/197] 508 : sonar qube critical issue fixes (#852) * 508 : sonar qube critical issue fixes * 508 : Sunar Qube Fixes Define a constant instead of duplicating this literal "user_accounts" 4 times. Define a constant instead of duplicating this literal "userID" 5 times Define a constant instead of duplicating this literal "additionalInfo" 4 times. Define a constant instead of duplicating this literal "userName" 4 times. * 508 : Sunar Qube Fixes Define a constant instead of duplicating this literal "user_accounts" 4 times. * 508 : Sonar Qube Fixes Define a constant instead of duplicating this literal "eEvans" 4 times Define a constant instead of duplicating this literal "jBloch" 6 times Define a constant instead of duplicating this literal "mFowler" 3 times * 508 : Sonar Qube FIxes Define a constant instead of duplicating this literal "username" 3 times. * 508: sonar qube issue fixes Define a constant instead of duplicating this literal "customerDao.getAllCustomers(): " 4 times. * 508 : sonar qube issue fixes Define a constant instead of duplicating this literal "App.main(), student : " 4 times. * 508 : sonar Qube issue fixes Define a constant instead of duplicating this literal "{} hits {}. {} is damaged!" 3 times. Define a constant instead of duplicating this literal "{} hits {}." 4 times. * 508 : Define a constant instead of duplicating this literal "{} hits {}." 4 times. * 508 : checkstyle fixes * 508: checkstyle fixes * 508: checkstyle fixes * 508: checkstyle fixes * 508: checkstyle fixes * 508: checkstyle fixes * 508: cqrs checkstyle fixes --- .../com/iluwatar/abstractdocument/App.java | 32 +++++++++---------- .../abstractdocument/domain/HasModel.java | 5 ++- .../abstractdocument/domain/HasParts.java | 4 +-- .../abstractdocument/domain/HasPrice.java | 4 +-- .../abstractdocument/domain/HasType.java | 8 ++--- .../domain/enums/Property.java | 11 +++++++ .../iluwatar/abstractdocument/DomainTest.java | 26 +++++++-------- .../java/com/iluwatar/caching/DbManager.java | 29 +++++++++-------- .../caching/constants/CachingConstants.java | 15 +++++++++ .../main/java/com/iluwatar/cqrs/app/App.java | 27 ++++++++-------- .../iluwatar/cqrs/constants/AppConstants.java | 15 +++++++++ .../cqrs/queries/QueryServiceImpl.java | 7 ++-- dao/src/main/java/com/iluwatar/dao/App.java | 9 +++--- .../java/com/iluwatar/datamapper/App.java | 10 +++--- .../iluwatar/doubledispatch/Meteoroid.java | 10 +++--- .../doubledispatch/SpaceStationMir.java | 10 +++--- .../constants/AppConstants.java | 11 +++++++ 17 files changed, 146 insertions(+), 87 deletions(-) create mode 100644 abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java create mode 100644 caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java create mode 100644 cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java create mode 100644 double-dispatch/src/main/java/com/iluwatar/doubledispatch/constants/AppConstants.java diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java index 83f6ab3d59dd..c0dbbff4755b 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java @@ -22,18 +22,16 @@ */ package com.iluwatar.abstractdocument; -import com.iluwatar.abstractdocument.domain.Car; -import com.iluwatar.abstractdocument.domain.HasModel; -import com.iluwatar.abstractdocument.domain.HasParts; -import com.iluwatar.abstractdocument.domain.HasPrice; -import com.iluwatar.abstractdocument.domain.HasType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.iluwatar.abstractdocument.domain.Car; +import com.iluwatar.abstractdocument.domain.enums.Property; + /** * The Abstract Document pattern enables handling additional, non-static * properties. This pattern uses concept of traits to enable type safety and @@ -55,20 +53,20 @@ public App() { LOGGER.info("Constructing parts and car"); Map carProperties = new HashMap<>(); - carProperties.put(HasModel.PROPERTY, "300SL"); - carProperties.put(HasPrice.PROPERTY, 10000L); + carProperties.put(Property.MODEL.toString(), "300SL"); + carProperties.put(Property.PRICE.toString(), 10000L); Map wheelProperties = new HashMap<>(); - wheelProperties.put(HasType.PROPERTY, "wheel"); - wheelProperties.put(HasModel.PROPERTY, "15C"); - wheelProperties.put(HasPrice.PROPERTY, 100L); + wheelProperties.put(Property.TYPE.toString(), "wheel"); + wheelProperties.put(Property.MODEL.toString(), "15C"); + wheelProperties.put(Property.PRICE.toString(), 100L); Map doorProperties = new HashMap<>(); - doorProperties.put(HasType.PROPERTY, "door"); - doorProperties.put(HasModel.PROPERTY, "Lambo"); - doorProperties.put(HasPrice.PROPERTY, 300L); + doorProperties.put(Property.TYPE.toString(), "door"); + doorProperties.put(Property.MODEL.toString(), "Lambo"); + doorProperties.put(Property.PRICE.toString(), 300L); - carProperties.put(HasParts.PROPERTY, Arrays.asList(wheelProperties, doorProperties)); + carProperties.put(Property.PARTS.toString(), Arrays.asList(wheelProperties, doorProperties)); Car car = new Car(carProperties); diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasModel.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasModel.java index 252a4644f289..3f2c40df8183 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasModel.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasModel.java @@ -25,16 +25,15 @@ import java.util.Optional; import com.iluwatar.abstractdocument.Document; +import com.iluwatar.abstractdocument.domain.enums.Property; /** * HasModel trait for static access to 'model' property */ public interface HasModel extends Document { - String PROPERTY = "model"; - default Optional getModel() { - return Optional.ofNullable((String) get(PROPERTY)); + return Optional.ofNullable((String) get(Property.MODEL.toString())); } } diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasParts.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasParts.java index 9df836376f55..cf6ec6b01ccf 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasParts.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasParts.java @@ -25,16 +25,16 @@ import java.util.stream.Stream; import com.iluwatar.abstractdocument.Document; +import com.iluwatar.abstractdocument.domain.enums.Property; /** * HasParts trait for static access to 'parts' property */ public interface HasParts extends Document { - String PROPERTY = "parts"; default Stream getParts() { - return children(PROPERTY, Part::new); + return children(Property.PARTS.toString(), Part::new); } } diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasPrice.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasPrice.java index 39e4d159ce58..ca2e9018966c 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasPrice.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasPrice.java @@ -25,16 +25,16 @@ import java.util.Optional; import com.iluwatar.abstractdocument.Document; +import com.iluwatar.abstractdocument.domain.enums.Property; /** * HasPrice trait for static access to 'price' property */ public interface HasPrice extends Document { - String PROPERTY = "price"; default Optional getPrice() { - return Optional.ofNullable((Number) get(PROPERTY)); + return Optional.ofNullable((Number) get(Property.PRICE.toString())); } } diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasType.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasType.java index 4a80bff20c16..1dfb36ab21b6 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasType.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasType.java @@ -22,19 +22,19 @@ */ package com.iluwatar.abstractdocument.domain; -import com.iluwatar.abstractdocument.Document; - import java.util.Optional; +import com.iluwatar.abstractdocument.Document; +import com.iluwatar.abstractdocument.domain.enums.Property; + /** * HasType trait for static access to 'type' property */ public interface HasType extends Document { - String PROPERTY = "type"; default Optional getType() { - return Optional.ofNullable((String) get(PROPERTY)); + return Optional.ofNullable((String) get(Property.TYPE.toString())); } } diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java new file mode 100644 index 000000000000..b766141a87f2 --- /dev/null +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java @@ -0,0 +1,11 @@ +package com.iluwatar.abstractdocument.domain.enums; + +/** + * + * Enum To Describe Property type + * + */ +public enum Property { + + PARTS, TYPE, PRICE, MODEL +} diff --git a/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java b/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java index 891e5a45763e..4c2a1c0d1ca7 100644 --- a/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java +++ b/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java @@ -22,19 +22,17 @@ */ package com.iluwatar.abstractdocument; -import com.iluwatar.abstractdocument.domain.Car; -import com.iluwatar.abstractdocument.domain.HasModel; -import com.iluwatar.abstractdocument.domain.HasParts; -import com.iluwatar.abstractdocument.domain.HasPrice; -import com.iluwatar.abstractdocument.domain.HasType; -import com.iluwatar.abstractdocument.domain.Part; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; + +import com.iluwatar.abstractdocument.domain.Car; +import com.iluwatar.abstractdocument.domain.Part; +import com.iluwatar.abstractdocument.domain.enums.Property; /** * Test for Part and Car @@ -51,9 +49,9 @@ public class DomainTest { @Test public void shouldConstructPart() { Map partProperties = new HashMap<>(); - partProperties.put(HasType.PROPERTY, TEST_PART_TYPE); - partProperties.put(HasModel.PROPERTY, TEST_PART_MODEL); - partProperties.put(HasPrice.PROPERTY, TEST_PART_PRICE); + partProperties.put(Property.TYPE.toString(), TEST_PART_TYPE); + partProperties.put(Property.MODEL.toString(), TEST_PART_MODEL); + partProperties.put(Property.PRICE.toString(), TEST_PART_PRICE); Part part = new Part(partProperties); assertEquals(TEST_PART_TYPE, part.getType().get()); @@ -64,9 +62,9 @@ public void shouldConstructPart() { @Test public void shouldConstructCar() { Map carProperties = new HashMap<>(); - carProperties.put(HasModel.PROPERTY, TEST_CAR_MODEL); - carProperties.put(HasPrice.PROPERTY, TEST_CAR_PRICE); - carProperties.put(HasParts.PROPERTY, Arrays.asList(new HashMap<>(), new HashMap<>())); + carProperties.put(Property.MODEL.toString(), TEST_CAR_MODEL); + carProperties.put(Property.PRICE.toString(), TEST_CAR_PRICE); + carProperties.put(Property.PARTS.toString(), Arrays.asList(new HashMap<>(), new HashMap<>())); Car car = new Car(carProperties); assertEquals(TEST_CAR_MODEL, car.getModel().get()); diff --git a/caching/src/main/java/com/iluwatar/caching/DbManager.java b/caching/src/main/java/com/iluwatar/caching/DbManager.java index 6fccaf43e5ff..9de45a17ee38 100644 --- a/caching/src/main/java/com/iluwatar/caching/DbManager.java +++ b/caching/src/main/java/com/iluwatar/caching/DbManager.java @@ -28,6 +28,7 @@ import org.bson.Document; +import com.iluwatar.caching.constants.CachingConstants; import com.mongodb.MongoClient; import com.mongodb.client.FindIterable; import com.mongodb.client.MongoDatabase; @@ -90,12 +91,12 @@ public static UserAccount readFromDb(String userId) { } } FindIterable iterable = - db.getCollection("user_accounts").find(new Document("userID", userId)); + db.getCollection(CachingConstants.USER_ACCOUNT).find(new Document(CachingConstants.USER_ID, userId)); if (iterable == null) { return null; } Document doc = iterable.first(); - return new UserAccount(userId, doc.getString("userName"), doc.getString("additionalInfo")); + return new UserAccount(userId, doc.getString(CachingConstants.USER_NAME), doc.getString(CachingConstants.ADD_INFO)); } /** @@ -113,9 +114,9 @@ public static void writeToDb(UserAccount userAccount) { e.printStackTrace(); } } - db.getCollection("user_accounts").insertOne( - new Document("userID", userAccount.getUserId()).append("userName", - userAccount.getUserName()).append("additionalInfo", userAccount.getAdditionalInfo())); + db.getCollection(CachingConstants.USER_ACCOUNT).insertOne( + new Document(CachingConstants.USER_ID ,userAccount.getUserId()).append(CachingConstants.USER_NAME, + userAccount.getUserName()).append(CachingConstants.ADD_INFO, userAccount.getAdditionalInfo())); } /** @@ -133,10 +134,10 @@ public static void updateDb(UserAccount userAccount) { e.printStackTrace(); } } - db.getCollection("user_accounts").updateOne( - new Document("userID", userAccount.getUserId()), - new Document("$set", new Document("userName", userAccount.getUserName()).append( - "additionalInfo", userAccount.getAdditionalInfo()))); + db.getCollection(CachingConstants.USER_ACCOUNT).updateOne( + new Document(CachingConstants.USER_ID, userAccount.getUserId()), + new Document("$set", new Document(CachingConstants.USER_NAME, userAccount.getUserName()) + .append(CachingConstants.ADD_INFO, userAccount.getAdditionalInfo()))); } /** @@ -155,10 +156,12 @@ public static void upsertDb(UserAccount userAccount) { e.printStackTrace(); } } - db.getCollection("user_accounts").updateOne( - new Document("userID", userAccount.getUserId()), - new Document("$set", new Document("userID", userAccount.getUserId()).append("userName", - userAccount.getUserName()).append("additionalInfo", userAccount.getAdditionalInfo())), + db.getCollection(CachingConstants.USER_ACCOUNT).updateOne( + new Document(CachingConstants.USER_ID, userAccount.getUserId()), + new Document("$set", + new Document(CachingConstants.USER_ID, userAccount.getUserId()) + .append(CachingConstants.USER_NAME, userAccount.getUserName()).append(CachingConstants.ADD_INFO, + userAccount.getAdditionalInfo())), new UpdateOptions().upsert(true)); } } diff --git a/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java b/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java new file mode 100644 index 000000000000..cc5e34e2d2b0 --- /dev/null +++ b/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java @@ -0,0 +1,15 @@ +package com.iluwatar.caching.constants; + +/** + * + * Constant class for defining constants + * + */ +public class CachingConstants { + + public static final String USER_ACCOUNT = "user_accounts"; + public static final String USER_ID = "userID"; + public static final String USER_NAME = "userName"; + public static final String ADD_INFO = "additionalInfo"; + +} diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/app/App.java b/cqrs/src/main/java/com/iluwatar/cqrs/app/App.java index a943a7f88891..0f766e5c727f 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/app/App.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/app/App.java @@ -30,6 +30,7 @@ import com.iluwatar.cqrs.commandes.CommandServiceImpl; import com.iluwatar.cqrs.commandes.ICommandService; +import com.iluwatar.cqrs.constants.AppConstants; import com.iluwatar.cqrs.dto.Author; import com.iluwatar.cqrs.dto.Book; import com.iluwatar.cqrs.queries.IQueryService; @@ -60,27 +61,27 @@ public static void main(String[] args) { ICommandService commands = new CommandServiceImpl(); // Create Authors and Books using CommandService - commands.authorCreated("eEvans", "Eric Evans", "eEvans@email.com"); - commands.authorCreated("jBloch", "Joshua Bloch", "jBloch@email.com"); - commands.authorCreated("mFowler", "Martin Fowler", "mFowler@email.com"); + commands.authorCreated(AppConstants.E_EVANS, "Eric Evans", "eEvans@email.com"); + commands.authorCreated(AppConstants.J_BLOCH, "Joshua Bloch", "jBloch@email.com"); + commands.authorCreated(AppConstants.M_FOWLER, "Martin Fowler", "mFowler@email.com"); - commands.bookAddedToAuthor("Domain-Driven Design", 60.08, "eEvans"); - commands.bookAddedToAuthor("Effective Java", 40.54, "jBloch"); - commands.bookAddedToAuthor("Java Puzzlers", 39.99, "jBloch"); - commands.bookAddedToAuthor("Java Concurrency in Practice", 29.40, "jBloch"); - commands.bookAddedToAuthor("Patterns of Enterprise Application Architecture", 54.01, "mFowler"); - commands.bookAddedToAuthor("Domain Specific Languages", 48.89, "mFowler"); - commands.authorNameUpdated("eEvans", "Eric J. Evans"); + commands.bookAddedToAuthor("Domain-Driven Design", 60.08, AppConstants.E_EVANS); + commands.bookAddedToAuthor("Effective Java", 40.54, AppConstants.J_BLOCH); + commands.bookAddedToAuthor("Java Puzzlers", 39.99, AppConstants.J_BLOCH); + commands.bookAddedToAuthor("Java Concurrency in Practice", 29.40, AppConstants.J_BLOCH); + commands.bookAddedToAuthor("Patterns of Enterprise Application Architecture", 54.01, AppConstants.M_FOWLER); + commands.bookAddedToAuthor("Domain Specific Languages", 48.89, AppConstants.M_FOWLER); + commands.authorNameUpdated(AppConstants.E_EVANS, "Eric J. Evans"); IQueryService queries = new QueryServiceImpl(); // Query the database using QueryService Author nullAuthor = queries.getAuthorByUsername("username"); - Author eEvans = queries.getAuthorByUsername("eEvans"); - BigInteger jBlochBooksCount = queries.getAuthorBooksCount("jBloch"); + Author eEvans = queries.getAuthorByUsername(AppConstants.E_EVANS); + BigInteger jBlochBooksCount = queries.getAuthorBooksCount(AppConstants.J_BLOCH); BigInteger authorsCount = queries.getAuthorsCount(); Book dddBook = queries.getBook("Domain-Driven Design"); - List jBlochBooks = queries.getAuthorBooks("jBloch"); + List jBlochBooks = queries.getAuthorBooks(AppConstants.J_BLOCH); LOGGER.info("Author username : {}", nullAuthor); LOGGER.info("Author eEvans : {}", eEvans); diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java b/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java new file mode 100644 index 000000000000..154d63a892cf --- /dev/null +++ b/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java @@ -0,0 +1,15 @@ +package com.iluwatar.cqrs.constants; + +/** + * + * Class to define the constants + * + */ +public class AppConstants { + + public static final String E_EVANS = "eEvans"; + public static final String J_BLOCH = "jBloch"; + public static final String M_FOWLER = "mFowler"; + public static final String USER_NAME = "username"; + +} diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/queries/QueryServiceImpl.java b/cqrs/src/main/java/com/iluwatar/cqrs/queries/QueryServiceImpl.java index dc44d0f1b7c8..86eb4dd2f351 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/queries/QueryServiceImpl.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/queries/QueryServiceImpl.java @@ -30,6 +30,7 @@ import org.hibernate.SessionFactory; import org.hibernate.transform.Transformers; +import com.iluwatar.cqrs.constants.AppConstants; import com.iluwatar.cqrs.dto.Author; import com.iluwatar.cqrs.dto.Book; import com.iluwatar.cqrs.util.HibernateUtil; @@ -50,7 +51,7 @@ public Author getAuthorByUsername(String username) { SQLQuery sqlQuery = session .createSQLQuery("SELECT a.username as \"username\", a.name as \"name\", a.email as \"email\"" + "FROM Author a where a.username=:username"); - sqlQuery.setParameter("username", username); + sqlQuery.setParameter(AppConstants.USER_NAME, username); authorDTo = (Author) sqlQuery.setResultTransformer(Transformers.aliasToBean(Author.class)).uniqueResult(); } return authorDTo; @@ -74,7 +75,7 @@ public List getAuthorBooks(String username) { try (Session session = sessionFactory.openSession()) { SQLQuery sqlQuery = session.createSQLQuery("SELECT b.title as \"title\", b.price as \"price\"" + " FROM Author a , Book b where b.author_id = a.id and a.username=:username"); - sqlQuery.setParameter("username", username); + sqlQuery.setParameter(AppConstants.USER_NAME, username); bookDTos = sqlQuery.setResultTransformer(Transformers.aliasToBean(Book.class)).list(); } return bookDTos; @@ -86,7 +87,7 @@ public BigInteger getAuthorBooksCount(String username) { try (Session session = sessionFactory.openSession()) { SQLQuery sqlQuery = session.createSQLQuery( "SELECT count(b.title)" + " FROM Book b, Author a where b.author_id = a.id and a.username=:username"); - sqlQuery.setParameter("username", username); + sqlQuery.setParameter(AppConstants.USER_NAME, username); bookcount = (BigInteger) sqlQuery.uniqueResult(); } return bookcount; diff --git a/dao/src/main/java/com/iluwatar/dao/App.java b/dao/src/main/java/com/iluwatar/dao/App.java index d2fa945b617d..b5e70f257ebb 100644 --- a/dao/src/main/java/com/iluwatar/dao/App.java +++ b/dao/src/main/java/com/iluwatar/dao/App.java @@ -52,6 +52,7 @@ public class App { private static final String DB_URL = "jdbc:h2:~/dao"; private static Logger log = Logger.getLogger(App.class); + private static final String ALL_CUSTOMERS = "customerDao.getAllCustomers(): "; /** * Program entry point. @@ -92,23 +93,23 @@ private static DataSource createDataSource() { private static void performOperationsUsing(final CustomerDao customerDao) throws Exception { addCustomers(customerDao); - log.info("customerDao.getAllCustomers(): "); + log.info(ALL_CUSTOMERS); try (Stream customerStream = customerDao.getAll()) { customerStream.forEach((customer) -> log.info(customer)); } log.info("customerDao.getCustomerById(2): " + customerDao.getById(2)); final Customer customer = new Customer(4, "Dan", "Danson"); customerDao.add(customer); - log.info("customerDao.getAllCustomers(): " + customerDao.getAll()); + log.info(ALL_CUSTOMERS + customerDao.getAll()); customer.setFirstName("Daniel"); customer.setLastName("Danielson"); customerDao.update(customer); - log.info("customerDao.getAllCustomers(): "); + log.info(ALL_CUSTOMERS); try (Stream customerStream = customerDao.getAll()) { customerStream.forEach((cust) -> log.info(cust)); } customerDao.delete(customer); - log.info("customerDao.getAllCustomers(): " + customerDao.getAll()); + log.info(ALL_CUSTOMERS + customerDao.getAll()); } private static void addCustomers(CustomerDao customerDao) throws Exception { diff --git a/data-mapper/src/main/java/com/iluwatar/datamapper/App.java b/data-mapper/src/main/java/com/iluwatar/datamapper/App.java index 5fcd0d9ea04c..9a6cbcd058c4 100644 --- a/data-mapper/src/main/java/com/iluwatar/datamapper/App.java +++ b/data-mapper/src/main/java/com/iluwatar/datamapper/App.java @@ -36,6 +36,8 @@ public final class App { private static Logger log = Logger.getLogger(App.class); + private static final String STUDENT_STRING = "App.main(), student : "; + /** * Program entry point. @@ -53,12 +55,12 @@ public static void main(final String... args) { /* Add student in respectibe store */ mapper.insert(student); - log.debug("App.main(), student : " + student + ", is inserted"); + log.debug(STUDENT_STRING + student + ", is inserted"); /* Find this student */ final Optional studentToBeFound = mapper.find(student.getStudentId()); - log.debug("App.main(), student : " + studentToBeFound + ", is searched"); + log.debug(STUDENT_STRING + studentToBeFound + ", is searched"); /* Update existing student object */ student = new Student(student.getStudentId(), "AdamUpdated", 'A'); @@ -66,8 +68,8 @@ public static void main(final String... args) { /* Update student in respectibe db */ mapper.update(student); - log.debug("App.main(), student : " + student + ", is updated"); - log.debug("App.main(), student : " + student + ", is going to be deleted"); + log.debug(STUDENT_STRING + student + ", is updated"); + log.debug(STUDENT_STRING + student + ", is going to be deleted"); /* Delete student in db */ mapper.delete(student); diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/Meteoroid.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/Meteoroid.java index 311ffa0e11f8..b5832fe41cb2 100644 --- a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/Meteoroid.java +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/Meteoroid.java @@ -25,6 +25,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.iluwatar.doubledispatch.constants.AppConstants; + /** * * Meteoroid game object @@ -45,21 +47,21 @@ public void collision(GameObject gameObject) { @Override public void collisionResolve(FlamingAsteroid asteroid) { - LOGGER.info("{} hits {}.", asteroid.getClass().getSimpleName(), this.getClass().getSimpleName()); + LOGGER.info(AppConstants.HITS, asteroid.getClass().getSimpleName(), this.getClass().getSimpleName()); } @Override public void collisionResolve(Meteoroid meteoroid) { - LOGGER.info("{} hits {}.", meteoroid.getClass().getSimpleName(), this.getClass().getSimpleName()); + LOGGER.info(AppConstants.HITS, meteoroid.getClass().getSimpleName(), this.getClass().getSimpleName()); } @Override public void collisionResolve(SpaceStationMir mir) { - LOGGER.info("{} hits {}.", mir.getClass().getSimpleName(), this.getClass().getSimpleName()); + LOGGER.info(AppConstants.HITS, mir.getClass().getSimpleName(), this.getClass().getSimpleName()); } @Override public void collisionResolve(SpaceStationIss iss) { - LOGGER.info("{} hits {}.", iss.getClass().getSimpleName(), this.getClass().getSimpleName()); + LOGGER.info(AppConstants.HITS, iss.getClass().getSimpleName(), this.getClass().getSimpleName()); } } diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/SpaceStationMir.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/SpaceStationMir.java index 419be2e30c78..e1183f9afee0 100644 --- a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/SpaceStationMir.java +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/SpaceStationMir.java @@ -25,6 +25,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.iluwatar.doubledispatch.constants.AppConstants; + /** * * Space station Mir game object @@ -45,7 +47,7 @@ public void collision(GameObject gameObject) { @Override public void collisionResolve(FlamingAsteroid asteroid) { - LOGGER.info("{} hits {}. {} is damaged! {} is set on fire!", asteroid.getClass().getSimpleName(), + LOGGER.info(AppConstants.HITS," {} is damaged! {} is set on fire!", asteroid.getClass().getSimpleName(), this.getClass().getSimpleName(), this.getClass().getSimpleName(), this.getClass().getSimpleName()); setDamaged(true); setOnFire(true); @@ -53,21 +55,21 @@ public void collisionResolve(FlamingAsteroid asteroid) { @Override public void collisionResolve(Meteoroid meteoroid) { - LOGGER.info("{} hits {}. {} is damaged!", meteoroid.getClass().getSimpleName(), + LOGGER.info(AppConstants.HITS," {} is damaged!", meteoroid.getClass().getSimpleName(), this.getClass().getSimpleName(), this.getClass().getSimpleName()); setDamaged(true); } @Override public void collisionResolve(SpaceStationMir mir) { - LOGGER.info("{} hits {}. {} is damaged!", mir.getClass().getSimpleName(), + LOGGER.info(AppConstants.HITS," {} is damaged!", mir.getClass().getSimpleName(), this.getClass().getSimpleName(), this.getClass().getSimpleName()); setDamaged(true); } @Override public void collisionResolve(SpaceStationIss iss) { - LOGGER.info("{} hits {}. {} is damaged!", iss.getClass().getSimpleName(), + LOGGER.info(AppConstants.HITS," {} is damaged!", iss.getClass().getSimpleName(), this.getClass().getSimpleName(), this.getClass().getSimpleName()); setDamaged(true); } diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/constants/AppConstants.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/constants/AppConstants.java new file mode 100644 index 000000000000..7e25e67b558f --- /dev/null +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/constants/AppConstants.java @@ -0,0 +1,11 @@ +package com.iluwatar.doubledispatch.constants; + +/** + * + * Constants class to define all constants + * + */ +public class AppConstants { + + public static final String HITS = "{} hits {}."; +} From f7e22a1cf6f7664e8790cc5c76285adbcc6ab19d Mon Sep 17 00:00:00 2001 From: kanwarpreet25 <39183641+kanwarpreet25@users.noreply.github.com> Date: Sun, 28 Jul 2019 18:12:03 +0530 Subject: [PATCH 004/197] 508 : Sonar qube critical Issue Fix (#854) * 508 : Sonar qube critical Issue Fix Refactor this method to reduce its Cognitive Complexity from 30 to the 15 allowed. * 508: Sonar Qube Issue fxes Define a constant instead of duplicating this literal " does not exist." 3 times. * 508: sonar qube issue fixes Define a constant instead of duplicating this literal "Some external api for only realtime execution could be called here." 3 times. --- .../com/iluwatar/event/asynchronous/App.java | 111 ++++++++++-------- .../event/asynchronous/EventManager.java | 8 +- .../event/sourcing/domain/Account.java | 8 +- 3 files changed, 72 insertions(+), 55 deletions(-) diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/App.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/App.java index 6e9138d3c518..820279bc058a 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/App.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/App.java @@ -60,7 +60,8 @@ public class App { /** * Program entry point. * - * @param args command line args + * @param args + * command line args */ public static void main(String[] args) { App app = new App(); @@ -150,56 +151,11 @@ public void runInteractiveMode() { option = s.nextInt(); if (option == 1) { - s.nextLine(); - LOGGER.info("Boil multiple eggs at once (A) or boil them one-by-one (S)?: "); - String eventType = s.nextLine(); - LOGGER.info("How long should this egg be boiled for (in seconds)?: "); - int eventTime = s.nextInt(); - if (eventType.equalsIgnoreCase("A")) { - try { - int eventId = eventManager.createAsync(eventTime); - eventManager.start(eventId); - LOGGER.info("Egg [{}] is being boiled.", eventId); - } catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException e) { - LOGGER.error(e.getMessage()); - } - } else if (eventType.equalsIgnoreCase("S")) { - try { - int eventId = eventManager.create(eventTime); - eventManager.start(eventId); - LOGGER.info("Egg [{}] is being boiled.", eventId); - } catch (MaxNumOfEventsAllowedException | InvalidOperationException | LongRunningEventException - | EventDoesNotExistException e) { - LOGGER.error(e.getMessage()); - } - } else { - LOGGER.info("Unknown event type."); - } + processOption1(eventManager, s); } else if (option == 2) { - LOGGER.info("Which egg?: "); - int eventId = s.nextInt(); - try { - eventManager.cancel(eventId); - LOGGER.info("Egg [{}] is removed from boiler.", eventId); - } catch (EventDoesNotExistException e) { - LOGGER.error(e.getMessage()); - } + processOption2(eventManager, s); } else if (option == 3) { - s.nextLine(); - LOGGER.info("Just one egg (O) OR all of them (A) ?: "); - String eggChoice = s.nextLine(); - - if (eggChoice.equalsIgnoreCase("O")) { - LOGGER.info("Which egg?: "); - int eventId = s.nextInt(); - try { - eventManager.status(eventId); - } catch (EventDoesNotExistException e) { - LOGGER.error(e.getMessage()); - } - } else if (eggChoice.equalsIgnoreCase("A")) { - eventManager.statusOfAllEvents(); - } + processOption3(eventManager, s); } else if (option == 4) { eventManager.shutdown(); } @@ -208,4 +164,61 @@ public void runInteractiveMode() { s.close(); } + private void processOption3(EventManager eventManager, Scanner s) { + s.nextLine(); + LOGGER.info("Just one egg (O) OR all of them (A) ?: "); + String eggChoice = s.nextLine(); + + if (eggChoice.equalsIgnoreCase("O")) { + LOGGER.info("Which egg?: "); + int eventId = s.nextInt(); + try { + eventManager.status(eventId); + } catch (EventDoesNotExistException e) { + LOGGER.error(e.getMessage()); + } + } else if (eggChoice.equalsIgnoreCase("A")) { + eventManager.statusOfAllEvents(); + } + } + + private void processOption2(EventManager eventManager, Scanner s) { + LOGGER.info("Which egg?: "); + int eventId = s.nextInt(); + try { + eventManager.cancel(eventId); + LOGGER.info("Egg [{}] is removed from boiler.", eventId); + } catch (EventDoesNotExistException e) { + LOGGER.error(e.getMessage()); + } + } + + private void processOption1(EventManager eventManager, Scanner s) { + s.nextLine(); + LOGGER.info("Boil multiple eggs at once (A) or boil them one-by-one (S)?: "); + String eventType = s.nextLine(); + LOGGER.info("How long should this egg be boiled for (in seconds)?: "); + int eventTime = s.nextInt(); + if (eventType.equalsIgnoreCase("A")) { + try { + int eventId = eventManager.createAsync(eventTime); + eventManager.start(eventId); + LOGGER.info("Egg [{}] is being boiled.", eventId); + } catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException e) { + LOGGER.error(e.getMessage()); + } + } else if (eventType.equalsIgnoreCase("S")) { + try { + int eventId = eventManager.create(eventTime); + eventManager.start(eventId); + LOGGER.info("Egg [{}] is being boiled.", eventId); + } catch (MaxNumOfEventsAllowedException | InvalidOperationException | LongRunningEventException + | EventDoesNotExistException e) { + LOGGER.error(e.getMessage()); + } + } else { + LOGGER.info("Unknown event type."); + } + } + } diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/EventManager.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/EventManager.java index 729900620aa0..d54665bb21f5 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/EventManager.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/EventManager.java @@ -39,6 +39,8 @@ public class EventManager implements ThreadCompleteListener { private int currentlyRunningSyncEvent = -1; private Random rand; private Map eventPool; + + private static final String DOES_NOT_EXIST = " does not exist."; /** * EventManager constructor. @@ -112,7 +114,7 @@ private int createEvent(int eventTime, boolean isSynchronous) */ public void start(int eventId) throws EventDoesNotExistException { if (!eventPool.containsKey(eventId)) { - throw new EventDoesNotExistException(eventId + " does not exist."); + throw new EventDoesNotExistException(eventId + DOES_NOT_EXIST); } eventPool.get(eventId).start(); @@ -126,7 +128,7 @@ public void start(int eventId) throws EventDoesNotExistException { */ public void cancel(int eventId) throws EventDoesNotExistException { if (!eventPool.containsKey(eventId)) { - throw new EventDoesNotExistException(eventId + " does not exist."); + throw new EventDoesNotExistException(eventId + DOES_NOT_EXIST); } if (eventId == currentlyRunningSyncEvent) { @@ -145,7 +147,7 @@ public void cancel(int eventId) throws EventDoesNotExistException { */ public void status(int eventId) throws EventDoesNotExistException { if (!eventPool.containsKey(eventId)) { - throw new EventDoesNotExistException(eventId + " does not exist."); + throw new EventDoesNotExistException(eventId + DOES_NOT_EXIST); } eventPool.get(eventId).status(); diff --git a/event-sourcing/src/main/java/com/iluwatar/event/sourcing/domain/Account.java b/event-sourcing/src/main/java/com/iluwatar/event/sourcing/domain/Account.java index d2e5f429b5d4..a8ba649eb602 100644 --- a/event-sourcing/src/main/java/com/iluwatar/event/sourcing/domain/Account.java +++ b/event-sourcing/src/main/java/com/iluwatar/event/sourcing/domain/Account.java @@ -44,6 +44,8 @@ public class Account { private final int accountNo; private final String owner; private BigDecimal money; + + private static final String MSG = "Some external api for only realtime execution could be called here."; /** * Instantiates a new Account. @@ -126,7 +128,7 @@ private void handleDeposit(BigDecimal money, boolean realTime) { depositMoney(money); AccountAggregate.putAccount(this); if (realTime) { - LOGGER.info("Some external api for only realtime execution could be called here."); + LOGGER.info(MSG); } } @@ -138,7 +140,7 @@ private void handleWithdrawal(BigDecimal money, boolean realTime) { withdrawMoney(money); AccountAggregate.putAccount(this); if (realTime) { - LOGGER.info("Some external api for only realtime execution could be called here."); + LOGGER.info(MSG); } } @@ -160,7 +162,7 @@ public void handleEvent(MoneyDepositEvent moneyDepositEvent) { public void handleEvent(AccountCreateEvent accountCreateEvent) { AccountAggregate.putAccount(this); if (accountCreateEvent.isRealTime()) { - LOGGER.info("Some external api for only realtime execution could be called here."); + LOGGER.info(MSG); } } From a113de6a14526e8d9f495f7d3af39b3da8cc81d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sun, 28 Jul 2019 16:24:14 +0300 Subject: [PATCH 005/197] Add licenses --- .../domain/enums/Property.java | 22 +++++++++++++++++ .../caching/constants/CachingConstants.java | 22 +++++++++++++++++ .../iluwatar/cqrs/constants/AppConstants.java | 22 +++++++++++++++++ .../constants/AppConstants.java | 22 +++++++++++++++++ typeobjectpattern/pom.xml | 24 +++++++++++++++++++ 5 files changed, 112 insertions(+) diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java index b766141a87f2..c20f5b26de41 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java @@ -1,3 +1,25 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.abstractdocument.domain.enums; /** diff --git a/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java b/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java index cc5e34e2d2b0..885829caf2e6 100644 --- a/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java +++ b/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java @@ -1,3 +1,25 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.caching.constants; /** diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java b/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java index 154d63a892cf..07a8b96190b3 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java @@ -1,3 +1,25 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.cqrs.constants; /** diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/constants/AppConstants.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/constants/AppConstants.java index 7e25e67b558f..29b7b58d8b98 100644 --- a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/constants/AppConstants.java +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/constants/AppConstants.java @@ -1,3 +1,25 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.doubledispatch.constants; /** diff --git a/typeobjectpattern/pom.xml b/typeobjectpattern/pom.xml index 3377245f30ba..35d3b966194b 100644 --- a/typeobjectpattern/pom.xml +++ b/typeobjectpattern/pom.xml @@ -1,3 +1,27 @@ + 4.0.0 From d9a567cf970748ea8109ef99013393f88821ff05 Mon Sep 17 00:00:00 2001 From: AnaghaSasikumar <42939261+AnaghaSasikumar@users.noreply.github.com> Date: Mon, 29 Jul 2019 23:39:08 +0530 Subject: [PATCH 006/197] Commander pattern #505 (#857) * Commander pattern * Fix checkstyle errors * Update Commander.java * Update README.md * Update PaymentService.java * Update Commander.java * Update README.md --- commander/README.md | 24 + commander/pom.xml | 26 + commander/properties/log4j.properties | 18 + .../commander/AppEmployeeDbFailCases.java | 96 +++ .../commander/AppMessagingFailCases.java | 138 ++++ .../commander/AppPaymentFailCases.java | 109 ++++ .../iluwatar/commander/AppQueueFailCases.java | 136 ++++ .../commander/AppShippingFailCases.java | 123 ++++ .../com/iluwatar/commander/Commander.java | 613 ++++++++++++++++++ .../java/com/iluwatar/commander/Database.java | 37 ++ .../java/com/iluwatar/commander/Order.java | 82 +++ .../java/com/iluwatar/commander/Retry.java | 105 +++ .../java/com/iluwatar/commander/Service.java | 72 ++ .../java/com/iluwatar/commander/User.java | 39 ++ .../employeehandle/EmployeeDatabase.java | 51 ++ .../employeehandle/EmployeeHandle.java | 54 ++ .../DatabaseUnavailableException.java | 33 + .../exceptions/IsEmptyException.java | 32 + .../exceptions/ItemUnavailableException.java | 32 + .../PaymentDetailsErrorException.java | 33 + .../ShippingNotPossibleException.java | 33 + .../messagingservice/MessagingDatabase.java | 52 ++ .../messagingservice/MessagingService.java | 95 +++ .../paymentservice/PaymentDatabase.java | 55 ++ .../paymentservice/PaymentService.java | 72 ++ .../com/iluwatar/commander/queue/Queue.java | 97 +++ .../commander/queue/QueueDatabase.java | 82 +++ .../iluwatar/commander/queue/QueueTask.java | 82 +++ .../shippingservice/ShippingDatabase.java | 52 ++ .../shippingservice/ShippingService.java | 70 ++ .../com/iluwatar/commander/RetryTest.java | 76 +++ pom.xml | 1 + 32 files changed, 2620 insertions(+) create mode 100644 commander/README.md create mode 100644 commander/pom.xml create mode 100644 commander/properties/log4j.properties create mode 100644 commander/src/main/java/com/iluwatar/commander/AppEmployeeDbFailCases.java create mode 100644 commander/src/main/java/com/iluwatar/commander/AppMessagingFailCases.java create mode 100644 commander/src/main/java/com/iluwatar/commander/AppPaymentFailCases.java create mode 100644 commander/src/main/java/com/iluwatar/commander/AppQueueFailCases.java create mode 100644 commander/src/main/java/com/iluwatar/commander/AppShippingFailCases.java create mode 100644 commander/src/main/java/com/iluwatar/commander/Commander.java create mode 100644 commander/src/main/java/com/iluwatar/commander/Database.java create mode 100644 commander/src/main/java/com/iluwatar/commander/Order.java create mode 100644 commander/src/main/java/com/iluwatar/commander/Retry.java create mode 100644 commander/src/main/java/com/iluwatar/commander/Service.java create mode 100644 commander/src/main/java/com/iluwatar/commander/User.java create mode 100644 commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeDatabase.java create mode 100644 commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeHandle.java create mode 100644 commander/src/main/java/com/iluwatar/commander/exceptions/DatabaseUnavailableException.java create mode 100644 commander/src/main/java/com/iluwatar/commander/exceptions/IsEmptyException.java create mode 100644 commander/src/main/java/com/iluwatar/commander/exceptions/ItemUnavailableException.java create mode 100644 commander/src/main/java/com/iluwatar/commander/exceptions/PaymentDetailsErrorException.java create mode 100644 commander/src/main/java/com/iluwatar/commander/exceptions/ShippingNotPossibleException.java create mode 100644 commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingDatabase.java create mode 100644 commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingService.java create mode 100644 commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentDatabase.java create mode 100644 commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentService.java create mode 100644 commander/src/main/java/com/iluwatar/commander/queue/Queue.java create mode 100644 commander/src/main/java/com/iluwatar/commander/queue/QueueDatabase.java create mode 100644 commander/src/main/java/com/iluwatar/commander/queue/QueueTask.java create mode 100644 commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingDatabase.java create mode 100644 commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingService.java create mode 100644 commander/src/test/java/com/iluwatar/commander/RetryTest.java diff --git a/commander/README.md b/commander/README.md new file mode 100644 index 000000000000..41e2cd587553 --- /dev/null +++ b/commander/README.md @@ -0,0 +1,24 @@ +--- +layout: pattern +title: Commander +folder: commander +permalink: /patterns/commander/ +categories: +tags: + - Java + - Difficulty-Intermediate +--- + +## Intent + +> Used to handle all problems that can be encountered when doing distributed transactions. + +## Applicability +This pattern can be used when we need to make commits into 2 (or more) databases to complete transaction, which cannot be done atomically and can thereby create problems. + +## Explanation +Handling distributed transactions can be tricky, but if we choose to not handle it carefully, there could be unwanted consequences. Say, we have an e-commerce website which has a Payment microservice and a Shipping microservice. If the shipping is available currently but payment service is not up, or vice versa, how would we deal with it after having already received the order from the user? +We need a mechanism in place which can handle these kinds of situations. We have to direct the order to either one of the services (in this example, shipping) and then add the order into the database of the other service (in this example, payment), since two databses cannot be updated atomically. If currently unable to do it, there should be a queue where this request can be queued, and there has to be a mechanism which allows for a failure in the queueing as well. All this needs to be done by constant retries while ensuring idempotence (even if the request is made several times, the change should only be applied once) by a commander class, to reach a state of eventual consistency. + +## Credits +* [https://www.grahamlea.com/2016/08/distributed-transactions-microservices-icebergs/] diff --git a/commander/pom.xml b/commander/pom.xml new file mode 100644 index 000000000000..895906e65ded --- /dev/null +++ b/commander/pom.xml @@ -0,0 +1,26 @@ + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.21.0-SNAPSHOT + + commander + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + log4j + log4j + 1.2.17 + + + \ No newline at end of file diff --git a/commander/properties/log4j.properties b/commander/properties/log4j.properties new file mode 100644 index 000000000000..d7a52f503e83 --- /dev/null +++ b/commander/properties/log4j.properties @@ -0,0 +1,18 @@ +#Define root logger options +log4j.rootLogger=TRACE, file, console + +#Define console appender +log4j.appender.console=org.apache.log4j.ConsoleAppender +logrj.appender.console.Target=System.out +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd} %d{HH:mm:ss} %5p[%t] %m%n + +#Define rolling file appender +log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.File=/log/logFile.log +log4j.appender.file.Append=true +log4j.appender.file.ImmediateFlush=true +log4j.appender.file.MaxFileSize=10MB +log4j.appender.file.MaxBackupIndex=5 +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d %d{HH:mm:ss} %5p[%t] %m%n diff --git a/commander/src/main/java/com/iluwatar/commander/AppEmployeeDbFailCases.java b/commander/src/main/java/com/iluwatar/commander/AppEmployeeDbFailCases.java new file mode 100644 index 000000000000..d0975b2b5b7f --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/AppEmployeeDbFailCases.java @@ -0,0 +1,96 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander; + +import com.iluwatar.commander.employeehandle.EmployeeDatabase; +import com.iluwatar.commander.employeehandle.EmployeeHandle; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import com.iluwatar.commander.exceptions.ItemUnavailableException; +import com.iluwatar.commander.messagingservice.MessagingDatabase; +import com.iluwatar.commander.messagingservice.MessagingService; +import com.iluwatar.commander.paymentservice.PaymentDatabase; +import com.iluwatar.commander.paymentservice.PaymentService; +import com.iluwatar.commander.shippingservice.ShippingDatabase; +import com.iluwatar.commander.shippingservice.ShippingService; +import com.iluwatar.commander.queue.QueueDatabase; + +/** + * AppEmployeeDbFailCases class looks at possible cases when Employee handle service is + * available/unavailable. + */ + +public class AppEmployeeDbFailCases { + final int numOfRetries = 3; + final long retryDuration = 30000; + final long queueTime = 240000; //4 mins + final long queueTaskTime = 60000; //1 min + final long paymentTime = 120000; //2 mins + final long messageTime = 150000; //2.5 mins + final long employeeTime = 240000; //4 mins + + void employeeDatabaseUnavailableCase() throws Exception { + PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + ShippingService ss = new ShippingService(new ShippingDatabase()); + MessagingService ms = new MessagingService(new MessagingDatabase()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + void employeeDbSuccessCase() throws Exception { + PaymentService ps = new PaymentService(new PaymentDatabase()); + ShippingService ss = new ShippingService(new ShippingDatabase(), new ItemUnavailableException()); + MessagingService ms = new MessagingService(new MessagingDatabase()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + QueueDatabase qdb = new QueueDatabase(); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + /** + * Program entry point. + * + * @param args command line args + */ + + public static void main(String[] args) throws Exception { + AppEmployeeDbFailCases aefc = new AppEmployeeDbFailCases(); + //aefc.employeeDatabaseUnavailableCase(); + aefc.employeeDbSuccessCase(); + } +} diff --git a/commander/src/main/java/com/iluwatar/commander/AppMessagingFailCases.java b/commander/src/main/java/com/iluwatar/commander/AppMessagingFailCases.java new file mode 100644 index 000000000000..5b5717d2e5c6 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/AppMessagingFailCases.java @@ -0,0 +1,138 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander; + +import com.iluwatar.commander.employeehandle.EmployeeDatabase; +import com.iluwatar.commander.employeehandle.EmployeeHandle; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import com.iluwatar.commander.messagingservice.MessagingDatabase; +import com.iluwatar.commander.messagingservice.MessagingService; +import com.iluwatar.commander.paymentservice.PaymentDatabase; +import com.iluwatar.commander.paymentservice.PaymentService; +import com.iluwatar.commander.shippingservice.ShippingDatabase; +import com.iluwatar.commander.shippingservice.ShippingService; +import com.iluwatar.commander.queue.QueueDatabase; + +/** + * AppMessagingFailCases class looks at possible cases when Messaging service is + * available/unavailable. + */ + +public class AppMessagingFailCases { + final int numOfRetries = 3; + final long retryDuration = 30000; + final long queueTime = 240000; //4 mins + final long queueTaskTime = 60000; //1 min + final long paymentTime = 120000; //2 mins + final long messageTime = 150000; //2.5 mins + final long employeeTime = 240000; //4 mins + + void messagingDatabaseUnavailableCasePaymentSuccess() throws Exception { + //rest is successful + PaymentService ps = new PaymentService(new PaymentDatabase()); + ShippingService ss = new ShippingService(new ShippingDatabase()); + MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + void messagingDatabaseUnavailableCasePaymentError() throws Exception { + //rest is successful + PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + ShippingService ss = new ShippingService(new ShippingDatabase()); + MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + void messagingDatabaseUnavailableCasePaymentFailure() throws Exception { + //rest is successful + PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + ShippingService ss = new ShippingService(new ShippingDatabase()); + MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration,queueTime,queueTaskTime, + paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + void messagingSuccessCase() throws Exception { + //done here + PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + ShippingService ss = new ShippingService(new ShippingDatabase()); + MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + /** + * Program entry point. + * + * @param args command line args + */ + + public static void main(String[] args) throws Exception { + AppMessagingFailCases amfc = new AppMessagingFailCases(); + //amfc.messagingDatabaseUnavailableCasePaymentSuccess(); + //amfc.messagingDatabaseUnavailableCasePaymentError(); + //amfc.messagingDatabaseUnavailableCasePaymentFailure(); + amfc.messagingSuccessCase(); + } +} diff --git a/commander/src/main/java/com/iluwatar/commander/AppPaymentFailCases.java b/commander/src/main/java/com/iluwatar/commander/AppPaymentFailCases.java new file mode 100644 index 000000000000..ca67571abe2c --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/AppPaymentFailCases.java @@ -0,0 +1,109 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander; + +import com.iluwatar.commander.employeehandle.EmployeeDatabase; +import com.iluwatar.commander.employeehandle.EmployeeHandle; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import com.iluwatar.commander.exceptions.PaymentDetailsErrorException; +import com.iluwatar.commander.messagingservice.MessagingDatabase; +import com.iluwatar.commander.messagingservice.MessagingService; +import com.iluwatar.commander.paymentservice.PaymentDatabase; +import com.iluwatar.commander.paymentservice.PaymentService; +import com.iluwatar.commander.shippingservice.ShippingDatabase; +import com.iluwatar.commander.shippingservice.ShippingService; +import com.iluwatar.commander.queue.QueueDatabase; + +/** + * AppPaymentFailCases class looks at possible cases when Payment service is + * available/unavailable. + */ + +public class AppPaymentFailCases { + final int numOfRetries = 3; + final long retryDuration = 30000; + final long queueTime = 240000; //4 mins + final long queueTaskTime = 60000; //1 min + final long paymentTime = 120000; //2 mins + final long messageTime = 150000; //2.5 mins + final long employeeTime = 240000; //4 mins + + void paymentNotPossibleCase() throws Exception { + PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new PaymentDetailsErrorException()); + ShippingService ss = new ShippingService(new ShippingDatabase()); + MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException()); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + void paymentDatabaseUnavailableCase() throws Exception { + //rest is successful + PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + ShippingService ss = new ShippingService(new ShippingDatabase()); + MessagingService ms = new MessagingService(new MessagingDatabase()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + void paymentSuccessCase() throws Exception { + //goes to message after 2 retries maybe - rest is successful for now + PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + ShippingService ss = new ShippingService(new ShippingDatabase()); + MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException()); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + /** + * Program entry point. + * + * @param args command line args + */ + + public static void main(String[] args) throws Exception { + AppPaymentFailCases apfc = new AppPaymentFailCases(); + //apfc.paymentNotPossibleCase(); + //apfc.paymentDatabaseUnavailableCase(); + apfc.paymentSuccessCase(); + } +} diff --git a/commander/src/main/java/com/iluwatar/commander/AppQueueFailCases.java b/commander/src/main/java/com/iluwatar/commander/AppQueueFailCases.java new file mode 100644 index 000000000000..de9f90dab7a3 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/AppQueueFailCases.java @@ -0,0 +1,136 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander; + +import com.iluwatar.commander.employeehandle.EmployeeDatabase; +import com.iluwatar.commander.employeehandle.EmployeeHandle; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import com.iluwatar.commander.exceptions.ItemUnavailableException; +import com.iluwatar.commander.messagingservice.MessagingDatabase; +import com.iluwatar.commander.messagingservice.MessagingService; +import com.iluwatar.commander.paymentservice.PaymentDatabase; +import com.iluwatar.commander.paymentservice.PaymentService; +import com.iluwatar.commander.shippingservice.ShippingDatabase; +import com.iluwatar.commander.shippingservice.ShippingService; +import com.iluwatar.commander.queue.QueueDatabase; + +/** + * AppQueueFailCases class looks at possible cases when Queue Database is + * available/unavailable. + */ + +public class AppQueueFailCases { + final int numOfRetries = 3; + final long retryDuration = 30000; + final long queueTime = 240000; //4 mins + final long queueTaskTime = 60000; //1 min + final long paymentTime = 120000; //2 mins + final long messageTime = 150000; //2.5 mins + final long employeeTime = 240000; //4 mins + + void queuePaymentTaskDatabaseUnavailableCase() throws Exception { + PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + ShippingService ss = new ShippingService(new ShippingDatabase()); + MessagingService ms = new MessagingService(new MessagingDatabase()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + void queueMessageTaskDatabaseUnavailableCase() throws Exception { + PaymentService ps = new PaymentService(new PaymentDatabase()); + ShippingService ss = new ShippingService(new ShippingDatabase()); + MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + void queueEmployeeDbTaskDatabaseUnavailableCase() throws Exception { + PaymentService ps = new PaymentService(new PaymentDatabase()); + ShippingService ss = new ShippingService(new ShippingDatabase(), new ItemUnavailableException()); + MessagingService ms = new MessagingService(new MessagingDatabase()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + void queueSuccessCase() throws Exception { + PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + ShippingService ss = new ShippingService(new ShippingDatabase()); + MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException()); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + /** + * Program entry point. + * + * @param args command line args + */ + + public static void main(String[] args) throws Exception { + AppQueueFailCases aqfc = new AppQueueFailCases(); + //aqfc.queuePaymentTaskDatabaseUnavailableCase(); + //aqfc.queueMessageTaskDatabaseUnavailableCase(); + //aqfc.queueEmployeeDbTaskDatabaseUnavailableCase(); + aqfc.queueSuccessCase(); + } +} diff --git a/commander/src/main/java/com/iluwatar/commander/AppShippingFailCases.java b/commander/src/main/java/com/iluwatar/commander/AppShippingFailCases.java new file mode 100644 index 000000000000..6245d9865e59 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/AppShippingFailCases.java @@ -0,0 +1,123 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander; + +import com.iluwatar.commander.employeehandle.EmployeeDatabase; +import com.iluwatar.commander.employeehandle.EmployeeHandle; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import com.iluwatar.commander.exceptions.ItemUnavailableException; +import com.iluwatar.commander.exceptions.ShippingNotPossibleException; +import com.iluwatar.commander.messagingservice.MessagingDatabase; +import com.iluwatar.commander.messagingservice.MessagingService; +import com.iluwatar.commander.paymentservice.PaymentDatabase; +import com.iluwatar.commander.paymentservice.PaymentService; +import com.iluwatar.commander.shippingservice.ShippingDatabase; +import com.iluwatar.commander.shippingservice.ShippingService; +import com.iluwatar.commander.queue.QueueDatabase; + +/** + * AppShippingFailCases class looks at possible cases when Shipping service is + * available/unavailable. + */ + +public class AppShippingFailCases { + final int numOfRetries = 3; + final long retryDuration = 30000; + final long queueTime = 240000; //4 mins + final long queueTaskTime = 60000; //1 min + final long paymentTime = 120000; //2 mins + final long messageTime = 150000; //2.5 mins + final long employeeTime = 240000; //4 mins + + void itemUnavailableCase() throws Exception { + PaymentService ps = new PaymentService(new PaymentDatabase()); + ShippingService ss = new ShippingService(new ShippingDatabase(), new ItemUnavailableException()); + MessagingService ms = new MessagingService(new MessagingDatabase()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + void shippingNotPossibleCase() throws Exception { + PaymentService ps = new PaymentService(new PaymentDatabase()); + ShippingService ss = new ShippingService(new ShippingDatabase(), new ShippingNotPossibleException()); + MessagingService ms = new MessagingService(new MessagingDatabase()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + void shippingDatabaseUnavailableCase() throws Exception { + //rest is successful + PaymentService ps = new PaymentService(new PaymentDatabase()); + ShippingService ss = new ShippingService(new ShippingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + MessagingService ms = new MessagingService(new MessagingDatabase()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + void shippingSuccessCase() throws Exception { + //goes to payment after 2 retries maybe - rest is successful for now + PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException()); + ShippingService ss = new ShippingService(new ShippingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException()); + EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); + QueueDatabase qdb = new QueueDatabase(); + Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, + queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + c.placeOrder(order); + } + + /** + * Program entry point. + * + * @param args command line args + */ + + public static void main(String[] args) throws Exception { + AppShippingFailCases asfc = new AppShippingFailCases(); + //asfc.itemUnavailableCase(); + //asfc.shippingNotPossibleCase(); + //asfc.shippingDatabaseUnavailableCase(); + asfc.shippingSuccessCase(); + } +} diff --git a/commander/src/main/java/com/iluwatar/commander/Commander.java b/commander/src/main/java/com/iluwatar/commander/Commander.java new file mode 100644 index 000000000000..87d4604d4ac3 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/Commander.java @@ -0,0 +1,613 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander; + +import java.util.ArrayList; +import org.apache.log4j.Logger; +import com.iluwatar.commander.employeehandle.EmployeeHandle; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import com.iluwatar.commander.exceptions.ItemUnavailableException; +import com.iluwatar.commander.exceptions.PaymentDetailsErrorException; +import com.iluwatar.commander.exceptions.ShippingNotPossibleException; +import com.iluwatar.commander.messagingservice.MessagingService; +import com.iluwatar.commander.Order.MessageSent; +import com.iluwatar.commander.Order.PaymentStatus; +import com.iluwatar.commander.paymentservice.PaymentService; +import com.iluwatar.commander.queue.QueueDatabase; +import com.iluwatar.commander.queue.QueueTask; +import com.iluwatar.commander.queue.QueueTask.TaskType; +import com.iluwatar.commander.shippingservice.ShippingService; + +/** + *

Commander pattern is used to handle all issues that can come up while making a + * distributed transaction. The idea is to have a commander, which coordinates the + * execution of all instructions and ensures proper completion using retries and + * taking care of idempotence. By queueing instructions while they haven't been done, + * we can ensure a state of 'eventual consistency'.

+ *

In our example, we have an e-commerce application. When the user places an order, + * the shipping service is intimated first. If the service does not respond for some + * reason, the order is not placed. If response is received, the commander then calls + * for the payment service to be intimated. If this fails, the shipping still takes + * place (order converted to COD) and the item is queued. If the queue is also found + * to be unavailable, the payment is noted to be not done and this is added to an + * employee database. Three types of messages are sent to the user - one, if payment + * succeeds; two, if payment fails definitively; and three, if payment fails in the + * first attempt. If the message is not sent, this is also queued and is added to employee + * db. We also have a time limit for each instruction to be completed, after which, the + * instruction is not executed, thereby ensuring that resources are not held for too long. + * In the rare occasion in which everything fails, an individual would have to step in to + * figure out how to solve the issue.

+ *

We have abstract classes {@link Database} and {@link Service} which are extended + * by all the databases and services. Each service has a database to be updated, and + * receives request from an outside user (the {@link Commander} class here). There are + * 5 microservices - {@link ShippingService}, {@link PaymentService}, {@link MessagingService}, + * {@link EmployeeHandle} and a {@link QueueDatabase}. We use retries to execute any + * instruction using {@link Retry} class, and idempotence is ensured by going through some + * checks before making requests to services and making change in {@link Order} class fields + * if request succeeds or definitively fails. There are 5 classes - + * {@link AppShippingFailCases}, {@link AppPaymentFailCases}, {@link AppMessagingFailCases}, + * {@link AppQueueFailCases} and {@link AppEmployeeDbFailCases}, which look at the different + * scenarios that may be encountered during the placing of an order.

+ */ + +public class Commander { + + private final QueueDatabase queue; + private final EmployeeHandle employeeDb; + private final PaymentService paymentService; + private final ShippingService shippingService; + private final MessagingService messagingService; + private int queueItems = 0; //keeping track here only so don't need access to queue db to get this + private final int numOfRetries; + private final long retryDuration; + private final long queueTime; + private final long queueTaskTime; + private final long paymentTime; + private final long messageTime; + private final long employeeTime; + private boolean finalSiteMsgShown; + static final Logger LOG = Logger.getLogger(Commander.class); + //we could also have another db where it stores all orders + + Commander(EmployeeHandle empDb, PaymentService pService, ShippingService sService, + MessagingService mService, QueueDatabase qdb, int numOfRetries, long retryDuration, + long queueTime, long queueTaskTime, long paymentTime, long messageTime, long employeeTime) { + this.paymentService = pService; + this.shippingService = sService; + this.messagingService = mService; + this.employeeDb = empDb; + this.queue = qdb; + this.numOfRetries = numOfRetries; + this.retryDuration = retryDuration; + this.queueTime = queueTime; + this.queueTaskTime = queueTaskTime; + this.paymentTime = paymentTime; + this.messageTime = messageTime; + this.employeeTime = employeeTime; + this.finalSiteMsgShown = false; + } + + void placeOrder(Order order) throws Exception { + sendShippingRequest(order); + } + + private void sendShippingRequest(Order order) throws Exception { + ArrayList list = shippingService.exceptionsList; + Retry.Operation op = (l) -> { + if (!l.isEmpty()) { + if (DatabaseUnavailableException.class.isAssignableFrom(l.get(0).getClass())) { + LOG.debug("Order " + order.id + ": Error in connecting to shipping service, trying again.."); + } else { + LOG.debug("Order " + order.id + ": Error in creating shipping request.."); + } + throw l.remove(0); + } + String transactionId = shippingService.receiveRequest(order.item, order.user.address); + //could save this transaction id in a db too + LOG.info("Order " + order.id + ": Shipping placed successfully, transaction id: " + transactionId); + System.out.println("Order has been placed and will be shipped to you. Please wait while we make your" + + " payment... "); + sendPaymentRequest(order); + return; + }; + Retry.HandleErrorIssue handleError = (o,err) -> { + if (ShippingNotPossibleException.class.isAssignableFrom(err.getClass())) { + System.out.println("Shipping is currently not possible to your address. We are working on the problem " + + "and will get back to you asap."); + finalSiteMsgShown = true; + LOG.info("Order " + order.id + ": Shipping not possible to address, trying to add problem to employee db.."); + employeeHandleIssue(o); + } else if (ItemUnavailableException.class.isAssignableFrom(err.getClass())) { + System.out.println("This item is currently unavailable. We will inform you as soon as the item becomes " + + "available again."); + finalSiteMsgShown = true; + LOG.info("Order " + order.id + ": Item " + order.item + " unavailable, trying to add problem to employee " + + "handle.."); + employeeHandleIssue(o); + } else { + System.out.println("Sorry, there was a problem in creating your order. Please try later."); + LOG.error("Order " + order.id + ": Shipping service unavailable, order not placed.."); + finalSiteMsgShown = true; + } + return; + }; + Retry r = new Retry(op, handleError, numOfRetries, retryDuration, + e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); + r.perform(list, order); + } + + private void sendPaymentRequest(Order order) { + if (System.currentTimeMillis() - order.createdTime >= this.paymentTime) { + if (order.paid.equals(PaymentStatus.Trying)) { + order.paid = PaymentStatus.NotDone; + sendPaymentFailureMessage(order); + LOG.error("Order " + order.id + ": Payment time for order over, failed and returning.."); + } //if succeeded or failed, would have been dequeued, no attempt to make payment + return; + } + ArrayList list = paymentService.exceptionsList; + Thread t = new Thread(new Runnable() { + @Override + public void run() { + Retry.Operation op = (l) -> { + if (!l.isEmpty()) { + if (DatabaseUnavailableException.class.isAssignableFrom(l.get(0).getClass())) { + LOG.debug("Order " + order.id + ": Error in connecting to payment service, trying again.."); + } else { + LOG.debug("Order " + order.id + ": Error in creating payment request.."); + } + throw l.remove(0); + } + if (order.paid.equals(PaymentStatus.Trying)) { + String transactionId = paymentService.receiveRequest(order.price); + order.paid = PaymentStatus.Done; + LOG.info("Order " + order.id + ": Payment successful, transaction Id: " + transactionId); + if (!finalSiteMsgShown) { + System.out.println("Payment made successfully, thank you for shopping with us!!"); + finalSiteMsgShown = true; + } + sendSuccessMessage(order); + return; + } + }; + Retry.HandleErrorIssue handleError = (o,err) -> { + if (PaymentDetailsErrorException.class.isAssignableFrom(err.getClass())) { + if (!finalSiteMsgShown) { + System.out.println("There was an error in payment. Your account/card details may have been incorrect. " + + "Meanwhile, your order has been converted to COD and will be shipped."); + finalSiteMsgShown = true; + } + LOG.error("Order " + order.id + ": Payment details incorrect, failed.."); + o.paid = PaymentStatus.NotDone; + sendPaymentFailureMessage(o); + } else { + try { + if (o.messageSent.equals(MessageSent.NoneSent)) { + if (!finalSiteMsgShown) { + System.out.println("There was an error in payment. We are on it, and will get back to you " + + "asap. Don't worry, your order has been placed and will be shipped."); + finalSiteMsgShown = true; + } + LOG.warn("Order " + order.id + ": Payment error, going to queue.."); + sendPaymentPossibleErrorMsg(o); + } + if (o.paid.equals(PaymentStatus.Trying) && System.currentTimeMillis() - o.createdTime < paymentTime) { + QueueTask qt = new QueueTask(o, TaskType.Payment,-1); + updateQueue(qt); + } + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + } + return; + }; + Retry r = new Retry(op, handleError, numOfRetries, retryDuration, + e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); + try { + r.perform(list, order); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + }); + t.start(); + } + + private void updateQueue(QueueTask qt) throws InterruptedException { + if (System.currentTimeMillis() - qt.order.createdTime >= this.queueTime) { + //since payment time is lesser than queuetime it would have already failed..additional check not needed + LOG.trace("Order " + qt.order.id + ": Queue time for order over, failed.."); + return; + } else if ((qt.taskType.equals(TaskType.Payment) && !qt.order.paid.equals(PaymentStatus.Trying)) + || (qt.taskType.equals(TaskType.Messaging) && ((qt.messageType == 1 + && !qt.order.messageSent.equals(MessageSent.NoneSent)) + || qt.order.messageSent.equals(MessageSent.PaymentFail) + || qt.order.messageSent.equals(MessageSent.PaymentSuccessful))) + || (qt.taskType.equals(TaskType.EmployeeDb) && qt.order.addedToEmployeeHandle)) { + LOG.trace("Order " + qt.order.id + ": Not queueing task since task already done.."); + return; + } + ArrayList list = queue.exceptionsList; + Thread t = new Thread(new Runnable() { + @Override + public void run() { + Retry.Operation op = (list) -> { + if (!list.isEmpty()) { + LOG.warn("Order " + qt.order.id + ": Error in connecting to queue db, trying again.."); + throw list.remove(0); + } + queue.add(qt); + queueItems++; + LOG.info("Order " + qt.order.id + ": " + qt.getType() + " task enqueued.."); + tryDoingTasksInQueue(); + return; + }; + Retry.HandleErrorIssue handleError = (qt,err) -> { + if (qt.taskType.equals(TaskType.Payment)) { + qt.order.paid = PaymentStatus.NotDone; + sendPaymentFailureMessage(qt.order); + LOG.error("Order " + qt.order.id + ": Unable to enqueue payment task, payment failed.."); + } + LOG.error("Order " + qt.order.id + ": Unable to enqueue task of type " + qt.getType() + + ", trying to add to employee handle.."); + employeeHandleIssue(qt.order); + return; + }; + Retry r = new Retry(op, handleError, numOfRetries, retryDuration, + e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); + try { + r.perform(list, qt); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + }); + t.start(); + } + + private void tryDoingTasksInQueue() { //commander controls operations done to queue + ArrayList list = queue.exceptionsList; + Thread t2 = new Thread(new Runnable() { + @Override + public void run() { + Retry.Operation op = (list) -> { + if (!list.isEmpty()) { + LOG.warn("Error in accessing queue db to do tasks, trying again.."); + throw list.remove(0); + } + doTasksInQueue(); + return; + }; + Retry.HandleErrorIssue handleError = (o,err) -> { + return; + }; + Retry r = new Retry(op, handleError, numOfRetries, retryDuration, + e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); + try { + r.perform(list, null); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + }); + t2.start(); + } + + private void tryDequeue() { + ArrayList list = queue.exceptionsList; + Thread t3 = new Thread(new Runnable() { + @Override + public void run() { + Retry.Operation op = (list) -> { + if (!list.isEmpty()) { + LOG.warn("Error in accessing queue db to dequeue task, trying again.."); + throw list.remove(0); + } + queue.dequeue(); + queueItems--; + return; + }; + Retry.HandleErrorIssue handleError = (o,err) -> { + return; + }; + Retry r = new Retry(op, handleError, numOfRetries, retryDuration, + e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); + try { + r.perform(list, null); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + }); + t3.start(); + } + + private void sendSuccessMessage(Order order) { + if (System.currentTimeMillis() - order.createdTime >= this.messageTime) { + LOG.trace("Order " + order.id + ": Message time for order over, returning.."); + return; + } + ArrayList list = messagingService.exceptionsList; + Thread t = new Thread(new Runnable() { + @Override + public void run() { + Retry.Operation op = (l) -> { + if (!l.isEmpty()) { + if (DatabaseUnavailableException.class.isAssignableFrom(l.get(0).getClass())) { + LOG.debug("Order " + order.id + ": Error in connecting to messaging service " + + "(Payment Success msg), trying again.."); + } else { + LOG.debug("Order " + order.id + ": Error in creating Payment Success messaging request.."); + } + throw l.remove(0); + } + if (!order.messageSent.equals(MessageSent.PaymentFail) + && !order.messageSent.equals(MessageSent.PaymentSuccessful)) { + String requestId = messagingService.receiveRequest(2); + order.messageSent = MessageSent.PaymentSuccessful; + LOG.info("Order " + order.id + ": Payment Success message sent, request Id: " + requestId); + } + return; + }; + Retry.HandleErrorIssue handleError = (o,err) -> { + try { + if ((o.messageSent.equals(MessageSent.NoneSent) || o.messageSent.equals(MessageSent.PaymentTrying)) + && System.currentTimeMillis() - o.createdTime < messageTime) { + QueueTask qt = new QueueTask(order, TaskType.Messaging,2); + updateQueue(qt); + LOG.info("Order " + order.id + ": Error in sending Payment Success message, trying to " + + "queue task and add to employee handle.."); + employeeHandleIssue(order); + } + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + return; + }; + Retry r = new Retry(op, handleError, numOfRetries, retryDuration, + e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); + try { + r.perform(list, order); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + }); + t.start(); + } + + private void sendPaymentFailureMessage(Order order) { + if (System.currentTimeMillis() - order.createdTime >= this.messageTime) { + LOG.trace("Order " + order.id + ": Message time for order over, returning.."); + return; + } + ArrayList list = messagingService.exceptionsList; + Thread t = new Thread(new Runnable() { + @Override + public void run() { + Retry.Operation op = (l) -> { + if (!l.isEmpty()) { + if (DatabaseUnavailableException.class.isAssignableFrom(l.get(0).getClass())) { + LOG.debug("Order " + order.id + ": Error in connecting to messaging service " + + "(Payment Failure msg), trying again.."); + } else { + LOG.debug("Order " + order.id + ": Error in creating Payment Failure message request.."); + } + throw l.remove(0); + } + if (!order.messageSent.equals(MessageSent.PaymentFail) + && !order.messageSent.equals(MessageSent.PaymentSuccessful)) { + String requestId = messagingService.receiveRequest(0); + order.messageSent = MessageSent.PaymentFail; + LOG.info("Order " + order.id + ": Payment Failure message sent successfully, request Id: " + requestId); + } + return; + }; + Retry.HandleErrorIssue handleError = (o,err) -> { + if ((o.messageSent.equals(MessageSent.NoneSent) || o.messageSent.equals(MessageSent.PaymentTrying)) + && System.currentTimeMillis() - o.createdTime < messageTime) { + try { + QueueTask qt = new QueueTask(order, TaskType.Messaging,0); + updateQueue(qt); + LOG.warn("Order " + order.id + ": Error in sending Payment Failure message, " + + "trying to queue task and add to employee handle.."); + employeeHandleIssue(o); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + return; + } + }; + Retry r = new Retry(op, handleError, numOfRetries, retryDuration, + e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); + try { + r.perform(list, order); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + }); + t.start(); + } + + private void sendPaymentPossibleErrorMsg(Order order) { + if (System.currentTimeMillis() - order.createdTime >= this.messageTime) { + LOG.trace("Message time for order over, returning.."); + return; + } + ArrayList list = messagingService.exceptionsList; + Thread t = new Thread(new Runnable() { + @Override + public void run() { + Retry.Operation op = (l) -> { + if (!l.isEmpty()) { + if (DatabaseUnavailableException.class.isAssignableFrom(l.get(0).getClass())) { + LOG.debug("Order " + order.id + ": Error in connecting to messaging service " + + "(Payment Error msg), trying again.."); + } else { + LOG.debug("Order " + order.id + ": Error in creating Payment Error messaging request.."); + } + throw l.remove(0); + } + if (order.paid.equals(PaymentStatus.Trying) && order.messageSent.equals(MessageSent.NoneSent)) { + String requestId = messagingService.receiveRequest(1); + order.messageSent = MessageSent.PaymentTrying; + LOG.info("Order " + order.id + ": Payment Error message sent successfully, request Id: " + requestId); + } + return; + }; + Retry.HandleErrorIssue handleError = (o,err) -> { + try { + if (o.messageSent.equals(MessageSent.NoneSent) && order.paid.equals(PaymentStatus.Trying) + && System.currentTimeMillis() - o.createdTime < messageTime) { + QueueTask qt = new QueueTask(order,TaskType.Messaging,1); + updateQueue(qt); + LOG.warn("Order " + order.id + ": Error in sending Payment Error message, " + + "trying to queue task and add to employee handle.."); + employeeHandleIssue(o); + } + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + return; + }; + Retry r = new Retry(op, handleError, numOfRetries, retryDuration, + e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); + try { + r.perform(list, order); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + }); + t.start(); + } + + private void employeeHandleIssue(Order order) { + if (System.currentTimeMillis() - order.createdTime >= this.employeeTime) { + LOG.trace("Order " + order.id + ": Employee handle time for order over, returning.."); + return; + } + ArrayList list = employeeDb.exceptionsList; + Thread t = new Thread(new Runnable() { + @Override + public void run() { + Retry.Operation op = (l) -> { + if (!l.isEmpty()) { + LOG.warn("Order " + order.id + ": Error in connecting to employee handle, trying again.."); + throw l.remove(0); + } + if (!order.addedToEmployeeHandle) { + employeeDb.receiveRequest(order); + order.addedToEmployeeHandle = true; + LOG.info("Order " + order.id + ": Added order to employee database"); + } + return; + }; + Retry.HandleErrorIssue handleError = (o,err) -> { + try { + if (!o.addedToEmployeeHandle && System.currentTimeMillis() - order.createdTime < employeeTime) { + QueueTask qt = new QueueTask(order, TaskType.EmployeeDb,-1); + updateQueue(qt); + LOG.warn("Order " + order.id + ": Error in adding to employee db, trying to queue task.."); + return; + } + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + return; + }; + Retry r = new Retry(op, handleError, numOfRetries, retryDuration, + e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); + try { + r.perform(list, order); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + }); + t.start(); + } + + private void doTasksInQueue() throws Exception { + if (queueItems != 0) { + QueueTask qt = queue.peek(); //this should probably be cloned here + //this is why we have retry for doTasksInQueue + LOG.trace("Order " + qt.order.id + ": Started doing task of type " + qt.getType()); + if (qt.firstAttemptTime == -1) { + qt.firstAttemptTime = System.currentTimeMillis(); + } + if (System.currentTimeMillis() - qt.firstAttemptTime >= queueTaskTime) { + tryDequeue(); + LOG.trace("Order " + qt.order.id + ": This queue task of type " + qt.getType() + + " does not need to be done anymore (timeout), dequeue.."); + } else { + if (qt.taskType.equals(TaskType.Payment)) { + if (!qt.order.paid.equals(PaymentStatus.Trying)) { + tryDequeue(); + LOG.trace("Order " + qt.order.id + ": This payment task already done, dequeueing.."); + } else { + sendPaymentRequest(qt.order); + LOG.debug("Order " + qt.order.id + ": Trying to connect to payment service.."); + } + } else if (qt.taskType.equals(TaskType.Messaging)) { + if (qt.order.messageSent.equals(MessageSent.PaymentFail) + || qt.order.messageSent.equals(MessageSent.PaymentSuccessful)) { + tryDequeue(); + LOG.trace("Order " + qt.order.id + ": This messaging task already done, dequeue.."); + } else if ((qt.messageType == 1 && (!qt.order.messageSent.equals(MessageSent.NoneSent) + || !qt.order.paid.equals(PaymentStatus.Trying)))) { + tryDequeue(); + LOG.trace("Order " + qt.order.id + ": This messaging task does not need to be done, dequeue.."); + } else if (qt.messageType == 0) { + sendPaymentFailureMessage(qt.order); + LOG.debug("Order " + qt.order.id + ": Trying to connect to messaging service.."); + } else if (qt.messageType == 1) { + sendPaymentPossibleErrorMsg(qt.order); + LOG.debug("Order " + qt.order.id + ": Trying to connect to messaging service.."); + } else if (qt.messageType == 2) { + sendSuccessMessage(qt.order); + LOG.debug("Order " + qt.order.id + ": Trying to connect to messaging service.."); + } + } else if (qt.taskType.equals(TaskType.EmployeeDb)) { + if (qt.order.addedToEmployeeHandle) { + tryDequeue(); + LOG.trace("Order " + qt.order.id + ": This employee handle task already done, dequeue.."); + } else { + employeeHandleIssue(qt.order); + LOG.debug("Order " + qt.order.id + ": Trying to connect to employee handle.."); + } + } + } + } + if (queueItems == 0) { + LOG.trace("Queue is empty, returning.."); + } else { + Thread.sleep(queueTaskTime / 3); + tryDoingTasksInQueue(); + } + return; + } + +} diff --git a/commander/src/main/java/com/iluwatar/commander/Database.java b/commander/src/main/java/com/iluwatar/commander/Database.java new file mode 100644 index 000000000000..09d145688aa7 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/Database.java @@ -0,0 +1,37 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander; + +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; + +/** + * Database abstract class is extended by all databases in our example. The add and get + * methods are used by the respective service to add to database or get from database. + * @param T is the type of object being held by database. + */ + +public abstract class Database { + public abstract T add(T obj) throws DatabaseUnavailableException; + public abstract T get(String tId) throws DatabaseUnavailableException; +} diff --git a/commander/src/main/java/com/iluwatar/commander/Order.java b/commander/src/main/java/com/iluwatar/commander/Order.java new file mode 100644 index 000000000000..5ee787d612b7 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/Order.java @@ -0,0 +1,82 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander; + +import java.util.Hashtable; +import java.util.Random; + +/** + * Order class holds details of the order. + */ + +public class Order { //can store all transactions ids also + + enum PaymentStatus { + NotDone, Trying, Done + }; + + enum MessageSent { + NoneSent, PaymentFail, PaymentTrying, PaymentSuccessful + }; + + final User user; + final String item; + public final String id; + final float price; + final long createdTime; + private static final String ALL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; + private static final Hashtable USED_IDS = new Hashtable(); + PaymentStatus paid; + MessageSent messageSent; //to avoid sending error msg on page and text more than once + boolean addedToEmployeeHandle; //to avoid creating more to enqueue + + Order(User user, String item, float price) { + this.createdTime = System.currentTimeMillis(); + this.user = user; + this.item = item; + this.price = price; + String id = createUniqueId(); + if (USED_IDS.get(id) != null) { + while (USED_IDS.get(id)) { + id = createUniqueId(); + } + } + this.id = id; + USED_IDS.put(this.id, true); + this.paid = PaymentStatus.Trying; + this.messageSent = MessageSent.NoneSent; + this.addedToEmployeeHandle = false; + } + + String createUniqueId() { + StringBuilder random = new StringBuilder(); + Random rand = new Random(); + while (random.length() < 12) { // length of the random string. + int index = (int) (rand.nextFloat() * ALL_CHARS.length()); + random.append(ALL_CHARS.charAt(index)); + } + return random.toString(); + } + +} diff --git a/commander/src/main/java/com/iluwatar/commander/Retry.java b/commander/src/main/java/com/iluwatar/commander/Retry.java new file mode 100644 index 000000000000..eefff663146f --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/Retry.java @@ -0,0 +1,105 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Random; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Predicate; + +/** + * Retry pattern + * @param is the type of object passed into HandleErrorIssue as a parameter. + */ + +public class Retry { + + /** + * Operation Interface will define method to be implemented. + */ + + public interface Operation { + void operation(ArrayList list) throws Exception; + } + + /** + * HandleErrorIssue defines how to handle errors. + * @param is the type of object to be passed into the method as parameter. + */ + + public interface HandleErrorIssue { + void handleIssue(T obj, Exception e); + } + + private final Operation op; + private final HandleErrorIssue handleError; + private final int maxAttempts; + private final long maxDelay; + private final AtomicInteger attempts; + private final Predicate test; + private final ArrayList errors; + + Retry(Operation op, HandleErrorIssue handleError, int maxAttempts, + long maxDelay, Predicate... ignoreTests) { + this.op = op; + this.handleError = handleError; + this.maxAttempts = maxAttempts; + this.maxDelay = maxDelay; + this.attempts = new AtomicInteger(); + this.test = Arrays.stream(ignoreTests).reduce(Predicate::or).orElse(e -> false); + this.errors = new ArrayList<>(); + } + + /** + * Performing the operation with retries. + * @param list is the exception list + * @param obj is the parameter to be passed into handleIsuue method + */ + + public void perform(ArrayList list, T obj) throws Exception { + do { + try { + op.operation(list); + return; + } catch (Exception e) { + this.errors.add(e); + if (this.attempts.incrementAndGet() >= this.maxAttempts || !this.test.test(e)) { + this.handleError.handleIssue(obj, e); + return; //return here...dont go further + } + try { + Random rand = new Random(); + long testDelay = (long) Math.pow(2, this.attempts.intValue()) * 1000 + rand.nextInt(1000); + long delay = testDelay < this.maxDelay ? testDelay : maxDelay; + Thread.sleep(delay); + } catch (InterruptedException f) { + //ignore + } + } + } + while (true); + } + +} diff --git a/commander/src/main/java/com/iluwatar/commander/Service.java b/commander/src/main/java/com/iluwatar/commander/Service.java new file mode 100644 index 000000000000..226f519eb046 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/Service.java @@ -0,0 +1,72 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.Random; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; + +/** + * Service class is an abstract class extended by all services in this example. They + * all have a public receiveRequest method to receive requests, which could also contain + * details of the user other than the implementation details (though we are not doing + * that here) and updateDb method which adds to their respective databases. There is a + * method to generate transaction/request id for the transactions/requests, which are + * then sent back. These could be stored by the {@link Commander} class in a separate + * database for reference (though we are not doing that here). + */ + +public abstract class Service { + + protected final Database database; + public ArrayList exceptionsList; + private static final String ALL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; + private static final Hashtable USED_IDS = new Hashtable(); + + protected Service(Database db, Exception...exc) { + this.database = db; + this.exceptionsList = new ArrayList(Arrays.asList(exc)); + } + + public abstract String receiveRequest(Object...parameters) throws DatabaseUnavailableException; + protected abstract String updateDb(Object...parameters) throws DatabaseUnavailableException; + + protected String generateId() { + StringBuilder random = new StringBuilder(); + Random rand = new Random(); + while (random.length() < 12) { // length of the random string. + int index = (int) (rand.nextFloat() * ALL_CHARS.length()); + random.append(ALL_CHARS.charAt(index)); + } + String id = random.toString(); + if (USED_IDS.get(id) != null) { + while (USED_IDS.get(id)) { + id = generateId(); + } + } + return id; + } +} diff --git a/commander/src/main/java/com/iluwatar/commander/User.java b/commander/src/main/java/com/iluwatar/commander/User.java new file mode 100644 index 000000000000..85c5b92735c1 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/User.java @@ -0,0 +1,39 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander; + +/** + * User class contains details of user who places order. + */ + +public class User { + String name; + String address; + + User(String name, String address) { + this.name = name; + this.address = address; + } + +} diff --git a/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeDatabase.java b/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeDatabase.java new file mode 100644 index 000000000000..729ba7ecbc73 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeDatabase.java @@ -0,0 +1,51 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.employeehandle; + +import java.util.Hashtable; +import com.iluwatar.commander.Database; +import com.iluwatar.commander.Order; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; + +/** + * The Employee Database is where orders which have encountered some issue(s) are added. + */ + +public class EmployeeDatabase extends Database { + private Hashtable data; + + public EmployeeDatabase() { + this.data = new Hashtable(); + } + + @Override + public Order add(Order o) throws DatabaseUnavailableException { + return data.put(o.id,o); + } + + @Override + public Order get(String oId) throws DatabaseUnavailableException { + return data.get(oId); + } +} diff --git a/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeHandle.java b/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeHandle.java new file mode 100644 index 000000000000..38e0747304cd --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeHandle.java @@ -0,0 +1,54 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.employeehandle; + +import com.iluwatar.commander.Order; +import com.iluwatar.commander.Service; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; + +/** + * The EmployeeHandle class is the middle-man between {@link Commander} and + * {@link EmployeeDatabase}. + */ + +public class EmployeeHandle extends Service { + + public EmployeeHandle(EmployeeDatabase db, Exception...exc) { + super(db, exc); + } + + public String receiveRequest(Object...parameters) throws DatabaseUnavailableException { + return updateDb((Order)parameters[0]); + } + + protected String updateDb(Object...parameters) throws DatabaseUnavailableException { + Order o = (Order) parameters[0]; + if (database.get(o.id) == null) { + database.add(o); + return o.id; //true rcvd - change addedToEmployeeHandle to true else dont do anything + } + return null; + } + +} diff --git a/commander/src/main/java/com/iluwatar/commander/exceptions/DatabaseUnavailableException.java b/commander/src/main/java/com/iluwatar/commander/exceptions/DatabaseUnavailableException.java new file mode 100644 index 000000000000..95cf3982513f --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/exceptions/DatabaseUnavailableException.java @@ -0,0 +1,33 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.exceptions; + +/** + * DatabaseUnavailableException is thrown when database is unavailable and nothing + * can be added or retrieved. + */ + +public class DatabaseUnavailableException extends Exception { + private static final long serialVersionUID = 2459603L; +} diff --git a/commander/src/main/java/com/iluwatar/commander/exceptions/IsEmptyException.java b/commander/src/main/java/com/iluwatar/commander/exceptions/IsEmptyException.java new file mode 100644 index 000000000000..c51a82d52d7d --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/exceptions/IsEmptyException.java @@ -0,0 +1,32 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.exceptions; + +/** + * IsEmptyException is thrown when it is attempted to dequeue from an empty queue. + */ + +public class IsEmptyException extends Exception { + private static final long serialVersionUID = 123546L; +} diff --git a/commander/src/main/java/com/iluwatar/commander/exceptions/ItemUnavailableException.java b/commander/src/main/java/com/iluwatar/commander/exceptions/ItemUnavailableException.java new file mode 100644 index 000000000000..6c7a52ba70d1 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/exceptions/ItemUnavailableException.java @@ -0,0 +1,32 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.exceptions; + +/** + * ItemUnavailableException is thrown when item is not available for shipping. + */ + +public class ItemUnavailableException extends Exception { + private static final long serialVersionUID = 575940L; +} diff --git a/commander/src/main/java/com/iluwatar/commander/exceptions/PaymentDetailsErrorException.java b/commander/src/main/java/com/iluwatar/commander/exceptions/PaymentDetailsErrorException.java new file mode 100644 index 000000000000..ee36b105f591 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/exceptions/PaymentDetailsErrorException.java @@ -0,0 +1,33 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.exceptions; + +/** + * PaymentDetailsErrorException is thrown when the details entered are incorrect or + * payment cannot be made with the details given. + */ + +public class PaymentDetailsErrorException extends Exception { + private static final long serialVersionUID = 867203L; +} diff --git a/commander/src/main/java/com/iluwatar/commander/exceptions/ShippingNotPossibleException.java b/commander/src/main/java/com/iluwatar/commander/exceptions/ShippingNotPossibleException.java new file mode 100644 index 000000000000..0ef7673a129d --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/exceptions/ShippingNotPossibleException.java @@ -0,0 +1,33 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.exceptions; + +/** + * ShippingNotPossibleException is thrown when the address entered cannot be shipped to + * by service currently for some reason. + */ + +public class ShippingNotPossibleException extends Exception { + private static final long serialVersionUID = 342055L; +} diff --git a/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingDatabase.java b/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingDatabase.java new file mode 100644 index 000000000000..2036a233cbd1 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingDatabase.java @@ -0,0 +1,52 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.messagingservice; + +import java.util.Hashtable; +import com.iluwatar.commander.Database; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import com.iluwatar.commander.messagingservice.MessagingService.MessageRequest; + +/** + * The MessagingDatabase is where the MessageRequest is added. + */ + +public class MessagingDatabase extends Database { + private Hashtable data; + + public MessagingDatabase() { + this.data = new Hashtable(); + } + + @Override + public MessageRequest add(MessageRequest r) throws DatabaseUnavailableException { + return data.put(r.reqId, r); + } + + @Override + public MessageRequest get(String rId) throws DatabaseUnavailableException { + return data.get(rId); + } + +} diff --git a/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingService.java b/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingService.java new file mode 100644 index 000000000000..99cba87223d6 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingService.java @@ -0,0 +1,95 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.messagingservice; + +import com.iluwatar.commander.Service; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; + +/** + * The MessagingService is used to send messages to user regarding their order and + * payment status. In case an error is encountered in payment and this service is + * found to be unavailable, the order is added to the {@link EmployeeDatabase}. + */ + +public class MessagingService extends Service { + + enum MessageToSend { + PaymentFail, PaymentTrying, PaymentSuccessful + }; + + class MessageRequest { + String reqId; + MessageToSend msg; + + MessageRequest(String reqId, MessageToSend msg) { + this.reqId = reqId; + this.msg = msg; + } + } + + public MessagingService(MessagingDatabase db, Exception...exc) { + super(db, exc); + } + + /** + * Public method which will receive request from {@link Commander}. + */ + + public String receiveRequest(Object...parameters) throws DatabaseUnavailableException { + int messageToSend = (int) parameters[0]; + String rId = generateId(); + MessageToSend msg = null; + if (messageToSend == 0) { + msg = MessageToSend.PaymentFail; + } else if (messageToSend == 1) { + msg = MessageToSend.PaymentTrying; + } else { //messageToSend == 2 + msg = MessageToSend.PaymentSuccessful; + } + MessageRequest req = new MessageRequest(rId, msg); + return updateDb(req); + } + + protected String updateDb(Object...parameters) throws DatabaseUnavailableException { + MessageRequest req = (MessageRequest) parameters[0]; + if (this.database.get(req.reqId) == null) { //idempotence, in case db fails here + database.add(req); //if successful: + System.out.println(sendMessage(req.msg)); + return req.reqId; + } + return null; + } + + String sendMessage(MessageToSend m) { + if (m.equals(MessageToSend.PaymentSuccessful)) { + return "Msg: Your order has been placed and paid for successfully! Thank you for shopping with us!"; + } else if (m.equals(MessageToSend.PaymentTrying)) { + return "Msg: There was an error in your payment process, we are working on it and will return back to you" + + " shortly. Meanwhile, your order has been placed and will be shipped."; + } else { + return "Msg: There was an error in your payment process. Your order is placed and has been converted to COD." + + " Please reach us on CUSTOMER-CARE-NUBER in case of any queries. Thank you for shopping with us!"; + } + } +} diff --git a/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentDatabase.java b/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentDatabase.java new file mode 100644 index 000000000000..39e3664d6b73 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentDatabase.java @@ -0,0 +1,55 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.paymentservice; + +import java.util.Hashtable; + +import com.iluwatar.commander.Database; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import com.iluwatar.commander.paymentservice.PaymentService.PaymentRequest; + +/** + * PaymentDatabase is where the PaymentRequest is added, along with details. + */ + +public class PaymentDatabase extends Database { + + private Hashtable data; + + public PaymentDatabase() { + this.data = new Hashtable(); + //0-fail, 1-error, 2-success + } + + @Override + public PaymentRequest add(PaymentRequest r) throws DatabaseUnavailableException { + return data.put(r.transactionId, r); + } + + @Override + public PaymentRequest get(String tId) throws DatabaseUnavailableException { + return data.get(tId); + } + +} diff --git a/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentService.java b/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentService.java new file mode 100644 index 000000000000..a3df0ce096e9 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentService.java @@ -0,0 +1,72 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.paymentservice; + +import com.iluwatar.commander.Service; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; + +/** + * The PaymentService class receives request from the {@link Commander} and adds + * to the {@link PaymentDatabase}. + */ + +public class PaymentService extends Service { + + class PaymentRequest { + String transactionId; + float payment; + boolean paid; + + PaymentRequest(String transactionId, float payment) { + this.transactionId = transactionId; + this.payment = payment; + this.paid = false; + } + } + + public PaymentService(PaymentDatabase db, Exception...exc) { + super(db, exc); + } + + /** + * Public method which will receive request from {@link Commander}. + */ + + public String receiveRequest(Object...parameters) throws DatabaseUnavailableException { + //it could also be sending a userid, payment details here or something, not added here + String tId = generateId(); + PaymentRequest req = new PaymentRequest(tId, (float)parameters[0]); + return updateDb(req); + } + + protected String updateDb(Object...parameters) throws DatabaseUnavailableException { + PaymentRequest req = (PaymentRequest) parameters[0]; + if (database.get(req.transactionId) == null || !req.paid) { + database.add(req); + req.paid = true; + return req.transactionId; + } + return null; + } +} diff --git a/commander/src/main/java/com/iluwatar/commander/queue/Queue.java b/commander/src/main/java/com/iluwatar/commander/queue/Queue.java new file mode 100644 index 000000000000..f1b0ef533117 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/queue/Queue.java @@ -0,0 +1,97 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.queue; + +import com.iluwatar.commander.exceptions.IsEmptyException; + +/** + * Queue data structure implementation. + * @param is the type of object the queue will hold. + */ + +public class Queue { + + Node front; + Node rear; + public int size = 0; + + class Node { + T value; + Node next; + + Node(T obj, Node b) { + value = obj; + next = b; + } + } + + /** + * Queue constructor + */ + + Queue() { + front = null; + rear = null; + size = 0; + } + + boolean isEmpty() { + if (size == 0) { + return true; + } else { + return false; + } + } + + void enqueue(T obj) { + if (front == null) { + front = new Node(obj, null); + rear = front; + } else { + Node temp = new Node(obj, null); + rear.next = temp; + rear = temp; + } + size++; + } + + T dequeue() throws IsEmptyException { + if (isEmpty()) { + throw new IsEmptyException(); + } else { + Node temp = front; + front = front.next; + size = size - 1; + return ((T) temp.value); + } + } + + T peek() throws IsEmptyException { + if (isEmpty()) { + throw new IsEmptyException(); + } else { + return ((T)front.value); + } + } +} diff --git a/commander/src/main/java/com/iluwatar/commander/queue/QueueDatabase.java b/commander/src/main/java/com/iluwatar/commander/queue/QueueDatabase.java new file mode 100644 index 000000000000..8ecd8c0a88e9 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/queue/QueueDatabase.java @@ -0,0 +1,82 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.queue; + +import java.util.ArrayList; +import java.util.Arrays; +import com.iluwatar.commander.Database; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import com.iluwatar.commander.exceptions.IsEmptyException; + +/** + * QueueDatabase id where the instructions to be implemented are queued. + */ + +public class QueueDatabase extends Database { + + private Queue data; + public ArrayList exceptionsList; + + public QueueDatabase(Exception...exc) { + this.data = new Queue(); + this.exceptionsList = new ArrayList(Arrays.asList(exc)); + } + + @Override + public QueueTask add(QueueTask t) throws DatabaseUnavailableException { + data.enqueue(t); + return t; + //even if same thing queued twice, it is taken care of in other dbs + } + + /** + * peek method returns object at front without removing it from queue + * @return object at front of queue + * @throws IsEmptyException if queue is empty + * @throws DatabaseUnavailableException if queue db is unavailable + */ + + public QueueTask peek() throws IsEmptyException, DatabaseUnavailableException { + QueueTask qt = this.data.peek(); + return qt; + } + + /** + * dequeue method removes the object at front and returns it + * @return object at front of queue + * @throws IsEmptyException if queue is empty + * @throws DatabaseUnavailableException if queue db is unavailable + */ + + public QueueTask dequeue() throws IsEmptyException, DatabaseUnavailableException { + QueueTask qt = this.data.dequeue(); + return qt; + } + + @Override + public QueueTask get(String tId) throws DatabaseUnavailableException { + return null; + } + +} diff --git a/commander/src/main/java/com/iluwatar/commander/queue/QueueTask.java b/commander/src/main/java/com/iluwatar/commander/queue/QueueTask.java new file mode 100644 index 000000000000..7e4219997978 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/queue/QueueTask.java @@ -0,0 +1,82 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.queue; + +import com.iluwatar.commander.Order; + +/** + * QueueTask object is the object enqueued in queue. + */ + +public class QueueTask { + +/** + * TaskType is the type of task to be done. + */ + + public enum TaskType { + Messaging, Payment, EmployeeDb + }; + + public Order order; + public TaskType taskType; + public int messageType; //0-fail, 1-error, 2-success + /*we could have varargs Object instead to pass in any parameter instead of just message type + but keeping it simple here*/ + public long firstAttemptTime; //when first time attempt made to do task + +/** + * QueueTask constructor + * @param o is the order for which the queuetask is being created + * @param t is the type of task to be done + * @param messageType if it is a message, which type of message - this could have instead been object varargs, + * and contained all additional details related to tasktype. + */ + + public QueueTask(Order o, TaskType t, int messageType) { + this.order = o; + this.taskType = t; + this.messageType = messageType; + this.firstAttemptTime = -1; + } + + /** + * getType method + * @return String representing type of task + */ + + public String getType() { + if (!this.taskType.equals(TaskType.Messaging)) { + return this.taskType.toString(); + } else { + if (this.messageType == 0) { + return "Payment Failure Message"; + } else if (this.messageType == 1) { + return "Payment Error Message"; + } else { + return "Payment Success Message"; + } + } + } +} diff --git a/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingDatabase.java b/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingDatabase.java new file mode 100644 index 000000000000..145a82437c32 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingDatabase.java @@ -0,0 +1,52 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.shippingservice; + +import java.util.Hashtable; +import com.iluwatar.commander.Database; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import com.iluwatar.commander.shippingservice.ShippingService.ShippingRequest; + +/** + * ShippingDatabase is where the ShippingRequest objects are added. + */ + +public class ShippingDatabase extends Database { + + private Hashtable data; + + public ShippingDatabase() { + this.data = new Hashtable(); + } + + @Override + public ShippingRequest add(ShippingRequest r) throws DatabaseUnavailableException { + return data.put(r.transactionId, r); + } + + public ShippingRequest get(String transactionId) throws DatabaseUnavailableException { + return data.get(transactionId); + } + +} diff --git a/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingService.java b/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingService.java new file mode 100644 index 000000000000..02d3430a8013 --- /dev/null +++ b/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingService.java @@ -0,0 +1,70 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander.shippingservice; + +import com.iluwatar.commander.Service; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; + +/** + * ShippingService class receives request from {@link Commander} class and adds it + * to the {@link ShippingDatabase}. + */ + +public class ShippingService extends Service { + + class ShippingRequest { + String transactionId; + String item; + String address; + + ShippingRequest(String transactionId, String item, String address) { + this.transactionId = transactionId; + this.item = item; + this.address = address; + } + } + + public ShippingService(ShippingDatabase db, Exception...exc) { + super(db, exc); + } + + /** + * Public method which will receive request from {@link Commander}. + */ + + public String receiveRequest(Object...parameters) throws DatabaseUnavailableException { + String tId = generateId(); + ShippingRequest req = new ShippingRequest(tId, (String) parameters[0] /*item*/, (String) parameters[1]/*address*/); + return updateDb(req); + } + + protected String updateDb(Object...parameters) throws DatabaseUnavailableException { + ShippingRequest req = (ShippingRequest) parameters[0]; + if (this.database.get(req.transactionId) == null) { + database.add(req); + return req.transactionId; + } + return null; + } +} diff --git a/commander/src/test/java/com/iluwatar/commander/RetryTest.java b/commander/src/test/java/com/iluwatar/commander/RetryTest.java new file mode 100644 index 000000000000..7a732f199071 --- /dev/null +++ b/commander/src/test/java/com/iluwatar/commander/RetryTest.java @@ -0,0 +1,76 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Sepp�l� + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.commander; + +import static org.junit.jupiter.api.Assertions.*; +import java.util.ArrayList; +import java.util.Arrays; +import org.junit.jupiter.api.Test; + +import com.iluwatar.commander.Order; +import com.iluwatar.commander.Retry; +import com.iluwatar.commander.User; +import com.iluwatar.commander.Retry.HandleErrorIssue; +import com.iluwatar.commander.Retry.Operation; +import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import com.iluwatar.commander.exceptions.ItemUnavailableException; + +class RetryTest { + + @Test + void performTest() { + Retry.Operation op = (l) -> { + if (!l.isEmpty()) { + throw l.remove(0); + } + return; + }; + Retry.HandleErrorIssue handleError = (o,e) -> { + return; + }; + Retry r1 = new Retry(op, handleError, 3, 30000, + e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); + Retry r2 = new Retry(op, handleError, 3, 30000, + e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); + User user = new User("Jim", "ABCD"); + Order order = new Order(user, "book", 10f); + ArrayList arr1 = new ArrayList(Arrays.asList(new Exception[] + {new ItemUnavailableException(), new DatabaseUnavailableException()})); + try { + r1.perform(arr1, order); + } catch (Exception e1) { + e1.printStackTrace(); + } + ArrayList arr2 = new ArrayList(Arrays.asList(new Exception[] + {new DatabaseUnavailableException(), new ItemUnavailableException()})); + try { + r2.perform(arr2, order); + } catch (Exception e1) { + e1.printStackTrace(); + } + //r1 stops at ItemUnavailableException, r2 retries because it encounters DatabaseUnavailableException + assertTrue(arr1.size() == 1 && arr2.size() == 0); + } + +} diff --git a/pom.xml b/pom.xml index 014e67bda525..e83a7c24a210 100644 --- a/pom.xml +++ b/pom.xml @@ -166,6 +166,7 @@ collection-pipeline master-worker-pattern spatial-partition + commander typeobjectpattern From 2757b210ea77be9bcd7645cee884e1483508a13a Mon Sep 17 00:00:00 2001 From: hoangnam2261 <31692990+hoangnam2261@users.noreply.github.com> Date: Tue, 30 Jul 2019 01:12:14 +0700 Subject: [PATCH 007/197] Best practice when compare enum (#869) --- chain/src/main/java/com/iluwatar/chain/OrcCommander.java | 2 +- chain/src/main/java/com/iluwatar/chain/OrcOfficer.java | 2 +- chain/src/main/java/com/iluwatar/chain/OrcSoldier.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chain/src/main/java/com/iluwatar/chain/OrcCommander.java b/chain/src/main/java/com/iluwatar/chain/OrcCommander.java index 048ba495457f..073ea257e740 100644 --- a/chain/src/main/java/com/iluwatar/chain/OrcCommander.java +++ b/chain/src/main/java/com/iluwatar/chain/OrcCommander.java @@ -35,7 +35,7 @@ public OrcCommander(RequestHandler handler) { @Override public void handleRequest(Request req) { - if (req.getRequestType().equals(RequestType.DEFEND_CASTLE)) { + if (RequestType.DEFEND_CASTLE == req.getRequestType()) { printHandling(req); req.markHandled(); } else { diff --git a/chain/src/main/java/com/iluwatar/chain/OrcOfficer.java b/chain/src/main/java/com/iluwatar/chain/OrcOfficer.java index 8e90b7ca0bdb..2c2902266d4f 100644 --- a/chain/src/main/java/com/iluwatar/chain/OrcOfficer.java +++ b/chain/src/main/java/com/iluwatar/chain/OrcOfficer.java @@ -35,7 +35,7 @@ public OrcOfficer(RequestHandler handler) { @Override public void handleRequest(Request req) { - if (req.getRequestType().equals(RequestType.TORTURE_PRISONER)) { + if (RequestType.TORTURE_PRISONER == req.getRequestType()) { printHandling(req); req.markHandled(); } else { diff --git a/chain/src/main/java/com/iluwatar/chain/OrcSoldier.java b/chain/src/main/java/com/iluwatar/chain/OrcSoldier.java index 99e0d5022348..adc25fb2bc44 100644 --- a/chain/src/main/java/com/iluwatar/chain/OrcSoldier.java +++ b/chain/src/main/java/com/iluwatar/chain/OrcSoldier.java @@ -35,7 +35,7 @@ public OrcSoldier(RequestHandler handler) { @Override public void handleRequest(Request req) { - if (req.getRequestType().equals(RequestType.COLLECT_TAX)) { + if (RequestType.COLLECT_TAX == req.getRequestType()) { printHandling(req); req.markHandled(); } else { From aaabc8f517461593d206a009858cefd163e43daa Mon Sep 17 00:00:00 2001 From: HelloCoCooo <46306510+HelloCoCooo@users.noreply.github.com> Date: Tue, 30 Jul 2019 02:16:21 +0800 Subject: [PATCH 008/197] Fix the dependency conflict issue (#872) --- api-gateway/api-gateway-service/pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api-gateway/api-gateway-service/pom.xml b/api-gateway/api-gateway-service/pom.xml index f947049a757c..13bbddc97d09 100644 --- a/api-gateway/api-gateway-service/pom.xml +++ b/api-gateway/api-gateway-service/pom.xml @@ -48,6 +48,10 @@ org.springframework spring-webmvc + + org.apache.httpcomponents + httpclient + org.springframework.boot spring-boot-starter-web @@ -67,10 +71,6 @@ mockito-core test - - org.apache.httpcomponents - httpclient - @@ -89,4 +89,4 @@ -
\ No newline at end of file + From b497d41f61b43e188f43fa0f3f70b3a2e164bb76 Mon Sep 17 00:00:00 2001 From: DRad Date: Mon, 29 Jul 2019 20:21:07 +0200 Subject: [PATCH 009/197] Modify Observer pattern UML (#877) --- observer/README.md | 2 +- observer/etc/observer.png | Bin 20227 -> 18867 bytes observer/etc/observer.ucls | 40 ++++++++++++++++++++++--------------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/observer/README.md b/observer/README.md index 38a28032f957..afeb0b37d68d 100644 --- a/observer/README.md +++ b/observer/README.md @@ -19,7 +19,7 @@ Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. -![alt text](./etc/observer_1.png "Observer") +![alt text](./etc/observer.png "Observer") ## Applicability Use the Observer pattern in any of the following situations diff --git a/observer/etc/observer.png b/observer/etc/observer.png index 40f112d03217b68755ad451d328716657522313c..f2ab0edfeb2159992c40c7fc3b684d4a0f7e02cd 100644 GIT binary patch literal 18867 zcmeIaWn7fq+BXb>l)@k_$dE&qq{PrF4I-r=pdj5LF?0=xbazX4cS|?Yh#;MUFf_d9 zc)9n!_H*y&x!?Que0e{-UtnULYaQ!Y|D%sJK`KhmadF6TP*6~CWo4vQQBdvxuTi(K z?f{=yB>7gNpvbz)N=v9YC-0?LkE(r5*=RH}(|z47fBLjWreASzxS)u^Wl#YpjT^g0 zi|xKG?gf)5Q;^^0$Ed=1Mrx5jA8efM&!~GS1ToUaF4EjStmBOg7vhR$ZwD2&w8-ZM zmEsjGaTLF@9eh4r5ZhSzb#SxQa*BX%9G|{i@|n*aX?DNdf_W^#hPOmppMe0PR7@t_ zk;EyWBY?l+QWl_J>+TJxUhU!XRbM{eDZrrVML*LZnMZTUoEAov_`*^r?OjQYoePMKRu@AiS#DZ0?)C2J^<7xhXT2WrA3ywZuoy=To*E5}-`5b6o-icU>I59IfxNt|Ysy9zbIsrH`3e_uHVJTE*6f&m1?~ zuN!YZJh9^%3ktxeEq%B6V2+*aSJUH*B4={mJK>4DyfgcUCVqC@-C12sb7<#-*{tI1 z%baXCblChWmk-vMPq=B*s@B&bMX@!o+OJ#N@)s`mhH((z`4ebN>WZ}<>X<22LzhE` zb~g7iGAzy>zviO9^}GJ@9AdgbXc@kk6&Kne|6DY|F0(6dR!Z+Pi;j4c=JT}2*Csjl zWCT4jp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&h>dRbIoJ@4g8L-rXM}v z)nS$z$Bz&D{uCsi^J@*gdPEvt0IZm);GzEJYA0veG{?|~jKRJ&kns>uk$;Pm>4FQ~ z2n7x);OP~>;dP*t1PTYd`nZ?jr)F(*@L6D291K{19RnZ$*F!++PravuvV8MQ)>M$F Mr>mdKI;Vst0Mv@py8r+H diff --git a/observer/etc/observer.ucls b/observer/etc/observer.ucls index 87a3dd216d4e..ac1d267f89b8 100644 --- a/observer/etc/observer.ucls +++ b/observer/etc/observer.ucls @@ -1,9 +1,9 @@ - + - + @@ -12,7 +12,7 @@ - + @@ -21,7 +21,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -48,28 +48,36 @@ - - + + + + + + + + + + - + - - + + + + + + - - - - From 3454941dcde93a9497160a43e7520cb2036af69d Mon Sep 17 00:00:00 2001 From: pierDipi <33736985+pierDipi@users.noreply.github.com> Date: Mon, 29 Jul 2019 20:22:56 +0200 Subject: [PATCH 010/197] Typo coresponding -> corresponding (#879) --- converter/src/main/java/com/iluwatar/converter/Converter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/converter/src/main/java/com/iluwatar/converter/Converter.java b/converter/src/main/java/com/iluwatar/converter/Converter.java index 4a2bb7381ede..a4a73f0c7e1a 100644 --- a/converter/src/main/java/com/iluwatar/converter/Converter.java +++ b/converter/src/main/java/com/iluwatar/converter/Converter.java @@ -30,7 +30,7 @@ /** * Generic converter, thanks to Java8 features not only provides a way of generic bidirectional - * conversion between coresponding types, but also a common way of converting a collection of objects + * conversion between corresponding types, but also a common way of converting a collection of objects * of the same type, reducing boilerplate code to the absolute minimum. * @param DTO representation's type * @param Domain representation's type From 36e80c4e692c37060fc9e4cb824d28c1eef1fa68 Mon Sep 17 00:00:00 2001 From: S Sethi Date: Mon, 29 Jul 2019 19:27:08 +0100 Subject: [PATCH 011/197] fixed failing tests (#860) (#880) --- .../java/com/iluwatar/twin/BallThreadTest.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/twin/src/test/java/com/iluwatar/twin/BallThreadTest.java b/twin/src/test/java/com/iluwatar/twin/BallThreadTest.java index 88fb0345e895..6e46cd4f1af5 100644 --- a/twin/src/test/java/com/iluwatar/twin/BallThreadTest.java +++ b/twin/src/test/java/com/iluwatar/twin/BallThreadTest.java @@ -30,11 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertTimeout; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.timeout; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.*; /** * Date: 12/30/15 - 18:55 PM @@ -55,9 +51,9 @@ public void testSuspend() throws Exception { ballThread.setTwin(ballItem); ballThread.start(); - - verify(ballItem, timeout(2000).atLeastOnce()).draw(); - verify(ballItem, timeout(2000).atLeastOnce()).move(); + sleep(200); + verify(ballItem, atLeastOnce()).draw(); + verify(ballItem, atLeastOnce()).move(); ballThread.suspendMe(); sleep(1000); @@ -88,8 +84,9 @@ public void testResume() { verifyZeroInteractions(ballItem); ballThread.resumeMe(); - verify(ballItem, timeout(2000).atLeastOnce()).draw(); - verify(ballItem, timeout(2000).atLeastOnce()).move(); + sleep(200); + verify(ballItem, atLeastOnce()).draw(); + verify(ballItem, atLeastOnce()).move(); ballThread.stopMe(); ballThread.join(); From 517c20960d1ac42c1c6a031df360baf27ef8d683 Mon Sep 17 00:00:00 2001 From: Thiago Medeiros Date: Mon, 29 Jul 2019 15:31:42 -0300 Subject: [PATCH 012/197] Added one more Credit/Article about the benefits of Repository pattern (#882) --- repository/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/repository/README.md b/repository/README.md index 67b3ea44e828..b1f4fb97f56c 100644 --- a/repository/README.md +++ b/repository/README.md @@ -35,3 +35,4 @@ Use the Repository pattern when * [Don’t use DAO, use Repository](http://thinkinginobjects.com/2012/08/26/dont-use-dao-use-repository/) * [Advanced Spring Data JPA - Specifications and Querydsl](https://spring.io/blog/2011/04/26/advanced-spring-data-jpa-specifications-and-querydsl/) +* [Repository Pattern Benefits and Spring Implementation](https://stackoverflow.com/questions/40068965/repository-pattern-benefits-and-spring-implementation) \ No newline at end of file From 6daaeec5c664108224d0dd6484032ed897f36fca Mon Sep 17 00:00:00 2001 From: hoangnam2261 <31692990+hoangnam2261@users.noreply.github.com> Date: Wed, 31 Jul 2019 02:46:38 +0700 Subject: [PATCH 013/197] Remove the transitive dependency(junit-jupiter-api) (#916) --- abstract-document/pom.xml | 7 +- abstract-factory/pom.xml | 5 - acyclic-visitor/pom.xml | 5 - adapter/pom.xml | 5 - .../aggregator-service/pom.xml | 7 +- .../information-microservice/pom.xml | 5 - .../inventory-microservice/pom.xml | 7 +- ambassador/pom.xml | 7 +- api-gateway/api-gateway-service/pom.xml | 5 - api-gateway/image-microservice/pom.xml | 7 +- api-gateway/price-microservice/pom.xml | 7 +- async-method-invocation/pom.xml | 5 - balking/pom.xml | 7 +- bridge/pom.xml | 5 - builder/pom.xml | 5 - business-delegate/pom.xml | 5 - caching/pom.xml | 5 - callback/pom.xml | 5 - chain/pom.xml | 5 - collection-pipeline/pom.xml | 7 +- command/pom.xml | 5 - commander/pom.xml | 7 +- composite/pom.xml | 5 - converter/pom.xml | 5 - cqrs/pom.xml | 5 - dao/pom.xml | 5 - data-bus/pom.xml | 5 - data-mapper/pom.xml | 95 +++++++++---------- data-transfer-object/pom.xml | 5 - decorator/pom.xml | 5 - delegation/pom.xml | 7 +- dependency-injection/pom.xml | 5 - dirty-flag/pom.xml | 5 - double-checked-locking/pom.xml | 5 - double-dispatch/pom.xml | 5 - eip-aggregator/pom.xml | 7 +- eip-message-channel/pom.xml | 5 - eip-publish-subscribe/pom.xml | 5 - eip-splitter/pom.xml | 7 +- eip-wire-tap/pom.xml | 7 +- event-aggregator/pom.xml | 5 - event-asynchronous/pom.xml | 5 - event-driven-architecture/pom.xml | 7 +- event-queue/pom.xml | 7 +- event-sourcing/pom.xml | 7 +- execute-around/pom.xml | 5 - extension-objects/pom.xml | 5 - facade/pom.xml | 5 - factory-kit/pom.xml | 7 +- factory-method/pom.xml | 5 - feature-toggle/pom.xml | 7 +- fluentinterface/pom.xml | 7 +- flux/pom.xml | 5 - flyweight/pom.xml | 5 - front-controller/pom.xml | 5 - guarded-suspension/pom.xml | 7 +- half-sync-half-async/pom.xml | 5 - hexagonal/pom.xml | 5 - intercepting-filter/pom.xml | 5 - interpreter/pom.xml | 5 - iterator/pom.xml | 5 - layers/pom.xml | 5 - lazy-loading/pom.xml | 5 - marker/pom.xml | 5 - master-worker-pattern/pom.xml | 5 - mediator/pom.xml | 5 - memento/pom.xml | 5 - model-view-controller/pom.xml | 5 - model-view-presenter/pom.xml | 5 - module/pom.xml | 5 - monad/pom.xml | 5 - monostate/pom.xml | 5 - multiton/pom.xml | 5 - mute-idiom/pom.xml | 5 - mutex/pom.xml | 5 - null-object/pom.xml | 5 - object-mother/pom.xml | 7 +- object-pool/pom.xml | 5 - observer/pom.xml | 5 - page-object/test-automation/pom.xml | 7 +- poison-pill/pom.xml | 5 - pom.xml | 8 +- private-class-data/pom.xml | 5 - producer-consumer/pom.xml | 5 - promise/pom.xml | 5 - property/pom.xml | 5 - prototype/pom.xml | 5 - proxy/pom.xml | 5 - queue-load-leveling/pom.xml | 5 - reactor/pom.xml | 5 - reader-writer-lock/pom.xml | 5 - repository/pom.xml | 5 - .../pom.xml | 5 - retry/pom.xml | 7 +- semaphore/pom.xml | 5 - servant/pom.xml | 5 - serverless/pom.xml | 7 +- service-layer/pom.xml | 5 - service-locator/pom.xml | 5 - singleton/pom.xml | 5 - spatial-partition/pom.xml | 5 - specification/pom.xml | 5 - state/pom.xml | 5 - step-builder/pom.xml | 7 +- strategy/pom.xml | 5 - template-method/pom.xml | 5 - thread-pool/pom.xml | 5 - throttling/pom.xml | 7 +- tls/pom.xml | 91 +++++++++--------- tolerant-reader/pom.xml | 5 - trampoline/pom.xml | 5 - twin/pom.xml | 5 - typeobjectpattern/pom.xml | 7 +- value-object/pom.xml | 5 - visitor/pom.xml | 5 - 115 files changed, 116 insertions(+), 692 deletions(-) diff --git a/abstract-document/pom.xml b/abstract-document/pom.xml index de6ef506982c..bdcdd170a43a 100644 --- a/abstract-document/pom.xml +++ b/abstract-document/pom.xml @@ -33,15 +33,10 @@ abstract-document - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine test - \ No newline at end of file + diff --git a/abstract-factory/pom.xml b/abstract-factory/pom.xml index 57bbdb5bbb98..00c9a491cf15 100644 --- a/abstract-factory/pom.xml +++ b/abstract-factory/pom.xml @@ -33,11 +33,6 @@ abstract-factory - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/acyclic-visitor/pom.xml b/acyclic-visitor/pom.xml index 8ce2b1e27586..4a0f740fdd42 100644 --- a/acyclic-visitor/pom.xml +++ b/acyclic-visitor/pom.xml @@ -56,11 +56,6 @@ 1.0.0 test - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/adapter/pom.xml b/adapter/pom.xml index b417432c2aab..0c47247dd8a7 100644 --- a/adapter/pom.xml +++ b/adapter/pom.xml @@ -33,11 +33,6 @@ adapter - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/aggregator-microservices/aggregator-service/pom.xml b/aggregator-microservices/aggregator-service/pom.xml index 626ddcd0ba4f..c4ad9cf1a4a9 100644 --- a/aggregator-microservices/aggregator-service/pom.xml +++ b/aggregator-microservices/aggregator-service/pom.xml @@ -53,11 +53,6 @@ org.springframework.boot spring-boot-starter-web - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -90,4 +85,4 @@ - \ No newline at end of file + diff --git a/aggregator-microservices/information-microservice/pom.xml b/aggregator-microservices/information-microservice/pom.xml index bac47c19c73c..85992658990b 100644 --- a/aggregator-microservices/information-microservice/pom.xml +++ b/aggregator-microservices/information-microservice/pom.xml @@ -53,11 +53,6 @@ org.springframework.boot spring-boot-starter-web - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/aggregator-microservices/inventory-microservice/pom.xml b/aggregator-microservices/inventory-microservice/pom.xml index bf613916b3ae..e19ba55533fb 100644 --- a/aggregator-microservices/inventory-microservice/pom.xml +++ b/aggregator-microservices/inventory-microservice/pom.xml @@ -53,11 +53,6 @@ org.springframework.boot spring-boot-starter-web - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -81,4 +76,4 @@ - \ No newline at end of file + diff --git a/ambassador/pom.xml b/ambassador/pom.xml index 6bfbf50084b1..efc8437051fe 100644 --- a/ambassador/pom.xml +++ b/ambassador/pom.xml @@ -34,15 +34,10 @@ 4.0.0 ambassador - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine test - \ No newline at end of file + diff --git a/api-gateway/api-gateway-service/pom.xml b/api-gateway/api-gateway-service/pom.xml index 13bbddc97d09..b17d71bfb905 100644 --- a/api-gateway/api-gateway-service/pom.xml +++ b/api-gateway/api-gateway-service/pom.xml @@ -56,11 +56,6 @@ org.springframework.boot spring-boot-starter-web - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/api-gateway/image-microservice/pom.xml b/api-gateway/image-microservice/pom.xml index 928b23ed699e..bf70cda03c74 100644 --- a/api-gateway/image-microservice/pom.xml +++ b/api-gateway/image-microservice/pom.xml @@ -53,11 +53,6 @@ org.springframework.boot spring-boot-starter-web - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -81,4 +76,4 @@ - \ No newline at end of file + diff --git a/api-gateway/price-microservice/pom.xml b/api-gateway/price-microservice/pom.xml index 58730846d6f2..33931cac5b2d 100644 --- a/api-gateway/price-microservice/pom.xml +++ b/api-gateway/price-microservice/pom.xml @@ -53,11 +53,6 @@ org.springframework.boot spring-boot-starter-web - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -81,4 +76,4 @@ - \ No newline at end of file + diff --git a/async-method-invocation/pom.xml b/async-method-invocation/pom.xml index 28e9705f26c7..0c42bc970333 100644 --- a/async-method-invocation/pom.xml +++ b/async-method-invocation/pom.xml @@ -33,11 +33,6 @@ async-method-invocation - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/balking/pom.xml b/balking/pom.xml index 500a11c82f6b..f20969b62765 100644 --- a/balking/pom.xml +++ b/balking/pom.xml @@ -35,11 +35,6 @@ balking - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -48,4 +43,4 @@ - \ No newline at end of file + diff --git a/bridge/pom.xml b/bridge/pom.xml index a86c5bf22c4d..cf45178a1925 100644 --- a/bridge/pom.xml +++ b/bridge/pom.xml @@ -33,11 +33,6 @@ bridge - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/builder/pom.xml b/builder/pom.xml index 9130209fffd2..dcf61fad5691 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -33,11 +33,6 @@ builder - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/business-delegate/pom.xml b/business-delegate/pom.xml index 70ad2a1137b3..ab2f1ae3cb2e 100644 --- a/business-delegate/pom.xml +++ b/business-delegate/pom.xml @@ -34,11 +34,6 @@ business-delegate - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/caching/pom.xml b/caching/pom.xml index f86f8b2bab2f..c678aba4f4e4 100644 --- a/caching/pom.xml +++ b/caching/pom.xml @@ -33,11 +33,6 @@ caching - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/callback/pom.xml b/callback/pom.xml index 4506d0316c6a..46e9e2c9a5fe 100644 --- a/callback/pom.xml +++ b/callback/pom.xml @@ -33,11 +33,6 @@ callback - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/chain/pom.xml b/chain/pom.xml index 7ff678a154ca..86b469ed828f 100644 --- a/chain/pom.xml +++ b/chain/pom.xml @@ -33,11 +33,6 @@ chain - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/collection-pipeline/pom.xml b/collection-pipeline/pom.xml index 8c4aad2dd392..6003c9b4d7b3 100644 --- a/collection-pipeline/pom.xml +++ b/collection-pipeline/pom.xml @@ -31,15 +31,10 @@ collection-pipeline - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine test - \ No newline at end of file + diff --git a/command/pom.xml b/command/pom.xml index 6807764561ef..6d22f80a3ef1 100644 --- a/command/pom.xml +++ b/command/pom.xml @@ -33,11 +33,6 @@ command - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/commander/pom.xml b/commander/pom.xml index 895906e65ded..bbf69b597113 100644 --- a/commander/pom.xml +++ b/commander/pom.xml @@ -7,11 +7,6 @@ commander - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -23,4 +18,4 @@ 1.2.17 - \ No newline at end of file + diff --git a/composite/pom.xml b/composite/pom.xml index 60142cf9061c..9d6f53e2cf08 100644 --- a/composite/pom.xml +++ b/composite/pom.xml @@ -33,11 +33,6 @@ composite - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/converter/pom.xml b/converter/pom.xml index 4caf7b203dc9..18b70a1d1e01 100644 --- a/converter/pom.xml +++ b/converter/pom.xml @@ -33,11 +33,6 @@ 4.0.0 - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/cqrs/pom.xml b/cqrs/pom.xml index 6480f25e9b0f..428a9943a2f2 100644 --- a/cqrs/pom.xml +++ b/cqrs/pom.xml @@ -25,11 +25,6 @@ cqrs - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/dao/pom.xml b/dao/pom.xml index 20eb79c535b3..addefc20873b 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -35,11 +35,6 @@ dao - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/data-bus/pom.xml b/data-bus/pom.xml index 9106191af529..918da99040d1 100644 --- a/data-bus/pom.xml +++ b/data-bus/pom.xml @@ -37,11 +37,6 @@ data-bus - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/data-mapper/pom.xml b/data-mapper/pom.xml index bbcf42ee6b5d..e64f44747e55 100644 --- a/data-mapper/pom.xml +++ b/data-mapper/pom.xml @@ -1,50 +1,45 @@ - - - - 4.0.0 - - com.iluwatar - java-design-patterns - 1.21.0-SNAPSHOT - - data-mapper - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - log4j - log4j - - - + + + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.21.0-SNAPSHOT + + data-mapper + + + org.junit.jupiter + junit-jupiter-engine + test + + + log4j + log4j + + + diff --git a/data-transfer-object/pom.xml b/data-transfer-object/pom.xml index 3dcb2dc3ce4d..79a54564430e 100644 --- a/data-transfer-object/pom.xml +++ b/data-transfer-object/pom.xml @@ -32,11 +32,6 @@ data-transfer-object - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/decorator/pom.xml b/decorator/pom.xml index a9b9c361d11a..e92b9dc492b2 100644 --- a/decorator/pom.xml +++ b/decorator/pom.xml @@ -33,11 +33,6 @@ decorator - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/delegation/pom.xml b/delegation/pom.xml index 62bda23185ff..02b0fda4adeb 100644 --- a/delegation/pom.xml +++ b/delegation/pom.xml @@ -37,15 +37,10 @@ delegation - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine test - \ No newline at end of file + diff --git a/dependency-injection/pom.xml b/dependency-injection/pom.xml index 631fc6b7c03f..21873c86813c 100644 --- a/dependency-injection/pom.xml +++ b/dependency-injection/pom.xml @@ -33,11 +33,6 @@ dependency-injection - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/dirty-flag/pom.xml b/dirty-flag/pom.xml index e91d6c9f4c25..de3ef48f0596 100644 --- a/dirty-flag/pom.xml +++ b/dirty-flag/pom.xml @@ -40,11 +40,6 @@ UTF-8 - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/double-checked-locking/pom.xml b/double-checked-locking/pom.xml index 999f78d878af..49ffe88a77fb 100644 --- a/double-checked-locking/pom.xml +++ b/double-checked-locking/pom.xml @@ -31,11 +31,6 @@ double-checked-locking - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/double-dispatch/pom.xml b/double-dispatch/pom.xml index 875c1b430247..22fe7a684bc3 100644 --- a/double-dispatch/pom.xml +++ b/double-dispatch/pom.xml @@ -33,11 +33,6 @@ double-dispatch - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/eip-aggregator/pom.xml b/eip-aggregator/pom.xml index 0cc3aa590d62..54de34334464 100644 --- a/eip-aggregator/pom.xml +++ b/eip-aggregator/pom.xml @@ -53,11 +53,6 @@ spring-test-junit5 test - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -75,4 +70,4 @@ - \ No newline at end of file + diff --git a/eip-message-channel/pom.xml b/eip-message-channel/pom.xml index 9b297f72995e..fd7ee5c0e5e8 100644 --- a/eip-message-channel/pom.xml +++ b/eip-message-channel/pom.xml @@ -42,11 +42,6 @@ org.apache.camel camel-stream - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/eip-publish-subscribe/pom.xml b/eip-publish-subscribe/pom.xml index c8bc4de28d7a..2a041930d048 100644 --- a/eip-publish-subscribe/pom.xml +++ b/eip-publish-subscribe/pom.xml @@ -40,11 +40,6 @@ org.apache.camel camel-stream - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/eip-splitter/pom.xml b/eip-splitter/pom.xml index 7cb722164492..3f5a79ca1dcc 100644 --- a/eip-splitter/pom.xml +++ b/eip-splitter/pom.xml @@ -53,11 +53,6 @@ spring-test-junit5 test - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -75,4 +70,4 @@ - \ No newline at end of file + diff --git a/eip-wire-tap/pom.xml b/eip-wire-tap/pom.xml index c9f569a554d8..e3791102d367 100644 --- a/eip-wire-tap/pom.xml +++ b/eip-wire-tap/pom.xml @@ -53,11 +53,6 @@ spring-test-junit5 test - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -75,4 +70,4 @@ - \ No newline at end of file + diff --git a/event-aggregator/pom.xml b/event-aggregator/pom.xml index a6d473841d2e..dca72de732eb 100644 --- a/event-aggregator/pom.xml +++ b/event-aggregator/pom.xml @@ -32,11 +32,6 @@ event-aggregator - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/event-asynchronous/pom.xml b/event-asynchronous/pom.xml index 64e69adb629a..908662d083d9 100644 --- a/event-asynchronous/pom.xml +++ b/event-asynchronous/pom.xml @@ -33,11 +33,6 @@ event-asynchronous - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/event-driven-architecture/pom.xml b/event-driven-architecture/pom.xml index 03ff66fed956..a336c9f13962 100644 --- a/event-driven-architecture/pom.xml +++ b/event-driven-architecture/pom.xml @@ -37,11 +37,6 @@ event-driven-architecture - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -54,4 +49,4 @@ test - \ No newline at end of file + diff --git a/event-queue/pom.xml b/event-queue/pom.xml index 65bb489c2b9b..bd80ba5a4bec 100644 --- a/event-queue/pom.xml +++ b/event-queue/pom.xml @@ -34,15 +34,10 @@ event-queue - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine test - \ No newline at end of file + diff --git a/event-sourcing/pom.xml b/event-sourcing/pom.xml index bae5e997073c..4b4d8c701cfa 100644 --- a/event-sourcing/pom.xml +++ b/event-sourcing/pom.xml @@ -34,11 +34,6 @@ event-sourcing - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -52,4 +47,4 @@ - \ No newline at end of file + diff --git a/execute-around/pom.xml b/execute-around/pom.xml index 8000c4e2f757..6fd853ff571f 100644 --- a/execute-around/pom.xml +++ b/execute-around/pom.xml @@ -33,11 +33,6 @@ execute-around - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/extension-objects/pom.xml b/extension-objects/pom.xml index 368ee8c36abc..2dee66d3aa46 100644 --- a/extension-objects/pom.xml +++ b/extension-objects/pom.xml @@ -35,11 +35,6 @@ extension-objects - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/facade/pom.xml b/facade/pom.xml index a658e4376af2..1b9bcb86ad4a 100644 --- a/facade/pom.xml +++ b/facade/pom.xml @@ -33,11 +33,6 @@ facade - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/factory-kit/pom.xml b/factory-kit/pom.xml index b6cb46b0ecc8..ac23757ec86d 100644 --- a/factory-kit/pom.xml +++ b/factory-kit/pom.xml @@ -34,15 +34,10 @@ factory-kit - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine test - \ No newline at end of file + diff --git a/factory-method/pom.xml b/factory-method/pom.xml index 9ea706365db2..226c80958e1d 100644 --- a/factory-method/pom.xml +++ b/factory-method/pom.xml @@ -33,11 +33,6 @@ factory-method - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/feature-toggle/pom.xml b/feature-toggle/pom.xml index 9f9f2678790c..bd0fb5d71ce5 100644 --- a/feature-toggle/pom.xml +++ b/feature-toggle/pom.xml @@ -38,15 +38,10 @@ - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine test - \ No newline at end of file + diff --git a/fluentinterface/pom.xml b/fluentinterface/pom.xml index c648602e77cc..605537a73b8a 100644 --- a/fluentinterface/pom.xml +++ b/fluentinterface/pom.xml @@ -35,11 +35,6 @@ fluentinterface - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -51,4 +46,4 @@ test - \ No newline at end of file + diff --git a/flux/pom.xml b/flux/pom.xml index f28c8fbb0197..726df234a27a 100644 --- a/flux/pom.xml +++ b/flux/pom.xml @@ -33,11 +33,6 @@ flux - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/flyweight/pom.xml b/flyweight/pom.xml index 223fae694ea4..5bb8f2254950 100644 --- a/flyweight/pom.xml +++ b/flyweight/pom.xml @@ -33,11 +33,6 @@ flyweight - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/front-controller/pom.xml b/front-controller/pom.xml index af1e22fff073..27dc990d110a 100644 --- a/front-controller/pom.xml +++ b/front-controller/pom.xml @@ -34,11 +34,6 @@ front-controller - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/guarded-suspension/pom.xml b/guarded-suspension/pom.xml index 367d582d57d8..c944f8586951 100644 --- a/guarded-suspension/pom.xml +++ b/guarded-suspension/pom.xml @@ -35,15 +35,10 @@ jar guarded-suspension - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine test - \ No newline at end of file + diff --git a/half-sync-half-async/pom.xml b/half-sync-half-async/pom.xml index e79a05037e03..a532c619347e 100644 --- a/half-sync-half-async/pom.xml +++ b/half-sync-half-async/pom.xml @@ -33,11 +33,6 @@ half-sync-half-async - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/hexagonal/pom.xml b/hexagonal/pom.xml index cb127c91d0f1..a2c9f1925d51 100644 --- a/hexagonal/pom.xml +++ b/hexagonal/pom.xml @@ -34,11 +34,6 @@ hexagonal - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/intercepting-filter/pom.xml b/intercepting-filter/pom.xml index f38e6b4f2ae0..bf78e6792669 100644 --- a/intercepting-filter/pom.xml +++ b/intercepting-filter/pom.xml @@ -33,11 +33,6 @@ intercepting-filter - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/interpreter/pom.xml b/interpreter/pom.xml index 1e958fa3f70f..1274a4b69557 100644 --- a/interpreter/pom.xml +++ b/interpreter/pom.xml @@ -33,11 +33,6 @@ interpreter - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/iterator/pom.xml b/iterator/pom.xml index 9d1f4e280dbe..fa06c9d3b0f0 100644 --- a/iterator/pom.xml +++ b/iterator/pom.xml @@ -33,11 +33,6 @@ iterator - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/layers/pom.xml b/layers/pom.xml index b3cdf0ac76ba..cdd996ccb515 100644 --- a/layers/pom.xml +++ b/layers/pom.xml @@ -51,11 +51,6 @@ com.h2database h2 - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/lazy-loading/pom.xml b/lazy-loading/pom.xml index c7f3679ae32d..773dd7d8bed6 100644 --- a/lazy-loading/pom.xml +++ b/lazy-loading/pom.xml @@ -33,11 +33,6 @@ lazy-loading - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/marker/pom.xml b/marker/pom.xml index 168abaee8b12..faa6868c237d 100644 --- a/marker/pom.xml +++ b/marker/pom.xml @@ -30,11 +30,6 @@ marker - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/master-worker-pattern/pom.xml b/master-worker-pattern/pom.xml index 6b413ea64c63..1c317bac9446 100644 --- a/master-worker-pattern/pom.xml +++ b/master-worker-pattern/pom.xml @@ -31,11 +31,6 @@ master-worker-pattern - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/mediator/pom.xml b/mediator/pom.xml index 83cc0f70d93f..d14e82bcc522 100644 --- a/mediator/pom.xml +++ b/mediator/pom.xml @@ -33,11 +33,6 @@ mediator - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/memento/pom.xml b/memento/pom.xml index 8846bcdcc813..fc3e1954f76d 100644 --- a/memento/pom.xml +++ b/memento/pom.xml @@ -33,11 +33,6 @@ memento - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/model-view-controller/pom.xml b/model-view-controller/pom.xml index d2b223dc2615..523319a28e50 100644 --- a/model-view-controller/pom.xml +++ b/model-view-controller/pom.xml @@ -33,11 +33,6 @@ model-view-controller - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/model-view-presenter/pom.xml b/model-view-presenter/pom.xml index a0f7d31b23b5..a4e91652820d 100644 --- a/model-view-presenter/pom.xml +++ b/model-view-presenter/pom.xml @@ -35,11 +35,6 @@ model-view-presenter http://maven.apache.org - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/module/pom.xml b/module/pom.xml index 56e0a8b35715..0320d97c0a8f 100644 --- a/module/pom.xml +++ b/module/pom.xml @@ -32,11 +32,6 @@ module - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/monad/pom.xml b/monad/pom.xml index 2e2e34870830..45741ee1b6e7 100644 --- a/monad/pom.xml +++ b/monad/pom.xml @@ -33,11 +33,6 @@ monad - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/monostate/pom.xml b/monostate/pom.xml index 920311a8bac7..d39071e261ea 100644 --- a/monostate/pom.xml +++ b/monostate/pom.xml @@ -33,11 +33,6 @@ monostate - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/multiton/pom.xml b/multiton/pom.xml index f1abf43a13f0..beaccf3e3db8 100644 --- a/multiton/pom.xml +++ b/multiton/pom.xml @@ -33,11 +33,6 @@ multiton - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/mute-idiom/pom.xml b/mute-idiom/pom.xml index b3f8d8aaf9b0..7cdbc5a42e0a 100644 --- a/mute-idiom/pom.xml +++ b/mute-idiom/pom.xml @@ -25,11 +25,6 @@ mute-idiom - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/mutex/pom.xml b/mutex/pom.xml index ed9e6b264dbc..85c5208d83b1 100644 --- a/mutex/pom.xml +++ b/mutex/pom.xml @@ -33,11 +33,6 @@ mutex - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/null-object/pom.xml b/null-object/pom.xml index 099fcfce32eb..5c35e6a0a9e0 100644 --- a/null-object/pom.xml +++ b/null-object/pom.xml @@ -33,11 +33,6 @@ null-object - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/object-mother/pom.xml b/object-mother/pom.xml index d22633313ef9..c0ed50739c74 100644 --- a/object-mother/pom.xml +++ b/object-mother/pom.xml @@ -34,11 +34,6 @@ object-mother - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -50,4 +45,4 @@ test - \ No newline at end of file + diff --git a/object-pool/pom.xml b/object-pool/pom.xml index 6ad7823c46f7..fcb95db29fea 100644 --- a/object-pool/pom.xml +++ b/object-pool/pom.xml @@ -33,11 +33,6 @@ object-pool - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/observer/pom.xml b/observer/pom.xml index 80720f6a2d0a..2248957c7179 100644 --- a/observer/pom.xml +++ b/observer/pom.xml @@ -33,11 +33,6 @@ observer - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/page-object/test-automation/pom.xml b/page-object/test-automation/pom.xml index 618eadb20e68..7f8bcb12d0e9 100644 --- a/page-object/test-automation/pom.xml +++ b/page-object/test-automation/pom.xml @@ -33,11 +33,6 @@ test-automation - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -48,4 +43,4 @@ htmlunit - \ No newline at end of file + diff --git a/poison-pill/pom.xml b/poison-pill/pom.xml index fa014d6544c7..eb68f4a108e6 100644 --- a/poison-pill/pom.xml +++ b/poison-pill/pom.xml @@ -33,11 +33,6 @@ poison-pill - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/pom.xml b/pom.xml index e83a7c24a210..fef21534fa71 100644 --- a/pom.xml +++ b/pom.xml @@ -236,12 +236,6 @@ camel-stream ${camel.version} - - org.junit.jupiter - junit-jupiter-api - ${junit-jupiter.version} - test - junit junit @@ -482,4 +476,4 @@ - \ No newline at end of file + diff --git a/private-class-data/pom.xml b/private-class-data/pom.xml index 219709d3119c..e01e81149459 100644 --- a/private-class-data/pom.xml +++ b/private-class-data/pom.xml @@ -33,11 +33,6 @@ private-class-data - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/producer-consumer/pom.xml b/producer-consumer/pom.xml index 3d75f41a99ba..4355df70256c 100644 --- a/producer-consumer/pom.xml +++ b/producer-consumer/pom.xml @@ -33,11 +33,6 @@ producer-consumer - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/promise/pom.xml b/promise/pom.xml index 7b069c74632e..6c29939d5228 100644 --- a/promise/pom.xml +++ b/promise/pom.xml @@ -33,11 +33,6 @@ promise - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/property/pom.xml b/property/pom.xml index 2df23c88f95f..dc0430fe3f97 100644 --- a/property/pom.xml +++ b/property/pom.xml @@ -33,11 +33,6 @@ property - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/prototype/pom.xml b/prototype/pom.xml index 473ba22740a2..ef81d38ecc2a 100644 --- a/prototype/pom.xml +++ b/prototype/pom.xml @@ -33,11 +33,6 @@ prototype - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/proxy/pom.xml b/proxy/pom.xml index d2d1f552eb1c..aef352a5d23a 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -33,11 +33,6 @@ proxy - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/queue-load-leveling/pom.xml b/queue-load-leveling/pom.xml index 15d81ec6dd94..4b028e3565fe 100644 --- a/queue-load-leveling/pom.xml +++ b/queue-load-leveling/pom.xml @@ -33,11 +33,6 @@ queue-load-leveling - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/reactor/pom.xml b/reactor/pom.xml index f50ff1391ea6..6b561996d623 100644 --- a/reactor/pom.xml +++ b/reactor/pom.xml @@ -33,11 +33,6 @@ reactor - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/reader-writer-lock/pom.xml b/reader-writer-lock/pom.xml index de6e57dc4569..460e58baa287 100644 --- a/reader-writer-lock/pom.xml +++ b/reader-writer-lock/pom.xml @@ -34,11 +34,6 @@ reader-writer-lock - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/repository/pom.xml b/repository/pom.xml index 6b0ab438eba4..36f73e344846 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -54,11 +54,6 @@ com.h2database h2 - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/resource-acquisition-is-initialization/pom.xml b/resource-acquisition-is-initialization/pom.xml index 4c5499f1c43b..17985bdef53a 100644 --- a/resource-acquisition-is-initialization/pom.xml +++ b/resource-acquisition-is-initialization/pom.xml @@ -33,11 +33,6 @@ resource-acquisition-is-initialization - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/retry/pom.xml b/retry/pom.xml index 80a40a45f600..931873491ddd 100644 --- a/retry/pom.xml +++ b/retry/pom.xml @@ -31,11 +31,6 @@ retry jar - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -47,4 +42,4 @@ test - \ No newline at end of file + diff --git a/semaphore/pom.xml b/semaphore/pom.xml index c2c2d19718b4..bebd9b802c56 100644 --- a/semaphore/pom.xml +++ b/semaphore/pom.xml @@ -33,11 +33,6 @@ semaphore - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/servant/pom.xml b/servant/pom.xml index 11bfeddd4f5a..e97b3a9895b2 100644 --- a/servant/pom.xml +++ b/servant/pom.xml @@ -33,11 +33,6 @@ servant - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/serverless/pom.xml b/serverless/pom.xml index f3eea887165e..89048283a472 100644 --- a/serverless/pom.xml +++ b/serverless/pom.xml @@ -75,11 +75,6 @@ jackson-annotations ${jackson.version} - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -130,4 +125,4 @@ - \ No newline at end of file + diff --git a/service-layer/pom.xml b/service-layer/pom.xml index 4e22d20d0c34..2bd114c55ca2 100644 --- a/service-layer/pom.xml +++ b/service-layer/pom.xml @@ -41,11 +41,6 @@ com.h2database h2 - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/service-locator/pom.xml b/service-locator/pom.xml index b4033038a394..fa6fcc4ba470 100644 --- a/service-locator/pom.xml +++ b/service-locator/pom.xml @@ -33,11 +33,6 @@ service-locator - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/singleton/pom.xml b/singleton/pom.xml index ac900d0a6d63..e3d8f06e2ea5 100644 --- a/singleton/pom.xml +++ b/singleton/pom.xml @@ -33,11 +33,6 @@ singleton - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/spatial-partition/pom.xml b/spatial-partition/pom.xml index 40fe0f735634..22eb7a6f68fb 100644 --- a/spatial-partition/pom.xml +++ b/spatial-partition/pom.xml @@ -50,11 +50,6 @@ spatial-partition - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/specification/pom.xml b/specification/pom.xml index 2e250d8ce9a5..8723651051e2 100644 --- a/specification/pom.xml +++ b/specification/pom.xml @@ -33,11 +33,6 @@ specification - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/state/pom.xml b/state/pom.xml index f0433d9b5fa0..9aeb4ec00cbd 100644 --- a/state/pom.xml +++ b/state/pom.xml @@ -33,11 +33,6 @@ state - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/step-builder/pom.xml b/step-builder/pom.xml index 42946351dd91..ca5ed709d711 100644 --- a/step-builder/pom.xml +++ b/step-builder/pom.xml @@ -34,15 +34,10 @@ step-builder - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine test - \ No newline at end of file + diff --git a/strategy/pom.xml b/strategy/pom.xml index eec6ad9a24ea..a8dbbd007336 100644 --- a/strategy/pom.xml +++ b/strategy/pom.xml @@ -33,11 +33,6 @@ strategy - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/template-method/pom.xml b/template-method/pom.xml index bd8255a8be45..1345eaa6ca86 100644 --- a/template-method/pom.xml +++ b/template-method/pom.xml @@ -33,11 +33,6 @@ template-method - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/thread-pool/pom.xml b/thread-pool/pom.xml index c4b2cdd282bb..a77230bf2130 100644 --- a/thread-pool/pom.xml +++ b/thread-pool/pom.xml @@ -33,11 +33,6 @@ thread-pool - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/throttling/pom.xml b/throttling/pom.xml index 3f8fac4b6034..d477af53f5aa 100644 --- a/throttling/pom.xml +++ b/throttling/pom.xml @@ -35,11 +35,6 @@ throttling - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -47,4 +42,4 @@ - \ No newline at end of file + diff --git a/tls/pom.xml b/tls/pom.xml index 2303930e2622..d3ccbfc2b79a 100644 --- a/tls/pom.xml +++ b/tls/pom.xml @@ -1,48 +1,43 @@ - - - - 4.0.0 - - com.iluwatar - java-design-patterns - 1.21.0-SNAPSHOT - - tls - - - org.junit.jupiter - junit-jupiter-api - test - - - org.junit.jupiter - junit-jupiter-engine - test - - - + + + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.21.0-SNAPSHOT + + tls + + + org.junit.jupiter + junit-jupiter-engine + test + + + diff --git a/tolerant-reader/pom.xml b/tolerant-reader/pom.xml index 8b4b1bbc53c6..51554d7dce28 100644 --- a/tolerant-reader/pom.xml +++ b/tolerant-reader/pom.xml @@ -33,11 +33,6 @@ tolerant-reader - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/trampoline/pom.xml b/trampoline/pom.xml index c5a181dd9f66..338dc101604b 100644 --- a/trampoline/pom.xml +++ b/trampoline/pom.xml @@ -42,11 +42,6 @@ test - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/twin/pom.xml b/twin/pom.xml index 0cfc558d7173..74e81ec0df44 100644 --- a/twin/pom.xml +++ b/twin/pom.xml @@ -33,11 +33,6 @@ twin - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/typeobjectpattern/pom.xml b/typeobjectpattern/pom.xml index 35d3b966194b..4e66263fefb7 100644 --- a/typeobjectpattern/pom.xml +++ b/typeobjectpattern/pom.xml @@ -36,11 +36,6 @@ json-simple 1.1.1 - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine @@ -52,4 +47,4 @@ test - \ No newline at end of file + diff --git a/value-object/pom.xml b/value-object/pom.xml index 5a942ff3067a..2b951d2a3135 100644 --- a/value-object/pom.xml +++ b/value-object/pom.xml @@ -40,11 +40,6 @@ 19.0 test - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine diff --git a/visitor/pom.xml b/visitor/pom.xml index 779673a23fa1..618b547ea553 100644 --- a/visitor/pom.xml +++ b/visitor/pom.xml @@ -33,11 +33,6 @@ visitor - - org.junit.jupiter - junit-jupiter-api - test - org.junit.jupiter junit-jupiter-engine From ccb257d5250f15061499dbb63aeba1057bafc963 Mon Sep 17 00:00:00 2001 From: Ranjeet Date: Sun, 4 Aug 2019 19:41:56 +0530 Subject: [PATCH 014/197] fixed bug #883 (#885) --- dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java b/dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java index 4d72b34da249..827028d09a06 100644 --- a/dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java +++ b/dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java @@ -55,9 +55,9 @@ public void run() { final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); executorService.scheduleAtFixedRate(new Runnable() { + final World world = new World(); @Override public void run() { - World world = new World(); List countries = world.fetch(); System.out.println("Our world currently has the following countries:-"); for (String country : countries) { From 61ef59de027168c7950592dc31ff969286cdfd64 Mon Sep 17 00:00:00 2001 From: Aravind M Date: Sun, 11 Aug 2019 23:36:27 +0530 Subject: [PATCH 015/197] fix code example containing syntax error (#890) --- ambassador/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ambassador/README.md b/ambassador/README.md index f23d1e13cedb..616604c27e52 100644 --- a/ambassador/README.md +++ b/ambassador/README.md @@ -43,7 +43,7 @@ A remote services represented as a singleton. public class RemoteService implements RemoteServiceInterface { private static final Logger LOGGER = LoggerFactory.getLogger(RemoteService.class); - private static RemoteService service = null;2 + private static RemoteService service = null; static synchronized RemoteService getRemoteService() { if (service == null) { From 085e47b50dd57be368a3d0baff4af205b2ec3af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Wed, 21 Aug 2019 21:47:36 +0300 Subject: [PATCH 016/197] Update SonarCloud badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ef0fbd216b1..c41a48a8898d 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Build status](https://travis-ci.org/iluwatar/java-design-patterns.svg?branch=master)](https://travis-ci.org/iluwatar/java-design-patterns) [![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/iluwatar/java-design-patterns/master/LICENSE.md) [![Join the chat at https://gitter.im/iluwatar/java-design-patterns](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=com.iluwatar%3Ajava-design-patterns&metric=alert_status)](https://sonarcloud.io/dashboard/index/com.iluwatar%3Ajava-design-patterns) +[![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=iluwatar_java-design-patterns&metric=alert_status)](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns) # Introduction From 11c055055934d1a78e1b98072ea5dd2c4b96da3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Wed, 21 Aug 2019 21:51:27 +0300 Subject: [PATCH 017/197] Create .sonarcloud.properties --- .sonarcloud.properties | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .sonarcloud.properties diff --git a/.sonarcloud.properties b/.sonarcloud.properties new file mode 100644 index 000000000000..7a93b07aa76d --- /dev/null +++ b/.sonarcloud.properties @@ -0,0 +1,15 @@ +# Path to sources +#sonar.sources=. +#sonar.exclusions= +#sonar.inclusions= + +# Path to tests +#sonar.tests= +#sonar.test.exclusions= +#sonar.test.inclusions= + +# Source encoding +#sonar.sourceEncoding=UTF-8 + +# Exclusions for copy-paste detection +#sonar.cpd.exclusions= From 7f6067f19fe03c41cc25f704dbdab93b5069f0cb Mon Sep 17 00:00:00 2001 From: Ranjeet Date: Sat, 31 Aug 2019 23:40:35 +0530 Subject: [PATCH 018/197] Added priority queue design pattern (#888) * added priority queue design pattern * Minor Refactored, fixed review comments --- pom.xml | 17 +- priority-queue/README.md | 27 +++ priority-queue/pom.xml | 45 +++++ .../iluwatar/priority/queue/Application.java | 60 ++++++ .../com/iluwatar/priority/queue/Message.java | 50 +++++ .../priority/queue/PriorityMessageQueue.java | 178 ++++++++++++++++++ .../iluwatar/priority/queue/QueueManager.java | 57 ++++++ .../com/iluwatar/priority/queue/Worker.java | 63 +++++++ .../queue/PriorityMessageQueueTest.java | 73 +++++++ .../priority/queue/QueueManagerTest.java | 53 ++++++ 10 files changed, 616 insertions(+), 7 deletions(-) create mode 100644 priority-queue/README.md create mode 100644 priority-queue/pom.xml create mode 100644 priority-queue/src/main/java/com/iluwatar/priority/queue/Application.java create mode 100644 priority-queue/src/main/java/com/iluwatar/priority/queue/Message.java create mode 100644 priority-queue/src/main/java/com/iluwatar/priority/queue/PriorityMessageQueue.java create mode 100644 priority-queue/src/main/java/com/iluwatar/priority/queue/QueueManager.java create mode 100644 priority-queue/src/main/java/com/iluwatar/priority/queue/Worker.java create mode 100644 priority-queue/src/test/java/com/iluwatar/priority/queue/PriorityMessageQueueTest.java create mode 100644 priority-queue/src/test/java/com/iluwatar/priority/queue/QueueManagerTest.java diff --git a/pom.xml b/pom.xml index fef21534fa71..f305e97d983e 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,9 @@ 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. ---> +--> + 4.0.0 com.iluwatar java-design-patterns @@ -162,12 +164,13 @@ trampoline serverless ambassador - acyclic-visitor - collection-pipeline - master-worker-pattern - spatial-partition - commander - typeobjectpattern + acyclic-visitor + collection-pipeline + master-worker-pattern + spatial-partition + priority-queue + commander + typeobjectpattern diff --git a/priority-queue/README.md b/priority-queue/README.md new file mode 100644 index 000000000000..bc8d7b8cfed0 --- /dev/null +++ b/priority-queue/README.md @@ -0,0 +1,27 @@ +--- +layout: pattern +title: Priority Queue Pattern +folder: priority-queue +permalink: /patterns/priority-queue/ +categories: Behavioral +tags: + - Java + - Difficulty-Beginner +--- + +## Intent +Prioritize requests sent to services so that requests with a higher priority are received and processed more quickly than those of a lower priority. This pattern is useful in applications that offer different service level guarantees to individual clients. + +## Explanation +Applications may delegate specific tasks to other services; for example, to perform background processing or to integrate with other applications or services. In the cloud, a message queue is typically used to delegate tasks to background processing. In many cases the order in which requests are received by a service is not important. However, in some cases it may be necessary to prioritize specific requests. These requests should be processed earlier than others of a lower priority that may have been sent previously by the application. + +## Applicability +Use the Property pattern when + +* The system must handle multiple tasks that might have different priorities. +* Different users or tenants should be served with different priority.. + +## Real world examples + +* [ Priority Queue Pattern](https://docs.microsoft.com/en-us/previous-versions/msp-n-p/dn589794(v=pandp.10)) +Microsoft Azure does not provide a queuing mechanism that natively support automatic prioritization of messages through sorting. However, it does provide Azure Service Bus topics and subscriptions, which support a queuing mechanism that provides message filtering, together with a wide range of flexible capabilities that make it ideal for use in almost all priority queue implementations. diff --git a/priority-queue/pom.xml b/priority-queue/pom.xml new file mode 100644 index 000000000000..9e5a788066c3 --- /dev/null +++ b/priority-queue/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + priority-queue + + com.iluwatar + java-design-patterns + 1.21.0-SNAPSHOT + + + + + org.junit.jupiter + junit-jupiter-engine + test + + + + \ No newline at end of file diff --git a/priority-queue/src/main/java/com/iluwatar/priority/queue/Application.java b/priority-queue/src/main/java/com/iluwatar/priority/queue/Application.java new file mode 100644 index 000000000000..5ec1dc0cbaae --- /dev/null +++ b/priority-queue/src/main/java/com/iluwatar/priority/queue/Application.java @@ -0,0 +1,60 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.priority.queue; + +/** + * Prioritize requests sent to services so that requests with a higher priority are received and + * processed more quickly than those of a lower priority. + * This pattern is useful in applications that offer different service level guarantees + * to individual clients. + * Example :Send multiple message with different priority to worker queue. + * Worker execute higher priority message first + * @see "https://docs.microsoft.com/en-us/previous-versions/msp-n-p/dn589794(v=pandp.10)" + */ +public class Application { + /** + * main entry + */ + public static void main(String[] args) throws Exception { + + QueueManager queueManager = new QueueManager(100); + + // push some message to queue + // Low Priority message + for (int i = 0; i < 100; i++) { + queueManager.publishMessage(new Message("Low Message Priority", 0)); + } + + // High Priority message + for (int i = 0; i < 100; i++) { + queueManager.publishMessage(new Message("High Message Priority", 1)); + } + + + // run worker + Worker worker = new Worker(queueManager); + worker.run(); + + + } +} diff --git a/priority-queue/src/main/java/com/iluwatar/priority/queue/Message.java b/priority-queue/src/main/java/com/iluwatar/priority/queue/Message.java new file mode 100644 index 000000000000..66c561d64269 --- /dev/null +++ b/priority-queue/src/main/java/com/iluwatar/priority/queue/Message.java @@ -0,0 +1,50 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.priority.queue; + +/** + * Message bean + */ +public class Message implements Comparable { + private final String message; + private final int priority; // define message priority in queue + + + public Message(String message, int priority) { + this.message = message; + this.priority = priority; + } + + @Override + public int compareTo(Message o) { + return priority - o.priority; + } + + @Override + public String toString() { + return "Message{" + + "message='" + message + '\'' + + ", priority=" + priority + + '}'; + } +} diff --git a/priority-queue/src/main/java/com/iluwatar/priority/queue/PriorityMessageQueue.java b/priority-queue/src/main/java/com/iluwatar/priority/queue/PriorityMessageQueue.java new file mode 100644 index 000000000000..2a49d94b53e3 --- /dev/null +++ b/priority-queue/src/main/java/com/iluwatar/priority/queue/PriorityMessageQueue.java @@ -0,0 +1,178 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.priority.queue; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static java.util.Arrays.copyOf; + +/** + * Keep high Priority message on top using maxHeap. + * + * @param : DataType to push in Queue + */ +public class PriorityMessageQueue { + + private static final Logger LOGGER = LoggerFactory.getLogger(PriorityMessageQueue.class); + + private int size = 0; + + private int capacity; + + + private T[] queue; + + public PriorityMessageQueue(T[] queue) { + this.queue = queue; + this.capacity = queue.length; + } + + /** + * Remove top message from queue + */ + public T remove() { + if (isEmpty()) { + return null; + } + + T root = queue[0]; + queue[0] = queue[size - 1]; + size--; + maxHeapifyDown(); + return root; + } + + /** + * Add message to queue + */ + public void add(T t) { + ensureCapacity(); + queue[size] = t; + size++; + maxHeapifyUp(); + } + + /** + * Check queue size + */ + public boolean isEmpty() { + return size == 0; + } + + + private void maxHeapifyDown() { + int index = 0; + while (hasLeftChild(index)) { + + int smallerIndex = leftChildIndex(index); + + if (hasRightChild(index) && right(index).compareTo(left(index)) > 0) { + smallerIndex = rightChildIndex(index); + } + + if (queue[index].compareTo(queue[smallerIndex]) > 0) { + break; + } else { + swap(index, smallerIndex); + } + + index = smallerIndex; + + + } + + } + + private void maxHeapifyUp() { + int index = size - 1; + while (hasParent(index) && parent(index).compareTo(queue[index]) < 0) { + swap(parentIndex(index), index); + index = parentIndex(index); + } + } + + + // index + private int parentIndex(int pos) { + return (pos - 1) / 2; + } + + private int leftChildIndex(int parentPos) { + return 2 * parentPos + 1; + } + + private int rightChildIndex(int parentPos) { + return 2 * parentPos + 2; + } + + // value + private T parent(int childIndex) { + return queue[parentIndex(childIndex)]; + } + + private T left(int parentIndex) { + return queue[leftChildIndex(parentIndex)]; + } + + private T right(int parentIndex) { + return queue[rightChildIndex(parentIndex)]; + } + + // check + private boolean hasLeftChild(int index) { + return leftChildIndex(index) < size; + } + + private boolean hasRightChild(int index) { + return rightChildIndex(index) < size; + } + + private boolean hasParent(int index) { + return parentIndex(index) >= 0; + } + + private void swap(int fpos, int tpos) { + T tmp = queue[fpos]; + queue[fpos] = queue[tpos]; + queue[tpos] = tmp; + } + + private void ensureCapacity() { + if (size == capacity) { + capacity = capacity * 2; + queue = copyOf(queue, capacity); + } + } + + /** + * For debug .. print current state of queue + */ + public void print() { + for (int i = 0; i <= size / 2; i++) { + LOGGER.info(" PARENT : " + queue[i] + " LEFT CHILD : " + + left(i) + " RIGHT CHILD :" + right(i)); + } + } + +} diff --git a/priority-queue/src/main/java/com/iluwatar/priority/queue/QueueManager.java b/priority-queue/src/main/java/com/iluwatar/priority/queue/QueueManager.java new file mode 100644 index 000000000000..7eb68500b178 --- /dev/null +++ b/priority-queue/src/main/java/com/iluwatar/priority/queue/QueueManager.java @@ -0,0 +1,57 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.priority.queue; + +/** + * Manage priority queue + */ +public class QueueManager { + /* + Priority message + */ + private final PriorityMessageQueue messagePriorityMessageQueue; + + public QueueManager(int initialCapacity) { + messagePriorityMessageQueue = new PriorityMessageQueue(new Message[initialCapacity]); + } + + /** + * Publish message to queue + */ + public void publishMessage(Message message) { + messagePriorityMessageQueue.add(message); + } + + + /** + * recive message from queue + */ + public Message receiveMessage() { + if (messagePriorityMessageQueue.isEmpty()) { + return null; + } + return messagePriorityMessageQueue.remove(); + } + + +} diff --git a/priority-queue/src/main/java/com/iluwatar/priority/queue/Worker.java b/priority-queue/src/main/java/com/iluwatar/priority/queue/Worker.java new file mode 100644 index 000000000000..22faa1519e34 --- /dev/null +++ b/priority-queue/src/main/java/com/iluwatar/priority/queue/Worker.java @@ -0,0 +1,63 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.priority.queue; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Message Worker + */ +public class Worker { + + private static final Logger LOGGER = LoggerFactory.getLogger(Worker.class); + + private final QueueManager queueManager; + + public Worker(QueueManager queueManager) { + this.queueManager = queueManager; + } + + /** + * Keep checking queue for message + */ + public void run() throws Exception { + while (true) { + Message message = queueManager.receiveMessage(); + if (message == null) { + LOGGER.info("No Message ... waiting"); + Thread.sleep(200); + } else { + processMessage(message); + } + } + } + + /** + * Process message + */ + private void processMessage(Message message) { + LOGGER.info(message.toString()); + } + +} diff --git a/priority-queue/src/test/java/com/iluwatar/priority/queue/PriorityMessageQueueTest.java b/priority-queue/src/test/java/com/iluwatar/priority/queue/PriorityMessageQueueTest.java new file mode 100644 index 000000000000..6dc26fcf67e2 --- /dev/null +++ b/priority-queue/src/test/java/com/iluwatar/priority/queue/PriorityMessageQueueTest.java @@ -0,0 +1,73 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.priority.queue; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Test case for order of messages + */ +public class PriorityMessageQueueTest { + + + @Test + public void remove() { + PriorityMessageQueue stringPriorityMessageQueue = new PriorityMessageQueue<>(new String[2]); + String pushMessage = "test"; + stringPriorityMessageQueue.add(pushMessage); + assertEquals(stringPriorityMessageQueue.remove(), pushMessage); + } + + @Test + public void add() { + PriorityMessageQueue stringPriorityMessageQueue = new PriorityMessageQueue<>(new Integer[2]); + stringPriorityMessageQueue.add(1); + stringPriorityMessageQueue.add(5); + stringPriorityMessageQueue.add(10); + stringPriorityMessageQueue.add(3); + assertTrue(stringPriorityMessageQueue.remove() == 10); + } + + @Test + public void isEmpty() { + PriorityMessageQueue stringPriorityMessageQueue = new PriorityMessageQueue<>(new Integer[2]); + assertTrue(stringPriorityMessageQueue.isEmpty()); + stringPriorityMessageQueue.add(1); + stringPriorityMessageQueue.remove(); + assertTrue(stringPriorityMessageQueue.isEmpty()); + } + + @Test + public void testEnsureSize() { + PriorityMessageQueue stringPriorityMessageQueue = new PriorityMessageQueue<>(new Integer[2]); + assertTrue(stringPriorityMessageQueue.isEmpty()); + stringPriorityMessageQueue.add(1); + stringPriorityMessageQueue.add(2); + stringPriorityMessageQueue.add(2); + stringPriorityMessageQueue.add(3); + assertTrue(stringPriorityMessageQueue.remove() == 3); + } +} \ No newline at end of file diff --git a/priority-queue/src/test/java/com/iluwatar/priority/queue/QueueManagerTest.java b/priority-queue/src/test/java/com/iluwatar/priority/queue/QueueManagerTest.java new file mode 100644 index 000000000000..721fea4deea1 --- /dev/null +++ b/priority-queue/src/test/java/com/iluwatar/priority/queue/QueueManagerTest.java @@ -0,0 +1,53 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.priority.queue; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Check queue manager + */ +public class QueueManagerTest { + + @Test + public void publishMessage() { + QueueManager queueManager = new QueueManager(2); + Message testMessage = new Message("Test Message", 1); + queueManager.publishMessage(testMessage); + Message recivedMessage = queueManager.receiveMessage(); + assertEquals(testMessage, recivedMessage); + } + + @Test + public void receiveMessage() { + QueueManager queueManager = new QueueManager(2); + Message testMessage1 = new Message("Test Message 1", 1); + queueManager.publishMessage(testMessage1); + Message testMessage2 = new Message("Test Message 2", 2); + queueManager.publishMessage(testMessage2); + Message recivedMessage = queueManager.receiveMessage(); + assertEquals(testMessage2, recivedMessage); + } +} \ No newline at end of file From 318f811fead95c4a363d776e968b0b1a4a112c86 Mon Sep 17 00:00:00 2001 From: Pawel Zawitowski Date: Tue, 3 Sep 2019 20:50:48 +0200 Subject: [PATCH 019/197] Bytecode pattern #553 (#896) * Added bytecode pattern * Diagram changed and added licence information * Added bytecode module to main pom. * Fixed missing dependency error --- bytecode/README.md | 25 +++ bytecode/etc/bytecode.png | Bin 0 -> 19866 bytes bytecode/etc/bytecode.ucls | 49 ++++++ bytecode/pom.xml | 45 +++++ .../main/java/com/iluwatar/bytecode/App.java | 79 +++++++++ .../com/iluwatar/bytecode/Instruction.java | 65 ++++++++ .../com/iluwatar/bytecode/VirtualMachine.java | 142 ++++++++++++++++ .../java/com/iluwatar/bytecode/Wizard.java | 83 ++++++++++ .../util/InstructionConverterUtil.java | 76 +++++++++ .../java/com/iluwatar/bytecode/AppTest.java | 37 +++++ .../iluwatar/bytecode/VirtualMachineTest.java | 154 ++++++++++++++++++ .../util/InstructionConverterUtilTest.java | 63 +++++++ pom.xml | 1 + 13 files changed, 819 insertions(+) create mode 100644 bytecode/README.md create mode 100644 bytecode/etc/bytecode.png create mode 100644 bytecode/etc/bytecode.ucls create mode 100644 bytecode/pom.xml create mode 100644 bytecode/src/main/java/com/iluwatar/bytecode/App.java create mode 100644 bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java create mode 100644 bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java create mode 100644 bytecode/src/main/java/com/iluwatar/bytecode/Wizard.java create mode 100644 bytecode/src/main/java/com/iluwatar/bytecode/util/InstructionConverterUtil.java create mode 100644 bytecode/src/test/java/com/iluwatar/bytecode/AppTest.java create mode 100644 bytecode/src/test/java/com/iluwatar/bytecode/VirtualMachineTest.java create mode 100644 bytecode/src/test/java/com/iluwatar/bytecode/util/InstructionConverterUtilTest.java diff --git a/bytecode/README.md b/bytecode/README.md new file mode 100644 index 000000000000..d2fc45e1e2d1 --- /dev/null +++ b/bytecode/README.md @@ -0,0 +1,25 @@ +--- +layout: pattern +title: Bytecode +folder: bytecode +permalink: /patterns/bytecode/ +categories: Behavioral +tags: + - Java + - Difficulty-Beginner +--- + +## Intent +Allows to encode behaviour as instructions for virtual machine. + +## Applicability +Use the Bytecode pattern when you have a lot of behavior you need to define and your +game’s implementation language isn’t a good fit because: + +* it’s too low-level, making it tedious or error-prone to program in. +* iterating on it takes too long due to slow compile times or other tooling issues. +* it has too much trust. If you want to ensure the behavior being defined can’t break the game, you need to sandbox it from the rest of the codebase. + +## Credits + +* [Game programming patterns](http://gameprogrammingpatterns.com/bytecode.html) diff --git a/bytecode/etc/bytecode.png b/bytecode/etc/bytecode.png new file mode 100644 index 0000000000000000000000000000000000000000..31b6bc6edba64cfb51910e5d2c5322be46e7c075 GIT binary patch literal 19866 zcmbrmbzD?mw?96^s3U?7sD#9TB8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h*83c!M&h5+m{e8XP-};*>l>r>4ok{tOsoFh1i-V^Zr3Oyu3n6)c5w@r0B3r?j23s(z2VwaCN{_ad%Bd2YevN##eKAtQj_Z zELpV59#k>-RCKs3E48R^Vp^P*ExNkZ;egOULr(W?+l7T~=^N?SDx)uo)YI2hGmsQ) zPdnt)T%PMHyfqFYE@(h~MwS!~ zV%Emwfq z3=kUy0Z)UxN?#(`$a50;xPXa7fN%itg;X)^D*c9r*{izb_c2Mlaw8RznG!CY<0w%w~Xf^Hs)+|t=lul>R{vP zWD))dNvkw_?drXtLg?L=k|qI|g_oz_F?2sO`}0!$YqHwYt{qeg(~;LGztL}cAXLx_ znD~3G-4Su0dDZfw2uaa+XBgnNQose5nP zT$7IeKC9pZY$&pI`tuuQr%UgoLk9j9{&mZdE>gTe~DWM4f D@r6J8 literal 0 HcmV?d00001 diff --git a/bytecode/etc/bytecode.ucls b/bytecode/etc/bytecode.ucls new file mode 100644 index 000000000000..3ec390458956 --- /dev/null +++ b/bytecode/etc/bytecode.ucls @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bytecode/pom.xml b/bytecode/pom.xml new file mode 100644 index 000000000000..e9e6247f8eb2 --- /dev/null +++ b/bytecode/pom.xml @@ -0,0 +1,45 @@ + + + + + java-design-patterns + com.iluwatar + 1.21.0-SNAPSHOT + + 4.0.0 + + bytecode + + + org.junit.jupiter + junit-jupiter-engine + test + + + + \ No newline at end of file diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/App.java b/bytecode/src/main/java/com/iluwatar/bytecode/App.java new file mode 100644 index 000000000000..90b97bd33308 --- /dev/null +++ b/bytecode/src/main/java/com/iluwatar/bytecode/App.java @@ -0,0 +1,79 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.bytecode; + +import com.iluwatar.bytecode.util.InstructionConverterUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The intention of Bytecode pattern is to give behavior the flexibility of data by encoding it as instructions + * for a virtual machine. + * An instruction set defines the low-level operations that can be performed. A series of instructions is encoded as + * a sequence of bytes. A virtual machine executes these instructions one at a time, + * using a stack for intermediate values. By combining instructions, complex high-level behavior can be defined. + * + * This pattern should be used when there is a need to define high number of behaviours and implementation engine + * is not a good choice because + * It is too lowe level + * Iterating on it takes too long due to slow compile times or other tooling issues. + * It has too much trust. If you want to ensure the behavior being defined can’t break the game, + * you need to sandbox it from the rest of the codebase. + * + */ +public class App { + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); + + /** + * Main app method + * @param args command line args + */ + public static void main(String[] args) { + VirtualMachine vm = new VirtualMachine(); + + Wizard wizard = new Wizard(); + wizard.setHealth(45); + wizard.setAgility(7); + wizard.setWisdom(11); + vm.getWizards()[0] = wizard; + + interpretInstruction("LITERAL 0", vm); + interpretInstruction( "LITERAL 0", vm); + interpretInstruction( "GET_HEALTH", vm); + interpretInstruction( "LITERAL 0", vm); + interpretInstruction( "GET_AGILITY", vm); + interpretInstruction( "LITERAL 0", vm); + interpretInstruction( "GET_WISDOM ", vm); + interpretInstruction( "ADD", vm); + interpretInstruction( "LITERAL 2", vm); + interpretInstruction( "DIVIDE", vm); + interpretInstruction( "ADD", vm); + interpretInstruction( "SET_HEALTH", vm); + } + + private static void interpretInstruction(String instruction, VirtualMachine vm) { + InstructionConverterUtil converter = new InstructionConverterUtil(); + vm.execute(converter.convertToByteCode(instruction)); + LOGGER.info(instruction + String.format("%" + (12 - instruction.length()) + "s", "" ) + vm.getStack()); + } +} diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java b/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java new file mode 100644 index 000000000000..2ceb66e3bdc2 --- /dev/null +++ b/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java @@ -0,0 +1,65 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.bytecode; + +/** + * Representation of instructions understandable by virtual machine + */ +public enum Instruction { + + LITERAL(1), + SET_HEALTH(2), + SET_WISDOM (3), + SET_AGILITY(4), + PLAY_SOUND(5), + SPAWN_PARTICLES(6), + GET_HEALTH(7), + GET_AGILITY(8), + GET_WISDOM(9), + ADD(10), + DIVIDE (11); + + private int value; + + Instruction(int value) { + this.value = value; + } + + public int getIntValue() { + return value; + } + + /** + * Converts integer value to Instruction + * @param value value of instruction + * @return representation of the instruction + */ + public static Instruction getInstruction(int value) { + for (int i = 0; i < Instruction.values().length; i++) { + if (Instruction.values()[i].getIntValue() == value) { + return Instruction.values()[i]; + } + } + throw new IllegalArgumentException("Invalid instruction value"); + } +} diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java b/bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java new file mode 100644 index 000000000000..aedafe514dce --- /dev/null +++ b/bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java @@ -0,0 +1,142 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.bytecode; + +import java.util.Stack; + +/** + * Implementation of virtual machine + */ +public class VirtualMachine { + + private Stack stack = new Stack(); + + private Wizard[] wizards = new Wizard[2]; + + /** + * Constructor + */ + public VirtualMachine() { + for (int i = 0; i < wizards.length; i++) { + wizards[i] = new Wizard(); + } + } + + /** + * Executes provided bytecode + * @param bytecode to execute + */ + public void execute(int[] bytecode) { + for (int i = 0; i < bytecode.length; i++) { + Instruction instruction = Instruction.getInstruction(bytecode[i]); + int wizard; + int amount; + switch (instruction) { + case LITERAL: + // Read the next byte from the bytecode. + int value = bytecode[++i]; + stack.push(value); + break; + case SET_AGILITY: + amount = stack.pop(); + wizard = stack.pop(); + setAgility(wizard, amount); + break; + case SET_WISDOM: + amount = stack.pop(); + wizard = stack.pop(); + setWisdom(wizard, amount); + break; + case SET_HEALTH: + amount = stack.pop(); + wizard = stack.pop(); + setHealth(wizard, amount); + break; + case GET_HEALTH: + wizard = stack.pop(); + stack.push(getHealth(wizard)); + break; + case GET_AGILITY: + wizard = stack.pop(); + stack.push(getAgility(wizard)); + break; + case GET_WISDOM: + wizard = stack.pop(); + stack.push(getWisdom(wizard)); + break; + case ADD: + int a = stack.pop(); + int b = stack.pop(); + stack.push(a + b); + break; + case DIVIDE: + a = stack.pop(); + b = stack.pop(); + stack.push(b / a); + break; + case PLAY_SOUND: + wizard = stack.pop(); + getWizards()[wizard].playSound(); + break; + case SPAWN_PARTICLES: + wizard = stack.pop(); + getWizards()[wizard].spawnParticles(); + break; + default: + throw new IllegalArgumentException("Invalid instruction value"); + } + } + } + + public Stack getStack() { + return stack; + } + + public void setHealth(int wizard, int amount) { + wizards[wizard].setHealth(amount); + } + + public void setWisdom(int wizard, int amount) { + wizards[wizard].setWisdom(amount); + } + + public void setAgility(int wizard, int amount) { + wizards[wizard].setAgility(amount); + } + + public int getHealth(int wizard) { + return wizards[wizard].getHealth(); + } + + public int getWisdom(int wizard) { + return wizards[wizard].getWisdom(); + } + + public int getAgility(int wizard) { + return wizards[wizard].getAgility(); + } + + public Wizard[] getWizards() { + return wizards; + } +} diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/Wizard.java b/bytecode/src/main/java/com/iluwatar/bytecode/Wizard.java new file mode 100644 index 000000000000..ca47fd28f873 --- /dev/null +++ b/bytecode/src/main/java/com/iluwatar/bytecode/Wizard.java @@ -0,0 +1,83 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.bytecode; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This class represent game objects which properties can be changed by instructions interpreted by virtual machine + */ +public class Wizard { + private static final Logger LOGGER = LoggerFactory.getLogger(Wizard.class); + + private int health; + + private int agility; + private int wisdom; + + private int numberOfPlayedSounds; + private int numberOfSpawnedParticles; + + public int getHealth() { + return health; + } + + public void setHealth(int health) { + this.health = health; + } + + public int getAgility() { + return agility; + } + + public void setAgility(int agility) { + this.agility = agility; + } + + public int getWisdom() { + return wisdom; + } + + public void setWisdom(int wisdom) { + this.wisdom = wisdom; + } + + public void playSound() { + LOGGER.info("Playing sound"); + numberOfPlayedSounds++; + } + + public void spawnParticles() { + LOGGER.info("Spawning particles"); + numberOfSpawnedParticles++; + } + + public int getNumberOfPlayedSounds() { + return numberOfPlayedSounds; + } + + public int getNumberOfSpawnedParticles() { + return numberOfSpawnedParticles; + } +} diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/util/InstructionConverterUtil.java b/bytecode/src/main/java/com/iluwatar/bytecode/util/InstructionConverterUtil.java new file mode 100644 index 000000000000..202784d5a96c --- /dev/null +++ b/bytecode/src/main/java/com/iluwatar/bytecode/util/InstructionConverterUtil.java @@ -0,0 +1,76 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.bytecode.util; + +import com.iluwatar.bytecode.Instruction; + +/** + * Utility class used for instruction validation and conversion + */ +public class InstructionConverterUtil { + /** + * Converts instructions represented as String + * + * @param instructions to convert + * @return array of int representing bytecode + */ + public static int[] convertToByteCode(String instructions) { + if (instructions == null || instructions.trim().length() == 0) { + return new int[0]; + } + + String[] splitedInstructions = instructions.trim().split(" "); + int[] bytecode = new int[splitedInstructions.length]; + for (int i = 0; i < splitedInstructions.length; i++) { + if (isValidInstruction(splitedInstructions[i])) { + bytecode[i] = Instruction.valueOf(splitedInstructions[i]).getIntValue(); + } else if (isValidInt(splitedInstructions[i])) { + bytecode[i] = Integer.valueOf(splitedInstructions[i]); + } else { + throw new IllegalArgumentException("Invalid instruction or number: " + splitedInstructions[i]); + } + } + + return bytecode; + } + + private static boolean isValidInstruction(String instruction) { + try { + Instruction.valueOf(instruction); + return true; + } catch (IllegalArgumentException e) { + return false; + } + } + + private static boolean isValidInt(String value) { + try { + Integer.parseInt(value); + return true; + } catch (NumberFormatException e) { + return false; + } + } + + +} diff --git a/bytecode/src/test/java/com/iluwatar/bytecode/AppTest.java b/bytecode/src/test/java/com/iluwatar/bytecode/AppTest.java new file mode 100644 index 000000000000..014ec787569c --- /dev/null +++ b/bytecode/src/test/java/com/iluwatar/bytecode/AppTest.java @@ -0,0 +1,37 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.bytecode; + +import org.junit.jupiter.api.Test; + +/** + * Application test + */ +public class AppTest { + + @Test + public void test() { + String[] args = {}; + App.main(args); + } +} diff --git a/bytecode/src/test/java/com/iluwatar/bytecode/VirtualMachineTest.java b/bytecode/src/test/java/com/iluwatar/bytecode/VirtualMachineTest.java new file mode 100644 index 000000000000..e4379c9ede38 --- /dev/null +++ b/bytecode/src/test/java/com/iluwatar/bytecode/VirtualMachineTest.java @@ -0,0 +1,154 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.bytecode; + +import org.junit.jupiter.api.Test; + +import static com.iluwatar.bytecode.Instruction.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +/** + * Test for {@Link VirtualMachine} + */ +public class VirtualMachineTest { + + @Test + public void testLiteral() { + int[] bytecode = new int[2]; + bytecode[0] = LITERAL.getIntValue(); + bytecode[1] = 10; + + VirtualMachine vm = new VirtualMachine(); + vm.execute(bytecode); + + assertEquals(1, vm.getStack().size()); + assertEquals(Integer.valueOf(10), vm.getStack().pop()); + } + + @Test + public void testSetHealth() { + int wizardNumber = 0; + int[] bytecode = new int[5]; + bytecode[0] = LITERAL.getIntValue(); + bytecode[1] = wizardNumber; + bytecode[2] = LITERAL.getIntValue(); + bytecode[3] = 50; // health amount + bytecode[4] = SET_HEALTH.getIntValue(); + + VirtualMachine vm = new VirtualMachine(); + vm.execute(bytecode); + + assertEquals(50, vm.getWizards()[wizardNumber].getHealth()); + } + + @Test + public void testSetAgility() { + int wizardNumber = 0; + int[] bytecode = new int[5]; + bytecode[0] = LITERAL.getIntValue(); + bytecode[1] = wizardNumber; + bytecode[2] = LITERAL.getIntValue(); + bytecode[3] = 50; // agility amount + bytecode[4] = SET_AGILITY.getIntValue(); + + VirtualMachine vm = new VirtualMachine(); + vm.execute(bytecode); + + assertEquals(50, vm.getWizards()[wizardNumber].getAgility()); + } + + @Test + public void testSetWisdom() { + int wizardNumber = 0; + int[] bytecode = new int[5]; + bytecode[0] = LITERAL.getIntValue(); + bytecode[1] = wizardNumber; + bytecode[2] = LITERAL.getIntValue(); + bytecode[3] = 50; // wisdom amount + bytecode[4] = SET_WISDOM.getIntValue(); + + VirtualMachine vm = new VirtualMachine(); + vm.execute(bytecode); + + assertEquals(50, vm.getWizards()[wizardNumber].getWisdom()); + } + + @Test + public void testGetHealth() { + int wizardNumber = 0; + int[] bytecode = new int[8]; + bytecode[0] = LITERAL.getIntValue(); + bytecode[1] = wizardNumber; + bytecode[2] = LITERAL.getIntValue(); + bytecode[3] = 50; // health amount + bytecode[4] = SET_HEALTH.getIntValue(); + bytecode[5] = LITERAL.getIntValue();; + bytecode[6] = wizardNumber; + bytecode[7] = GET_HEALTH.getIntValue(); + + VirtualMachine vm = new VirtualMachine(); + vm.execute(bytecode); + + assertEquals(Integer.valueOf(50), vm.getStack().pop()); + } + + @Test + public void testPlaySound() { + int wizardNumber = 0; + int[] bytecode = new int[3]; + bytecode[0] = LITERAL.getIntValue(); + bytecode[1] = wizardNumber; + bytecode[2] = PLAY_SOUND.getIntValue(); + + VirtualMachine vm = new VirtualMachine(); + vm.execute(bytecode); + + assertEquals(0, vm.getStack().size()); + assertEquals(1, vm.getWizards()[0].getNumberOfPlayedSounds()); + } + + @Test + public void testSpawnParticles() { + int wizardNumber = 0; + int[] bytecode = new int[3]; + bytecode[0] = LITERAL.getIntValue(); + bytecode[1] = wizardNumber; + bytecode[2] = SPAWN_PARTICLES.getIntValue(); + + VirtualMachine vm = new VirtualMachine(); + vm.execute(bytecode); + + assertEquals(0, vm.getStack().size()); + assertEquals(1, vm.getWizards()[0].getNumberOfSpawnedParticles()); + } + + @Test + public void testInvalidInstruction() { + int[] bytecode = new int[1]; + bytecode[0] = 999; + VirtualMachine vm = new VirtualMachine(); + + assertThrows(IllegalArgumentException.class, () -> vm.execute(bytecode)); + } +} diff --git a/bytecode/src/test/java/com/iluwatar/bytecode/util/InstructionConverterUtilTest.java b/bytecode/src/test/java/com/iluwatar/bytecode/util/InstructionConverterUtilTest.java new file mode 100644 index 000000000000..4743ac109e12 --- /dev/null +++ b/bytecode/src/test/java/com/iluwatar/bytecode/util/InstructionConverterUtilTest.java @@ -0,0 +1,63 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.bytecode.util; + +import com.iluwatar.bytecode.Instruction; +import com.iluwatar.bytecode.util.InstructionConverterUtil; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + * Test for {@Link InstructionConverterUtil} + */ +public class InstructionConverterUtilTest { + @Test + public void testEmptyInstruction() { + String instruction = ""; + + int[] bytecode = InstructionConverterUtil.convertToByteCode(instruction); + + Assertions.assertEquals(0, bytecode.length); + } + + @Test + public void testInstructions() { + String instructions = + "LITERAL 35 SET_HEALTH SET_WISDOM SET_AGILITY PLAY_SOUND SPAWN_PARTICLES GET_HEALTH ADD DIVIDE"; + + int[] bytecode = InstructionConverterUtil.convertToByteCode(instructions); + + Assertions.assertEquals(10, bytecode.length); + Assertions.assertEquals(Instruction.LITERAL.getIntValue(), bytecode[0]); + Assertions.assertEquals(35, bytecode[1]); + Assertions.assertEquals(Instruction.SET_HEALTH.getIntValue(), bytecode[2]); + Assertions.assertEquals(Instruction.SET_WISDOM.getIntValue(), bytecode[3]); + Assertions.assertEquals(Instruction.SET_AGILITY.getIntValue(), bytecode[4]); + Assertions.assertEquals(Instruction.PLAY_SOUND.getIntValue(), bytecode[5]); + Assertions.assertEquals(Instruction.SPAWN_PARTICLES.getIntValue(), bytecode[6]); + Assertions.assertEquals(Instruction.GET_HEALTH.getIntValue(), bytecode[7]); + Assertions.assertEquals(Instruction.ADD.getIntValue(), bytecode[8]); + Assertions.assertEquals(Instruction.DIVIDE.getIntValue(), bytecode[9]); + } + +} diff --git a/pom.xml b/pom.xml index f305e97d983e..c55ed6492211 100644 --- a/pom.xml +++ b/pom.xml @@ -171,6 +171,7 @@ priority-queue commander typeobjectpattern + bytecode From 35dc25d4806f898bfc8f1ee31e4c9479bcc496d8 Mon Sep 17 00:00:00 2001 From: saksham93 <37399540+saksham93@users.noreply.github.com> Date: Sat, 7 Sep 2019 21:24:40 +0400 Subject: [PATCH 020/197] MInor bug fix Issue #895 -> Code comment change (https://github.com/iluwatar/java-design-patterns/issues/895) (#901) --- .../src/main/java/com/iluwatar/acyclicvisitor/App.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/App.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/App.java index 06e4bd2f255d..2a2f64591b6c 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/App.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/App.java @@ -47,7 +47,7 @@ public static void main(String[] args) { Zoom zoom = new Zoom(); Hayes hayes = new Hayes(); - hayes.accept(conDos); // Hayes modem with Unix configurator + hayes.accept(conDos); // Hayes modem with Dos configurator zoom.accept(conDos); // Zoom modem with Dos configurator hayes.accept(conUnix); // Hayes modem with Unix configurator zoom.accept(conUnix); // Zoom modem with Unix configurator From c653edf38fae9f067b1a35bfaf376b3312d97ee8 Mon Sep 17 00:00:00 2001 From: dongshengchen Date: Sun, 8 Sep 2019 01:52:49 +0800 Subject: [PATCH 021/197] fix must override a superclass method (#919) * fix must override a superclass method * fix must override a superclass method --- .../java/com/iluwatar/abstractfactory/ElfKingdomFactory.java | 3 +++ .../java/com/iluwatar/abstractfactory/OrcKingdomFactory.java | 3 +++ .../com/iluwatar/acyclicvisitor/ConfigureForDosVisitor.java | 2 ++ .../com/iluwatar/acyclicvisitor/ConfigureForUnixVisitor.java | 1 + .../main/java/com/iluwatar/factory/method/ElfBlacksmith.java | 1 + .../main/java/com/iluwatar/factory/method/OrcBlacksmith.java | 1 + .../java/com/iluwatar/throttling/timer/ThrottleTimerImpl.java | 1 + 7 files changed, 12 insertions(+) diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKingdomFactory.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKingdomFactory.java index 31cfddb70ff8..fc71ded766d6 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKingdomFactory.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKingdomFactory.java @@ -29,14 +29,17 @@ */ public class ElfKingdomFactory implements KingdomFactory { + @Override public Castle createCastle() { return new ElfCastle(); } + @Override public King createKing() { return new ElfKing(); } + @Override public Army createArmy() { return new ElfArmy(); } diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKingdomFactory.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKingdomFactory.java index 5b2ba3a30fc9..43eef13a111b 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKingdomFactory.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKingdomFactory.java @@ -29,14 +29,17 @@ */ public class OrcKingdomFactory implements KingdomFactory { + @Override public Castle createCastle() { return new OrcCastle(); } + @Override public King createKing() { return new OrcKing(); } + @Override public Army createArmy() { return new OrcArmy(); } diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitor.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitor.java index a6d66b1db477..4ef69b4b772b 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitor.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitor.java @@ -33,10 +33,12 @@ public class ConfigureForDosVisitor implements AllModemVisitor { private static final Logger LOGGER = LoggerFactory.getLogger(ConfigureForDosVisitor.class); + @Override public void visit(Hayes hayes) { LOGGER.info(hayes + " used with Dos configurator."); } + @Override public void visit(Zoom zoom) { LOGGER.info(zoom + " used with Dos configurator."); } diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitor.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitor.java index c3546012166d..f3be302f734c 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitor.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitor.java @@ -34,6 +34,7 @@ public class ConfigureForUnixVisitor implements ZoomVisitor { private static final Logger LOGGER = LoggerFactory.getLogger(ConfigureForUnixVisitor.class); + @Override public void visit(Zoom zoom) { LOGGER.info(zoom + " used with Unix configurator."); } diff --git a/factory-method/src/main/java/com/iluwatar/factory/method/ElfBlacksmith.java b/factory-method/src/main/java/com/iluwatar/factory/method/ElfBlacksmith.java index 66938bb1773b..63e083e3501d 100644 --- a/factory-method/src/main/java/com/iluwatar/factory/method/ElfBlacksmith.java +++ b/factory-method/src/main/java/com/iluwatar/factory/method/ElfBlacksmith.java @@ -29,6 +29,7 @@ */ public class ElfBlacksmith implements Blacksmith { + @Override public Weapon manufactureWeapon(WeaponType weaponType) { return new ElfWeapon(weaponType); } diff --git a/factory-method/src/main/java/com/iluwatar/factory/method/OrcBlacksmith.java b/factory-method/src/main/java/com/iluwatar/factory/method/OrcBlacksmith.java index e2921a4b52cf..6df398a814e9 100644 --- a/factory-method/src/main/java/com/iluwatar/factory/method/OrcBlacksmith.java +++ b/factory-method/src/main/java/com/iluwatar/factory/method/OrcBlacksmith.java @@ -29,6 +29,7 @@ */ public class OrcBlacksmith implements Blacksmith { + @Override public Weapon manufactureWeapon(WeaponType weaponType) { return new OrcWeapon(weaponType); } diff --git a/throttling/src/main/java/com/iluwatar/throttling/timer/ThrottleTimerImpl.java b/throttling/src/main/java/com/iluwatar/throttling/timer/ThrottleTimerImpl.java index 3d1e68287ccd..e2da42350bdd 100644 --- a/throttling/src/main/java/com/iluwatar/throttling/timer/ThrottleTimerImpl.java +++ b/throttling/src/main/java/com/iluwatar/throttling/timer/ThrottleTimerImpl.java @@ -49,6 +49,7 @@ public ThrottleTimerImpl(int throttlePeriod, CallsCount callsCount) { * A timer is initiated with this method. The timer runs every second and resets the * counter. */ + @Override public void start() { new Timer(true).schedule(new TimerTask() { @Override From 8c865e6b4dace244042c8b3c4399d81adcffdf90 Mon Sep 17 00:00:00 2001 From: Ibrahim ali abdelghany Date: Sat, 7 Sep 2019 20:07:01 +0200 Subject: [PATCH 022/197] clean code (#910) --- .../com/iluwatar/abstractdocument/AbstractDocument.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java index 36a946cc9eca..fccc23d83b7b 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java @@ -54,17 +54,16 @@ public Object get(String key) { @Override public Stream children(String key, Function, T> constructor) { - Optional>> any = Stream.of(get(key)).filter(el -> el != null) + Optional>> any = Stream.of(get(key)).filter(Objects::nonNull) .map(el -> (List>) el).findAny(); - return any.isPresent() ? any.get().stream().map(constructor) : Stream.empty(); + return any.map(maps -> maps.stream().map(constructor)).orElseGet(Stream::empty); } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getClass().getName()).append("["); - properties.entrySet() - .forEach(e -> builder.append("[").append(e.getKey()).append(" : ").append(e.getValue()).append("]")); + properties.forEach((key, value) -> builder.append("[").append(key).append(" : ").append(value).append("]")); builder.append("]"); return builder.toString(); } From f1410337b570c6d444e98713036d13b53bdefe68 Mon Sep 17 00:00:00 2001 From: Adrian Yao Date: Sun, 8 Sep 2019 02:13:15 +0800 Subject: [PATCH 023/197] Fix issue #761: ThreadSafeDoubleCheckLocking.java: Instantiating by Reflection call will be successful if you do that firstly (#920) --- singleton/pom.xml | 4 ++++ .../singleton/ThreadSafeDoubleCheckLocking.java | 6 +++++- .../ThreadSafeDoubleCheckLockingTest.java | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/singleton/pom.xml b/singleton/pom.xml index e3d8f06e2ea5..038d6fdac040 100644 --- a/singleton/pom.xml +++ b/singleton/pom.xml @@ -38,5 +38,9 @@ junit-jupiter-engine test + + junit + junit + diff --git a/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLocking.java b/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLocking.java index a7557fda37e0..6c17f7c3f001 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLocking.java +++ b/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLocking.java @@ -35,12 +35,16 @@ public final class ThreadSafeDoubleCheckLocking { private static volatile ThreadSafeDoubleCheckLocking instance; + private static boolean flag = true; + /** * private constructor to prevent client from instantiating. */ private ThreadSafeDoubleCheckLocking() { // to prevent instantiating by Reflection call - if (instance != null) { + if (flag) { + flag = false; + } else { throw new IllegalStateException("Already initialized."); } } diff --git a/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLockingTest.java b/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLockingTest.java index 1d00d9f8f624..6286b09fb2a4 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLockingTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLockingTest.java @@ -22,6 +22,11 @@ */ package com.iluwatar.singleton; +import org.junit.Test; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; + /** * Date: 12/29/15 - 19:26 PM * @@ -36,4 +41,15 @@ public ThreadSafeDoubleCheckLockingTest() { super(ThreadSafeDoubleCheckLocking::getInstance); } + /** + * Test creating new instance by refection + */ + @Test(expected = InvocationTargetException.class) + public void testCreatingNewInstanceByRefection() throws Exception { + ThreadSafeDoubleCheckLocking instance1 = ThreadSafeDoubleCheckLocking.getInstance(); + Constructor constructor = ThreadSafeDoubleCheckLocking.class.getDeclaredConstructor(); + constructor.setAccessible(true); + ThreadSafeDoubleCheckLocking instance2 = (ThreadSafeDoubleCheckLocking) constructor.newInstance(null); + } + } \ No newline at end of file From 88fae070e64dd90c94ed6008a7e15cd549badc17 Mon Sep 17 00:00:00 2001 From: snehalatapandit Date: Sat, 7 Sep 2019 23:48:13 +0530 Subject: [PATCH 024/197] Fix broken links #915 (#921) --- half-sync-half-async/README.md | 4 ++-- intercepting-filter/README.md | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/half-sync-half-async/README.md b/half-sync-half-async/README.md index 8a091f8133a3..ef463edadc6f 100644 --- a/half-sync-half-async/README.md +++ b/half-sync-half-async/README.md @@ -27,11 +27,11 @@ Use Half-Sync/Half-Async pattern when ## Real world examples -* [BSD Unix networking subsystem](http://www.cs.wustl.edu/~schmidt/PDF/PLoP-95.pdf) +* [BSD Unix networking subsystem](https://www.dre.vanderbilt.edu/~schmidt/PDF/PLoP-95.pdf) * [Real Time CORBA](http://www.omg.org/news/meetings/workshops/presentations/realtime2001/4-3_Pyarali_thread-pool.pdf) * [Android AsyncTask framework](http://developer.android.com/reference/android/os/AsyncTask.html) ## Credits -* [Douglas C. Schmidt and Charles D. Cranor - Half Sync/Half Async](http://www.cs.wustl.edu/~schmidt/PDF/PLoP-95.pdf) +* [Douglas C. Schmidt and Charles D. Cranor - Half Sync/Half Async](https://www.dre.vanderbilt.edu/~schmidt/PDF/PLoP-95.pdf) * [Pattern Oriented Software Architecture Vol I-V](http://www.amazon.com/Pattern-Oriented-Software-Architecture-Volume-Patterns/dp/0471958697) diff --git a/intercepting-filter/README.md b/intercepting-filter/README.md index 0d35044de8a7..c287138953eb 100644 --- a/intercepting-filter/README.md +++ b/intercepting-filter/README.md @@ -30,9 +30,8 @@ Use the Intercepting Filter pattern when ## Real world examples * [javax.servlet.FilterChain](https://tomcat.apache.org/tomcat-8.0-doc/servletapi/javax/servlet/FilterChain.html) and [javax.servlet.Filter](https://tomcat.apache.org/tomcat-8.0-doc/servletapi/javax/servlet/Filter.html) -* [Struts 2 - Interceptors](https://struts.apache.org/docs/interceptors.html) +* [Struts 2 - Interceptors](https://struts.apache.org/core-developers/interceptors.html) ## Credits * [TutorialsPoint - Intercepting Filter](http://www.tutorialspoint.com/design_pattern/intercepting_filter_pattern.htm) -* [Presentation Tier Patterns](http://www.javagyan.com/tutorials/corej2eepatterns/presentation-tier-patterns) From 9bf7a059b8b716ea6fe4ae7b96ae2745877d2dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sun, 8 Sep 2019 10:49:40 +0300 Subject: [PATCH 025/197] Java Design Patterns v1.21.0 --- abstract-document/pom.xml | 2 +- abstract-factory/pom.xml | 2 +- acyclic-visitor/pom.xml | 2 +- adapter/pom.xml | 2 +- aggregator-microservices/aggregator-service/pom.xml | 2 +- aggregator-microservices/information-microservice/pom.xml | 2 +- aggregator-microservices/inventory-microservice/pom.xml | 2 +- aggregator-microservices/pom.xml | 2 +- ambassador/pom.xml | 2 +- api-gateway/api-gateway-service/pom.xml | 2 +- api-gateway/image-microservice/pom.xml | 2 +- api-gateway/pom.xml | 2 +- api-gateway/price-microservice/pom.xml | 2 +- async-method-invocation/pom.xml | 2 +- balking/pom.xml | 2 +- bridge/pom.xml | 2 +- builder/pom.xml | 2 +- business-delegate/pom.xml | 2 +- bytecode/pom.xml | 2 +- caching/pom.xml | 2 +- callback/pom.xml | 2 +- chain/pom.xml | 2 +- collection-pipeline/pom.xml | 2 +- command/pom.xml | 2 +- commander/pom.xml | 2 +- composite/pom.xml | 2 +- converter/pom.xml | 2 +- cqrs/pom.xml | 2 +- dao/pom.xml | 2 +- data-bus/pom.xml | 2 +- data-mapper/pom.xml | 2 +- data-transfer-object/pom.xml | 2 +- decorator/pom.xml | 2 +- delegation/pom.xml | 2 +- dependency-injection/pom.xml | 2 +- dirty-flag/pom.xml | 4 ++-- double-checked-locking/pom.xml | 2 +- double-dispatch/pom.xml | 2 +- eip-aggregator/pom.xml | 2 +- eip-message-channel/pom.xml | 2 +- eip-publish-subscribe/pom.xml | 2 +- eip-splitter/pom.xml | 2 +- eip-wire-tap/pom.xml | 2 +- event-aggregator/pom.xml | 2 +- event-asynchronous/pom.xml | 2 +- event-driven-architecture/pom.xml | 2 +- event-queue/pom.xml | 2 +- event-sourcing/pom.xml | 2 +- execute-around/pom.xml | 2 +- extension-objects/pom.xml | 2 +- facade/pom.xml | 2 +- factory-kit/pom.xml | 2 +- factory-method/pom.xml | 2 +- feature-toggle/pom.xml | 2 +- fluentinterface/pom.xml | 2 +- flux/pom.xml | 2 +- flyweight/pom.xml | 2 +- front-controller/pom.xml | 2 +- guarded-suspension/pom.xml | 2 +- half-sync-half-async/pom.xml | 2 +- hexagonal/pom.xml | 2 +- intercepting-filter/pom.xml | 2 +- interpreter/pom.xml | 2 +- iterator/pom.xml | 2 +- layers/pom.xml | 2 +- lazy-loading/pom.xml | 2 +- marker/pom.xml | 2 +- master-worker-pattern/pom.xml | 2 +- mediator/pom.xml | 2 +- memento/pom.xml | 2 +- model-view-controller/pom.xml | 2 +- model-view-presenter/pom.xml | 2 +- module/pom.xml | 2 +- monad/pom.xml | 2 +- monostate/pom.xml | 2 +- multiton/pom.xml | 2 +- mute-idiom/pom.xml | 2 +- mutex/pom.xml | 2 +- naked-objects/dom/pom.xml | 2 +- naked-objects/fixture/pom.xml | 2 +- naked-objects/integtests/pom.xml | 2 +- naked-objects/pom.xml | 8 ++++---- naked-objects/webapp/pom.xml | 2 +- null-object/pom.xml | 2 +- object-mother/pom.xml | 2 +- object-pool/pom.xml | 2 +- observer/pom.xml | 2 +- page-object/pom.xml | 2 +- page-object/sample-application/pom.xml | 2 +- page-object/test-automation/pom.xml | 2 +- partial-response/pom.xml | 2 +- poison-pill/pom.xml | 2 +- pom.xml | 2 +- priority-queue/pom.xml | 2 +- private-class-data/pom.xml | 2 +- producer-consumer/pom.xml | 2 +- promise/pom.xml | 2 +- property/pom.xml | 2 +- prototype/pom.xml | 2 +- proxy/pom.xml | 2 +- queue-load-leveling/pom.xml | 2 +- reactor/pom.xml | 2 +- reader-writer-lock/pom.xml | 2 +- repository/pom.xml | 2 +- resource-acquisition-is-initialization/pom.xml | 2 +- retry/pom.xml | 2 +- semaphore/pom.xml | 2 +- servant/pom.xml | 2 +- serverless/pom.xml | 2 +- service-layer/pom.xml | 2 +- service-locator/pom.xml | 2 +- singleton/pom.xml | 2 +- spatial-partition/pom.xml | 2 +- specification/pom.xml | 2 +- state/pom.xml | 2 +- step-builder/pom.xml | 2 +- strategy/pom.xml | 2 +- template-method/pom.xml | 2 +- thread-pool/pom.xml | 2 +- throttling/pom.xml | 2 +- tls/pom.xml | 2 +- tolerant-reader/pom.xml | 2 +- trampoline/pom.xml | 2 +- twin/pom.xml | 2 +- typeobjectpattern/pom.xml | 2 +- unit-of-work/pom.xml | 2 +- value-object/pom.xml | 2 +- visitor/pom.xml | 2 +- 128 files changed, 132 insertions(+), 132 deletions(-) diff --git a/abstract-document/pom.xml b/abstract-document/pom.xml index bdcdd170a43a..452ac6319b15 100644 --- a/abstract-document/pom.xml +++ b/abstract-document/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 abstract-document diff --git a/abstract-factory/pom.xml b/abstract-factory/pom.xml index 00c9a491cf15..d0a6a4330466 100644 --- a/abstract-factory/pom.xml +++ b/abstract-factory/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 abstract-factory diff --git a/acyclic-visitor/pom.xml b/acyclic-visitor/pom.xml index 4a0f740fdd42..9d091750ff5c 100644 --- a/acyclic-visitor/pom.xml +++ b/acyclic-visitor/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 acyclic-visitor diff --git a/adapter/pom.xml b/adapter/pom.xml index 0c47247dd8a7..5d0940b94261 100644 --- a/adapter/pom.xml +++ b/adapter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 adapter diff --git a/aggregator-microservices/aggregator-service/pom.xml b/aggregator-microservices/aggregator-service/pom.xml index c4ad9cf1a4a9..5a23ad063480 100644 --- a/aggregator-microservices/aggregator-service/pom.xml +++ b/aggregator-microservices/aggregator-service/pom.xml @@ -29,7 +29,7 @@ aggregator-microservices com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/aggregator-microservices/information-microservice/pom.xml b/aggregator-microservices/information-microservice/pom.xml index 85992658990b..dd29d683057a 100644 --- a/aggregator-microservices/information-microservice/pom.xml +++ b/aggregator-microservices/information-microservice/pom.xml @@ -29,7 +29,7 @@ aggregator-microservices com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/aggregator-microservices/inventory-microservice/pom.xml b/aggregator-microservices/inventory-microservice/pom.xml index e19ba55533fb..66943eb8d701 100644 --- a/aggregator-microservices/inventory-microservice/pom.xml +++ b/aggregator-microservices/inventory-microservice/pom.xml @@ -29,7 +29,7 @@ aggregator-microservices com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/aggregator-microservices/pom.xml b/aggregator-microservices/pom.xml index 20e912395a05..98caca2070ff 100644 --- a/aggregator-microservices/pom.xml +++ b/aggregator-microservices/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 aggregator-microservices diff --git a/ambassador/pom.xml b/ambassador/pom.xml index efc8437051fe..ee04afc0af89 100644 --- a/ambassador/pom.xml +++ b/ambassador/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 ambassador diff --git a/api-gateway/api-gateway-service/pom.xml b/api-gateway/api-gateway-service/pom.xml index b17d71bfb905..bf96a660994a 100644 --- a/api-gateway/api-gateway-service/pom.xml +++ b/api-gateway/api-gateway-service/pom.xml @@ -29,7 +29,7 @@ api-gateway com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 api-gateway-service diff --git a/api-gateway/image-microservice/pom.xml b/api-gateway/image-microservice/pom.xml index bf70cda03c74..7ac0b9c90246 100644 --- a/api-gateway/image-microservice/pom.xml +++ b/api-gateway/image-microservice/pom.xml @@ -29,7 +29,7 @@ api-gateway com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/api-gateway/pom.xml b/api-gateway/pom.xml index a46a511177a7..7d5adf478468 100644 --- a/api-gateway/pom.xml +++ b/api-gateway/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 api-gateway diff --git a/api-gateway/price-microservice/pom.xml b/api-gateway/price-microservice/pom.xml index 33931cac5b2d..c3668a7f9558 100644 --- a/api-gateway/price-microservice/pom.xml +++ b/api-gateway/price-microservice/pom.xml @@ -29,7 +29,7 @@ api-gateway com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/async-method-invocation/pom.xml b/async-method-invocation/pom.xml index 0c42bc970333..2bfbed289035 100644 --- a/async-method-invocation/pom.xml +++ b/async-method-invocation/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 async-method-invocation diff --git a/balking/pom.xml b/balking/pom.xml index f20969b62765..a6e02fac8c29 100644 --- a/balking/pom.xml +++ b/balking/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/bridge/pom.xml b/bridge/pom.xml index cf45178a1925..a6082e24f3fa 100644 --- a/bridge/pom.xml +++ b/bridge/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 bridge diff --git a/builder/pom.xml b/builder/pom.xml index dcf61fad5691..2f094dbfb33a 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 builder diff --git a/business-delegate/pom.xml b/business-delegate/pom.xml index ab2f1ae3cb2e..c1abe317e18d 100644 --- a/business-delegate/pom.xml +++ b/business-delegate/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 business-delegate diff --git a/bytecode/pom.xml b/bytecode/pom.xml index e9e6247f8eb2..3e6fd5ca656c 100644 --- a/bytecode/pom.xml +++ b/bytecode/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/caching/pom.xml b/caching/pom.xml index c678aba4f4e4..b18d250b8ccd 100644 --- a/caching/pom.xml +++ b/caching/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 caching diff --git a/callback/pom.xml b/callback/pom.xml index 46e9e2c9a5fe..04ab9c6fad5b 100644 --- a/callback/pom.xml +++ b/callback/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 callback diff --git a/chain/pom.xml b/chain/pom.xml index 86b469ed828f..f992cf7871d0 100644 --- a/chain/pom.xml +++ b/chain/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 chain diff --git a/collection-pipeline/pom.xml b/collection-pipeline/pom.xml index 6003c9b4d7b3..3390f41dbf39 100644 --- a/collection-pipeline/pom.xml +++ b/collection-pipeline/pom.xml @@ -27,7 +27,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 collection-pipeline diff --git a/command/pom.xml b/command/pom.xml index 6d22f80a3ef1..c0eee39bffa7 100644 --- a/command/pom.xml +++ b/command/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 command diff --git a/commander/pom.xml b/commander/pom.xml index bbf69b597113..baeee42fd564 100644 --- a/commander/pom.xml +++ b/commander/pom.xml @@ -3,7 +3,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 commander diff --git a/composite/pom.xml b/composite/pom.xml index 9d6f53e2cf08..4698ed1419b7 100644 --- a/composite/pom.xml +++ b/composite/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 composite diff --git a/converter/pom.xml b/converter/pom.xml index 18b70a1d1e01..412d2509f741 100644 --- a/converter/pom.xml +++ b/converter/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/cqrs/pom.xml b/cqrs/pom.xml index 428a9943a2f2..aeec001b0e28 100644 --- a/cqrs/pom.xml +++ b/cqrs/pom.xml @@ -21,7 +21,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 cqrs diff --git a/dao/pom.xml b/dao/pom.xml index addefc20873b..743bfc429641 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 dao diff --git a/data-bus/pom.xml b/data-bus/pom.xml index 918da99040d1..20d9f817bc6b 100644 --- a/data-bus/pom.xml +++ b/data-bus/pom.xml @@ -33,7 +33,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 data-bus diff --git a/data-mapper/pom.xml b/data-mapper/pom.xml index e64f44747e55..ca48e87ad49f 100644 --- a/data-mapper/pom.xml +++ b/data-mapper/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 data-mapper diff --git a/data-transfer-object/pom.xml b/data-transfer-object/pom.xml index 79a54564430e..e7b0a5ddc734 100644 --- a/data-transfer-object/pom.xml +++ b/data-transfer-object/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 data-transfer-object diff --git a/decorator/pom.xml b/decorator/pom.xml index e92b9dc492b2..f80026ff9209 100644 --- a/decorator/pom.xml +++ b/decorator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 decorator diff --git a/delegation/pom.xml b/delegation/pom.xml index 02b0fda4adeb..55fb8a14703e 100644 --- a/delegation/pom.xml +++ b/delegation/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/dependency-injection/pom.xml b/dependency-injection/pom.xml index 21873c86813c..1dd72abcc33f 100644 --- a/dependency-injection/pom.xml +++ b/dependency-injection/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 dependency-injection diff --git a/dirty-flag/pom.xml b/dirty-flag/pom.xml index de3ef48f0596..caaa58795935 100644 --- a/dirty-flag/pom.xml +++ b/dirty-flag/pom.xml @@ -29,11 +29,11 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 com.iluwatar dirty-flag - 1.21.0-SNAPSHOT + 1.21.0 dirty-flag http://maven.apache.org diff --git a/double-checked-locking/pom.xml b/double-checked-locking/pom.xml index 49ffe88a77fb..9d3ac69af8ac 100644 --- a/double-checked-locking/pom.xml +++ b/double-checked-locking/pom.xml @@ -27,7 +27,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 double-checked-locking diff --git a/double-dispatch/pom.xml b/double-dispatch/pom.xml index 22fe7a684bc3..11f66b11455b 100644 --- a/double-dispatch/pom.xml +++ b/double-dispatch/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 double-dispatch diff --git a/eip-aggregator/pom.xml b/eip-aggregator/pom.xml index 54de34334464..3f1e930c2f2c 100644 --- a/eip-aggregator/pom.xml +++ b/eip-aggregator/pom.xml @@ -26,7 +26,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 diff --git a/eip-message-channel/pom.xml b/eip-message-channel/pom.xml index fd7ee5c0e5e8..e0927ef5aa03 100644 --- a/eip-message-channel/pom.xml +++ b/eip-message-channel/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 eip-message-channel diff --git a/eip-publish-subscribe/pom.xml b/eip-publish-subscribe/pom.xml index 2a041930d048..4d8711a563c3 100644 --- a/eip-publish-subscribe/pom.xml +++ b/eip-publish-subscribe/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 eip-publish-subscribe diff --git a/eip-splitter/pom.xml b/eip-splitter/pom.xml index 3f5a79ca1dcc..d5aab1ed29f6 100644 --- a/eip-splitter/pom.xml +++ b/eip-splitter/pom.xml @@ -26,7 +26,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 diff --git a/eip-wire-tap/pom.xml b/eip-wire-tap/pom.xml index e3791102d367..a2b3aee8f556 100644 --- a/eip-wire-tap/pom.xml +++ b/eip-wire-tap/pom.xml @@ -26,7 +26,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 diff --git a/event-aggregator/pom.xml b/event-aggregator/pom.xml index dca72de732eb..4ede7e366d80 100644 --- a/event-aggregator/pom.xml +++ b/event-aggregator/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 event-aggregator diff --git a/event-asynchronous/pom.xml b/event-asynchronous/pom.xml index 908662d083d9..647296d0d629 100644 --- a/event-asynchronous/pom.xml +++ b/event-asynchronous/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 event-asynchronous diff --git a/event-driven-architecture/pom.xml b/event-driven-architecture/pom.xml index a336c9f13962..dc846f241173 100644 --- a/event-driven-architecture/pom.xml +++ b/event-driven-architecture/pom.xml @@ -31,7 +31,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 event-driven-architecture diff --git a/event-queue/pom.xml b/event-queue/pom.xml index bd80ba5a4bec..2d341e7eb67b 100644 --- a/event-queue/pom.xml +++ b/event-queue/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 event-queue diff --git a/event-sourcing/pom.xml b/event-sourcing/pom.xml index 4b4d8c701cfa..8242cb502505 100644 --- a/event-sourcing/pom.xml +++ b/event-sourcing/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 event-sourcing diff --git a/execute-around/pom.xml b/execute-around/pom.xml index 6fd853ff571f..50b5672d4a81 100644 --- a/execute-around/pom.xml +++ b/execute-around/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 execute-around diff --git a/extension-objects/pom.xml b/extension-objects/pom.xml index 2dee66d3aa46..340e59c44a9f 100644 --- a/extension-objects/pom.xml +++ b/extension-objects/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/facade/pom.xml b/facade/pom.xml index 1b9bcb86ad4a..c608bfe4654f 100644 --- a/facade/pom.xml +++ b/facade/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 facade diff --git a/factory-kit/pom.xml b/factory-kit/pom.xml index ac23757ec86d..9a4d9eae8b68 100644 --- a/factory-kit/pom.xml +++ b/factory-kit/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 factory-kit diff --git a/factory-method/pom.xml b/factory-method/pom.xml index 226c80958e1d..0a18f23a6c1e 100644 --- a/factory-method/pom.xml +++ b/factory-method/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 factory-method diff --git a/feature-toggle/pom.xml b/feature-toggle/pom.xml index bd0fb5d71ce5..a9589047a86b 100644 --- a/feature-toggle/pom.xml +++ b/feature-toggle/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/fluentinterface/pom.xml b/fluentinterface/pom.xml index 605537a73b8a..6276ee3836e1 100644 --- a/fluentinterface/pom.xml +++ b/fluentinterface/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/flux/pom.xml b/flux/pom.xml index 726df234a27a..9f9c367196f2 100644 --- a/flux/pom.xml +++ b/flux/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 flux diff --git a/flyweight/pom.xml b/flyweight/pom.xml index 5bb8f2254950..0cd16209f4b4 100644 --- a/flyweight/pom.xml +++ b/flyweight/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 flyweight diff --git a/front-controller/pom.xml b/front-controller/pom.xml index 27dc990d110a..395fe55c4acf 100644 --- a/front-controller/pom.xml +++ b/front-controller/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 front-controller diff --git a/guarded-suspension/pom.xml b/guarded-suspension/pom.xml index c944f8586951..3616ecfed7cd 100644 --- a/guarded-suspension/pom.xml +++ b/guarded-suspension/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 jar guarded-suspension diff --git a/half-sync-half-async/pom.xml b/half-sync-half-async/pom.xml index a532c619347e..f6f6b727a33f 100644 --- a/half-sync-half-async/pom.xml +++ b/half-sync-half-async/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 half-sync-half-async diff --git a/hexagonal/pom.xml b/hexagonal/pom.xml index a2c9f1925d51..d94f3ec4c3b3 100644 --- a/hexagonal/pom.xml +++ b/hexagonal/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 hexagonal diff --git a/intercepting-filter/pom.xml b/intercepting-filter/pom.xml index bf78e6792669..9b318c69cf27 100644 --- a/intercepting-filter/pom.xml +++ b/intercepting-filter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 intercepting-filter diff --git a/interpreter/pom.xml b/interpreter/pom.xml index 1274a4b69557..e0fb1df114ee 100644 --- a/interpreter/pom.xml +++ b/interpreter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 interpreter diff --git a/iterator/pom.xml b/iterator/pom.xml index fa06c9d3b0f0..88a626a9585e 100644 --- a/iterator/pom.xml +++ b/iterator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 iterator diff --git a/layers/pom.xml b/layers/pom.xml index cdd996ccb515..362109afb505 100644 --- a/layers/pom.xml +++ b/layers/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 com.iluwatar.layers layers diff --git a/lazy-loading/pom.xml b/lazy-loading/pom.xml index 773dd7d8bed6..e2ccf22bee3b 100644 --- a/lazy-loading/pom.xml +++ b/lazy-loading/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 lazy-loading diff --git a/marker/pom.xml b/marker/pom.xml index faa6868c237d..dabb13ece783 100644 --- a/marker/pom.xml +++ b/marker/pom.xml @@ -24,7 +24,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/master-worker-pattern/pom.xml b/master-worker-pattern/pom.xml index 1c317bac9446..fdc0d4e91b6c 100644 --- a/master-worker-pattern/pom.xml +++ b/master-worker-pattern/pom.xml @@ -27,7 +27,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 master-worker-pattern diff --git a/mediator/pom.xml b/mediator/pom.xml index d14e82bcc522..804f80ecee19 100644 --- a/mediator/pom.xml +++ b/mediator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 mediator diff --git a/memento/pom.xml b/memento/pom.xml index fc3e1954f76d..b48d66c4a080 100644 --- a/memento/pom.xml +++ b/memento/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 memento diff --git a/model-view-controller/pom.xml b/model-view-controller/pom.xml index 523319a28e50..8bd3b5a5386d 100644 --- a/model-view-controller/pom.xml +++ b/model-view-controller/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 model-view-controller diff --git a/model-view-presenter/pom.xml b/model-view-presenter/pom.xml index a4e91652820d..54616e2dbede 100644 --- a/model-view-presenter/pom.xml +++ b/model-view-presenter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 model-view-presenter model-view-presenter diff --git a/module/pom.xml b/module/pom.xml index 0320d97c0a8f..facf36cc813b 100644 --- a/module/pom.xml +++ b/module/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 module diff --git a/monad/pom.xml b/monad/pom.xml index 45741ee1b6e7..ed29eebe20bd 100644 --- a/monad/pom.xml +++ b/monad/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 monad diff --git a/monostate/pom.xml b/monostate/pom.xml index d39071e261ea..09a43f5bf06f 100644 --- a/monostate/pom.xml +++ b/monostate/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 monostate diff --git a/multiton/pom.xml b/multiton/pom.xml index beaccf3e3db8..8c3f1badbddc 100644 --- a/multiton/pom.xml +++ b/multiton/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 multiton diff --git a/mute-idiom/pom.xml b/mute-idiom/pom.xml index 7cdbc5a42e0a..7d91bbe17a67 100644 --- a/mute-idiom/pom.xml +++ b/mute-idiom/pom.xml @@ -21,7 +21,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 mute-idiom diff --git a/mutex/pom.xml b/mutex/pom.xml index 85c5208d83b1..37188c21318b 100644 --- a/mutex/pom.xml +++ b/mutex/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 mutex diff --git a/naked-objects/dom/pom.xml b/naked-objects/dom/pom.xml index 519e2cc0d883..c8029784e38e 100644 --- a/naked-objects/dom/pom.xml +++ b/naked-objects/dom/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.21.0-SNAPSHOT + 1.21.0 naked-objects-dom diff --git a/naked-objects/fixture/pom.xml b/naked-objects/fixture/pom.xml index cdb77b1b940e..c4d1f48bc4ee 100644 --- a/naked-objects/fixture/pom.xml +++ b/naked-objects/fixture/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.21.0-SNAPSHOT + 1.21.0 naked-objects-fixture diff --git a/naked-objects/integtests/pom.xml b/naked-objects/integtests/pom.xml index 460f2f5060cc..cfe74e43f01a 100644 --- a/naked-objects/integtests/pom.xml +++ b/naked-objects/integtests/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.21.0-SNAPSHOT + 1.21.0 naked-objects-integtests diff --git a/naked-objects/pom.xml b/naked-objects/pom.xml index 2a1832ea7e63..021374a6910d 100644 --- a/naked-objects/pom.xml +++ b/naked-objects/pom.xml @@ -15,7 +15,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 naked-objects @@ -350,17 +350,17 @@ ${project.groupId} naked-objects-dom - 1.21.0-SNAPSHOT + 1.21.0 ${project.groupId} naked-objects-fixture - 1.21.0-SNAPSHOT + 1.21.0 ${project.groupId} naked-objects-webapp - 1.21.0-SNAPSHOT + 1.21.0 diff --git a/naked-objects/webapp/pom.xml b/naked-objects/webapp/pom.xml index 54ccc40afae6..fff34db70edd 100644 --- a/naked-objects/webapp/pom.xml +++ b/naked-objects/webapp/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.21.0-SNAPSHOT + 1.21.0 naked-objects-webapp diff --git a/null-object/pom.xml b/null-object/pom.xml index 5c35e6a0a9e0..d5e1930c7ce2 100644 --- a/null-object/pom.xml +++ b/null-object/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 null-object diff --git a/object-mother/pom.xml b/object-mother/pom.xml index c0ed50739c74..1e9b61af1d9d 100644 --- a/object-mother/pom.xml +++ b/object-mother/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 object-mother diff --git a/object-pool/pom.xml b/object-pool/pom.xml index fcb95db29fea..a3eb20c743ba 100644 --- a/object-pool/pom.xml +++ b/object-pool/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 object-pool diff --git a/observer/pom.xml b/observer/pom.xml index 2248957c7179..0d1c18300798 100644 --- a/observer/pom.xml +++ b/observer/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 observer diff --git a/page-object/pom.xml b/page-object/pom.xml index ae239725dbe7..169b9512e17d 100644 --- a/page-object/pom.xml +++ b/page-object/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 page-object pom diff --git a/page-object/sample-application/pom.xml b/page-object/sample-application/pom.xml index d78e46b28a78..e18312e15fb2 100644 --- a/page-object/sample-application/pom.xml +++ b/page-object/sample-application/pom.xml @@ -29,7 +29,7 @@ page-object com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 sample-application diff --git a/page-object/test-automation/pom.xml b/page-object/test-automation/pom.xml index 7f8bcb12d0e9..dc5a17549b2c 100644 --- a/page-object/test-automation/pom.xml +++ b/page-object/test-automation/pom.xml @@ -29,7 +29,7 @@ page-object com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 test-automation diff --git a/partial-response/pom.xml b/partial-response/pom.xml index 04b760ca833e..1bc6a1b6ccee 100644 --- a/partial-response/pom.xml +++ b/partial-response/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/poison-pill/pom.xml b/poison-pill/pom.xml index eb68f4a108e6..f701473b33ee 100644 --- a/poison-pill/pom.xml +++ b/poison-pill/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 poison-pill diff --git a/pom.xml b/pom.xml index c55ed6492211..e4aeb5253457 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 4.0.0 com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 pom 2014 diff --git a/priority-queue/pom.xml b/priority-queue/pom.xml index 9e5a788066c3..3fb50b5746de 100644 --- a/priority-queue/pom.xml +++ b/priority-queue/pom.xml @@ -31,7 +31,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 diff --git a/private-class-data/pom.xml b/private-class-data/pom.xml index e01e81149459..fa2e4fc0d0a4 100644 --- a/private-class-data/pom.xml +++ b/private-class-data/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 private-class-data diff --git a/producer-consumer/pom.xml b/producer-consumer/pom.xml index 4355df70256c..c09b8e47aa35 100644 --- a/producer-consumer/pom.xml +++ b/producer-consumer/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 producer-consumer diff --git a/promise/pom.xml b/promise/pom.xml index 6c29939d5228..89ce50e997fc 100644 --- a/promise/pom.xml +++ b/promise/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 promise diff --git a/property/pom.xml b/property/pom.xml index dc0430fe3f97..68da0c2f52b2 100644 --- a/property/pom.xml +++ b/property/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 property diff --git a/prototype/pom.xml b/prototype/pom.xml index ef81d38ecc2a..ab5fa9373af7 100644 --- a/prototype/pom.xml +++ b/prototype/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 prototype diff --git a/proxy/pom.xml b/proxy/pom.xml index aef352a5d23a..98449c48f20f 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 proxy diff --git a/queue-load-leveling/pom.xml b/queue-load-leveling/pom.xml index 4b028e3565fe..0dcf4770e591 100644 --- a/queue-load-leveling/pom.xml +++ b/queue-load-leveling/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 queue-load-leveling diff --git a/reactor/pom.xml b/reactor/pom.xml index 6b561996d623..beebf7b83232 100644 --- a/reactor/pom.xml +++ b/reactor/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 reactor diff --git a/reader-writer-lock/pom.xml b/reader-writer-lock/pom.xml index 460e58baa287..f7154a525012 100644 --- a/reader-writer-lock/pom.xml +++ b/reader-writer-lock/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 reader-writer-lock diff --git a/repository/pom.xml b/repository/pom.xml index 36f73e344846..be05c82721ef 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 repository diff --git a/resource-acquisition-is-initialization/pom.xml b/resource-acquisition-is-initialization/pom.xml index 17985bdef53a..cd311e4e1a8f 100644 --- a/resource-acquisition-is-initialization/pom.xml +++ b/resource-acquisition-is-initialization/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 resource-acquisition-is-initialization diff --git a/retry/pom.xml b/retry/pom.xml index 931873491ddd..d4d906e49d7b 100644 --- a/retry/pom.xml +++ b/retry/pom.xml @@ -26,7 +26,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 retry jar diff --git a/semaphore/pom.xml b/semaphore/pom.xml index bebd9b802c56..49363925f2a5 100644 --- a/semaphore/pom.xml +++ b/semaphore/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 semaphore diff --git a/servant/pom.xml b/servant/pom.xml index e97b3a9895b2..60be0dd76903 100644 --- a/servant/pom.xml +++ b/servant/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 servant diff --git a/serverless/pom.xml b/serverless/pom.xml index 89048283a472..92b525b65e5c 100644 --- a/serverless/pom.xml +++ b/serverless/pom.xml @@ -26,7 +26,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 diff --git a/service-layer/pom.xml b/service-layer/pom.xml index 2bd114c55ca2..942cc851980e 100644 --- a/service-layer/pom.xml +++ b/service-layer/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 service-layer diff --git a/service-locator/pom.xml b/service-locator/pom.xml index fa6fcc4ba470..31f247ac5b26 100644 --- a/service-locator/pom.xml +++ b/service-locator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 service-locator diff --git a/singleton/pom.xml b/singleton/pom.xml index 038d6fdac040..a142faec0ebc 100644 --- a/singleton/pom.xml +++ b/singleton/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 singleton diff --git a/spatial-partition/pom.xml b/spatial-partition/pom.xml index 22eb7a6f68fb..d0227f227b7d 100644 --- a/spatial-partition/pom.xml +++ b/spatial-partition/pom.xml @@ -46,7 +46,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 spatial-partition diff --git a/specification/pom.xml b/specification/pom.xml index 8723651051e2..26cce77656e0 100644 --- a/specification/pom.xml +++ b/specification/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 specification diff --git a/state/pom.xml b/state/pom.xml index 9aeb4ec00cbd..a3499e5bf62e 100644 --- a/state/pom.xml +++ b/state/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 state diff --git a/step-builder/pom.xml b/step-builder/pom.xml index ca5ed709d711..d11312def4bc 100644 --- a/step-builder/pom.xml +++ b/step-builder/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 step-builder diff --git a/strategy/pom.xml b/strategy/pom.xml index a8dbbd007336..6d93322a1b54 100644 --- a/strategy/pom.xml +++ b/strategy/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 strategy diff --git a/template-method/pom.xml b/template-method/pom.xml index 1345eaa6ca86..915e48f2f4a5 100644 --- a/template-method/pom.xml +++ b/template-method/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 template-method diff --git a/thread-pool/pom.xml b/thread-pool/pom.xml index a77230bf2130..7d9263312817 100644 --- a/thread-pool/pom.xml +++ b/thread-pool/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 thread-pool diff --git a/throttling/pom.xml b/throttling/pom.xml index d477af53f5aa..518b610e0de9 100644 --- a/throttling/pom.xml +++ b/throttling/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/tls/pom.xml b/tls/pom.xml index d3ccbfc2b79a..81c53be5dd02 100644 --- a/tls/pom.xml +++ b/tls/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 tls diff --git a/tolerant-reader/pom.xml b/tolerant-reader/pom.xml index 51554d7dce28..1ccd55ca4429 100644 --- a/tolerant-reader/pom.xml +++ b/tolerant-reader/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 tolerant-reader diff --git a/trampoline/pom.xml b/trampoline/pom.xml index 338dc101604b..f7a95a54b128 100644 --- a/trampoline/pom.xml +++ b/trampoline/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 trampoline diff --git a/twin/pom.xml b/twin/pom.xml index 74e81ec0df44..fae948958aca 100644 --- a/twin/pom.xml +++ b/twin/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 twin diff --git a/typeobjectpattern/pom.xml b/typeobjectpattern/pom.xml index 4e66263fefb7..a1546de05e2f 100644 --- a/typeobjectpattern/pom.xml +++ b/typeobjectpattern/pom.xml @@ -27,7 +27,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 typeobjectpattern diff --git a/unit-of-work/pom.xml b/unit-of-work/pom.xml index b53075f21e8a..5fb8e9796838 100644 --- a/unit-of-work/pom.xml +++ b/unit-of-work/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0-SNAPSHOT + 1.21.0 4.0.0 diff --git a/value-object/pom.xml b/value-object/pom.xml index 2b951d2a3135..3f31c8461e5d 100644 --- a/value-object/pom.xml +++ b/value-object/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 value-object diff --git a/visitor/pom.xml b/visitor/pom.xml index 618b547ea553..f159a28c0551 100644 --- a/visitor/pom.xml +++ b/visitor/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0-SNAPSHOT + 1.21.0 visitor From b874adc29693de254ce47759f543ee4eec19c19b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sun, 8 Sep 2019 11:01:12 +0300 Subject: [PATCH 026/197] Set version for next development iteration --- abstract-document/pom.xml | 2 +- abstract-factory/pom.xml | 2 +- acyclic-visitor/pom.xml | 2 +- adapter/pom.xml | 2 +- aggregator-microservices/aggregator-service/pom.xml | 2 +- aggregator-microservices/information-microservice/pom.xml | 2 +- aggregator-microservices/inventory-microservice/pom.xml | 2 +- aggregator-microservices/pom.xml | 2 +- ambassador/pom.xml | 2 +- api-gateway/api-gateway-service/pom.xml | 2 +- api-gateway/image-microservice/pom.xml | 2 +- api-gateway/pom.xml | 2 +- api-gateway/price-microservice/pom.xml | 2 +- async-method-invocation/pom.xml | 2 +- balking/pom.xml | 2 +- bridge/pom.xml | 2 +- builder/pom.xml | 2 +- business-delegate/pom.xml | 2 +- bytecode/pom.xml | 2 +- caching/pom.xml | 2 +- callback/pom.xml | 2 +- chain/pom.xml | 2 +- collection-pipeline/pom.xml | 2 +- command/pom.xml | 2 +- commander/pom.xml | 2 +- composite/pom.xml | 2 +- converter/pom.xml | 2 +- cqrs/pom.xml | 2 +- dao/pom.xml | 2 +- data-bus/pom.xml | 2 +- data-mapper/pom.xml | 2 +- data-transfer-object/pom.xml | 2 +- decorator/pom.xml | 2 +- delegation/pom.xml | 2 +- dependency-injection/pom.xml | 2 +- dirty-flag/pom.xml | 4 ++-- double-checked-locking/pom.xml | 2 +- double-dispatch/pom.xml | 2 +- eip-aggregator/pom.xml | 2 +- eip-message-channel/pom.xml | 2 +- eip-publish-subscribe/pom.xml | 2 +- eip-splitter/pom.xml | 2 +- eip-wire-tap/pom.xml | 2 +- event-aggregator/pom.xml | 2 +- event-asynchronous/pom.xml | 2 +- event-driven-architecture/pom.xml | 2 +- event-queue/pom.xml | 2 +- event-sourcing/pom.xml | 2 +- execute-around/pom.xml | 2 +- extension-objects/pom.xml | 2 +- facade/pom.xml | 2 +- factory-kit/pom.xml | 2 +- factory-method/pom.xml | 2 +- feature-toggle/pom.xml | 2 +- fluentinterface/pom.xml | 2 +- flux/pom.xml | 2 +- flyweight/pom.xml | 2 +- front-controller/pom.xml | 2 +- guarded-suspension/pom.xml | 2 +- half-sync-half-async/pom.xml | 2 +- hexagonal/pom.xml | 2 +- intercepting-filter/pom.xml | 2 +- interpreter/pom.xml | 2 +- iterator/pom.xml | 2 +- layers/pom.xml | 2 +- lazy-loading/pom.xml | 2 +- marker/pom.xml | 2 +- master-worker-pattern/pom.xml | 2 +- mediator/pom.xml | 2 +- memento/pom.xml | 2 +- model-view-controller/pom.xml | 2 +- model-view-presenter/pom.xml | 2 +- module/pom.xml | 2 +- monad/pom.xml | 2 +- monostate/pom.xml | 2 +- multiton/pom.xml | 2 +- mute-idiom/pom.xml | 2 +- mutex/pom.xml | 2 +- naked-objects/dom/pom.xml | 2 +- naked-objects/fixture/pom.xml | 2 +- naked-objects/integtests/pom.xml | 2 +- naked-objects/pom.xml | 8 ++++---- naked-objects/webapp/pom.xml | 2 +- null-object/pom.xml | 2 +- object-mother/pom.xml | 2 +- object-pool/pom.xml | 2 +- observer/pom.xml | 2 +- page-object/pom.xml | 2 +- page-object/sample-application/pom.xml | 2 +- page-object/test-automation/pom.xml | 2 +- partial-response/pom.xml | 2 +- poison-pill/pom.xml | 2 +- pom.xml | 2 +- priority-queue/pom.xml | 2 +- private-class-data/pom.xml | 2 +- producer-consumer/pom.xml | 2 +- promise/pom.xml | 2 +- property/pom.xml | 2 +- prototype/pom.xml | 2 +- proxy/pom.xml | 2 +- queue-load-leveling/pom.xml | 2 +- reactor/pom.xml | 2 +- reader-writer-lock/pom.xml | 2 +- repository/pom.xml | 2 +- resource-acquisition-is-initialization/pom.xml | 2 +- retry/pom.xml | 2 +- semaphore/pom.xml | 2 +- servant/pom.xml | 2 +- serverless/pom.xml | 2 +- service-layer/pom.xml | 2 +- service-locator/pom.xml | 2 +- singleton/pom.xml | 2 +- spatial-partition/pom.xml | 2 +- specification/pom.xml | 2 +- state/pom.xml | 2 +- step-builder/pom.xml | 2 +- strategy/pom.xml | 2 +- template-method/pom.xml | 2 +- thread-pool/pom.xml | 2 +- throttling/pom.xml | 2 +- tls/pom.xml | 2 +- tolerant-reader/pom.xml | 2 +- trampoline/pom.xml | 2 +- twin/pom.xml | 2 +- typeobjectpattern/pom.xml | 2 +- unit-of-work/pom.xml | 2 +- value-object/pom.xml | 2 +- visitor/pom.xml | 2 +- 128 files changed, 132 insertions(+), 132 deletions(-) diff --git a/abstract-document/pom.xml b/abstract-document/pom.xml index 452ac6319b15..c3f783184d33 100644 --- a/abstract-document/pom.xml +++ b/abstract-document/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT abstract-document diff --git a/abstract-factory/pom.xml b/abstract-factory/pom.xml index d0a6a4330466..402297ed9866 100644 --- a/abstract-factory/pom.xml +++ b/abstract-factory/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT abstract-factory diff --git a/acyclic-visitor/pom.xml b/acyclic-visitor/pom.xml index 9d091750ff5c..a1f2bbf54f97 100644 --- a/acyclic-visitor/pom.xml +++ b/acyclic-visitor/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT acyclic-visitor diff --git a/adapter/pom.xml b/adapter/pom.xml index 5d0940b94261..c50050037fd7 100644 --- a/adapter/pom.xml +++ b/adapter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT adapter diff --git a/aggregator-microservices/aggregator-service/pom.xml b/aggregator-microservices/aggregator-service/pom.xml index 5a23ad063480..dbe303809f9b 100644 --- a/aggregator-microservices/aggregator-service/pom.xml +++ b/aggregator-microservices/aggregator-service/pom.xml @@ -29,7 +29,7 @@ aggregator-microservices com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/aggregator-microservices/information-microservice/pom.xml b/aggregator-microservices/information-microservice/pom.xml index dd29d683057a..b15af35e4b82 100644 --- a/aggregator-microservices/information-microservice/pom.xml +++ b/aggregator-microservices/information-microservice/pom.xml @@ -29,7 +29,7 @@ aggregator-microservices com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/aggregator-microservices/inventory-microservice/pom.xml b/aggregator-microservices/inventory-microservice/pom.xml index 66943eb8d701..1791ee72c9e8 100644 --- a/aggregator-microservices/inventory-microservice/pom.xml +++ b/aggregator-microservices/inventory-microservice/pom.xml @@ -29,7 +29,7 @@ aggregator-microservices com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/aggregator-microservices/pom.xml b/aggregator-microservices/pom.xml index 98caca2070ff..3bd1832499da 100644 --- a/aggregator-microservices/pom.xml +++ b/aggregator-microservices/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 aggregator-microservices diff --git a/ambassador/pom.xml b/ambassador/pom.xml index ee04afc0af89..2c2cf2c1c3c0 100644 --- a/ambassador/pom.xml +++ b/ambassador/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 ambassador diff --git a/api-gateway/api-gateway-service/pom.xml b/api-gateway/api-gateway-service/pom.xml index bf96a660994a..82aa6aedef80 100644 --- a/api-gateway/api-gateway-service/pom.xml +++ b/api-gateway/api-gateway-service/pom.xml @@ -29,7 +29,7 @@ api-gateway com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 api-gateway-service diff --git a/api-gateway/image-microservice/pom.xml b/api-gateway/image-microservice/pom.xml index 7ac0b9c90246..c4367cdd8f45 100644 --- a/api-gateway/image-microservice/pom.xml +++ b/api-gateway/image-microservice/pom.xml @@ -29,7 +29,7 @@ api-gateway com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/api-gateway/pom.xml b/api-gateway/pom.xml index 7d5adf478468..69437e7c72ac 100644 --- a/api-gateway/pom.xml +++ b/api-gateway/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 api-gateway diff --git a/api-gateway/price-microservice/pom.xml b/api-gateway/price-microservice/pom.xml index c3668a7f9558..89aaba7ae7d4 100644 --- a/api-gateway/price-microservice/pom.xml +++ b/api-gateway/price-microservice/pom.xml @@ -29,7 +29,7 @@ api-gateway com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/async-method-invocation/pom.xml b/async-method-invocation/pom.xml index 2bfbed289035..c6764f61cad0 100644 --- a/async-method-invocation/pom.xml +++ b/async-method-invocation/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT async-method-invocation diff --git a/balking/pom.xml b/balking/pom.xml index a6e02fac8c29..5da1ea43c71f 100644 --- a/balking/pom.xml +++ b/balking/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/bridge/pom.xml b/bridge/pom.xml index a6082e24f3fa..2480b06cffad 100644 --- a/bridge/pom.xml +++ b/bridge/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT bridge diff --git a/builder/pom.xml b/builder/pom.xml index 2f094dbfb33a..0ae5bf1e8368 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT builder diff --git a/business-delegate/pom.xml b/business-delegate/pom.xml index c1abe317e18d..efe9e714586e 100644 --- a/business-delegate/pom.xml +++ b/business-delegate/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT business-delegate diff --git a/bytecode/pom.xml b/bytecode/pom.xml index 3e6fd5ca656c..75b5a8c139aa 100644 --- a/bytecode/pom.xml +++ b/bytecode/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/caching/pom.xml b/caching/pom.xml index b18d250b8ccd..76578b8830cc 100644 --- a/caching/pom.xml +++ b/caching/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT caching diff --git a/callback/pom.xml b/callback/pom.xml index 04ab9c6fad5b..8b74bcc9e8f9 100644 --- a/callback/pom.xml +++ b/callback/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT callback diff --git a/chain/pom.xml b/chain/pom.xml index f992cf7871d0..443e8aee42b2 100644 --- a/chain/pom.xml +++ b/chain/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT chain diff --git a/collection-pipeline/pom.xml b/collection-pipeline/pom.xml index 3390f41dbf39..9af2bd42ea73 100644 --- a/collection-pipeline/pom.xml +++ b/collection-pipeline/pom.xml @@ -27,7 +27,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT collection-pipeline diff --git a/command/pom.xml b/command/pom.xml index c0eee39bffa7..dc4f5edb92a0 100644 --- a/command/pom.xml +++ b/command/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT command diff --git a/commander/pom.xml b/commander/pom.xml index baeee42fd564..68ff374203b7 100644 --- a/commander/pom.xml +++ b/commander/pom.xml @@ -3,7 +3,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT commander diff --git a/composite/pom.xml b/composite/pom.xml index 4698ed1419b7..327e497d757b 100644 --- a/composite/pom.xml +++ b/composite/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT composite diff --git a/converter/pom.xml b/converter/pom.xml index 412d2509f741..ac1b88032fde 100644 --- a/converter/pom.xml +++ b/converter/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/cqrs/pom.xml b/cqrs/pom.xml index aeec001b0e28..beb195473ced 100644 --- a/cqrs/pom.xml +++ b/cqrs/pom.xml @@ -21,7 +21,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT cqrs diff --git a/dao/pom.xml b/dao/pom.xml index 743bfc429641..911ac6b05d1f 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT dao diff --git a/data-bus/pom.xml b/data-bus/pom.xml index 20d9f817bc6b..e5a2946951aa 100644 --- a/data-bus/pom.xml +++ b/data-bus/pom.xml @@ -33,7 +33,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT data-bus diff --git a/data-mapper/pom.xml b/data-mapper/pom.xml index ca48e87ad49f..baf8add13888 100644 --- a/data-mapper/pom.xml +++ b/data-mapper/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT data-mapper diff --git a/data-transfer-object/pom.xml b/data-transfer-object/pom.xml index e7b0a5ddc734..294f7cbbeebb 100644 --- a/data-transfer-object/pom.xml +++ b/data-transfer-object/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT data-transfer-object diff --git a/decorator/pom.xml b/decorator/pom.xml index f80026ff9209..71c64b331f99 100644 --- a/decorator/pom.xml +++ b/decorator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT decorator diff --git a/delegation/pom.xml b/delegation/pom.xml index 55fb8a14703e..89b0b7b4459e 100644 --- a/delegation/pom.xml +++ b/delegation/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/dependency-injection/pom.xml b/dependency-injection/pom.xml index 1dd72abcc33f..2347cb14f946 100644 --- a/dependency-injection/pom.xml +++ b/dependency-injection/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT dependency-injection diff --git a/dirty-flag/pom.xml b/dirty-flag/pom.xml index caaa58795935..31f7edd71284 100644 --- a/dirty-flag/pom.xml +++ b/dirty-flag/pom.xml @@ -29,11 +29,11 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT com.iluwatar dirty-flag - 1.21.0 + 1.22.0-SNAPSHOT dirty-flag http://maven.apache.org diff --git a/double-checked-locking/pom.xml b/double-checked-locking/pom.xml index 9d3ac69af8ac..4db5d6fe63bd 100644 --- a/double-checked-locking/pom.xml +++ b/double-checked-locking/pom.xml @@ -27,7 +27,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT double-checked-locking diff --git a/double-dispatch/pom.xml b/double-dispatch/pom.xml index 11f66b11455b..6b6c9064c939 100644 --- a/double-dispatch/pom.xml +++ b/double-dispatch/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT double-dispatch diff --git a/eip-aggregator/pom.xml b/eip-aggregator/pom.xml index 3f1e930c2f2c..f56ae78deb73 100644 --- a/eip-aggregator/pom.xml +++ b/eip-aggregator/pom.xml @@ -26,7 +26,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT diff --git a/eip-message-channel/pom.xml b/eip-message-channel/pom.xml index e0927ef5aa03..9d91b7ead49d 100644 --- a/eip-message-channel/pom.xml +++ b/eip-message-channel/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT eip-message-channel diff --git a/eip-publish-subscribe/pom.xml b/eip-publish-subscribe/pom.xml index 4d8711a563c3..50c29e300162 100644 --- a/eip-publish-subscribe/pom.xml +++ b/eip-publish-subscribe/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT eip-publish-subscribe diff --git a/eip-splitter/pom.xml b/eip-splitter/pom.xml index d5aab1ed29f6..2bc3eec8402b 100644 --- a/eip-splitter/pom.xml +++ b/eip-splitter/pom.xml @@ -26,7 +26,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT diff --git a/eip-wire-tap/pom.xml b/eip-wire-tap/pom.xml index a2b3aee8f556..efca8d3c4cfb 100644 --- a/eip-wire-tap/pom.xml +++ b/eip-wire-tap/pom.xml @@ -26,7 +26,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT diff --git a/event-aggregator/pom.xml b/event-aggregator/pom.xml index 4ede7e366d80..2e9f4d9a97fb 100644 --- a/event-aggregator/pom.xml +++ b/event-aggregator/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT event-aggregator diff --git a/event-asynchronous/pom.xml b/event-asynchronous/pom.xml index 647296d0d629..5efa0252fba9 100644 --- a/event-asynchronous/pom.xml +++ b/event-asynchronous/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT event-asynchronous diff --git a/event-driven-architecture/pom.xml b/event-driven-architecture/pom.xml index dc846f241173..778949862727 100644 --- a/event-driven-architecture/pom.xml +++ b/event-driven-architecture/pom.xml @@ -31,7 +31,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT event-driven-architecture diff --git a/event-queue/pom.xml b/event-queue/pom.xml index 2d341e7eb67b..dd08a6ae7337 100644 --- a/event-queue/pom.xml +++ b/event-queue/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT event-queue diff --git a/event-sourcing/pom.xml b/event-sourcing/pom.xml index 8242cb502505..c97921a1c731 100644 --- a/event-sourcing/pom.xml +++ b/event-sourcing/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT event-sourcing diff --git a/execute-around/pom.xml b/execute-around/pom.xml index 50b5672d4a81..ac56665fd9f5 100644 --- a/execute-around/pom.xml +++ b/execute-around/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT execute-around diff --git a/extension-objects/pom.xml b/extension-objects/pom.xml index 340e59c44a9f..37322cc011db 100644 --- a/extension-objects/pom.xml +++ b/extension-objects/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/facade/pom.xml b/facade/pom.xml index c608bfe4654f..4a8b3e412c7b 100644 --- a/facade/pom.xml +++ b/facade/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT facade diff --git a/factory-kit/pom.xml b/factory-kit/pom.xml index 9a4d9eae8b68..54554a35447a 100644 --- a/factory-kit/pom.xml +++ b/factory-kit/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT factory-kit diff --git a/factory-method/pom.xml b/factory-method/pom.xml index 0a18f23a6c1e..cc4d21d1a4c8 100644 --- a/factory-method/pom.xml +++ b/factory-method/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT factory-method diff --git a/feature-toggle/pom.xml b/feature-toggle/pom.xml index a9589047a86b..75da6ec9c0f9 100644 --- a/feature-toggle/pom.xml +++ b/feature-toggle/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/fluentinterface/pom.xml b/fluentinterface/pom.xml index 6276ee3836e1..23fc5d806866 100644 --- a/fluentinterface/pom.xml +++ b/fluentinterface/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/flux/pom.xml b/flux/pom.xml index 9f9c367196f2..424aaffd2bc2 100644 --- a/flux/pom.xml +++ b/flux/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT flux diff --git a/flyweight/pom.xml b/flyweight/pom.xml index 0cd16209f4b4..43b9d3ade3e6 100644 --- a/flyweight/pom.xml +++ b/flyweight/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT flyweight diff --git a/front-controller/pom.xml b/front-controller/pom.xml index 395fe55c4acf..d7c2da36ea51 100644 --- a/front-controller/pom.xml +++ b/front-controller/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT front-controller diff --git a/guarded-suspension/pom.xml b/guarded-suspension/pom.xml index 3616ecfed7cd..e802eb4bd94a 100644 --- a/guarded-suspension/pom.xml +++ b/guarded-suspension/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT jar guarded-suspension diff --git a/half-sync-half-async/pom.xml b/half-sync-half-async/pom.xml index f6f6b727a33f..d965298ca364 100644 --- a/half-sync-half-async/pom.xml +++ b/half-sync-half-async/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT half-sync-half-async diff --git a/hexagonal/pom.xml b/hexagonal/pom.xml index d94f3ec4c3b3..4f56a1020116 100644 --- a/hexagonal/pom.xml +++ b/hexagonal/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT hexagonal diff --git a/intercepting-filter/pom.xml b/intercepting-filter/pom.xml index 9b318c69cf27..c4183c7d0742 100644 --- a/intercepting-filter/pom.xml +++ b/intercepting-filter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT intercepting-filter diff --git a/interpreter/pom.xml b/interpreter/pom.xml index e0fb1df114ee..aa834b2edbb5 100644 --- a/interpreter/pom.xml +++ b/interpreter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT interpreter diff --git a/iterator/pom.xml b/iterator/pom.xml index 88a626a9585e..6eafcb92cb48 100644 --- a/iterator/pom.xml +++ b/iterator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT iterator diff --git a/layers/pom.xml b/layers/pom.xml index 362109afb505..8237c8f4f6e0 100644 --- a/layers/pom.xml +++ b/layers/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT com.iluwatar.layers layers diff --git a/lazy-loading/pom.xml b/lazy-loading/pom.xml index e2ccf22bee3b..d5dacc7ce041 100644 --- a/lazy-loading/pom.xml +++ b/lazy-loading/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT lazy-loading diff --git a/marker/pom.xml b/marker/pom.xml index dabb13ece783..afa82f4db4bf 100644 --- a/marker/pom.xml +++ b/marker/pom.xml @@ -24,7 +24,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/master-worker-pattern/pom.xml b/master-worker-pattern/pom.xml index fdc0d4e91b6c..be512fdef041 100644 --- a/master-worker-pattern/pom.xml +++ b/master-worker-pattern/pom.xml @@ -27,7 +27,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT master-worker-pattern diff --git a/mediator/pom.xml b/mediator/pom.xml index 804f80ecee19..14aadac8dd9b 100644 --- a/mediator/pom.xml +++ b/mediator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT mediator diff --git a/memento/pom.xml b/memento/pom.xml index b48d66c4a080..7eadc5839483 100644 --- a/memento/pom.xml +++ b/memento/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT memento diff --git a/model-view-controller/pom.xml b/model-view-controller/pom.xml index 8bd3b5a5386d..64cb39f47f6e 100644 --- a/model-view-controller/pom.xml +++ b/model-view-controller/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT model-view-controller diff --git a/model-view-presenter/pom.xml b/model-view-presenter/pom.xml index 54616e2dbede..2be7b30ca848 100644 --- a/model-view-presenter/pom.xml +++ b/model-view-presenter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT model-view-presenter model-view-presenter diff --git a/module/pom.xml b/module/pom.xml index facf36cc813b..df8c1494214d 100644 --- a/module/pom.xml +++ b/module/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT module diff --git a/monad/pom.xml b/monad/pom.xml index ed29eebe20bd..d9a436a6b569 100644 --- a/monad/pom.xml +++ b/monad/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT monad diff --git a/monostate/pom.xml b/monostate/pom.xml index 09a43f5bf06f..018e352483a4 100644 --- a/monostate/pom.xml +++ b/monostate/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT monostate diff --git a/multiton/pom.xml b/multiton/pom.xml index 8c3f1badbddc..df26fe204470 100644 --- a/multiton/pom.xml +++ b/multiton/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT multiton diff --git a/mute-idiom/pom.xml b/mute-idiom/pom.xml index 7d91bbe17a67..271e5265836c 100644 --- a/mute-idiom/pom.xml +++ b/mute-idiom/pom.xml @@ -21,7 +21,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT mute-idiom diff --git a/mutex/pom.xml b/mutex/pom.xml index 37188c21318b..2075fb4a2462 100644 --- a/mutex/pom.xml +++ b/mutex/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT mutex diff --git a/naked-objects/dom/pom.xml b/naked-objects/dom/pom.xml index c8029784e38e..69365bd4b00a 100644 --- a/naked-objects/dom/pom.xml +++ b/naked-objects/dom/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.21.0 + 1.22.0-SNAPSHOT naked-objects-dom diff --git a/naked-objects/fixture/pom.xml b/naked-objects/fixture/pom.xml index c4d1f48bc4ee..6426eb1d6473 100644 --- a/naked-objects/fixture/pom.xml +++ b/naked-objects/fixture/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.21.0 + 1.22.0-SNAPSHOT naked-objects-fixture diff --git a/naked-objects/integtests/pom.xml b/naked-objects/integtests/pom.xml index cfe74e43f01a..c4dd52dcf652 100644 --- a/naked-objects/integtests/pom.xml +++ b/naked-objects/integtests/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.21.0 + 1.22.0-SNAPSHOT naked-objects-integtests diff --git a/naked-objects/pom.xml b/naked-objects/pom.xml index 021374a6910d..8c21504bb6f5 100644 --- a/naked-objects/pom.xml +++ b/naked-objects/pom.xml @@ -15,7 +15,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT naked-objects @@ -350,17 +350,17 @@ ${project.groupId} naked-objects-dom - 1.21.0 + 1.22.0-SNAPSHOT ${project.groupId} naked-objects-fixture - 1.21.0 + 1.22.0-SNAPSHOT ${project.groupId} naked-objects-webapp - 1.21.0 + 1.22.0-SNAPSHOT diff --git a/naked-objects/webapp/pom.xml b/naked-objects/webapp/pom.xml index fff34db70edd..e3b8d122aba0 100644 --- a/naked-objects/webapp/pom.xml +++ b/naked-objects/webapp/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.21.0 + 1.22.0-SNAPSHOT naked-objects-webapp diff --git a/null-object/pom.xml b/null-object/pom.xml index d5e1930c7ce2..f477b861c6d7 100644 --- a/null-object/pom.xml +++ b/null-object/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT null-object diff --git a/object-mother/pom.xml b/object-mother/pom.xml index 1e9b61af1d9d..431d4d3b9dfb 100644 --- a/object-mother/pom.xml +++ b/object-mother/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT object-mother diff --git a/object-pool/pom.xml b/object-pool/pom.xml index a3eb20c743ba..a9a0fd044db1 100644 --- a/object-pool/pom.xml +++ b/object-pool/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT object-pool diff --git a/observer/pom.xml b/observer/pom.xml index 0d1c18300798..dbe40f22f8ad 100644 --- a/observer/pom.xml +++ b/observer/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT observer diff --git a/page-object/pom.xml b/page-object/pom.xml index 169b9512e17d..93bf25fc9a2e 100644 --- a/page-object/pom.xml +++ b/page-object/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT page-object pom diff --git a/page-object/sample-application/pom.xml b/page-object/sample-application/pom.xml index e18312e15fb2..44bc18a8c6b5 100644 --- a/page-object/sample-application/pom.xml +++ b/page-object/sample-application/pom.xml @@ -29,7 +29,7 @@ page-object com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT sample-application diff --git a/page-object/test-automation/pom.xml b/page-object/test-automation/pom.xml index dc5a17549b2c..f657a8dab0b6 100644 --- a/page-object/test-automation/pom.xml +++ b/page-object/test-automation/pom.xml @@ -29,7 +29,7 @@ page-object com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT test-automation diff --git a/partial-response/pom.xml b/partial-response/pom.xml index 1bc6a1b6ccee..db70ffd1c883 100644 --- a/partial-response/pom.xml +++ b/partial-response/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/poison-pill/pom.xml b/poison-pill/pom.xml index f701473b33ee..16ee086c7088 100644 --- a/poison-pill/pom.xml +++ b/poison-pill/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT poison-pill diff --git a/pom.xml b/pom.xml index e4aeb5253457..cb5dbbd1c343 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 4.0.0 com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT pom 2014 diff --git a/priority-queue/pom.xml b/priority-queue/pom.xml index 3fb50b5746de..aaf172ef3953 100644 --- a/priority-queue/pom.xml +++ b/priority-queue/pom.xml @@ -31,7 +31,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT diff --git a/private-class-data/pom.xml b/private-class-data/pom.xml index fa2e4fc0d0a4..d3ea624a46b5 100644 --- a/private-class-data/pom.xml +++ b/private-class-data/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT private-class-data diff --git a/producer-consumer/pom.xml b/producer-consumer/pom.xml index c09b8e47aa35..20cc0a1929e4 100644 --- a/producer-consumer/pom.xml +++ b/producer-consumer/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT producer-consumer diff --git a/promise/pom.xml b/promise/pom.xml index 89ce50e997fc..8e7e92ddfccb 100644 --- a/promise/pom.xml +++ b/promise/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT promise diff --git a/property/pom.xml b/property/pom.xml index 68da0c2f52b2..d17aff7056ee 100644 --- a/property/pom.xml +++ b/property/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT property diff --git a/prototype/pom.xml b/prototype/pom.xml index ab5fa9373af7..12416f41d54f 100644 --- a/prototype/pom.xml +++ b/prototype/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT prototype diff --git a/proxy/pom.xml b/proxy/pom.xml index 98449c48f20f..e6b3ec76f7c4 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT proxy diff --git a/queue-load-leveling/pom.xml b/queue-load-leveling/pom.xml index 0dcf4770e591..bba4c44df34d 100644 --- a/queue-load-leveling/pom.xml +++ b/queue-load-leveling/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT queue-load-leveling diff --git a/reactor/pom.xml b/reactor/pom.xml index beebf7b83232..ff28b19ad090 100644 --- a/reactor/pom.xml +++ b/reactor/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT reactor diff --git a/reader-writer-lock/pom.xml b/reader-writer-lock/pom.xml index f7154a525012..4a69cdb0c196 100644 --- a/reader-writer-lock/pom.xml +++ b/reader-writer-lock/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT reader-writer-lock diff --git a/repository/pom.xml b/repository/pom.xml index be05c82721ef..48bca0cf2ba8 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT repository diff --git a/resource-acquisition-is-initialization/pom.xml b/resource-acquisition-is-initialization/pom.xml index cd311e4e1a8f..fc91d5c04c26 100644 --- a/resource-acquisition-is-initialization/pom.xml +++ b/resource-acquisition-is-initialization/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT resource-acquisition-is-initialization diff --git a/retry/pom.xml b/retry/pom.xml index d4d906e49d7b..5d054183f1c7 100644 --- a/retry/pom.xml +++ b/retry/pom.xml @@ -26,7 +26,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT retry jar diff --git a/semaphore/pom.xml b/semaphore/pom.xml index 49363925f2a5..3761e5e49a8f 100644 --- a/semaphore/pom.xml +++ b/semaphore/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT semaphore diff --git a/servant/pom.xml b/servant/pom.xml index 60be0dd76903..1ee17aa9c919 100644 --- a/servant/pom.xml +++ b/servant/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT servant diff --git a/serverless/pom.xml b/serverless/pom.xml index 92b525b65e5c..6156b41afd0e 100644 --- a/serverless/pom.xml +++ b/serverless/pom.xml @@ -26,7 +26,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT diff --git a/service-layer/pom.xml b/service-layer/pom.xml index 942cc851980e..403a896a4613 100644 --- a/service-layer/pom.xml +++ b/service-layer/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT service-layer diff --git a/service-locator/pom.xml b/service-locator/pom.xml index 31f247ac5b26..948997f7aa8d 100644 --- a/service-locator/pom.xml +++ b/service-locator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT service-locator diff --git a/singleton/pom.xml b/singleton/pom.xml index a142faec0ebc..e518665d3ad8 100644 --- a/singleton/pom.xml +++ b/singleton/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT singleton diff --git a/spatial-partition/pom.xml b/spatial-partition/pom.xml index d0227f227b7d..0ad20721166a 100644 --- a/spatial-partition/pom.xml +++ b/spatial-partition/pom.xml @@ -46,7 +46,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT spatial-partition diff --git a/specification/pom.xml b/specification/pom.xml index 26cce77656e0..38adf9b6fc8b 100644 --- a/specification/pom.xml +++ b/specification/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT specification diff --git a/state/pom.xml b/state/pom.xml index a3499e5bf62e..f90da878680a 100644 --- a/state/pom.xml +++ b/state/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT state diff --git a/step-builder/pom.xml b/step-builder/pom.xml index d11312def4bc..6021ecb2af39 100644 --- a/step-builder/pom.xml +++ b/step-builder/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT step-builder diff --git a/strategy/pom.xml b/strategy/pom.xml index 6d93322a1b54..c421436f5f81 100644 --- a/strategy/pom.xml +++ b/strategy/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT strategy diff --git a/template-method/pom.xml b/template-method/pom.xml index 915e48f2f4a5..e1f24ae251db 100644 --- a/template-method/pom.xml +++ b/template-method/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT template-method diff --git a/thread-pool/pom.xml b/thread-pool/pom.xml index 7d9263312817..f05f6c2190e7 100644 --- a/thread-pool/pom.xml +++ b/thread-pool/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT thread-pool diff --git a/throttling/pom.xml b/throttling/pom.xml index 518b610e0de9..e21d8b3c1232 100644 --- a/throttling/pom.xml +++ b/throttling/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/tls/pom.xml b/tls/pom.xml index 81c53be5dd02..596ebd37310d 100644 --- a/tls/pom.xml +++ b/tls/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT tls diff --git a/tolerant-reader/pom.xml b/tolerant-reader/pom.xml index 1ccd55ca4429..abf786059fa2 100644 --- a/tolerant-reader/pom.xml +++ b/tolerant-reader/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT tolerant-reader diff --git a/trampoline/pom.xml b/trampoline/pom.xml index f7a95a54b128..e6f2e620afac 100644 --- a/trampoline/pom.xml +++ b/trampoline/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT trampoline diff --git a/twin/pom.xml b/twin/pom.xml index fae948958aca..15b4f6c1159f 100644 --- a/twin/pom.xml +++ b/twin/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT twin diff --git a/typeobjectpattern/pom.xml b/typeobjectpattern/pom.xml index a1546de05e2f..f07460f49c54 100644 --- a/typeobjectpattern/pom.xml +++ b/typeobjectpattern/pom.xml @@ -27,7 +27,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT typeobjectpattern diff --git a/unit-of-work/pom.xml b/unit-of-work/pom.xml index 5fb8e9796838..fc11432e2923 100644 --- a/unit-of-work/pom.xml +++ b/unit-of-work/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.21.0 + 1.22.0-SNAPSHOT 4.0.0 diff --git a/value-object/pom.xml b/value-object/pom.xml index 3f31c8461e5d..669ea521e470 100644 --- a/value-object/pom.xml +++ b/value-object/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT value-object diff --git a/visitor/pom.xml b/visitor/pom.xml index f159a28c0551..5fbc84142675 100644 --- a/visitor/pom.xml +++ b/visitor/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.21.0 + 1.22.0-SNAPSHOT visitor From 019abc9980b9855bf04086c44b68f3282119c6b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Tue, 10 Sep 2019 20:26:18 +0300 Subject: [PATCH 027/197] Add license headers --- .sonarcloud.properties | 23 +++++++++++++++++++++++ commander/pom.xml | 24 ++++++++++++++++++++++++ commander/properties/log4j.properties | 23 +++++++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 7a93b07aa76d..1bd690065c42 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2014 Ilkka Seppälä +# +# 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 NONINFRINGEMENT. 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. +# + # Path to sources #sonar.sources=. #sonar.exclusions= diff --git a/commander/pom.xml b/commander/pom.xml index 68ff374203b7..9639c4c9820b 100644 --- a/commander/pom.xml +++ b/commander/pom.xml @@ -1,3 +1,27 @@ + 4.0.0 diff --git a/commander/properties/log4j.properties b/commander/properties/log4j.properties index d7a52f503e83..1aaf1a4af6c8 100644 --- a/commander/properties/log4j.properties +++ b/commander/properties/log4j.properties @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2014 Ilkka Seppälä +# +# 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 NONINFRINGEMENT. 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. +# + #Define root logger options log4j.rootLogger=TRACE, file, console From 5f39f7fbf71fd2799bb48384fc79efc4aba8e1ea Mon Sep 17 00:00:00 2001 From: Hemant Bothra Date: Fri, 20 Sep 2019 10:38:43 +0530 Subject: [PATCH 028/197] Updating README.md file to update doc as suggested in issue#925 (#926) --- adapter/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/adapter/README.md b/adapter/README.md index e943baba52fd..03334bf18262 100644 --- a/adapter/README.md +++ b/adapter/README.md @@ -56,15 +56,14 @@ public class FishingBoat { And captain expects an implementation of `RowingBoat` interface to be able to move ```java -public class Captain implements RowingBoat { +public class Captain { private RowingBoat rowingBoat; - + // default constructor and setter for rowingBoat public Captain(RowingBoat rowingBoat) { this.rowingBoat = rowingBoat; } - @Override public void row() { rowingBoat.row(); } From 6b297b701fe67aca48f1a59b6b321c3fc95138a9 Mon Sep 17 00:00:00 2001 From: Ranjeet Date: Mon, 30 Sep 2019 20:49:08 +0530 Subject: [PATCH 029/197] Data Locality pattern #559 (#889) * Data Locality pattern #559 * Fixed review comments * updated pom * Fixed failed build --- data-locality/README.md | 30 +++++++ data-locality/pom.xml | 45 ++++++++++ .../iluwatar/data/locality/Application.java | 53 ++++++++++++ .../data/locality/game/GameEntity.java | 83 +++++++++++++++++++ .../locality/game/component/AiComponent.java | 47 +++++++++++ .../locality/game/component/Component.java | 33 ++++++++ .../game/component/PhysicsComponent.java | 46 ++++++++++ .../game/component/RenderComponent.java | 47 +++++++++++ .../component/manager/AiComponentManager.java | 68 +++++++++++++++ .../manager/PhysicsComponentManager.java | 70 ++++++++++++++++ .../manager/RenderComponentManager.java | 70 ++++++++++++++++ .../data/locality/ApplicationTest.java | 40 +++++++++ pom.xml | 1 + 13 files changed, 633 insertions(+) create mode 100644 data-locality/README.md create mode 100644 data-locality/pom.xml create mode 100644 data-locality/src/main/java/com/iluwatar/data/locality/Application.java create mode 100644 data-locality/src/main/java/com/iluwatar/data/locality/game/GameEntity.java create mode 100644 data-locality/src/main/java/com/iluwatar/data/locality/game/component/AiComponent.java create mode 100644 data-locality/src/main/java/com/iluwatar/data/locality/game/component/Component.java create mode 100644 data-locality/src/main/java/com/iluwatar/data/locality/game/component/PhysicsComponent.java create mode 100644 data-locality/src/main/java/com/iluwatar/data/locality/game/component/RenderComponent.java create mode 100644 data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/AiComponentManager.java create mode 100644 data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/PhysicsComponentManager.java create mode 100644 data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/RenderComponentManager.java create mode 100644 data-locality/src/test/java/com/iluwatar/data/locality/ApplicationTest.java diff --git a/data-locality/README.md b/data-locality/README.md new file mode 100644 index 000000000000..6a72a45194b3 --- /dev/null +++ b/data-locality/README.md @@ -0,0 +1,30 @@ +--- +layout: pattern +title: Data Locality +folder: data-locality +permalink: /patterns/data-locality/ +categories: Other +tags: + - Java + - Difficulty-Intermediate + - Performance +--- + +## Intent +Accelerate memory access by arranging data to take advantage of CPU caching. + +Modern CPUs have caches to speed up memory access. These can access memory adjacent to recently accessed memory much quicker. Take advantage of that to improve performance by increasing data locality keeping data in contiguous memory in the order that you process it. + + +## Applicability + +* Like most optimizations, the first guideline for using the Data Locality pattern is when you have a performance problem. +* With this pattern specifically, you’ll also want to be sure your performance problems are caused by cache misses. + +## Real world example + +* The [Artemis](http://gamadu.com/artemis/) game engine is one of the first and better-known frameworks that uses simple IDs for game entities. + +## Credits + +* [Game Programming Patterns Optimization Patterns: Data Locality](http://gameprogrammingpatterns.com/data-locality.html) \ No newline at end of file diff --git a/data-locality/pom.xml b/data-locality/pom.xml new file mode 100644 index 000000000000..bc6c8fc5160d --- /dev/null +++ b/data-locality/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.22.0-SNAPSHOT + + data-locality + + + + org.junit.jupiter + junit-jupiter-engine + test + + + + \ No newline at end of file diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/Application.java b/data-locality/src/main/java/com/iluwatar/data/locality/Application.java new file mode 100644 index 000000000000..76f309bb0e97 --- /dev/null +++ b/data-locality/src/main/java/com/iluwatar/data/locality/Application.java @@ -0,0 +1,53 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.data.locality; + +import com.iluwatar.data.locality.game.GameEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Use the Data Locality pattern is when you have a performance problem. + * Take advantage of that to improve performance by increasing data locality — keeping data in + * contiguous memory in the order that you process it. + * + * Example: Game loop that processes a bunch of game entities. + * Those entities are decomposed into different domains  + * — AI, physics, and rendering — using the Component pattern. + * + */ +public class Application { + + private static final Logger LOGGER = LoggerFactory.getLogger(Application.class); + + private static final int NUM_ENTITIES = 5; + /** + * Start game loop with each component have NUM_ENTITIES instance + */ + public static void main(String[] args) { + LOGGER.info("Start Game Application using Data-Locality pattern"); + GameEntity gameEntity = new GameEntity(NUM_ENTITIES); + gameEntity.start(); + gameEntity.update(); + } +} diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/GameEntity.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/GameEntity.java new file mode 100644 index 000000000000..219f7388cf7b --- /dev/null +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/GameEntity.java @@ -0,0 +1,83 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.data.locality.game; + +import com.iluwatar.data.locality.game.component.manager.AiComponentManager; +import com.iluwatar.data.locality.game.component.manager.PhysicsComponentManager; +import com.iluwatar.data.locality.game.component.manager.RenderComponentManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The game Entity maintains a big array of pointers . + * Each spin of the game loop, we need to run the following: + * + * Update the AI components . + * + * Update the physics components for them. + * + * Render them using their render components. + */ +public class GameEntity { + private static final Logger LOGGER = LoggerFactory.getLogger(GameEntity.class); + + private final AiComponentManager aiComponentManager; + private final PhysicsComponentManager physicsComponentManager; + private final RenderComponentManager renderComponentManager; + + /** + * Init components + */ + public GameEntity(int numEntities) { + LOGGER.info("Init Game with #Entity : {}", numEntities); + aiComponentManager = new AiComponentManager(numEntities); + physicsComponentManager = new PhysicsComponentManager(numEntities); + renderComponentManager = new RenderComponentManager(numEntities); + } + + /** + * start all component + */ + public void start() { + LOGGER.info("Start Game"); + aiComponentManager.start(); + physicsComponentManager.start(); + renderComponentManager.start(); + } + + /** + * update all component + */ + public void update() { + LOGGER.info("Update Game Component"); + // Process AI. + aiComponentManager.update(); + + // update physics. + physicsComponentManager.update(); + + // Draw to screen. + renderComponentManager.render(); + } + +} diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/AiComponent.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/AiComponent.java new file mode 100644 index 000000000000..83a4a18c88d2 --- /dev/null +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/AiComponent.java @@ -0,0 +1,47 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.data.locality.game.component; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Implementation of AI component for Game + */ +public class AiComponent implements Component { + + private static final Logger LOGGER = LoggerFactory.getLogger(AiComponent.class); + + /** + * Update ai component + */ + @Override + public void update() { + LOGGER.info("update AI component"); + } + + @Override + public void render() { + + } +} diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/Component.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/Component.java new file mode 100644 index 000000000000..5a25aa46c5bf --- /dev/null +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/Component.java @@ -0,0 +1,33 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.data.locality.game.component; + +/** + * Implement different Game component update and render process + */ +public interface Component { + + void update(); + + void render(); +} diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/PhysicsComponent.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/PhysicsComponent.java new file mode 100644 index 000000000000..32eed1878dee --- /dev/null +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/PhysicsComponent.java @@ -0,0 +1,46 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.data.locality.game.component; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Implementation of Physics Component of Game + */ +public class PhysicsComponent implements Component { + + private static final Logger LOGGER = LoggerFactory.getLogger(PhysicsComponent.class); + /** + * update physics component of game + */ + @Override + public void update() { + LOGGER.info("Update physics component of game"); + } + + @Override + public void render() { + // do nothing + } +} diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/RenderComponent.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/RenderComponent.java new file mode 100644 index 000000000000..910a57caeb6a --- /dev/null +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/RenderComponent.java @@ -0,0 +1,47 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.data.locality.game.component; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Implementation of Render Component of Game + */ +public class RenderComponent implements Component { + + private static final Logger LOGGER = LoggerFactory.getLogger(RenderComponent.class); + + @Override + public void update() { + // do nothing + } + + /** + * render + */ + @Override + public void render() { + LOGGER.info("Render Component"); + } +} diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/AiComponentManager.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/AiComponentManager.java new file mode 100644 index 000000000000..7e98746b3179 --- /dev/null +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/AiComponentManager.java @@ -0,0 +1,68 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.data.locality.game.component.manager; + +import com.iluwatar.data.locality.game.component.AiComponent; +import com.iluwatar.data.locality.game.component.Component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * AI component manager for Game + */ +public class AiComponentManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(AiComponentManager.class); + + private static final int MAX_ENTITIES = 10000; + + private final int numEntities; + + private static final Component[] AI_COMPONENTS = new AiComponent[MAX_ENTITIES]; + + public AiComponentManager(int numEntities) { + this.numEntities = numEntities; + } + + /** + * start AI component of Game + */ + public void start() { + LOGGER.info("Start AI Game Component"); + for (int i = 0; i < numEntities; i++) { + AI_COMPONENTS[i] = new AiComponent(); + } + } + + /** + * Update AI component of Game + */ + public void update() { + LOGGER.info("Update AI Game Component"); + for (int i = 0; i < numEntities; i++) { + if (AI_COMPONENTS.length > i && AI_COMPONENTS[i] != null) { + AI_COMPONENTS[i].update(); + } + } + } +} diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/PhysicsComponentManager.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/PhysicsComponentManager.java new file mode 100644 index 000000000000..abb2c45816cc --- /dev/null +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/PhysicsComponentManager.java @@ -0,0 +1,70 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.data.locality.game.component.manager; + +import com.iluwatar.data.locality.game.component.Component; +import com.iluwatar.data.locality.game.component.PhysicsComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Physics component Manager for Game. + */ +public class PhysicsComponentManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(PhysicsComponentManager.class); + + private static final int MAX_ENTITIES = 10000; + + private final int numEntities; + + private static final Component[] PHYSICS_COMPONENTS = new PhysicsComponent[MAX_ENTITIES]; + + public PhysicsComponentManager(int numEntities) { + this.numEntities = numEntities; + } + + /** + * Start physics component of Game + */ + public void start() { + LOGGER.info("Start Physics Game Component "); + for (int i = 0; i < numEntities; i++) { + PHYSICS_COMPONENTS[i] = new PhysicsComponent(); + } + } + + + /** + * Update physics component of Game + */ + public void update() { + LOGGER.info("Update Physics Game Component "); + // Process physics. + for (int i = 0; i < numEntities; i++) { + if (PHYSICS_COMPONENTS.length > i && PHYSICS_COMPONENTS[i] != null) { + PHYSICS_COMPONENTS[i].update(); + } + } + } +} diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/RenderComponentManager.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/RenderComponentManager.java new file mode 100644 index 000000000000..66f18bd32557 --- /dev/null +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/RenderComponentManager.java @@ -0,0 +1,70 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.data.locality.game.component.manager; + +import com.iluwatar.data.locality.game.component.Component; +import com.iluwatar.data.locality.game.component.RenderComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Render component manager for Game + */ +public class RenderComponentManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(RenderComponentManager.class); + + private static final int MAX_ENTITIES = 10000; + + private final int numEntities; + + private static final Component[] RENDER_COMPONENTS = new RenderComponent[MAX_ENTITIES]; + + public RenderComponentManager(int numEntities) { + this.numEntities = numEntities; + } + + /** + * Start render component + */ + public void start() { + LOGGER.info("Start Render Game Component "); + for (int i = 0; i < numEntities; i++) { + RENDER_COMPONENTS[i] = new RenderComponent(); + } + } + + + /** + * render component + */ + public void render() { + LOGGER.info("Update Render Game Component "); + // Process Render. + for (int i = 0; i < numEntities; i++) { + if (RENDER_COMPONENTS.length > i && RENDER_COMPONENTS[i] != null) { + RENDER_COMPONENTS[i].render(); + } + } + } +} diff --git a/data-locality/src/test/java/com/iluwatar/data/locality/ApplicationTest.java b/data-locality/src/test/java/com/iluwatar/data/locality/ApplicationTest.java new file mode 100644 index 000000000000..69b1c7a07df5 --- /dev/null +++ b/data-locality/src/test/java/com/iluwatar/data/locality/ApplicationTest.java @@ -0,0 +1,40 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.data.locality; + + +import org.junit.jupiter.api.Test; + +/** + * Test Game Application + */ +class ApplicationTest { + + /** + * Test run + */ + @Test + void main() { + Application.main(new String[] {}); + } +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index cb5dbbd1c343..ce773f61a243 100644 --- a/pom.xml +++ b/pom.xml @@ -172,6 +172,7 @@ commander typeobjectpattern bytecode + data-locality From 06fa92af2c7e85aa213569d077a2e01c09b307f7 Mon Sep 17 00:00:00 2001 From: Hemant Bothra Date: Mon, 30 Sep 2019 20:57:02 +0530 Subject: [PATCH 030/197] Removing the dead link to resove automagic issue as mentioned in issue#915 (#927) --- partial-response/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/partial-response/README.md b/partial-response/README.md index 5d03cb359fb2..f81dffaa1df3 100644 --- a/partial-response/README.md +++ b/partial-response/README.md @@ -26,4 +26,3 @@ Use the Partial Response pattern when ## Credits * [Common Design Patterns](https://cloud.google.com/apis/design/design_patterns) -* [Partial Response in RESTful API Design](http://yaoganglian.com/2013/07/01/partial-response/) From 3d62e02891d269890e86680b06b22033498d6bc6 Mon Sep 17 00:00:00 2001 From: Zhang WH Date: Mon, 30 Sep 2019 23:32:29 +0800 Subject: [PATCH 031/197] fixed bug #929: close async service before the main thread finishes (#931) --- .../java/com/iluwatar/halfsynchalfasync/App.java | 2 ++ .../halfsynchalfasync/AsynchronousService.java | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/App.java b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/App.java index 90cb5ecbfb0d..b24e29b6a55c 100644 --- a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/App.java +++ b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/App.java @@ -94,6 +94,8 @@ public static void main(String[] args) { service.execute(new ArithmeticSumTask(500)); service.execute(new ArithmeticSumTask(2000)); service.execute(new ArithmeticSumTask(1)); + + service.close(); } /** diff --git a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsynchronousService.java b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsynchronousService.java index 4e2f9c23a6cd..3e64edd9894c 100644 --- a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsynchronousService.java +++ b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsynchronousService.java @@ -22,6 +22,9 @@ */ package com.iluwatar.halfsynchalfasync; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; @@ -38,6 +41,7 @@ */ public class AsynchronousService { + private static final Logger LOGGER = LoggerFactory.getLogger(AsynchronousService.class); /* * This represents the queuing layer as well as synchronous layer of the pattern. The thread pool * contains worker threads which execute the tasks in blocking/synchronous manner. Long running @@ -95,4 +99,16 @@ protected void done() { } }); } + + /** + * Stops the pool of workers. This is a blocking call to wait for all tasks to be completed. + */ + public void close() { + service.shutdown(); + try { + service.awaitTermination(10, TimeUnit.SECONDS); + } catch (InterruptedException ie) { + LOGGER.error("Error waiting for executor service shutdown!"); + } + } } From b03e0b8c35abb3d4bc964f1bb7f352068df157f3 Mon Sep 17 00:00:00 2001 From: Anirudh Date: Tue, 1 Oct 2019 20:34:19 +0200 Subject: [PATCH 032/197] Fix for BallThreadTest#testResume (#935) * Fix for flaky test * Remove other file changes * Remove other file changes * Remove other file changes not related to bug --- twin/src/test/java/com/iluwatar/twin/BallThreadTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twin/src/test/java/com/iluwatar/twin/BallThreadTest.java b/twin/src/test/java/com/iluwatar/twin/BallThreadTest.java index 6e46cd4f1af5..5b5f8f6a2aea 100644 --- a/twin/src/test/java/com/iluwatar/twin/BallThreadTest.java +++ b/twin/src/test/java/com/iluwatar/twin/BallThreadTest.java @@ -84,7 +84,7 @@ public void testResume() { verifyZeroInteractions(ballItem); ballThread.resumeMe(); - sleep(200); + sleep(300); verify(ballItem, atLeastOnce()).draw(); verify(ballItem, atLeastOnce()).move(); From 823c58bef2197c30d7f8a40c2701973ee9a04ea2 Mon Sep 17 00:00:00 2001 From: Denise Date: Wed, 2 Oct 2019 08:53:57 +0100 Subject: [PATCH 033/197] added new information (#937) --- abstract-factory/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/abstract-factory/README.md b/abstract-factory/README.md index 0bf86dfa6a91..0084030b645e 100644 --- a/abstract-factory/README.md +++ b/abstract-factory/README.md @@ -169,15 +169,20 @@ Use the Abstract Factory pattern when * you need a run-time value to construct a particular dependency * you want to decide which product to call from a family at runtime. * you need to supply one or more parameters only known at run-time before you can resolve a dependency. +* when you need consistency among products +* you don’t want to change existing code when adding new products or families of products to the program. ## Use Cases: * Selecting to call the appropriate implementation of FileSystemAcmeService or DatabaseAcmeService or NetworkAcmeService at runtime. * Unit test case writing becomes much easier +* UI tools for different OS ## Consequences: * Dependency injection in java hides the service class dependencies that can lead to runtime errors that would have been caught at compile time. +* While the pattern is great when creating predefined objects, adding the new ones might be challenging. +* The code may become more complicated than it should be, since a lot of new interfaces and classes are introduced along with the pattern. ## Tutorial From 05d0f0babfcb37fc46bc92c384db6e096d78ddca Mon Sep 17 00:00:00 2001 From: Per Wramdemark Date: Thu, 3 Oct 2019 20:50:50 +0200 Subject: [PATCH 034/197] #834 Fix dependency management issue for POM files (#940) --- aggregator-microservices/aggregator-service/pom.xml | 11 ----------- .../information-microservice/pom.xml | 9 --------- .../inventory-microservice/pom.xml | 12 +----------- api-gateway/api-gateway-service/pom.xml | 10 ---------- api-gateway/image-microservice/pom.xml | 11 ----------- api-gateway/price-microservice/pom.xml | 9 --------- pom.xml | 5 ----- 7 files changed, 1 insertion(+), 66 deletions(-) diff --git a/aggregator-microservices/aggregator-service/pom.xml b/aggregator-microservices/aggregator-service/pom.xml index dbe303809f9b..6ad8c3c8c5a4 100644 --- a/aggregator-microservices/aggregator-service/pom.xml +++ b/aggregator-microservices/aggregator-service/pom.xml @@ -32,18 +32,8 @@ 1.22.0-SNAPSHOT 4.0.0 - aggregator-service jar - - - - - org.springframework.boot - spring-boot-dependencies - - - org.springframework @@ -74,7 +64,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot.version} diff --git a/aggregator-microservices/information-microservice/pom.xml b/aggregator-microservices/information-microservice/pom.xml index b15af35e4b82..54113d3ad2eb 100644 --- a/aggregator-microservices/information-microservice/pom.xml +++ b/aggregator-microservices/information-microservice/pom.xml @@ -36,14 +36,6 @@ information-microservice jar - - - - org.springframework.boot - spring-boot-dependencies - - - org.springframework @@ -65,7 +57,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot.version} diff --git a/aggregator-microservices/inventory-microservice/pom.xml b/aggregator-microservices/inventory-microservice/pom.xml index 1791ee72c9e8..3a24e9540edf 100644 --- a/aggregator-microservices/inventory-microservice/pom.xml +++ b/aggregator-microservices/inventory-microservice/pom.xml @@ -32,18 +32,9 @@ 1.22.0-SNAPSHOT 4.0.0 - inventory-microservice - jar - - - - org.springframework.boot - spring-boot-dependencies - - - + jar org.springframework @@ -65,7 +56,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot.version} diff --git a/api-gateway/api-gateway-service/pom.xml b/api-gateway/api-gateway-service/pom.xml index 82aa6aedef80..44a8bde37923 100644 --- a/api-gateway/api-gateway-service/pom.xml +++ b/api-gateway/api-gateway-service/pom.xml @@ -34,15 +34,6 @@ 4.0.0 api-gateway-service jar - - - - - org.springframework.boot - spring-boot-dependencies - - - org.springframework @@ -73,7 +64,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot.version} diff --git a/api-gateway/image-microservice/pom.xml b/api-gateway/image-microservice/pom.xml index c4367cdd8f45..4c897325d931 100644 --- a/api-gateway/image-microservice/pom.xml +++ b/api-gateway/image-microservice/pom.xml @@ -31,19 +31,9 @@ com.iluwatar 1.22.0-SNAPSHOT - 4.0.0 image-microservice jar - - - - - org.springframework.boot - spring-boot-dependencies - - - org.springframework @@ -65,7 +55,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot.version} diff --git a/api-gateway/price-microservice/pom.xml b/api-gateway/price-microservice/pom.xml index 89aaba7ae7d4..21a68dc6efd3 100644 --- a/api-gateway/price-microservice/pom.xml +++ b/api-gateway/price-microservice/pom.xml @@ -36,14 +36,6 @@ price-microservice jar - - - - org.springframework.boot - spring-boot-dependencies - - - org.springframework @@ -65,7 +57,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot.version} diff --git a/pom.xml b/pom.xml index ce773f61a243..5dfb1fff4376 100644 --- a/pom.xml +++ b/pom.xml @@ -211,11 +211,6 @@ spring-webmvc ${spring.version} - - org.springframework.boot - spring-boot-starter-web - ${spring-boot.version} - org.apache.httpcomponents httpclient From 218ba44dbfcaaacc12f11ec4830cf6cd13451388 Mon Sep 17 00:00:00 2001 From: Per Wramdemark Date: Sat, 5 Oct 2019 13:23:20 +0200 Subject: [PATCH 035/197] Upgrade of maven plugins (#951) * Upgrade maven plugins * Upgrade maven plugins Some general code cleanup was necessary due to upgrade of PMD and checkstyle. Also needed to add Junit 4 as a dependency due to Mockito.timout issue found here: https://github.com/mockito/mockito/issues/152 --- async-method-invocation/pom.xml | 5 ++ .../com/iluwatar/bytecode/Instruction.java | 4 +- caching/pom.xml | 1 - .../com/iluwatar/caching/CachingPolicy.java | 2 +- .../com/iluwatar/commander/Commander.java | 17 +++--- .../com/iluwatar/commander/queue/Queue.java | 4 +- .../iluwatar/doublechecked/locking/App.java | 4 +- .../iluwatar/event/asynchronous/Event.java | 2 +- exclude-pmd.properties | 1 + .../com/iluwatar/flux/action/Content.java | 2 +- half-sync-half-async/pom.xml | 5 ++ .../hexagonal/service/ConsoleLottery.java | 2 +- naked-objects/pom.xml | 22 -------- .../com/iluwatar/poison/pill/Message.java | 2 +- pom.xml | 56 ++++++++----------- .../java/com/iluwatar/retry/RetryTest.java | 9 ++- .../java/com/iluwatar/semaphore/Fruit.java | 2 +- .../servicelayer/common/BaseEntity.java | 6 +- trampoline/pom.xml | 1 - 19 files changed, 63 insertions(+), 84 deletions(-) diff --git a/async-method-invocation/pom.xml b/async-method-invocation/pom.xml index c6764f61cad0..49e39009ebdd 100644 --- a/async-method-invocation/pom.xml +++ b/async-method-invocation/pom.xml @@ -43,5 +43,10 @@ mockito-core test + + junit + junit + test + diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java b/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java index 2ceb66e3bdc2..1d921da51037 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java @@ -29,7 +29,7 @@ public enum Instruction { LITERAL(1), SET_HEALTH(2), - SET_WISDOM (3), + SET_WISDOM(3), SET_AGILITY(4), PLAY_SOUND(5), SPAWN_PARTICLES(6), @@ -37,7 +37,7 @@ public enum Instruction { GET_AGILITY(8), GET_WISDOM(9), ADD(10), - DIVIDE (11); + DIVIDE(11); private int value; diff --git a/caching/pom.xml b/caching/pom.xml index 76578b8830cc..c20e29e922d2 100644 --- a/caching/pom.xml +++ b/caching/pom.xml @@ -65,7 +65,6 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19 false diff --git a/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java b/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java index 9f7c92b2eef5..6b7fc35c3ace 100644 --- a/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java +++ b/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java @@ -32,7 +32,7 @@ public enum CachingPolicy { private String policy; - private CachingPolicy(String policy) { + CachingPolicy(String policy) { this.policy = policy; } diff --git a/commander/src/main/java/com/iluwatar/commander/Commander.java b/commander/src/main/java/com/iluwatar/commander/Commander.java index 87d4604d4ac3..8f19d1df8794 100644 --- a/commander/src/main/java/com/iluwatar/commander/Commander.java +++ b/commander/src/main/java/com/iluwatar/commander/Commander.java @@ -239,12 +239,12 @@ private void updateQueue(QueueTask qt) throws InterruptedException { //since payment time is lesser than queuetime it would have already failed..additional check not needed LOG.trace("Order " + qt.order.id + ": Queue time for order over, failed.."); return; - } else if ((qt.taskType.equals(TaskType.Payment) && !qt.order.paid.equals(PaymentStatus.Trying)) - || (qt.taskType.equals(TaskType.Messaging) && ((qt.messageType == 1 - && !qt.order.messageSent.equals(MessageSent.NoneSent)) + } else if (qt.taskType.equals(TaskType.Payment) && !qt.order.paid.equals(PaymentStatus.Trying) + || qt.taskType.equals(TaskType.Messaging) && (qt.messageType == 1 + && !qt.order.messageSent.equals(MessageSent.NoneSent) || qt.order.messageSent.equals(MessageSent.PaymentFail) - || qt.order.messageSent.equals(MessageSent.PaymentSuccessful))) - || (qt.taskType.equals(TaskType.EmployeeDb) && qt.order.addedToEmployeeHandle)) { + || qt.order.messageSent.equals(MessageSent.PaymentSuccessful)) + || qt.taskType.equals(TaskType.EmployeeDb) && qt.order.addedToEmployeeHandle) { LOG.trace("Order " + qt.order.id + ": Not queueing task since task already done.."); return; } @@ -576,8 +576,8 @@ private void doTasksInQueue() throws Exception { || qt.order.messageSent.equals(MessageSent.PaymentSuccessful)) { tryDequeue(); LOG.trace("Order " + qt.order.id + ": This messaging task already done, dequeue.."); - } else if ((qt.messageType == 1 && (!qt.order.messageSent.equals(MessageSent.NoneSent) - || !qt.order.paid.equals(PaymentStatus.Trying)))) { + } else if (qt.messageType == 1 && (!qt.order.messageSent.equals(MessageSent.NoneSent) + || !qt.order.paid.equals(PaymentStatus.Trying))) { tryDequeue(); LOG.trace("Order " + qt.order.id + ": This messaging task does not need to be done, dequeue.."); } else if (qt.messageType == 0) { @@ -606,8 +606,7 @@ private void doTasksInQueue() throws Exception { } else { Thread.sleep(queueTaskTime / 3); tryDoingTasksInQueue(); - } - return; + } } } diff --git a/commander/src/main/java/com/iluwatar/commander/queue/Queue.java b/commander/src/main/java/com/iluwatar/commander/queue/Queue.java index f1b0ef533117..440f65c90938 100644 --- a/commander/src/main/java/com/iluwatar/commander/queue/Queue.java +++ b/commander/src/main/java/com/iluwatar/commander/queue/Queue.java @@ -83,7 +83,7 @@ T dequeue() throws IsEmptyException { Node temp = front; front = front.next; size = size - 1; - return ((T) temp.value); + return (T) temp.value; } } @@ -91,7 +91,7 @@ T peek() throws IsEmptyException { if (isEmpty()) { throw new IsEmptyException(); } else { - return ((T)front.value); + return (T)front.value; } } } diff --git a/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java b/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java index c814f98bc586..3a9faf4dca16 100644 --- a/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java +++ b/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java @@ -55,7 +55,9 @@ public static void main(String[] args) { ExecutorService executorService = Executors.newFixedThreadPool(3); for (int i = 0; i < 3; i++) { executorService.execute(() -> { - while (inventory.addItem(new Item())) {}; + while (inventory.addItem(new Item())) { + LOGGER.info("Adding another item"); + } }); } diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java index 5dc069bc7032..c22f54ca0e29 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java @@ -97,7 +97,7 @@ public final void removeListener(final ThreadCompleteListener listener) { this.eventListener = null; } - private final void completed() { + private void completed() { if (eventListener != null) { eventListener.completedEventHandler(eventId); } diff --git a/exclude-pmd.properties b/exclude-pmd.properties index 288ee9b2d318..5a4bb138834e 100644 --- a/exclude-pmd.properties +++ b/exclude-pmd.properties @@ -24,3 +24,4 @@ com.iluwatar.servicelayer.common.BaseEntity=UnusedPrivateField com.iluwatar.doublechecked.locking.App=EmptyStatementNotInLoop,EmptyWhileStmt com.iluwatar.doublechecked.locking.InventoryTest=EmptyStatementNotInLoop,EmptyWhileStmt +domainapp.dom.modules.simple.QSimpleObject=UnusedFormalParameter \ No newline at end of file diff --git a/flux/src/main/java/com/iluwatar/flux/action/Content.java b/flux/src/main/java/com/iluwatar/flux/action/Content.java index 596b466db414..8854ebced07a 100644 --- a/flux/src/main/java/com/iluwatar/flux/action/Content.java +++ b/flux/src/main/java/com/iluwatar/flux/action/Content.java @@ -34,7 +34,7 @@ public enum Content { private String title; - private Content(String title) { + Content(String title) { this.title = title; } diff --git a/half-sync-half-async/pom.xml b/half-sync-half-async/pom.xml index d965298ca364..2ca43a964844 100644 --- a/half-sync-half-async/pom.xml +++ b/half-sync-half-async/pom.xml @@ -43,5 +43,10 @@ mockito-core test + + junit + junit + test + diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java index 9956788ad100..2d2a53318620 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java @@ -48,7 +48,7 @@ public static void main(String[] args) { Injector injector = Guice.createInjector(new LotteryModule()); LotteryService service = injector.getInstance( LotteryService.class); WireTransfers bank = injector.getInstance(WireTransfers.class); - try (final Scanner scanner = new Scanner(System.in)) { + try (Scanner scanner = new Scanner(System.in)) { boolean exit = false; while (!exit) { printMainMenu(); diff --git a/naked-objects/pom.xml b/naked-objects/pom.xml index 8c21504bb6f5..d0fe727d3205 100644 --- a/naked-objects/pom.xml +++ b/naked-objects/pom.xml @@ -90,31 +90,9 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.8 - 1.8 - -parameters - - - - source - compile - - - test - test-compile - - - - org.apache.maven.plugins maven-surefire-plugin - 2.16 **/*Test.java diff --git a/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java b/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java index cd2d2da6ac90..e9937d30cac0 100644 --- a/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java +++ b/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java @@ -66,7 +66,7 @@ private RuntimeException poison() { /** * Enumeration of Type of Headers */ - public enum Headers { + enum Headers { DATE, SENDER } diff --git a/pom.xml b/pom.xml index 5dfb1fff4376..d985b6c62fe2 100644 --- a/pom.xml +++ b/pom.xml @@ -36,10 +36,9 @@ 4.12 5.0.2 ${junit.version}.2 - 1.0.2 1.0.2 - 3.0 - 0.7.2.201409121644 + 3.8.1 + 0.8.4 1.4 2.16.1 19.0 @@ -55,6 +54,7 @@ 1.0.0 2.0.1 2.8.5 + 3.12.0 abstract-factory @@ -353,20 +353,27 @@ + + org.apache.maven.plugins + maven-compiler-plugin + ${compiler.version} + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M3 + + -Xmx1024M ${argLine} + + - - - org.apache.maven.plugins - maven-compiler-plugin - ${compiler.version} - - 1.8 - 1.8 - - org.jacoco jacoco-maven-plugin @@ -387,7 +394,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 2.17 + 3.1.0 validate @@ -406,25 +413,10 @@ - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - - org.junit.platform - junit-platform-surefire-provider - ${junit-platform.version} - - - - -Xmx1024M ${argLine} - - org.apache.maven.plugins maven-pmd-plugin - 3.6 + ${pmd.version} true 5 @@ -445,7 +437,7 @@ com.mycila license-maven-plugin - 2.11 + 3.0

com/mycila/maven/plugin/license/templates/MIT.txt
@@ -471,7 +463,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.6 + ${pmd.version} diff --git a/retry/src/test/java/com/iluwatar/retry/RetryTest.java b/retry/src/test/java/com/iluwatar/retry/RetryTest.java index a8307d1cd9f3..d435c7e84331 100644 --- a/retry/src/test/java/com/iluwatar/retry/RetryTest.java +++ b/retry/src/test/java/com/iluwatar/retry/RetryTest.java @@ -43,7 +43,8 @@ public class RetryTest { public void errors() { final BusinessException e = new BusinessException("unhandled"); final Retry retry = new Retry<>( - () -> { throw e; }, + () -> { + throw e; }, 2, 0 ); @@ -67,7 +68,8 @@ public void errors() { public void attempts() { final BusinessException e = new BusinessException("unhandled"); final Retry retry = new Retry<>( - () -> { throw e; }, + () -> { + throw e; }, 2, 0 ); @@ -91,7 +93,8 @@ public void attempts() { public void ignore() throws Exception { final BusinessException e = new CustomerNotFoundException("customer not found"); final Retry retry = new Retry<>( - () -> { throw e; }, + () -> { + throw e; }, 2, 0, ex -> CustomerNotFoundException.class.isAssignableFrom(ex.getClass()) diff --git a/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java b/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java index 88255997fa7e..9ab004c17531 100644 --- a/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java +++ b/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java @@ -30,7 +30,7 @@ public class Fruit { /** * Enumeration of Fruit Types */ - public static enum FruitType { + public enum FruitType { ORANGE, APPLE, LEMON } diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java b/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java index 52c24292e2ec..bf3988d07484 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java @@ -25,10 +25,9 @@ import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.MappedSuperclass; -import javax.persistence.Version; /** - * + * * Base class for entities. * */ @@ -36,9 +35,6 @@ @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract class BaseEntity { - @Version - private Long version; - /** * Indicates the unique id of this entity * diff --git a/trampoline/pom.xml b/trampoline/pom.xml index e6f2e620afac..1e019ef31297 100644 --- a/trampoline/pom.xml +++ b/trampoline/pom.xml @@ -62,7 +62,6 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19 false From 364c43a73aab5b5d4cb76194a90f0122ab3a608d Mon Sep 17 00:00:00 2001 From: Per Wramdemark Date: Sat, 5 Oct 2019 16:13:08 +0200 Subject: [PATCH 036/197] Get rid of build warnings WARNING about problems found when building the effective model (#953) --- naked-objects/pom.xml | 9 --------- pom.xml | 5 +++++ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/naked-objects/pom.xml b/naked-objects/pom.xml index d0fe727d3205..271a07705589 100644 --- a/naked-objects/pom.xml +++ b/naked-objects/pom.xml @@ -17,23 +17,14 @@ com.iluwatar 1.22.0-SNAPSHOT - naked-objects - pom - - - 3.0.4 - - 1.9.0 - UTF-8 UTF-8 2.0.0 - apache.snapshots diff --git a/pom.xml b/pom.xml index d985b6c62fe2..7d5b038873de 100644 --- a/pom.xml +++ b/pom.xml @@ -370,6 +370,11 @@ -Xmx1024M ${argLine} + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + From 933de30d42271f422a487b0a74d6d7ccf6053709 Mon Sep 17 00:00:00 2001 From: Per Wramdemark Date: Sat, 5 Oct 2019 17:01:23 +0200 Subject: [PATCH 037/197] Add JXR plugin to get rid of WARNING Unable to locate Source XRef to link to (#952) --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 7d5b038873de..f1a586eb8b34 100644 --- a/pom.xml +++ b/pom.xml @@ -470,6 +470,11 @@ maven-pmd-plugin ${pmd.version} + + org.apache.maven.plugins + maven-jxr-plugin + 3.0.0 + From 60171e3c873257b86f66b0a67935321735d2c7d1 Mon Sep 17 00:00:00 2001 From: Arpit Jain Date: Sun, 6 Oct 2019 20:57:39 +0530 Subject: [PATCH 038/197] Fix for Issue #549 : Update Exception Handling Code in Aggregator Microservice (#958) * Fix for Issue##549 Catch ClientProtocolException and Update Error Logs * Fix indentation, checkstyle errors --- .../microservices/ProductInformationClientImpl.java | 7 +++++-- .../microservices/ProductInventoryClientImpl.java | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java index 16849d529386..131fbf8695cd 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java @@ -22,6 +22,7 @@ */ package com.iluwatar.aggregator.microservices; +import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; @@ -49,8 +50,10 @@ public String getProductTitle() { try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { response = EntityUtils.toString(httpResponse.getEntity()); } - } catch (IOException e) { - LOGGER.error("Exception caught.", e); + } catch (ClientProtocolException cpe) { + LOGGER.error("ClientProtocolException Occured", cpe); + } catch (IOException ioe) { + LOGGER.error("IOException Occurred", ioe); } return response; } diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java index 89f1a25e0580..780dccb78e20 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java @@ -22,6 +22,7 @@ */ package com.iluwatar.aggregator.microservices; +import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; @@ -49,8 +50,10 @@ public int getProductInventories() { try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { response = EntityUtils.toString(httpResponse.getEntity()); } - } catch (IOException e) { - LOGGER.error("Exception caught.", e); + } catch (ClientProtocolException cpe) { + LOGGER.error("ClientProtocolException Occured", cpe); + } catch (IOException ioe) { + LOGGER.error("IOException Occurred", ioe); } return Integer.parseInt(response); } From 94ca25462667b15d2d4f7d5120c94a0733f53bf7 Mon Sep 17 00:00:00 2001 From: Arpit Jain Date: Sun, 6 Oct 2019 21:36:39 +0530 Subject: [PATCH 039/197] Fix for issue #954 : Add external Dependencies to run with Java11 (#957) * Fix for issue #954 Add javax.annotation and java.xml.bind as external maven dependencies Verified with jdk-11 * Move dependency versions to main pom.xml's dependencyManagement section --- pom.xml | 12 ++++++++++++ repository/pom.xml | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/pom.xml b/pom.xml index f1a586eb8b34..acaaef6181c5 100644 --- a/pom.xml +++ b/pom.xml @@ -55,6 +55,8 @@ 2.0.1 2.8.5 3.12.0 + 2.3.0 + 1.3.1 abstract-factory @@ -298,6 +300,16 @@ mongo-java-driver ${mongo-java-driver.version}
+ + javax.xml.bind + jaxb-api + ${jaxb-api.version} + + + javax.annotation + javax.annotation-api + ${annotation-api.version} +
diff --git a/repository/pom.xml b/repository/pom.xml index 48bca0cf2ba8..2ccdc9da7ba5 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -63,5 +63,13 @@ com.google.guava guava
+ + javax.xml.bind + jaxb-api + + + javax.annotation + javax.annotation-api +
From 2b1c09aa72149bed1b5391561bbb409cfa47fad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Mon, 7 Oct 2019 09:45:06 +0300 Subject: [PATCH 040/197] Fix link in Acyclic Visitor --- acyclic-visitor/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acyclic-visitor/README.md b/acyclic-visitor/README.md index 939fe38b97d1..83b618601fb2 100644 --- a/acyclic-visitor/README.md +++ b/acyclic-visitor/README.md @@ -33,7 +33,7 @@ The bad: * Parallel hierarchy of visitors has to be created for all members in visitable class hierarchy. ## Related patterns -* [Visitor Pattern](../visitor/README.md) +* [Visitor Pattern](../visitor/) ## Credits -* [Acyclic Visitor](http://condor.depaul.edu/dmumaugh/OOT/Design-Principles/acv.pdf) \ No newline at end of file +* [Acyclic Visitor](http://condor.depaul.edu/dmumaugh/OOT/Design-Principles/acv.pdf) From f5455f9887f2613ef2b8ca16eb594d6a962196d8 Mon Sep 17 00:00:00 2001 From: Kevin O'Neal Date: Mon, 7 Oct 2019 11:10:26 -0500 Subject: [PATCH 041/197] update buggy dependencies (#968) --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index acaaef6181c5..539da396b2d8 100644 --- a/pom.xml +++ b/pom.xml @@ -43,12 +43,12 @@ 2.16.1 19.0 1.10.19 - 4.5.2 + 4.5.10 2.22 4.0 3.3.0 - 1.7.21 - 1.1.7 + 1.7.28 + 1.2.3 1.1.0 1.11.289 1.0.0 From 84c4b034a9f282a0d8739ef7bd4cd83813a7c454 Mon Sep 17 00:00:00 2001 From: Gaurav Deshpande Date: Tue, 8 Oct 2019 10:12:54 +0530 Subject: [PATCH 042/197] Fix: Github reports security vulnerabilities #933 (#960) * Fix: Github reports security vulnerabilities #933 Upgrade camel and spring-data * -Fix github security vulnerabilities in spring-data and camel * -Code changes for review comments --- .../routes/AggregatorRouteTest.java | 4 +-- .../splitter/routes/SplitterRouteTest.java | 4 +-- .../eip/wiretap/routes/WireTapRouteTest.java | 4 +-- layers/pom.xml | 6 ++++- .../layers/CakeBakingServiceImpl.java | 27 +++++++++++-------- .../src/main/resources/applicationContext.xml | 2 +- pom.xml | 21 ++++++++------- repository/pom.xml | 6 ++++- .../java/com/iluwatar/repository/App.java | 9 ++++--- .../com/iluwatar/repository/AppConfig.java | 13 +++++---- .../src/main/resources/applicationContext.xml | 2 +- .../AnnotationBasedRepositoryTest.java | 12 ++++----- .../iluwatar/repository/AppConfigTest.java | 5 ++-- .../iluwatar/repository/RepositoryTest.java | 11 ++++---- 14 files changed, 72 insertions(+), 54 deletions(-) diff --git a/eip-aggregator/src/test/java/com/iluwatar/eip/aggregator/routes/AggregatorRouteTest.java b/eip-aggregator/src/test/java/com/iluwatar/eip/aggregator/routes/AggregatorRouteTest.java index 2c7d207d6f53..2b831e01958b 100644 --- a/eip-aggregator/src/test/java/com/iluwatar/eip/aggregator/routes/AggregatorRouteTest.java +++ b/eip-aggregator/src/test/java/com/iluwatar/eip/aggregator/routes/AggregatorRouteTest.java @@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.ComponentScan; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; @@ -44,7 +44,7 @@ *

*/ @ExtendWith(SpringExtension.class) -@SpringApplicationConfiguration(classes = AggregatorRouteTest.class) +@SpringBootTest(classes = AggregatorRouteTest.class) @ActiveProfiles("test") @EnableAutoConfiguration @ComponentScan diff --git a/eip-splitter/src/test/java/com/iluwatar/eip/splitter/routes/SplitterRouteTest.java b/eip-splitter/src/test/java/com/iluwatar/eip/splitter/routes/SplitterRouteTest.java index 9257a4410186..334b77da03c8 100644 --- a/eip-splitter/src/test/java/com/iluwatar/eip/splitter/routes/SplitterRouteTest.java +++ b/eip-splitter/src/test/java/com/iluwatar/eip/splitter/routes/SplitterRouteTest.java @@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.ComponentScan; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; @@ -42,7 +42,7 @@ *

*/ @ExtendWith(SpringExtension.class) -@SpringApplicationConfiguration(classes = SplitterRouteTest.class) +@SpringBootTest(classes = SplitterRouteTest.class) @ActiveProfiles("test") @EnableAutoConfiguration @ComponentScan diff --git a/eip-wire-tap/src/test/java/com/iluwatar/eip/wiretap/routes/WireTapRouteTest.java b/eip-wire-tap/src/test/java/com/iluwatar/eip/wiretap/routes/WireTapRouteTest.java index 449f86208258..bb433f350238 100644 --- a/eip-wire-tap/src/test/java/com/iluwatar/eip/wiretap/routes/WireTapRouteTest.java +++ b/eip-wire-tap/src/test/java/com/iluwatar/eip/wiretap/routes/WireTapRouteTest.java @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.ComponentScan; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; @@ -45,7 +45,7 @@ *

*/ @ExtendWith(SpringExtension.class) -@SpringApplicationConfiguration(classes = WireTapRouteTest.class) +@SpringBootTest(classes = WireTapRouteTest.class) @ActiveProfiles("test") @EnableAutoConfiguration @ComponentScan diff --git a/layers/pom.xml b/layers/pom.xml index 8237c8f4f6e0..a6d3d17199f6 100644 --- a/layers/pom.xml +++ b/layers/pom.xml @@ -41,7 +41,11 @@
org.hibernate - hibernate-entitymanager + hibernate-core + + + javax.xml.bind + jaxb-api commons-dbcp diff --git a/layers/src/main/java/com/iluwatar/layers/CakeBakingServiceImpl.java b/layers/src/main/java/com/iluwatar/layers/CakeBakingServiceImpl.java index e8deee73a767..556a74c7afbf 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeBakingServiceImpl.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeBakingServiceImpl.java @@ -72,18 +72,23 @@ public void bakeNewCake(CakeInfo cakeInfo) throws CakeBakingException { } } CakeToppingDao toppingBean = context.getBean(CakeToppingDao.class); - CakeTopping topping = toppingBean.findOne(matchingToppings.iterator().next().getId()); + Optional topping = toppingBean.findById(matchingToppings.iterator().next().getId()); CakeDao cakeBean = context.getBean(CakeDao.class); - Cake cake = new Cake(); - cake.setTopping(topping); - cake.setLayers(foundLayers); - cakeBean.save(cake); - topping.setCake(cake); - toppingBean.save(topping); - CakeLayerDao layerBean = context.getBean(CakeLayerDao.class); - for (CakeLayer layer : foundLayers) { - layer.setCake(cake); - layerBean.save(layer); + if (topping.isPresent()) { + Cake cake = new Cake(); + cake.setTopping(topping.get()); + cake.setLayers(foundLayers); + cakeBean.save(cake); + topping.get().setCake(cake); + toppingBean.save(topping.get()); + CakeLayerDao layerBean = context.getBean(CakeLayerDao.class); + for (CakeLayer layer : foundLayers) { + layer.setCake(cake); + layerBean.save(layer); + } + } else { + throw new CakeBakingException(String.format("Topping %s is not available", + cakeInfo.cakeToppingInfo.name)); } } diff --git a/layers/src/main/resources/applicationContext.xml b/layers/src/main/resources/applicationContext.xml index eca3670b0fbf..c149094c1fa3 100644 --- a/layers/src/main/resources/applicationContext.xml +++ b/layers/src/main/resources/applicationContext.xml @@ -50,7 +50,7 @@ - + diff --git a/pom.xml b/pom.xml index 539da396b2d8..33219175ec9d 100644 --- a/pom.xml +++ b/pom.xml @@ -28,10 +28,10 @@ 2014 UTF-8 - 5.0.1.Final - 4.2.4.RELEASE - 1.3.3.RELEASE - 1.9.2.RELEASE + 5.2.18.Final + 5.0.13.RELEASE + 2.0.9.RELEASE + 2.0.14.RELEASE 1.4.190 4.12 5.0.2 @@ -40,7 +40,7 @@ 3.8.1 0.8.4 1.4 - 2.16.1 + 2.24.0 19.0 1.10.19 4.5.10 @@ -55,6 +55,7 @@ 2.0.1 2.8.5 3.12.0 + 1.2.17 2.3.0 1.3.1 @@ -191,11 +192,6 @@ hibernate-core ${hibernate.version} - - org.hibernate - hibernate-entitymanager - ${hibernate.version} - org.springframework.boot spring-boot-dependencies @@ -300,6 +296,11 @@ mongo-java-driver ${mongo-java-driver.version} + + log4j + log4j + ${log4j.version} + javax.xml.bind jaxb-api diff --git a/repository/pom.xml b/repository/pom.xml index 2ccdc9da7ba5..f0340f1260ef 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -44,7 +44,7 @@ org.hibernate - hibernate-entitymanager + hibernate-core commons-dbcp @@ -71,5 +71,9 @@ javax.annotation javax.annotation-api + + org.springframework.boot + spring-boot-starter-test +
diff --git a/repository/src/main/java/com/iluwatar/repository/App.java b/repository/src/main/java/com/iluwatar/repository/App.java index d96b4351ea38..c4a885380064 100644 --- a/repository/src/main/java/com/iluwatar/repository/App.java +++ b/repository/src/main/java/com/iluwatar/repository/App.java @@ -23,6 +23,7 @@ package com.iluwatar.repository; import java.util.List; +import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -84,17 +85,17 @@ public static void main(String[] args) { nasta.setSurname("Spotakova"); repository.save(nasta); - LOGGER.info("Find by id 2: {}", repository.findOne(2L)); + LOGGER.info("Find by id 2: {}", repository.findById(2L).get()); // Remove record from Person - repository.delete(2L); + repository.deleteById(2L); // count records LOGGER.info("Count Person records: {}", repository.count()); // find by name - Person p = repository.findOne(new PersonSpecifications.NameEqualSpec("John")); - LOGGER.info("Find by John is {}", p); + Optional p = repository.findOne(new PersonSpecifications.NameEqualSpec("John")); + LOGGER.info("Find by John is {}", p.get()); // find by age persons = repository.findAll(new PersonSpecifications.AgeBetweenSpec(20, 40)); diff --git a/repository/src/main/java/com/iluwatar/repository/AppConfig.java b/repository/src/main/java/com/iluwatar/repository/AppConfig.java index c5ccb7d00002..584c09037be7 100644 --- a/repository/src/main/java/com/iluwatar/repository/AppConfig.java +++ b/repository/src/main/java/com/iluwatar/repository/AppConfig.java @@ -24,6 +24,7 @@ import java.sql.SQLException; import java.util.List; +import java.util.Optional; import java.util.Properties; import javax.sql.DataSource; @@ -32,6 +33,7 @@ import org.hibernate.jpa.HibernatePersistenceProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringBootConfiguration; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @@ -44,6 +46,7 @@ * */ @EnableJpaRepositories +@SpringBootConfiguration public class AppConfig { private static final Logger LOGGER = LoggerFactory.getLogger(AppConfig.class); @@ -60,7 +63,7 @@ public DataSource dataSource() { basicDataSource.setUrl("jdbc:h2:~/databases/person"); basicDataSource.setUsername("sa"); basicDataSource.setPassword("sa"); - return (DataSource) basicDataSource; + return basicDataSource; } /** @@ -134,17 +137,17 @@ public static void main(String[] args) { nasta.setSurname("Spotakova"); repository.save(nasta); - LOGGER.info("Find by id 2: {}", repository.findOne(2L)); + LOGGER.info("Find by id 2: {}", repository.findById(2L).get()); // Remove record from Person - repository.delete(2L); + repository.deleteById(2L); // count records LOGGER.info("Count Person records: {}", repository.count()); // find by name - Person p = repository.findOne(new PersonSpecifications.NameEqualSpec("John")); - LOGGER.info("Find by John is {}", p); + Optional p = repository.findOne(new PersonSpecifications.NameEqualSpec("John")); + LOGGER.info("Find by John is {}", p.get()); // find by age persons = repository.findAll(new PersonSpecifications.AgeBetweenSpec(20, 40)); diff --git a/repository/src/main/resources/applicationContext.xml b/repository/src/main/resources/applicationContext.xml index 26d6cb3f4dc3..b27bb4c85f73 100644 --- a/repository/src/main/resources/applicationContext.xml +++ b/repository/src/main/resources/applicationContext.xml @@ -49,7 +49,7 @@ - + diff --git a/repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java b/repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java index 4cfb6e022f51..8d7e1d94b797 100644 --- a/repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java +++ b/repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java @@ -28,6 +28,7 @@ import java.util.Arrays; import java.util.List; +import java.util.Optional; import javax.annotation.Resource; @@ -35,9 +36,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.ContextConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.support.AnnotationConfigContextLoader; import com.google.common.collect.Lists; @@ -47,7 +47,7 @@ * */ @ExtendWith(SpringExtension.class) -@ContextConfiguration(classes = { AppConfig.class }, loader = AnnotationConfigContextLoader.class) +@SpringBootTest(classes = { AppConfig.class }) public class AnnotationBasedRepositoryTest { @Resource @@ -66,7 +66,7 @@ public class AnnotationBasedRepositoryTest { @BeforeEach public void setup() { - repository.save(persons); + repository.saveAll(persons); } @Test @@ -119,8 +119,8 @@ public void testFindAllByAgeBetweenSpec() { @Test public void testFindOneByNameEqualSpec() { - Person actual = repository.findOne(new PersonSpecifications.NameEqualSpec("Terry")); - assertEquals(terry, actual); + Optional actual = repository.findOne(new PersonSpecifications.NameEqualSpec("Terry")); + assertEquals(terry, actual.get()); } @AfterEach diff --git a/repository/src/test/java/com/iluwatar/repository/AppConfigTest.java b/repository/src/test/java/com/iluwatar/repository/AppConfigTest.java index 3fb1b427b232..1839a2523e6c 100644 --- a/repository/src/test/java/com/iluwatar/repository/AppConfigTest.java +++ b/repository/src/test/java/com/iluwatar/repository/AppConfigTest.java @@ -25,9 +25,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.support.AnnotationConfigContextLoader; import org.springframework.transaction.annotation.Transactional; import javax.sql.DataSource; @@ -42,7 +41,7 @@ * */ @ExtendWith(SpringExtension.class) -@ContextConfiguration(classes = { AppConfig.class }, loader = AnnotationConfigContextLoader.class) +@SpringBootTest(classes = { AppConfig.class }) public class AppConfigTest { @Autowired diff --git a/repository/src/test/java/com/iluwatar/repository/RepositoryTest.java b/repository/src/test/java/com/iluwatar/repository/RepositoryTest.java index 5b4b8e80c055..dc976cbe72d3 100644 --- a/repository/src/test/java/com/iluwatar/repository/RepositoryTest.java +++ b/repository/src/test/java/com/iluwatar/repository/RepositoryTest.java @@ -28,6 +28,7 @@ import java.util.Arrays; import java.util.List; +import java.util.Optional; import javax.annotation.Resource; @@ -35,7 +36,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.ContextConfiguration; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; import com.google.common.collect.Lists; @@ -45,7 +46,7 @@ * by {@link org.springframework.data.jpa.domain.Specification} are also test. */ @ExtendWith(SpringExtension.class) -@ContextConfiguration(locations = { "classpath:applicationContext.xml" }) +@SpringBootTest(properties = { "locations=classpath:applicationContext.xml" }) public class RepositoryTest { @Resource @@ -64,7 +65,7 @@ public class RepositoryTest { @BeforeEach public void setup() { - repository.save(persons); + repository.saveAll(persons); } @Test @@ -115,8 +116,8 @@ public void testFindAllByAgeBetweenSpec() { @Test public void testFindOneByNameEqualSpec() { - Person actual = repository.findOne(new PersonSpecifications.NameEqualSpec("Terry")); - assertEquals(terry, actual); + Optional actual = repository.findOne(new PersonSpecifications.NameEqualSpec("Terry")); + assertEquals(terry, actual.get()); } @AfterEach From f903d7e9a9379c79742ecc61a3901bdbe2a0a318 Mon Sep 17 00:00:00 2001 From: Joshua Jimenez Date: Tue, 8 Oct 2019 14:19:28 +0800 Subject: [PATCH 043/197] #496 Pipeline pattern (#967) * #496 Add pipeline module to parent pom :sparkles: * #496: Add main application class and test for pipeline * #496: Checkstyle format and add log messages on pipeline stages :art: * #496: Fill readme sections of pipeline :sparkles: * #496: Javadocs and checkstyle formatting :art: * #496: Follow PMD checks and add more explanation as block comment on App.java * #496: Apply requested PR changes by iluwatar :art: --- pipeline/README.md | 37 +++++++++++ pipeline/pom.xml | 47 +++++++++++++ .../main/java/com.iluwatar.pipeline/App.java | 66 +++++++++++++++++++ .../ConvertToCharArrayHandler.java | 45 +++++++++++++ .../java/com.iluwatar.pipeline/Handler.java | 32 +++++++++ .../java/com.iluwatar.pipeline/Pipeline.java | 46 +++++++++++++ .../RemoveAlphabetsHandler.java | 54 +++++++++++++++ .../RemoveDigitsHandler.java | 54 +++++++++++++++ .../java/com.iluwatar.pipeline/AppTest.java | 37 +++++++++++ .../com.iluwatar.pipeline/PipelineTest.java | 45 +++++++++++++ pom.xml | 1 + 11 files changed, 464 insertions(+) create mode 100644 pipeline/README.md create mode 100644 pipeline/pom.xml create mode 100644 pipeline/src/main/java/com.iluwatar.pipeline/App.java create mode 100644 pipeline/src/main/java/com.iluwatar.pipeline/ConvertToCharArrayHandler.java create mode 100644 pipeline/src/main/java/com.iluwatar.pipeline/Handler.java create mode 100644 pipeline/src/main/java/com.iluwatar.pipeline/Pipeline.java create mode 100644 pipeline/src/main/java/com.iluwatar.pipeline/RemoveAlphabetsHandler.java create mode 100644 pipeline/src/main/java/com.iluwatar.pipeline/RemoveDigitsHandler.java create mode 100644 pipeline/src/test/java/com.iluwatar.pipeline/AppTest.java create mode 100644 pipeline/src/test/java/com.iluwatar.pipeline/PipelineTest.java diff --git a/pipeline/README.md b/pipeline/README.md new file mode 100644 index 000000000000..e990affd62c7 --- /dev/null +++ b/pipeline/README.md @@ -0,0 +1,37 @@ +--- +layout: pattern +title: Pipeline +folder: pipeline +permalink: /patterns/pipeline/ +categories: Behavioral +tags: + - Java + - Functional + - Difficulty-Intermediate +--- + +## Intent +Allows processing of data in a series of stages by giving in an initial input and passing the processed output to be used by the next stages. + +## Applicability +Use the Pipeline pattern when you want to + +* execute individual stages that yields a final value +* add readability to complex sequence of operations by providing a fluent builder as an interface +* improve testability of code since stages will most likely be doing a single thing, complying to the [Single Responsibility Principle (SRP)](https://java-design-patterns.com/principles/#single-responsibility-principle) + +## Typical Use Case + +* implement stages and execute them in an ordered manner + +## Real world examples + +* [java.util.Stream](https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html) +* [Maven Build Lifecycle](http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html) +* [Functional Java](https://github.com/functionaljava/functionaljava) + +## Credits + +* [The Pipeline Pattern — for fun and profit](https://medium.com/@aaronweatherall/the-pipeline-pattern-for-fun-and-profit-9b5f43a98130) +* [The Pipeline design pattern (in Java)](https://medium.com/@deepakbapat/the-pipeline-design-pattern-in-java-831d9ce2fe21) +* [Pipelines | Microsoft Docs](https://docs.microsoft.com/en-us/previous-versions/msp-n-p/ff963548(v=pandp.10)) \ No newline at end of file diff --git a/pipeline/pom.xml b/pipeline/pom.xml new file mode 100644 index 000000000000..7ad60d5620e4 --- /dev/null +++ b/pipeline/pom.xml @@ -0,0 +1,47 @@ + + + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.22.0-SNAPSHOT + + pipeline + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.mockito + mockito-core + test + + + diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/App.java b/pipeline/src/main/java/com.iluwatar.pipeline/App.java new file mode 100644 index 000000000000..7efa2ecca003 --- /dev/null +++ b/pipeline/src/main/java/com.iluwatar.pipeline/App.java @@ -0,0 +1,66 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.pipeline; + +/** + * The Pipeline pattern uses ordered stages to process a sequence of input values. + * Each implemented task is represented by a stage of the pipeline. You can think of + * pipelines as similar to assembly lines in a factory, where each item in the assembly + * line is constructed in stages. The partially assembled item is passed from one assembly + * stage to another. The outputs of the assembly line occur in the same order as that of the + * inputs. + * + * Classes used in this example are suffixed with "Handlers", and synonymously refers to the + * "stage". + */ +public class App { + /** + * Specify the initial input type for the first stage handler and the expected output type + * of the last stage handler as type parameters for Pipeline. Use the fluent builder by + * calling addHandler to add more stage handlers on the pipeline. + */ + public static void main(String[] args) { + /* + Suppose we wanted to pass through a String to a series of filtering stages and convert it + as a char array on the last stage. + + - Stage handler 1 (pipe): Removing the alphabets, accepts a String input and returns the + processed String output. This will be used by the next handler as its input. + + - Stage handler 2 (pipe): Removing the digits, accepts a String input and returns the + processed String output. This shall also be used by the last handler we have. + + - Stage handler 3 (pipe): Converting the String input to a char array handler. We would + be returning a different type in here since that is what's specified by the requirement. + This means that at any stages along the pipeline, the handler can return any type of data + as long as it fulfills the requirements for the next handler's input. + + Suppose we wanted to add another handler after ConvertToCharArrayHandler. That handler + then is expected to receive an input of char[] array since that is the type being returned + by the previous handler, ConvertToCharArrayHandler. + */ + new Pipeline<>(new RemoveAlphabetsHandler()) + .addHandler(new RemoveDigitsHandler()) + .addHandler(new ConvertToCharArrayHandler()); + } +} diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/ConvertToCharArrayHandler.java b/pipeline/src/main/java/com.iluwatar.pipeline/ConvertToCharArrayHandler.java new file mode 100644 index 000000000000..b69241914980 --- /dev/null +++ b/pipeline/src/main/java/com.iluwatar.pipeline/ConvertToCharArrayHandler.java @@ -0,0 +1,45 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.pipeline; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Arrays; + +/** + * Stage handler that converts an input String to its char[] array counterpart. + */ +class ConvertToCharArrayHandler implements Handler { + + private final Logger logger = LoggerFactory.getLogger(ConvertToCharArrayHandler.class); + + @Override + public char[] process(String input) { + char[] characters = input.toCharArray(); + logger.info(String.format("Current handler: %s, input is %s of type %s, output is %s, of type %s", + ConvertToCharArrayHandler.class, input, String.class, Arrays.toString(characters), Character[].class)); + + return characters; + } +} diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/Handler.java b/pipeline/src/main/java/com.iluwatar.pipeline/Handler.java new file mode 100644 index 000000000000..7d2bc0db7f59 --- /dev/null +++ b/pipeline/src/main/java/com.iluwatar.pipeline/Handler.java @@ -0,0 +1,32 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.pipeline; + +/** + * Forms a contract to all stage handlers to accept a certain type of input and return a processed output. + * @param the input type of the handler + * @param the processed output type of the handler + */ +interface Handler { + O process(I input); +} \ No newline at end of file diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/Pipeline.java b/pipeline/src/main/java/com.iluwatar.pipeline/Pipeline.java new file mode 100644 index 000000000000..8e231bbc4d09 --- /dev/null +++ b/pipeline/src/main/java/com.iluwatar.pipeline/Pipeline.java @@ -0,0 +1,46 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.pipeline; + +/** + * Main Pipeline class that initially sets the current handler. Processed output + * of the initial handler is then passed as the input to the next stage handlers. + * @param the type of the input for the first stage handler + * @param the final stage handler's output type + */ +class Pipeline { + + private final Handler currentHandler; + + Pipeline(Handler currentHandler) { + this.currentHandler = currentHandler; + } + + Pipeline addHandler(Handler newHandler) { + return new Pipeline<>(input -> newHandler.process(currentHandler.process(input))); + } + + O execute(I input) { + return currentHandler.process(input); + } +} \ No newline at end of file diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/RemoveAlphabetsHandler.java b/pipeline/src/main/java/com.iluwatar.pipeline/RemoveAlphabetsHandler.java new file mode 100644 index 000000000000..2085052742fa --- /dev/null +++ b/pipeline/src/main/java/com.iluwatar.pipeline/RemoveAlphabetsHandler.java @@ -0,0 +1,54 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.pipeline; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Stage handler that returns a new instance of String without the alphabet characters of the input string. + */ +class RemoveAlphabetsHandler implements Handler { + + private final Logger logger = LoggerFactory.getLogger(RemoveAlphabetsHandler.class); + + @Override + public String process(String input) { + StringBuilder inputWithoutAlphabets = new StringBuilder(); + + for (int index = 0; index < input.length(); index++) { + char currentCharacter = input.charAt(index); + if (Character.isAlphabetic(currentCharacter)) { + continue; + } + + inputWithoutAlphabets.append(currentCharacter); + } + + String inputWithoutAlphabetsStr = inputWithoutAlphabets.toString(); + logger.info(String.format("Current handler: %s, input is %s of type %s, output is %s, of type %s", + RemoveAlphabetsHandler.class, input, String.class, inputWithoutAlphabetsStr, String.class)); + + return inputWithoutAlphabetsStr; + } +} \ No newline at end of file diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/RemoveDigitsHandler.java b/pipeline/src/main/java/com.iluwatar.pipeline/RemoveDigitsHandler.java new file mode 100644 index 000000000000..e0c0aa6a87b2 --- /dev/null +++ b/pipeline/src/main/java/com.iluwatar.pipeline/RemoveDigitsHandler.java @@ -0,0 +1,54 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.pipeline; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Stage handler that returns a new instance of String without the digit characters of the input string. + */ +class RemoveDigitsHandler implements Handler { + + private final Logger logger = LoggerFactory.getLogger(RemoveDigitsHandler.class); + + @Override + public String process(String input) { + StringBuilder inputWithoutDigits = new StringBuilder(); + + for (int index = 0; index < input.length(); index++) { + char currentCharacter = input.charAt(index); + if (Character.isDigit(currentCharacter)) { + continue; + } + + inputWithoutDigits.append(currentCharacter); + } + + String inputWithoutDigitsStr = inputWithoutDigits.toString(); + logger.info(String.format("Current handler: %s, input is %s of type %s, output is %s, of type %s", + RemoveDigitsHandler.class, input, String.class, inputWithoutDigitsStr, String.class)); + + return inputWithoutDigitsStr; + } +} \ No newline at end of file diff --git a/pipeline/src/test/java/com.iluwatar.pipeline/AppTest.java b/pipeline/src/test/java/com.iluwatar.pipeline/AppTest.java new file mode 100644 index 000000000000..79524575c13c --- /dev/null +++ b/pipeline/src/test/java/com.iluwatar.pipeline/AppTest.java @@ -0,0 +1,37 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.pipeline; + +import org.junit.jupiter.api.Test; + +/** + * Application Test + */ +public class AppTest { + + @Test + public void test() { + String[] args = {}; + App.main(args); + } +} diff --git a/pipeline/src/test/java/com.iluwatar.pipeline/PipelineTest.java b/pipeline/src/test/java/com.iluwatar.pipeline/PipelineTest.java new file mode 100644 index 000000000000..1a2676e25d05 --- /dev/null +++ b/pipeline/src/test/java/com.iluwatar.pipeline/PipelineTest.java @@ -0,0 +1,45 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.pipeline; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; + +/** + * Test for {@link Pipeline} + */ +public class PipelineTest { + + @Test + public void testAddHandlersToPipeline() { + Pipeline filters = new Pipeline<>(new RemoveAlphabetsHandler()) + .addHandler(new RemoveDigitsHandler()) + .addHandler(new ConvertToCharArrayHandler()); + + assertArrayEquals( + new char[] {'#', '!', '(', '&', '%', '#', '!'}, + filters.execute("#H!E(L&L0O%THE3R#34E!") + ); + } +} diff --git a/pom.xml b/pom.xml index 33219175ec9d..39cfee91c241 100644 --- a/pom.xml +++ b/pom.xml @@ -97,6 +97,7 @@ property intercepting-filter producer-consumer + pipeline poison-pill reader-writer-lock lazy-loading From 41b8d8047965f247c9a3dcf7aeb19046599c8583 Mon Sep 17 00:00:00 2001 From: erikgajdos1997 <56270468+erikgajdos1997@users.noreply.github.com> Date: Tue, 8 Oct 2019 17:08:56 +0200 Subject: [PATCH 044/197] Close #969 (#972) --- repository/src/main/resources/logback.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repository/src/main/resources/logback.xml b/repository/src/main/resources/logback.xml index 56b6a59bb6cf..81b998ad9021 100644 --- a/repository/src/main/resources/logback.xml +++ b/repository/src/main/resources/logback.xml @@ -42,11 +42,11 @@ - + - + From 90ea4506caa653711f69fabb99ee7ac26c4ecce7 Mon Sep 17 00:00:00 2001 From: Azureyjt Date: Tue, 8 Oct 2019 23:29:59 +0800 Subject: [PATCH 045/197] Leader Election Pattern (#923) * Fix issue #761: ThreadSafeDoubleCheckLocking.java: Instantiating by Reflection call will be successful if you do that firstly * Create leader election module * Create Interface of Instance and MessageManager * Create implementations with token ring algorithm * Change package structure. Create basic message system. * Implement heartbeat and heartbeat invoking message system * Implement election message handler * Add leader message handler * Add main entry point * Add comments * Update README.md * Fix checkstyle issue * Add Unit Tests * Add Unit Tests * Add bully leader selection * Change System.out to log print. Add MIT license in each file. * Add More java doc comments * Add unit test * Add unit tests --- leader-election/README.md | 31 ++++ leader-election/pom.xml | 43 +++++ .../leaderelection/AbstractInstance.java | 148 +++++++++++++++++ .../AbstractMessageManager.java | 73 +++++++++ .../com/iluwatar/leaderelection/Instance.java | 49 ++++++ .../com/iluwatar/leaderelection/Message.java | 76 +++++++++ .../leaderelection/MessageManager.java | 60 +++++++ .../iluwatar/leaderelection/MessageType.java | 62 +++++++ .../leaderelection/bully/BullyApp.java | 77 +++++++++ .../leaderelection/bully/BullyInstance.java | 121 ++++++++++++++ .../bully/BullyMessageManager.java | 117 ++++++++++++++ .../iluwatar/leaderelection/ring/RingApp.java | 77 +++++++++ .../leaderelection/ring/RingInstance.java | 133 +++++++++++++++ .../ring/RingMessageManager.java | 96 +++++++++++ .../iluwatar/leaderelection/MessageTest.java | 48 ++++++ .../leaderelection/bully/BullyAppTest.java | 39 +++++ .../bully/BullyMessageManagerTest.java | 151 ++++++++++++++++++ .../bully/BullyinstanceTest.java | 78 +++++++++ .../leaderelection/ring/RingAppTest.java | 39 +++++ .../leaderelection/ring/RingInstanceTest.java | 76 +++++++++ .../ring/RingMessageManagerTest.java | 123 ++++++++++++++ pom.xml | 2 + 22 files changed, 1719 insertions(+) create mode 100644 leader-election/README.md create mode 100644 leader-election/pom.xml create mode 100644 leader-election/src/main/java/com/iluwatar/leaderelection/AbstractInstance.java create mode 100644 leader-election/src/main/java/com/iluwatar/leaderelection/AbstractMessageManager.java create mode 100644 leader-election/src/main/java/com/iluwatar/leaderelection/Instance.java create mode 100644 leader-election/src/main/java/com/iluwatar/leaderelection/Message.java create mode 100644 leader-election/src/main/java/com/iluwatar/leaderelection/MessageManager.java create mode 100644 leader-election/src/main/java/com/iluwatar/leaderelection/MessageType.java create mode 100644 leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyApp.java create mode 100644 leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyInstance.java create mode 100644 leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyMessageManager.java create mode 100644 leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingApp.java create mode 100644 leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingInstance.java create mode 100644 leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingMessageManager.java create mode 100644 leader-election/src/test/java/com/iluwatar/leaderelection/MessageTest.java create mode 100644 leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyAppTest.java create mode 100644 leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyMessageManagerTest.java create mode 100644 leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyinstanceTest.java create mode 100644 leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingAppTest.java create mode 100644 leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingInstanceTest.java create mode 100644 leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingMessageManagerTest.java diff --git a/leader-election/README.md b/leader-election/README.md new file mode 100644 index 000000000000..36c2670dffa0 --- /dev/null +++ b/leader-election/README.md @@ -0,0 +1,31 @@ +--- +layout: pattern +title: Leader Election +folder: leader-election +permalink: /patterns/leader-election/ +categories: Other +tags: + - Java + - Difficulty-Beginner +--- + +## Intent +Leader Election pattern is commonly used in cloud system design. It can help to ensure that task instances selec the leader instance correctly and do not conflict with each other, cause contention for shared resources, or inadvertently interfere with the work that other task instances are performing. + +## Applicability +Use this pattern when + +* the tasks in a distributed application, such as a cloud-hosted solution, require careful coordination and there is no natural leader. + +Do not use this pattern when + +* there is a natural leader or dedicated process that can always act as the leader. For example, it may be possible to implement a singleton process that coordinates the task instances. If this process fails or becomes unhealthy, the system can shut it down and restart it. +* the coordination between tasks can be easily achieved by using a more lightweight mechanism. For example, if several task instances simply require coordinated access to a shared resource, a preferable solution might be to use optimistic or pessimistic locking to control access to that resource. + +## Real world examples + +* [Raft Leader Election](https://github.com/ronenhamias/raft-leader-election) + +## Credits + +* [ Cloud Design Patterns: Prescriptive Architecture Guidance for Cloud Applications](https://docs.microsoft.com/en-us/previous-versions/msp-n-p/dn568104(v=pandp.10)) diff --git a/leader-election/pom.xml b/leader-election/pom.xml new file mode 100644 index 000000000000..7c1312d01a1d --- /dev/null +++ b/leader-election/pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + java-design-patterns + com.iluwatar + 1.22.0-SNAPSHOT + + leader-election + + + org.junit.jupiter + junit-jupiter-engine + test + + + \ No newline at end of file diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractInstance.java b/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractInstance.java new file mode 100644 index 000000000000..5f153870a300 --- /dev/null +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractInstance.java @@ -0,0 +1,148 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; + +/** + * Abstract class of all the instance implementation classes. + */ +public abstract class AbstractInstance implements Instance, Runnable { + + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractInstance.class); + + protected static final int HEARTBEAT_INTERVAL = 5000; + + protected MessageManager messageManager; + protected Queue messageQueue; + protected final int localId; + protected int leaderId; + protected boolean alive; + + /** + * Constructor of BullyInstance. + */ + public AbstractInstance(MessageManager messageManager, int localId, int leaderId) { + this.messageManager = messageManager; + this.messageQueue = new ConcurrentLinkedQueue<>(); + this.localId = localId; + this.leaderId = leaderId; + this.alive = true; + } + + /** + * The instance will execute the message in its message queue periodically once it is alive. + */ + @Override + public void run() { + while (true) { + if (!this.messageQueue.isEmpty()) { + this.processMessage(this.messageQueue.remove()); + } + } + } + + /** + * Once messages are sent to the certain instance, it will firstly be added to the queue and wait to be executed. + * @param message Message sent by other instances + */ + @Override + public void onMessage(Message message) { + messageQueue.offer(message); + } + + /** + * Check if the instance is alive or not. + * @return {@code true} if the instance is alive. + */ + @Override + public boolean isAlive() { + return alive; + } + + /** + * Set the health status of the certain instance. + * @param alive {@code true} for alive. + */ + @Override + public void setAlive(boolean alive) { + this.alive = alive; + } + + /** + * Process the message according to its type. + * @param message Message polled from queue. + */ + private void processMessage(Message message) { + switch (message.getType()) { + case ELECTION: + LOGGER.info("Instance " + localId + " - Election Message handling..."); + handleElectionMessage(message); + break; + case LEADER: + LOGGER.info("Instance " + localId + " - Leader Message handling..."); + handleLeaderMessage(message); + break; + case HEARTBEAT: + LOGGER.info("Instance " + localId + " - Heartbeat Message handling..."); + handleHeartbeatMessage(message); + break; + case ELECTION_INVOKE: + LOGGER.info("Instance " + localId + " - Election Invoke Message handling..."); + handleElectionInvokeMessage(); + break; + case LEADER_INVOKE: + LOGGER.info("Instance " + localId + " - Leader Invoke Message handling..."); + handleLeaderInvokeMessage(); + break; + case HEARTBEAT_INVOKE: + LOGGER.info("Instance " + localId + " - Heartbeat Invoke Message handling..."); + handleHeartbeatInvokeMessage(); + break; + default: + break; + } + } + + /** + * Abstract methods to handle different types of message. These methods need to be implemented in concrete instance + * class to implement corresponding leader-selection pattern. + */ + protected abstract void handleElectionMessage(Message message); + + protected abstract void handleElectionInvokeMessage(); + + protected abstract void handleLeaderMessage(Message message); + + protected abstract void handleLeaderInvokeMessage(); + + protected abstract void handleHeartbeatMessage(Message message); + + protected abstract void handleHeartbeatInvokeMessage(); + +} diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractMessageManager.java b/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractMessageManager.java new file mode 100644 index 000000000000..4384da25f79d --- /dev/null +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractMessageManager.java @@ -0,0 +1,73 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * Abstract class of all the message manager classes. + */ +public abstract class AbstractMessageManager implements MessageManager { + + /** + * Contain all the instances in the system. Key is its ID, and value is the instance itself. + */ + protected Map instanceMap; + + /** + * Construtor of AbstractMessageManager + */ + public AbstractMessageManager(Map instanceMap) { + this.instanceMap = instanceMap; + } + + /** + * Find the next instance with smallest ID. + * @return The next instance. + */ + protected Instance findNextInstance(int currentId) { + Instance result = null; + List candidateList = instanceMap.keySet() + .stream() + .filter((i) -> i > currentId && instanceMap.get(i).isAlive()) + .sorted() + .collect(Collectors.toList()); + if (candidateList.isEmpty()) { + int index = instanceMap.keySet() + .stream() + .filter((i) -> instanceMap.get(i).isAlive()) + .sorted() + .collect(Collectors.toList()) + .get(0); + result = instanceMap.get(index); + } else { + int index = candidateList.get(0); + result = instanceMap.get(index); + } + return result; + } + +} diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/Instance.java b/leader-election/src/main/java/com/iluwatar/leaderelection/Instance.java new file mode 100644 index 000000000000..abaa62791185 --- /dev/null +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/Instance.java @@ -0,0 +1,49 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection; + +/** + * Instance interface + */ +public interface Instance { + + /** + * Check if the instance is alive or not. + * @return {@code true} if the instance is alive. + */ + boolean isAlive(); + + /** + * Set the health status of the certain instance. + * @param alive {@code true} for alive. + */ + void setAlive(boolean alive); + + /** + * Consume messages from other instances. + * @param message Message sent by other instances + */ + void onMessage(Message message); + +} diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/Message.java b/leader-election/src/main/java/com/iluwatar/leaderelection/Message.java new file mode 100644 index 000000000000..7ac79e4bcd46 --- /dev/null +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/Message.java @@ -0,0 +1,76 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection; + +import java.util.Objects; + +/** + * Message used to transport data between instances. + */ +public class Message { + + private MessageType type; + + private String content; + + public Message() {} + + public Message(MessageType type, String content) { + this.type = type; + this.content = content; + } + + public MessageType getType() { + return type; + } + + public void setType(MessageType type) { + this.type = type; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Message message = (Message) o; + return type == message.type && Objects.equals(content, message.content); + } + + @Override + public int hashCode() { + return Objects.hash(type, content); + } +} diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/MessageManager.java b/leader-election/src/main/java/com/iluwatar/leaderelection/MessageManager.java new file mode 100644 index 000000000000..56e78a00856a --- /dev/null +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/MessageManager.java @@ -0,0 +1,60 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection; + +/** + * MessageManager interface + */ +public interface MessageManager { + + /** + * Send heartbeat message to leader instance to check whether the leader instance is alive. + * @param leaderId Instance ID of leader instance. + * @return {@code true} if leader instance is alive, or {@code false} if not. + */ + boolean sendHeartbeatMessage(int leaderId); + + /** + * Send election message to other instances. + * @param currentId Instance ID of which sends this message. + * @param content Election message content. + * @return {@code true} if the message is accepted by the target instances. + */ + boolean sendElectionMessage(int currentId, String content); + + /** + * Send new leader notification message to other instances. + * @param currentId Instance ID of which sends this message. + * @param leaderId Leader message content. + * @return {@code true} if the message is accepted by the target instances. + */ + boolean sendLeaderMessage(int currentId, int leaderId); + + /** + * Send heartbeat invoke message. This will invoke heartbeat task in the target instance. + * @param currentId Instance ID of which sends this message. + */ + void sendHeartbeatInvokeMessage(int currentId); + +} diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/MessageType.java b/leader-election/src/main/java/com/iluwatar/leaderelection/MessageType.java new file mode 100644 index 000000000000..17f658ec4244 --- /dev/null +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/MessageType.java @@ -0,0 +1,62 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection; + +/** + * Message Type enum + */ +public enum MessageType { + + /** + * Start the election. The content of the message stores ID(s) of the candidate instance(s). + */ + ELECTION, + + /** + * Nodify the new leader. The content of the message should be the leader ID. + */ + LEADER, + + /** + * Check health of current leader instance. + */ + HEARTBEAT, + + /** + * Inform target instance to start election. + */ + ELECTION_INVOKE, + + /** + * Inform target instance to notify all the other instance that it is the new leader. + */ + LEADER_INVOKE, + + /** + * Inform target instance to start heartbeat. + */ + HEARTBEAT_INVOKE + +} + diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyApp.java b/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyApp.java new file mode 100644 index 000000000000..7355b34456a9 --- /dev/null +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyApp.java @@ -0,0 +1,77 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection.bully; + +import com.iluwatar.leaderelection.Instance; +import com.iluwatar.leaderelection.Message; +import com.iluwatar.leaderelection.MessageManager; +import com.iluwatar.leaderelection.MessageType; + +import java.util.HashMap; +import java.util.Map; + +/** + * Example of how to use bully leader election. Initially 5 instances is created in the clould + * system, and the instance with ID 1 is set as leader. After the system is started stop the + * leader instance, and the new leader will be elected. + */ +public class BullyApp { + + /** + * Program entry point + */ + public static void main(String[] args) { + + Map instanceMap = new HashMap<>(); + MessageManager messageManager = new BullyMessageManager(instanceMap); + + BullyInstance instance1 = new BullyInstance(messageManager, 1, 1); + BullyInstance instance2 = new BullyInstance(messageManager, 2, 1); + BullyInstance instance3 = new BullyInstance(messageManager, 3, 1); + BullyInstance instance4 = new BullyInstance(messageManager, 4, 1); + BullyInstance instance5 = new BullyInstance(messageManager, 5, 1); + + instanceMap.put(1, instance1); + instanceMap.put(2, instance2); + instanceMap.put(3, instance3); + instanceMap.put(4, instance4); + instanceMap.put(5, instance5); + + instance4.onMessage(new Message(MessageType.HEARTBEAT_INVOKE, "")); + + Thread thread1 = new Thread(instance1); + Thread thread2 = new Thread(instance2); + Thread thread3 = new Thread(instance3); + Thread thread4 = new Thread(instance4); + Thread thread5 = new Thread(instance5); + + thread1.start(); + thread2.start(); + thread3.start(); + thread4.start(); + thread5.start(); + + instance1.setAlive(false); + } +} diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyInstance.java b/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyInstance.java new file mode 100644 index 000000000000..70a9c60f341a --- /dev/null +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyInstance.java @@ -0,0 +1,121 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection.bully; + +import com.iluwatar.leaderelection.AbstractInstance; +import com.iluwatar.leaderelection.Message; +import com.iluwatar.leaderelection.MessageManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Impelemetation with bully algorithm. Each instance should have a sequential id and is able to + * communicate with other instances in the system. Initially the instance with smallest (or largest) + * ID is selected to be the leader. All the other instances send heartbeat message to leader periodically + * to check its health. If one certain instance finds the server done, it will send an election message + * to all the instances of which the ID is larger. If the target instance is alive, it will return an + * alive message (in this sample return true) and then send election message with its ID. If not, + * the original instance will send leader message to all the other instances. + */ +public class BullyInstance extends AbstractInstance { + + private static final Logger LOGGER = LoggerFactory.getLogger(BullyInstance.class); + + /** + * Constructor of BullyInstance. + */ + public BullyInstance(MessageManager messageManager, int localId, int leaderId) { + super(messageManager, localId, leaderId); + } + + /** + * Process the heartbeat invoke message. After receiving the message, the instance will send a heartbeat + * to leader to check its health. If alive, it will inform the next instance to do the heartbeat. If not, + * it will start the election process. + */ + @Override + protected void handleHeartbeatInvokeMessage() { + try { + boolean isLeaderAlive = messageManager.sendHeartbeatMessage(leaderId); + if (isLeaderAlive) { + LOGGER.info("Instance " + localId + "- Leader is alive."); + Thread.sleep(HEARTBEAT_INTERVAL); + messageManager.sendHeartbeatInvokeMessage(localId); + } else { + LOGGER.info("Instance " + localId + "- Leader is not alive. Start election."); + boolean electionResult = messageManager.sendElectionMessage(localId, String.valueOf(localId)); + if (electionResult) { + LOGGER.info("Instance " + localId + "- Succeed in election. Start leader notification."); + messageManager.sendLeaderMessage(localId, localId); + } + } + } catch (InterruptedException e) { + LOGGER.info("Instance " + localId + "- Interrupted."); + } + } + + /** + * Process election invoke message. Send election message to all the instances with smaller ID. If any + * one of them is alive, do nothing. If no instance alive, send leader message to all the alive instance + * and restart heartbeat. + */ + @Override + protected void handleElectionInvokeMessage() { + if (!isLeader()) { + LOGGER.info("Instance " + localId + "- Start election."); + boolean electionResult = messageManager.sendElectionMessage(localId, String.valueOf(localId)); + if (electionResult) { + LOGGER.info("Instance " + localId + "- Succeed in election. Start leader notification."); + leaderId = localId; + messageManager.sendLeaderMessage(localId, localId); + messageManager.sendHeartbeatInvokeMessage(localId); + } + } + } + + /** + * Process leader message. Update local leader information. + */ + @Override + protected void handleLeaderMessage(Message message) { + leaderId = Integer.valueOf(message.getContent()); + LOGGER.info("Instance " + localId + " - Leader update done."); + } + + private boolean isLeader() { + return localId == leaderId; + } + + /** + * Not used in Bully instance. + */ + @Override + protected void handleLeaderInvokeMessage() {} + + @Override + protected void handleHeartbeatMessage(Message message) {} + + @Override + protected void handleElectionMessage(Message message) {} +} diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyMessageManager.java b/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyMessageManager.java new file mode 100644 index 000000000000..3fcadefba2de --- /dev/null +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyMessageManager.java @@ -0,0 +1,117 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection.bully; + +import com.iluwatar.leaderelection.AbstractMessageManager; +import com.iluwatar.leaderelection.Instance; +import com.iluwatar.leaderelection.Message; +import com.iluwatar.leaderelection.MessageType; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * Implementation of BullyMessageManager + */ +public class BullyMessageManager extends AbstractMessageManager { + + /** + * Constructor of BullyMessageManager. + */ + public BullyMessageManager(Map instanceMap) { + super(instanceMap); + } + + /** + * Send heartbeat message to current leader instance to check the health. + * @param leaderId leaderID + * @return {@code true} if the leader is alive. + */ + @Override + public boolean sendHeartbeatMessage(int leaderId) { + Instance leaderInstance = instanceMap.get(leaderId); + boolean alive = leaderInstance.isAlive(); + return alive; + } + + /** + * Send election message to all the instances with smaller ID. + * @param currentId Instance ID of which sends this message. + * @param content Election message content. + * @return {@code true} if no alive instance has smaller ID, so that the election is accepted. + */ + @Override + public boolean sendElectionMessage(int currentId, String content) { + List candidateList = findElectionCandidateInstanceList(currentId); + if (candidateList.isEmpty()) { + return true; + } else { + Message electionMessage = new Message(MessageType.ELECTION_INVOKE, ""); + candidateList.stream() + .forEach((i) -> instanceMap.get(i).onMessage(electionMessage)); + return false; + } + } + + /** + * Send leader message to all the instances to notify the new leader. + * @param currentId Instance ID of which sends this message. + * @param leaderId Leader message content. + * @return {@code true} if the message is accepted. + */ + @Override + public boolean sendLeaderMessage(int currentId, int leaderId) { + Message leaderMessage = new Message(MessageType.LEADER, String.valueOf(leaderId)); + instanceMap.keySet() + .stream() + .filter((i) -> i != currentId) + .forEach((i) -> instanceMap.get(i).onMessage(leaderMessage)); + return false; + } + + /** + * Send heartbeat invoke message to the next instance. + * @param currentId Instance ID of which sends this message. + */ + @Override + public void sendHeartbeatInvokeMessage(int currentId) { + Instance nextInstance = this.findNextInstance(currentId); + Message heartbeatInvokeMessage = new Message(MessageType.HEARTBEAT_INVOKE, ""); + nextInstance.onMessage(heartbeatInvokeMessage); + } + + /** + * Find all the alive instances with smaller ID than current instance. + * @param currentId ID of current instance. + * @return ID list of all the candidate instance. + */ + private List findElectionCandidateInstanceList(int currentId) { + return instanceMap.keySet() + .stream() + .filter((i) -> i < currentId && instanceMap.get(i).isAlive()) + .collect(Collectors.toList()); + } + +} diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingApp.java b/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingApp.java new file mode 100644 index 000000000000..ade5bb70dc29 --- /dev/null +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingApp.java @@ -0,0 +1,77 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection.ring; + +import com.iluwatar.leaderelection.Instance; +import com.iluwatar.leaderelection.Message; +import com.iluwatar.leaderelection.MessageManager; +import com.iluwatar.leaderelection.MessageType; + +import java.util.HashMap; +import java.util.Map; + +/** + * Example of how to use ring leader election. Initially 5 instances is created in the clould + * system, and the instance with ID 1 is set as leader. After the system is started stop the + * leader instance, and the new leader will be elected. + */ +public class RingApp { + + /** + * Program entry point + */ + public static void main(String[] args) { + + Map instanceMap = new HashMap<>(); + MessageManager messageManager = new RingMessageManager(instanceMap); + + RingInstance instance1 = new RingInstance(messageManager, 1, 1); + RingInstance instance2 = new RingInstance(messageManager, 2, 1); + RingInstance instance3 = new RingInstance(messageManager, 3, 1); + RingInstance instance4 = new RingInstance(messageManager, 4, 1); + RingInstance instance5 = new RingInstance(messageManager, 5, 1); + + instanceMap.put(1, instance1); + instanceMap.put(2, instance2); + instanceMap.put(3, instance3); + instanceMap.put(4, instance4); + instanceMap.put(5, instance5); + + instance2.onMessage(new Message(MessageType.HEARTBEAT_INVOKE, "")); + + Thread thread1 = new Thread(instance1); + Thread thread2 = new Thread(instance2); + Thread thread3 = new Thread(instance3); + Thread thread4 = new Thread(instance4); + Thread thread5 = new Thread(instance5); + + thread1.start(); + thread2.start(); + thread3.start(); + thread4.start(); + thread5.start(); + + instance1.setAlive(false); + } +} diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingInstance.java b/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingInstance.java new file mode 100644 index 000000000000..e3472e4b4669 --- /dev/null +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingInstance.java @@ -0,0 +1,133 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection.ring; + +import com.iluwatar.leaderelection.AbstractInstance; +import com.iluwatar.leaderelection.Message; +import com.iluwatar.leaderelection.MessageManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Implementation with token ring algorithm. The instances in the system are organized as a ring. + * Each instance should have a sequential id and the instance with smallest (or largest) id should + * be the initial leader. All the other instances send heartbeat message to leader periodically + * to check its health. If one certain instance finds the server done, it will send an election + * message to the next alive instance in the ring, which contains its own ID. Then the next instance + * add its ID into the message and pass it to the next. After all the alive instances' ID are add + * to the message, the message is send back to the first instance and it will choose the instance + * with smallest ID to be the new leader, and then send a leader message to other instances to + * inform the result. + */ +public class RingInstance extends AbstractInstance { + + private static final Logger LOGGER = LoggerFactory.getLogger(RingInstance.class); + + /** + * Constructor of RingInstance. + */ + public RingInstance(MessageManager messageManager, int localId, int leaderId) { + super(messageManager, localId, leaderId); + } + + /** + * Process the heartbeat invoke message. After receiving the message, the instance will send a heartbeat + * to leader to check its health. If alive, it will inform the next instance to do the heartbeat. If not, + * it will start the election process. + */ + @Override + protected void handleHeartbeatInvokeMessage() { + try { + boolean isLeaderAlive = messageManager.sendHeartbeatMessage(this.leaderId); + if (isLeaderAlive) { + LOGGER.info("Instance " + localId + "- Leader is alive. Start next heartbeat in 5 second."); + Thread.sleep(HEARTBEAT_INTERVAL); + messageManager.sendHeartbeatInvokeMessage(this.localId); + } else { + LOGGER.info("Instance " + localId + "- Leader is not alive. Start election."); + messageManager.sendElectionMessage(this.localId, String.valueOf(this.localId)); + } + } catch (InterruptedException e) { + LOGGER.info("Instance " + localId + "- Interrupted."); + } + } + + /** + * Process election message. If the local ID is contained in the ID list, the instance will select the + * alive instance with smallest ID to be the new leader, and send the leader inform message. If not, + * it will add its local ID to the list and send the message to the next instance in the ring. + */ + @Override + protected void handleElectionMessage(Message message) { + String content = message.getContent(); + LOGGER.info("Instance " + localId + " - Election Message: " + content); + List candidateList = + Arrays.stream(content.trim().split(",")) + .map(Integer::valueOf) + .sorted() + .collect(Collectors.toList()); + if (candidateList.contains(localId)) { + int newLeaderId = candidateList.get(0); + LOGGER.info("Instance " + localId + " - New leader should be " + newLeaderId + "."); + messageManager.sendLeaderMessage(localId, newLeaderId); + } else { + content += "," + localId; + messageManager.sendElectionMessage(localId, content); + } + } + + /** + * Process leader Message. The instance will set the leader ID to be the new one and send the message to + * the next instance until all the alive instance in the ring is informed. + */ + @Override + protected void handleLeaderMessage(Message message) { + int newLeaderId = Integer.valueOf(message.getContent()); + if (this.leaderId != newLeaderId) { + LOGGER.info("Instance " + localId + " - Update leaderID"); + this.leaderId = newLeaderId; + messageManager.sendLeaderMessage(localId, newLeaderId); + } else { + LOGGER.info("Instance " + localId + " - Leader update done. Start heartbeat."); + messageManager.sendHeartbeatInvokeMessage(localId); + } + } + + /** + * Not used in Ring instance. + */ + @Override + protected void handleLeaderInvokeMessage() {} + + @Override + protected void handleHeartbeatMessage(Message message) {} + + @Override + protected void handleElectionInvokeMessage() {} + +} diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingMessageManager.java b/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingMessageManager.java new file mode 100644 index 000000000000..257a9f764d97 --- /dev/null +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingMessageManager.java @@ -0,0 +1,96 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection.ring; + +import com.iluwatar.leaderelection.AbstractMessageManager; +import com.iluwatar.leaderelection.Instance; +import com.iluwatar.leaderelection.Message; +import com.iluwatar.leaderelection.MessageType; + +import java.util.Map; + +/** + * Implementation of RingMessageManager + */ +public class RingMessageManager extends AbstractMessageManager { + + /** + * Constructor of RingMessageManager. + */ + public RingMessageManager(Map instanceMap) { + super(instanceMap); + } + + /** + * Send heartbeat message to current leader instance to check the health. + * @param leaderId leaderID + * @return {@code true} if the leader is alive. + */ + @Override + public boolean sendHeartbeatMessage(int leaderId) { + Instance leaderInstance = instanceMap.get(leaderId); + boolean alive = leaderInstance.isAlive(); + return alive; + } + + /** + * Send election message to the next instance. + * @param currentId currentID + * @param content list contains all the IDs of instances which have received this election message. + * @return {@code true} if the election message is accepted by the target instance. + */ + @Override + public boolean sendElectionMessage(int currentId, String content) { + Instance nextInstance = this.findNextInstance(currentId); + Message electionMessage = new Message(MessageType.ELECTION, content); + nextInstance.onMessage(electionMessage); + return true; + } + + /** + * Send leader message to the next instance. + * @param currentId Instance ID of which sends this message. + * @param leaderId Leader message content. + * @return {@code true} if the leader message is accepted by the target instance. + */ + @Override + public boolean sendLeaderMessage(int currentId, int leaderId) { + Instance nextInstance = this.findNextInstance(currentId); + Message leaderMessage = new Message(MessageType.LEADER, String.valueOf(leaderId)); + nextInstance.onMessage(leaderMessage); + return true; + } + + /** + * Send heartbeat invoke message to the next instance. + * @param currentId Instance ID of which sends this message. + */ + @Override + public void sendHeartbeatInvokeMessage(int currentId) { + Instance nextInstance = this.findNextInstance(currentId); + Message heartbeatInvokeMessage = new Message(MessageType.HEARTBEAT_INVOKE, ""); + nextInstance.onMessage(heartbeatInvokeMessage); + } + +} diff --git a/leader-election/src/test/java/com/iluwatar/leaderelection/MessageTest.java b/leader-election/src/test/java/com/iluwatar/leaderelection/MessageTest.java new file mode 100644 index 000000000000..3cd5b93d9fdd --- /dev/null +++ b/leader-election/src/test/java/com/iluwatar/leaderelection/MessageTest.java @@ -0,0 +1,48 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Message test case. + */ +public class MessageTest { + + @Test + public void testGetType() { + Message message = new Message(MessageType.HEARTBEAT, ""); + assertEquals(MessageType.HEARTBEAT, message.getType()); + } + + @Test + public void testGetContent() { + String content = "test"; + Message message = new Message(MessageType.HEARTBEAT, content); + assertEquals(content, message.getContent()); + } + +} diff --git a/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyAppTest.java b/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyAppTest.java new file mode 100644 index 000000000000..b4b527d5a813 --- /dev/null +++ b/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyAppTest.java @@ -0,0 +1,39 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection.bully; + +import org.junit.jupiter.api.Test; + +/** + * BullyApp unit test. + */ +public class BullyAppTest { + + @Test + public void test() { + String[] args = {}; + BullyApp.main(args); + } + +} diff --git a/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyMessageManagerTest.java b/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyMessageManagerTest.java new file mode 100644 index 000000000000..3a8e35b54abe --- /dev/null +++ b/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyMessageManagerTest.java @@ -0,0 +1,151 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection.bully; + +import com.iluwatar.leaderelection.*; +import com.iluwatar.leaderelection.ring.RingInstance; +import com.iluwatar.leaderelection.ring.RingMessageManager; +import org.junit.jupiter.api.Test; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; +import java.util.Queue; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * BullyMessageManager unit test. + */ +public class BullyMessageManagerTest { + + @Test + public void testSendHeartbeatMessage() { + Instance instance1 = new BullyInstance(null, 1, 1); + Map instanceMap = new HashMap<>(); + instanceMap.put(1, instance1); + MessageManager messageManager = new BullyMessageManager(instanceMap); + assertTrue(messageManager.sendHeartbeatMessage(1)); + } + + @Test + public void testSendElectionMessageNotAccepted() { + try { + Instance instance1 = new BullyInstance(null, 1, 1); + Instance instance2 = new BullyInstance(null, 1, 2); + Instance instance3 = new BullyInstance(null, 1, 3); + Instance instance4 = new BullyInstance(null, 1, 4); + Map instanceMap = new HashMap<>(); + instanceMap.put(1, instance1); + instanceMap.put(2, instance2); + instanceMap.put(3, instance3); + instanceMap.put(4, instance4); + instance1.setAlive(false); + MessageManager messageManager = new BullyMessageManager(instanceMap); + boolean result = messageManager.sendElectionMessage(3, "3"); + Class instanceClass = AbstractInstance.class; + Field messageQueueField = instanceClass.getDeclaredField("messageQueue"); + messageQueueField.setAccessible(true); + Message message2 = ((Queue) messageQueueField.get(instance2)).poll(); + int instance4QueueSize = ((Queue) messageQueueField.get(instance4)).size(); + Message expectedMessage = new Message(MessageType.ELECTION_INVOKE, ""); + assertEquals(message2, expectedMessage); + assertEquals(instance4QueueSize, 0); + assertEquals(result, false); + } catch (IllegalAccessException | NoSuchFieldException e) { + fail("Error to access private field."); + } + } + + @Test + public void testElectionMessageAccepted() { + Instance instance1 = new BullyInstance(null, 1, 1); + Instance instance2 = new BullyInstance(null, 1, 2); + Instance instance3 = new BullyInstance(null, 1, 3); + Instance instance4 = new BullyInstance(null, 1, 4); + Map instanceMap = new HashMap<>(); + instanceMap.put(1, instance1); + instanceMap.put(2, instance2); + instanceMap.put(3, instance3); + instanceMap.put(4, instance4); + instance1.setAlive(false); + MessageManager messageManager = new BullyMessageManager(instanceMap); + boolean result = messageManager.sendElectionMessage(2, "2"); + assertEquals(result, true); + } + + @Test + public void testSendLeaderMessage() { + try { + Instance instance1 = new BullyInstance(null, 1, 1); + Instance instance2 = new BullyInstance(null, 1, 2); + Instance instance3 = new BullyInstance(null, 1, 3); + Instance instance4 = new BullyInstance(null, 1, 4); + Map instanceMap = new HashMap<>(); + instanceMap.put(1, instance1); + instanceMap.put(2, instance2); + instanceMap.put(3, instance3); + instanceMap.put(4, instance4); + instance1.setAlive(false); + MessageManager messageManager = new BullyMessageManager(instanceMap); + messageManager.sendLeaderMessage(2, 2); + Class instanceClass = AbstractInstance.class; + Field messageQueueField = instanceClass.getDeclaredField("messageQueue"); + messageQueueField.setAccessible(true); + Message message3 = ((Queue) messageQueueField.get(instance3)).poll(); + Message message4 = ((Queue) messageQueueField.get(instance4)).poll(); + Message expectedMessage = new Message(MessageType.LEADER, "2"); + assertEquals(message3, expectedMessage); + assertEquals(message4, expectedMessage); + } catch (IllegalAccessException | NoSuchFieldException e) { + fail("Error to access private field."); + } + } + + @Test + public void testSendHeartbeatInvokeMessage() { + try { + Instance instance1 = new BullyInstance(null, 1, 1); + Instance instance2 = new BullyInstance(null, 1, 2); + Instance instance3 = new BullyInstance(null, 1, 3); + Map instanceMap = new HashMap<>(); + instanceMap.put(1, instance1); + instanceMap.put(2, instance2); + instanceMap.put(3, instance3); + MessageManager messageManager = new BullyMessageManager(instanceMap); + messageManager.sendHeartbeatInvokeMessage(2); + Message message = new Message(MessageType.HEARTBEAT_INVOKE, ""); + Class instanceClass = AbstractInstance.class; + Field messageQueueField = instanceClass.getDeclaredField("messageQueue"); + messageQueueField.setAccessible(true); + Message messageSent = ((Queue) messageQueueField.get(instance3)).poll(); + assertEquals(messageSent.getType(), message.getType()); + assertEquals(messageSent.getContent(), message.getContent()); + } catch (NoSuchFieldException | IllegalAccessException e) { + fail("Error to access private field."); + } + } + + +} diff --git a/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyinstanceTest.java b/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyinstanceTest.java new file mode 100644 index 000000000000..7581a8af1247 --- /dev/null +++ b/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyinstanceTest.java @@ -0,0 +1,78 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection.bully; + +import com.iluwatar.leaderelection.AbstractInstance; +import com.iluwatar.leaderelection.Message; +import com.iluwatar.leaderelection.MessageType; +import org.junit.jupiter.api.Test; + +import java.lang.reflect.Field; +import java.util.Queue; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * BullyInstance unit test. + */ +public class BullyinstanceTest { + + @Test + public void testOnMessage() { + try { + final BullyInstance bullyInstance = new BullyInstance(null, 1, 1); + Message bullyMessage = new Message(MessageType.HEARTBEAT, ""); + bullyInstance.onMessage(bullyMessage); + Class instanceClass = AbstractInstance.class; + Field messageQueueField = instanceClass.getDeclaredField("messageQueue"); + messageQueueField.setAccessible(true); + assertEquals(bullyMessage, ((Queue) messageQueueField.get(bullyInstance)).poll()); + } catch (IllegalAccessException | NoSuchFieldException e) { + fail("fail to access messasge queue."); + } + + } + + @Test + public void testIsAlive() { + try { + final BullyInstance bullyInstance = new BullyInstance(null, 1, 1); + Class instanceClass = AbstractInstance.class; + Field aliveField = instanceClass.getDeclaredField("alive"); + aliveField.setAccessible(true); + aliveField.set(bullyInstance, false); + assertFalse(bullyInstance.isAlive()); + } catch (NoSuchFieldException | IllegalAccessException e) { + fail("Fail to access field alive."); + } + } + + @Test + public void testSetAlive() { + final BullyInstance bullyInstance = new BullyInstance(null, 1, 1); + bullyInstance.setAlive(false); + assertFalse(bullyInstance.isAlive()); + } + +} diff --git a/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingAppTest.java b/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingAppTest.java new file mode 100644 index 000000000000..c6f50bc799fd --- /dev/null +++ b/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingAppTest.java @@ -0,0 +1,39 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection.ring; + +import org.junit.jupiter.api.Test; + +/** + * RingApp unit test. + */ +public class RingAppTest { + + @Test + public void test() { + String[] args = {}; + RingApp.main(args); + } + +} diff --git a/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingInstanceTest.java b/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingInstanceTest.java new file mode 100644 index 000000000000..65c3916cc535 --- /dev/null +++ b/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingInstanceTest.java @@ -0,0 +1,76 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection.ring; + +import com.iluwatar.leaderelection.AbstractInstance; +import com.iluwatar.leaderelection.Message; +import com.iluwatar.leaderelection.MessageType; +import org.junit.jupiter.api.Test; + +import java.lang.reflect.Field; +import java.util.Queue; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * RingInstance unit test. + */ +public class RingInstanceTest { + + @Test + public void testOnMessage() { + try { + final RingInstance ringInstance = new RingInstance(null, 1, 1); + Message ringMessage = new Message(MessageType.HEARTBEAT, ""); + ringInstance.onMessage(ringMessage); + Class ringInstanceClass = AbstractInstance.class; + Field messageQueueField = ringInstanceClass.getDeclaredField("messageQueue"); + messageQueueField.setAccessible(true); + assertEquals(ringMessage, ((Queue) messageQueueField.get(ringInstance)).poll()); + } catch (IllegalAccessException | NoSuchFieldException e) { + fail("fail to access messasge queue."); + } + } + + @Test + public void testIsAlive() { + try { + final RingInstance ringInstance = new RingInstance(null, 1, 1); + Class ringInstanceClass = AbstractInstance.class; + Field aliveField = ringInstanceClass.getDeclaredField("alive"); + aliveField.setAccessible(true); + aliveField.set(ringInstance, false); + assertFalse(ringInstance.isAlive()); + } catch (NoSuchFieldException | IllegalAccessException e) { + fail("Fail to access field alive."); + } + } + + @Test + public void testSetAlive() { + final RingInstance ringInstance = new RingInstance(null, 1, 1); + ringInstance.setAlive(false); + assertFalse(ringInstance.isAlive()); + } +} diff --git a/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingMessageManagerTest.java b/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingMessageManagerTest.java new file mode 100644 index 000000000000..64d5af69f5bb --- /dev/null +++ b/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingMessageManagerTest.java @@ -0,0 +1,123 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.leaderelection.ring; + +import com.iluwatar.leaderelection.*; +import org.junit.jupiter.api.Test; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; +import java.util.Queue; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * RingMessageManager unit test. + */ +public class RingMessageManagerTest { + + @Test + public void testSendHeartbeatMessage() { + Instance instance1 = new RingInstance(null, 1, 1); + Map instanceMap = new HashMap<>(); + instanceMap.put(1, instance1); + MessageManager messageManager = new RingMessageManager(instanceMap); + assertTrue(messageManager.sendHeartbeatMessage(1)); + } + + @Test + public void testSendElectionMessage() { + try { + Instance instance1 = new RingInstance(null, 1, 1); + Instance instance2 = new RingInstance(null, 1, 2); + Instance instance3 = new RingInstance(null, 1, 3); + Map instanceMap = new HashMap<>(); + instanceMap.put(1, instance1); + instanceMap.put(2, instance2); + instanceMap.put(3, instance3); + MessageManager messageManager = new RingMessageManager(instanceMap); + String messageContent = "2"; + messageManager.sendElectionMessage(2, messageContent); + Message ringMessage = new Message(MessageType.ELECTION, messageContent); + Class instanceClass = AbstractInstance.class; + Field messageQueueField = instanceClass.getDeclaredField("messageQueue"); + messageQueueField.setAccessible(true); + Message ringMessageSent = ((Queue) messageQueueField.get(instance3)).poll(); + assertEquals(ringMessageSent.getType(), ringMessage.getType()); + assertEquals(ringMessageSent.getContent(), ringMessage.getContent()); + } catch (NoSuchFieldException | IllegalAccessException e) { + fail("Error to access private field."); + } + } + + @Test + public void testSendLeaderMessage() { + try { + Instance instance1 = new RingInstance(null, 1, 1); + Instance instance2 = new RingInstance(null, 1, 2); + Instance instance3 = new RingInstance(null, 1, 3); + Map instanceMap = new HashMap<>(); + instanceMap.put(1, instance1); + instanceMap.put(2, instance2); + instanceMap.put(3, instance3); + MessageManager messageManager = new RingMessageManager(instanceMap); + String messageContent = "3"; + messageManager.sendLeaderMessage(2, 3); + Message ringMessage = new Message(MessageType.LEADER, messageContent); + Class instanceClass = AbstractInstance.class; + Field messageQueueField = instanceClass.getDeclaredField("messageQueue"); + messageQueueField.setAccessible(true); + Message ringMessageSent = ((Queue) messageQueueField.get(instance3)).poll(); + assertEquals(ringMessageSent, ringMessage); + } catch (NoSuchFieldException | IllegalAccessException e) { + fail("Error to access private field."); + } + } + + @Test + public void testSendHeartbeatInvokeMessage() { + try { + Instance instance1 = new RingInstance(null, 1, 1); + Instance instance2 = new RingInstance(null, 1, 2); + Instance instance3 = new RingInstance(null, 1, 3); + Map instanceMap = new HashMap<>(); + instanceMap.put(1, instance1); + instanceMap.put(2, instance2); + instanceMap.put(3, instance3); + MessageManager messageManager = new RingMessageManager(instanceMap); + messageManager.sendHeartbeatInvokeMessage(2); + Message ringMessage = new Message(MessageType.HEARTBEAT_INVOKE, ""); + Class instanceClass = AbstractInstance.class; + Field messageQueueField = instanceClass.getDeclaredField("messageQueue"); + messageQueueField.setAccessible(true); + Message ringMessageSent = ((Queue) messageQueueField.get(instance3)).poll(); + assertEquals(ringMessageSent.getType(), ringMessage.getType()); + assertEquals(ringMessageSent.getContent(), ringMessage.getContent()); + } catch (NoSuchFieldException | IllegalAccessException e) { + fail("Error to access private field."); + } + } + +} diff --git a/pom.xml b/pom.xml index 39cfee91c241..d812d27c4c54 100644 --- a/pom.xml +++ b/pom.xml @@ -176,7 +176,9 @@ commander typeobjectpattern bytecode + leader-election data-locality + From 795b6be17d270e93ccfc871fa4976f052c33a181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Fri, 11 Oct 2019 19:28:50 +0300 Subject: [PATCH 046/197] Configure Travis to build on JDK8 and JDK11 --- .travis.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 58edddeb416e..2a82f6051f2c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ language: java -dist: trusty # Xenial build environment won't allow installation of Java 8 +dist: xenial jdk: -- oraclejdk8 +- openjdk8 +- openjdk11 env: global: @@ -21,12 +22,6 @@ after_success: - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN - bash update-ghpages.sh -# use latest java version available instead of travis default -addons: - apt: - packages: - - oracle-java8-installer - notifications: email: - iluwatar@gmail.com From 71f26c3e59f45d0e62b7137a75705a522d43cdec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Fri, 11 Oct 2019 19:37:28 +0300 Subject: [PATCH 047/197] Fix Travis xvfb --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2a82f6051f2c..84b031fadcc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,10 +9,9 @@ env: - GH_REF: github.com/iluwatar/java-design-patterns.git - secure: LxTDuNS/rBWIvKkaEqr79ImZAe48mCdoYCF41coxNXgNoippo4GIBArknqtv+XvdkiuRZ1yGyj6pn8GU33c/yn+krddTUkVCwTbVatbalW5jhQjDbHYym/JcxaK9ZS/3JTeGcWrBgiPqHEEDhCf26vPZsXoMSeVCEORVKTp1BSg= - secure: "eoWlW9GyTJY04P8K3pxayXwU9/hmptQg/LfirispQkV9YvmziCfSzXnatnBhNfud98sCzY8BScXnb+OWLTnjLKpId4rtEqb0aJ40Jc32cUKzgzFAUn7cNcDAbUIfyPAGVqyQqfj/11wYSADwWMMOPlW97ExUtoyiH2WenXuRHso=" - -before_install: -- export DISPLAY=:99.0 -- sh -e /etc/init.d/xvfb start + +services: +- xvfb # default install command is just "mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V" install: From e36bbbb22bad5e24c15ea2d185309033580f2ba8 Mon Sep 17 00:00:00 2001 From: lbroman Date: Fri, 11 Oct 2019 20:55:48 +0200 Subject: [PATCH 048/197] Maven profiles to support jdk 11 builds. #948 (#975) * Maven profiles to support jdk 11 builds. #948 Added maven profiles activated by jdk 11, wich will not break java 8 support. Bumped lombok and datanucleus enhancer as the old versions dont work with 11. * Fixed PMD issue when building naked-objects * Fixed the eip modules with xml dependencies. Previous dependency relaxing commit causes xml libs to go missing from some modules that actually needed them --- cqrs/pom.xml | 21 ++++++++++++++++ eip-aggregator/pom.xml | 20 +++++++++++++++ eip-splitter/pom.xml | 21 ++++++++++++++++ eip-wire-tap/pom.xml | 19 +++++++++++++++ naked-objects/dom/exclude-pmd.properties | 24 ++++++++++++++++++ naked-objects/dom/pom.xml | 2 +- naked-objects/integtests/pom.xml | 14 +++++++++++ pom.xml | 31 +++++++++++++++++++++++- service-layer/pom.xml | 18 ++++++++++++++ trampoline/pom.xml | 2 +- 10 files changed, 169 insertions(+), 3 deletions(-) create mode 100644 naked-objects/dom/exclude-pmd.properties diff --git a/cqrs/pom.xml b/cqrs/pom.xml index beb195473ced..fc89a93b7c79 100644 --- a/cqrs/pom.xml +++ b/cqrs/pom.xml @@ -39,4 +39,25 @@ hibernate-core + + + jdk11-deps + + [11,) + + + + com.sun.xml.bind + jaxb-impl + test + 2.1.17 + + + javax.xml.bind + jaxb-api + test + + + + diff --git a/eip-aggregator/pom.xml b/eip-aggregator/pom.xml index f56ae78deb73..39270f02097e 100644 --- a/eip-aggregator/pom.xml +++ b/eip-aggregator/pom.xml @@ -70,4 +70,24 @@ + + + + jdk11-deps + + [11,) + + + + com.sun.xml.bind + jaxb-impl + + + javax.xml.bind + jaxb-api + + + + + diff --git a/eip-splitter/pom.xml b/eip-splitter/pom.xml index 2bc3eec8402b..7319f651939c 100644 --- a/eip-splitter/pom.xml +++ b/eip-splitter/pom.xml @@ -70,4 +70,25 @@ + + + + jdk11-deps + + [11,) + + + + com.sun.xml.bind + jaxb-impl + + + javax.xml.bind + jaxb-api + + + + + + diff --git a/eip-wire-tap/pom.xml b/eip-wire-tap/pom.xml index efca8d3c4cfb..a9d30924204a 100644 --- a/eip-wire-tap/pom.xml +++ b/eip-wire-tap/pom.xml @@ -70,4 +70,23 @@ + + + + jdk11-deps + + [11,) + + + + com.sun.xml.bind + jaxb-impl + + + javax.xml.bind + jaxb-api + + + + diff --git a/naked-objects/dom/exclude-pmd.properties b/naked-objects/dom/exclude-pmd.properties new file mode 100644 index 000000000000..bda3929accc6 --- /dev/null +++ b/naked-objects/dom/exclude-pmd.properties @@ -0,0 +1,24 @@ +# +# The MIT License +# Copyright (c) 2014-2016 Ilkka Seppälä +# +# 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 NONINFRINGEMENT. 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. +# + +domainapp.dom.modules.simple.QSimpleObject=UnusedFormalParameter \ No newline at end of file diff --git a/naked-objects/dom/pom.xml b/naked-objects/dom/pom.xml index 69365bd4b00a..039afc373727 100644 --- a/naked-objects/dom/pom.xml +++ b/naked-objects/dom/pom.xml @@ -78,7 +78,7 @@ true - 4.0.1 + 5.2.1 diff --git a/naked-objects/integtests/pom.xml b/naked-objects/integtests/pom.xml index c4dd52dcf652..f12f4ae1e368 100644 --- a/naked-objects/integtests/pom.xml +++ b/naked-objects/integtests/pom.xml @@ -122,6 +122,20 @@ --> + + + jdk11-deps + + [11,) + + + + javax.annotation + javax.annotation-api + + + + diff --git a/pom.xml b/pom.xml index d812d27c4c54..efeee185c788 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,8 @@ 2.8.5 3.12.0 1.2.17 - 2.3.0 + 2.3.1 + 2.3.2 1.3.1 @@ -314,6 +315,11 @@ javax.annotation-api ${annotation-api.version} + + com.sun.xml.bind + jaxb-impl + ${jaxb-impl.version} + @@ -494,4 +500,27 @@ + + + jdk11-dep-management + + [11,) + + + + + org.javassist + javassist + 3.25.0-GA + + + javax.annotation + javax.annotation-api + 1.3.2 + + + + + + diff --git a/service-layer/pom.xml b/service-layer/pom.xml index 403a896a4613..4edd950740a8 100644 --- a/service-layer/pom.xml +++ b/service-layer/pom.xml @@ -52,4 +52,22 @@ test + + + jdk11-deps + + [11,) + + + + com.sun.xml.bind + jaxb-impl + + + javax.xml.bind + jaxb-api + + + + diff --git a/trampoline/pom.xml b/trampoline/pom.xml index 1e019ef31297..86726a1186bc 100644 --- a/trampoline/pom.xml +++ b/trampoline/pom.xml @@ -51,7 +51,7 @@ org.projectlombok lombok - 1.16.18 + 1.18.10 From 6faec9901a2380800aa50af538c8669539997176 Mon Sep 17 00:00:00 2001 From: lbroman Date: Sat, 12 Oct 2019 07:39:58 +0200 Subject: [PATCH 049/197] Bump java language to 11 (#980) * Moved java XML and annotations dependencies to project level instead of as profiles * Set compiler language level to 11 * Removed jdk8 from travis build * Kept java level 8 in naked-objects/dom for datanucleus enhancer, for now. --- .travis.yml | 1 - cqrs/pom.xml | 34 ++++++++++++-------------------- eip-aggregator/pom.xml | 28 +++++++++----------------- eip-splitter/pom.xml | 30 ++++++++++------------------ eip-wire-tap/pom.xml | 28 ++++++++++---------------- naked-objects/dom/pom.xml | 11 +++++++++++ naked-objects/integtests/pom.xml | 20 +++++-------------- pom.xml | 34 ++++++++------------------------ service-layer/pom.xml | 27 +++++++++---------------- 9 files changed, 75 insertions(+), 138 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84b031fadcc1..45323dcfd457 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: java dist: xenial jdk: -- openjdk8 - openjdk11 env: diff --git a/cqrs/pom.xml b/cqrs/pom.xml index fc89a93b7c79..9c9458505aba 100644 --- a/cqrs/pom.xml +++ b/cqrs/pom.xml @@ -38,26 +38,18 @@ org.hibernate hibernate-core + + com.sun.xml.bind + jaxb-impl + test + 2.1.17 + + + javax.xml.bind + jaxb-api + test + + - - - jdk11-deps - - [11,) - - - - com.sun.xml.bind - jaxb-impl - test - 2.1.17 - - - javax.xml.bind - jaxb-api - test - - - - + diff --git a/eip-aggregator/pom.xml b/eip-aggregator/pom.xml index 39270f02097e..6a5e32845cfc 100644 --- a/eip-aggregator/pom.xml +++ b/eip-aggregator/pom.xml @@ -47,6 +47,15 @@ ${camel.version} + + com.sun.xml.bind + jaxb-impl + + + javax.xml.bind + jaxb-api + + com.github.sbrannen @@ -71,23 +80,4 @@ - - - jdk11-deps - - [11,) - - - - com.sun.xml.bind - jaxb-impl - - - javax.xml.bind - jaxb-api - - - - - diff --git a/eip-splitter/pom.xml b/eip-splitter/pom.xml index 7319f651939c..9769d08034a7 100644 --- a/eip-splitter/pom.xml +++ b/eip-splitter/pom.xml @@ -47,6 +47,16 @@ ${camel.version} + + com.sun.xml.bind + jaxb-impl + + + javax.xml.bind + jaxb-api + + + com.github.sbrannen @@ -71,24 +81,4 @@ - - - jdk11-deps - - [11,) - - - - com.sun.xml.bind - jaxb-impl - - - javax.xml.bind - jaxb-api - - - - - - diff --git a/eip-wire-tap/pom.xml b/eip-wire-tap/pom.xml index a9d30924204a..c96063418c46 100644 --- a/eip-wire-tap/pom.xml +++ b/eip-wire-tap/pom.xml @@ -47,6 +47,16 @@ ${camel.version} + + com.sun.xml.bind + jaxb-impl + + + javax.xml.bind + jaxb-api + + + com.github.sbrannen @@ -71,22 +81,4 @@ - - - jdk11-deps - - [11,) - - - - com.sun.xml.bind - jaxb-impl - - - javax.xml.bind - jaxb-api - - - - diff --git a/naked-objects/dom/pom.xml b/naked-objects/dom/pom.xml index 039afc373727..e816c76bbd78 100644 --- a/naked-objects/dom/pom.xml +++ b/naked-objects/dom/pom.xml @@ -36,6 +36,17 @@ + + + org.apache.maven.plugins + maven-compiler-plugin + ${compiler.version} + + 8 + 8 + + + diff --git a/naked-objects/integtests/pom.xml b/naked-objects/integtests/pom.xml index f12f4ae1e368..7365a71a9acb 100644 --- a/naked-objects/integtests/pom.xml +++ b/naked-objects/integtests/pom.xml @@ -90,6 +90,11 @@ hsqldb + + javax.annotation + javax.annotation-api + + - - - jdk11-deps - - [11,) - - - - javax.annotation - javax.annotation-api - - - - - diff --git a/pom.xml b/pom.xml index efeee185c788..b3756e1c06fb 100644 --- a/pom.xml +++ b/pom.xml @@ -58,7 +58,7 @@ 1.2.17 2.3.1 2.3.2 - 1.3.1 + 1.3.2 abstract-factory @@ -320,6 +320,11 @@ jaxb-impl ${jaxb-impl.version} + + org.javassist + javassist + 3.25.0-GA + @@ -380,8 +385,8 @@ maven-compiler-plugin ${compiler.version} - 1.8 - 1.8 + 11 + 11 @@ -500,27 +505,4 @@ - - - jdk11-dep-management - - [11,) - - - - - org.javassist - javassist - 3.25.0-GA - - - javax.annotation - javax.annotation-api - 1.3.2 - - - - - - diff --git a/service-layer/pom.xml b/service-layer/pom.xml index 4edd950740a8..057a701341a7 100644 --- a/service-layer/pom.xml +++ b/service-layer/pom.xml @@ -41,6 +41,14 @@ com.h2database h2 + + com.sun.xml.bind + jaxb-impl + + + javax.xml.bind + jaxb-api + org.junit.jupiter junit-jupiter-engine @@ -52,22 +60,5 @@ test - - - jdk11-deps - - [11,) - - - - com.sun.xml.bind - jaxb-impl - - - javax.xml.bind - jaxb-api - - - - + From fcc1c0a27cbf92f07d4a2d9164598c883da74416 Mon Sep 17 00:00:00 2001 From: shumyk Date: Sat, 12 Oct 2019 12:58:48 +0300 Subject: [PATCH 050/197] [mvn] - Remove maven-pmd-plugin from the project (#977) (#979) --- exclude-pmd.properties | 27 --------------------------- pom.xml | 26 -------------------------- 2 files changed, 53 deletions(-) delete mode 100644 exclude-pmd.properties diff --git a/exclude-pmd.properties b/exclude-pmd.properties deleted file mode 100644 index 5a4bb138834e..000000000000 --- a/exclude-pmd.properties +++ /dev/null @@ -1,27 +0,0 @@ -# -# The MIT License -# Copyright (c) 2014-2016 Ilkka Seppälä -# -# 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 NONINFRINGEMENT. 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. -# - -com.iluwatar.servicelayer.common.BaseEntity=UnusedPrivateField -com.iluwatar.doublechecked.locking.App=EmptyStatementNotInLoop,EmptyWhileStmt -com.iluwatar.doublechecked.locking.InventoryTest=EmptyStatementNotInLoop,EmptyWhileStmt -domainapp.dom.modules.simple.QSimpleObject=UnusedFormalParameter \ No newline at end of file diff --git a/pom.xml b/pom.xml index b3756e1c06fb..9b4672fb3b6e 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,6 @@ 1.0.0 2.0.1 2.8.5 - 3.12.0 1.2.17 2.3.1 2.3.2 @@ -445,26 +444,6 @@ - - org.apache.maven.plugins - maven-pmd-plugin - ${pmd.version} - - true - 5 - true - - - - - check - - - exclude-pmd.properties - - - - com.mycila @@ -492,11 +471,6 @@ - - org.apache.maven.plugins - maven-pmd-plugin - ${pmd.version} - org.apache.maven.plugins maven-jxr-plugin From 9ebbc421dd96b84c50808ca8ac4a520042e73b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 12 Oct 2019 20:05:54 +0300 Subject: [PATCH 051/197] Update license headers --- .sonarcloud.properties | 2 +- abstract-document/pom.xml | 2 +- .../abstractdocument/AbstractDocument.java | 8 ++-- .../com/iluwatar/abstractdocument/App.java | 8 ++-- .../iluwatar/abstractdocument/Document.java | 8 ++-- .../iluwatar/abstractdocument/domain/Car.java | 8 ++-- .../abstractdocument/domain/HasModel.java | 8 ++-- .../abstractdocument/domain/HasParts.java | 8 ++-- .../abstractdocument/domain/HasPrice.java | 8 ++-- .../abstractdocument/domain/HasType.java | 8 ++-- .../abstractdocument/domain/Part.java | 8 ++-- .../domain/enums/Property.java | 2 +- .../AbstractDocumentTest.java | 8 ++-- .../iluwatar/abstractdocument/AppTest.java | 8 ++-- .../iluwatar/abstractdocument/DomainTest.java | 8 ++-- abstract-factory/etc/presentation.html | 2 +- abstract-factory/pom.xml | 2 +- .../com/iluwatar/abstractfactory/App.java | 2 +- .../com/iluwatar/abstractfactory/Army.java | 2 +- .../com/iluwatar/abstractfactory/Castle.java | 2 +- .../com/iluwatar/abstractfactory/ElfArmy.java | 2 +- .../iluwatar/abstractfactory/ElfCastle.java | 2 +- .../com/iluwatar/abstractfactory/ElfKing.java | 2 +- .../abstractfactory/ElfKingdomFactory.java | 2 +- .../com/iluwatar/abstractfactory/King.java | 2 +- .../abstractfactory/KingdomFactory.java | 2 +- .../com/iluwatar/abstractfactory/OrcArmy.java | 2 +- .../iluwatar/abstractfactory/OrcCastle.java | 2 +- .../com/iluwatar/abstractfactory/OrcKing.java | 2 +- .../abstractfactory/OrcKingdomFactory.java | 2 +- .../abstractfactory/AbstractFactoryTest.java | 2 +- .../com/iluwatar/abstractfactory/AppTest.java | 2 +- acyclic-visitor/pom.xml | 2 +- .../acyclicvisitor/AllModemVisitor.java | 2 +- .../java/com/iluwatar/acyclicvisitor/App.java | 2 +- .../ConfigureForDosVisitor.java | 2 +- .../ConfigureForUnixVisitor.java | 2 +- .../com/iluwatar/acyclicvisitor/Hayes.java | 2 +- .../iluwatar/acyclicvisitor/HayesVisitor.java | 2 +- .../com/iluwatar/acyclicvisitor/Modem.java | 2 +- .../iluwatar/acyclicvisitor/ModemVisitor.java | 2 +- .../com/iluwatar/acyclicvisitor/Zoom.java | 2 +- .../iluwatar/acyclicvisitor/ZoomVisitor.java | 2 +- .../com/iluwatar/acyclicvisitor/AppTest.java | 2 +- .../ConfigureForDosVisitorTest.java | 2 +- .../ConfigureForUnixVisitorTest.java | 2 +- .../iluwatar/acyclicvisitor/HayesTest.java | 2 +- .../com/iluwatar/acyclicvisitor/ZoomTest.java | 2 +- adapter/pom.xml | 2 +- .../main/java/com/iluwatar/adapter/App.java | 2 +- .../java/com/iluwatar/adapter/Captain.java | 2 +- .../com/iluwatar/adapter/FishingBoat.java | 2 +- .../iluwatar/adapter/FishingBoatAdapter.java | 2 +- .../java/com/iluwatar/adapter/RowingBoat.java | 2 +- .../iluwatar/adapter/AdapterPatternTest.java | 2 +- .../java/com/iluwatar/adapter/AppTest.java | 2 +- .../aggregator-service/pom.xml | 2 +- .../aggregator/microservices/Aggregator.java | 8 ++-- .../aggregator/microservices/App.java | 8 ++-- .../aggregator/microservices/Product.java | 8 ++-- .../ProductInformationClient.java | 8 ++-- .../ProductInformationClientImpl.java | 8 ++-- .../microservices/ProductInventoryClient.java | 8 ++-- .../ProductInventoryClientImpl.java | 8 ++-- .../src/main/resources/application.properties | 2 +- .../microservices/AggregatorTest.java | 8 ++-- .../information-microservice/pom.xml | 2 +- .../microservice/InformationApplication.java | 8 ++-- .../microservice/InformationController.java | 8 ++-- .../src/main/resources/application.properties | 2 +- .../InformationControllerTest.java | 8 ++-- .../inventory-microservice/pom.xml | 2 +- .../microservice/InventoryApplication.java | 8 ++-- .../microservice/InventoryController.java | 8 ++-- .../src/main/resources/application.properties | 2 +- .../microservice/InventoryControllerTest.java | 8 ++-- aggregator-microservices/pom.xml | 2 +- ambassador/pom.xml | 2 +- .../java/com/iluwatar/ambassador/App.java | 2 +- .../java/com/iluwatar/ambassador/Client.java | 2 +- .../iluwatar/ambassador/RemoteService.java | 2 +- .../ambassador/RemoteServiceInterface.java | 2 +- .../ambassador/ServiceAmbassador.java | 2 +- .../ambassador/util/RandomProvider.java | 2 +- .../java/com/iluwatar/ambassador/AppTest.java | 2 +- .../com/iluwatar/ambassador/ClientTest.java | 2 +- .../ambassador/RemoteServiceTest.java | 2 +- .../ambassador/ServiceAmbassadorTest.java | 2 +- api-gateway/api-gateway-service/pom.xml | 2 +- .../com/iluwatar/api/gateway/ApiGateway.java | 2 +- .../java/com/iluwatar/api/gateway/App.java | 2 +- .../iluwatar/api/gateway/DesktopProduct.java | 2 +- .../com/iluwatar/api/gateway/ImageClient.java | 2 +- .../iluwatar/api/gateway/ImageClientImpl.java | 2 +- .../iluwatar/api/gateway/MobileProduct.java | 2 +- .../com/iluwatar/api/gateway/PriceClient.java | 2 +- .../iluwatar/api/gateway/PriceClientImpl.java | 2 +- .../src/main/resources/application.properties | 2 +- .../iluwatar/api/gateway/ApiGatewayTest.java | 2 +- api-gateway/image-microservice/pom.xml | 2 +- .../image/microservice/ImageApplication.java | 2 +- .../image/microservice/ImageController.java | 2 +- .../src/main/resources/application.properties | 2 +- .../microservice/ImageControllerTest.java | 2 +- api-gateway/pom.xml | 2 +- api-gateway/price-microservice/pom.xml | 2 +- .../price/microservice/PriceApplication.java | 2 +- .../price/microservice/PriceController.java | 2 +- .../src/main/resources/application.properties | 2 +- .../microservice/PriceControllerTest.java | 2 +- async-method-invocation/pom.xml | 2 +- .../iluwatar/async/method/invocation/App.java | 2 +- .../method/invocation/AsyncCallback.java | 2 +- .../method/invocation/AsyncExecutor.java | 2 +- .../async/method/invocation/AsyncResult.java | 2 +- .../invocation/ThreadAsyncExecutor.java | 2 +- .../async/method/invocation/AppTest.java | 2 +- .../invocation/ThreadAsyncExecutorTest.java | 2 +- balking/pom.xml | 2 +- .../main/java/com/iluwatar/balking/App.java | 8 ++-- .../com/iluwatar/balking/DelayProvider.java | 2 +- .../com/iluwatar/balking/WashingMachine.java | 8 ++-- .../iluwatar/balking/WashingMachineState.java | 8 ++-- .../java/com/iluwatar/balking/AppTest.java | 9 ++--- .../iluwatar/balking/WashingMachineTest.java | 8 ++-- bridge/pom.xml | 2 +- .../main/java/com/iluwatar/bridge/App.java | 2 +- .../java/com/iluwatar/bridge/Enchantment.java | 2 +- .../iluwatar/bridge/FlyingEnchantment.java | 2 +- .../main/java/com/iluwatar/bridge/Hammer.java | 2 +- .../bridge/SoulEatingEnchantment.java | 2 +- .../main/java/com/iluwatar/bridge/Sword.java | 2 +- .../main/java/com/iluwatar/bridge/Weapon.java | 2 +- .../java/com/iluwatar/bridge/AppTest.java | 2 +- .../java/com/iluwatar/bridge/HammerTest.java | 2 +- .../java/com/iluwatar/bridge/SwordTest.java | 2 +- .../java/com/iluwatar/bridge/WeaponTest.java | 2 +- builder/pom.xml | 2 +- .../main/java/com/iluwatar/builder/App.java | 2 +- .../main/java/com/iluwatar/builder/Armor.java | 2 +- .../java/com/iluwatar/builder/HairColor.java | 2 +- .../java/com/iluwatar/builder/HairType.java | 2 +- .../main/java/com/iluwatar/builder/Hero.java | 2 +- .../java/com/iluwatar/builder/Profession.java | 2 +- .../java/com/iluwatar/builder/Weapon.java | 2 +- .../java/com/iluwatar/builder/AppTest.java | 2 +- .../java/com/iluwatar/builder/HeroTest.java | 2 +- business-delegate/pom.xml | 2 +- .../com/iluwatar/business/delegate/App.java | 2 +- .../business/delegate/BusinessDelegate.java | 2 +- .../business/delegate/BusinessLookup.java | 2 +- .../business/delegate/BusinessService.java | 2 +- .../iluwatar/business/delegate/Client.java | 2 +- .../business/delegate/EjbService.java | 2 +- .../business/delegate/JmsService.java | 2 +- .../business/delegate/ServiceType.java | 2 +- .../iluwatar/business/delegate/AppTest.java | 2 +- .../delegate/BusinessDelegateTest.java | 2 +- bytecode/pom.xml | 2 +- .../main/java/com/iluwatar/bytecode/App.java | 2 +- .../com/iluwatar/bytecode/Instruction.java | 2 +- .../com/iluwatar/bytecode/VirtualMachine.java | 2 +- .../java/com/iluwatar/bytecode/Wizard.java | 2 +- .../util/InstructionConverterUtil.java | 2 +- .../java/com/iluwatar/bytecode/AppTest.java | 2 +- .../iluwatar/bytecode/VirtualMachineTest.java | 2 +- .../util/InstructionConverterUtilTest.java | 2 +- caching/pom.xml | 2 +- .../main/java/com/iluwatar/caching/App.java | 2 +- .../java/com/iluwatar/caching/AppManager.java | 2 +- .../java/com/iluwatar/caching/CacheStore.java | 2 +- .../com/iluwatar/caching/CachingPolicy.java | 2 +- .../java/com/iluwatar/caching/DbManager.java | 2 +- .../java/com/iluwatar/caching/LruCache.java | 2 +- .../com/iluwatar/caching/UserAccount.java | 2 +- .../caching/constants/CachingConstants.java | 2 +- .../java/com/iluwatar/caching/AppTest.java | 2 +- .../com/iluwatar/caching/CachingTest.java | 2 +- callback/pom.xml | 2 +- .../main/java/com/iluwatar/callback/App.java | 2 +- .../java/com/iluwatar/callback/Callback.java | 2 +- .../com/iluwatar/callback/LambdasApp.java | 2 +- .../com/iluwatar/callback/SimpleTask.java | 2 +- .../main/java/com/iluwatar/callback/Task.java | 2 +- .../java/com/iluwatar/callback/AppTest.java | 2 +- .../com/iluwatar/callback/CallbackTest.java | 2 +- chain/pom.xml | 2 +- .../src/main/java/com/iluwatar/chain/App.java | 2 +- .../java/com/iluwatar/chain/OrcCommander.java | 2 +- .../main/java/com/iluwatar/chain/OrcKing.java | 2 +- .../java/com/iluwatar/chain/OrcOfficer.java | 2 +- .../java/com/iluwatar/chain/OrcSoldier.java | 2 +- .../main/java/com/iluwatar/chain/Request.java | 2 +- .../com/iluwatar/chain/RequestHandler.java | 2 +- .../java/com/iluwatar/chain/RequestType.java | 2 +- .../test/java/com/iluwatar/chain/AppTest.java | 2 +- .../java/com/iluwatar/chain/OrcKingTest.java | 2 +- checkstyle-suppressions.xml | 2 +- checkstyle.xml | 2 +- collection-pipeline/pom.xml | 2 +- .../com/iluwatar/collectionpipeline/App.java | 2 +- .../com/iluwatar/collectionpipeline/Car.java | 2 +- .../collectionpipeline/CarFactory.java | 2 +- .../iluwatar/collectionpipeline/Category.java | 2 +- .../FunctionalProgramming.java | 2 +- .../ImperativeProgramming.java | 2 +- .../iluwatar/collectionpipeline/Person.java | 2 +- .../iluwatar/collectionpipeline/AppTest.java | 2 +- command/etc/presentation.html | 2 +- command/pom.xml | 2 +- .../main/java/com/iluwatar/command/App.java | 2 +- .../java/com/iluwatar/command/Command.java | 2 +- .../java/com/iluwatar/command/Goblin.java | 2 +- .../iluwatar/command/InvisibilitySpell.java | 2 +- .../com/iluwatar/command/ShrinkSpell.java | 2 +- .../main/java/com/iluwatar/command/Size.java | 2 +- .../java/com/iluwatar/command/Target.java | 2 +- .../java/com/iluwatar/command/Visibility.java | 2 +- .../java/com/iluwatar/command/Wizard.java | 2 +- .../java/com/iluwatar/command/AppTest.java | 2 +- .../com/iluwatar/command/CommandTest.java | 2 +- commander/pom.xml | 2 +- commander/properties/log4j.properties | 2 +- .../commander/AppEmployeeDbFailCases.java | 3 +- .../commander/AppMessagingFailCases.java | 3 +- .../commander/AppPaymentFailCases.java | 3 +- .../iluwatar/commander/AppQueueFailCases.java | 3 +- .../commander/AppShippingFailCases.java | 3 +- .../com/iluwatar/commander/Commander.java | 3 +- .../java/com/iluwatar/commander/Database.java | 3 +- .../java/com/iluwatar/commander/Order.java | 3 +- .../java/com/iluwatar/commander/Retry.java | 3 +- .../java/com/iluwatar/commander/Service.java | 3 +- .../java/com/iluwatar/commander/User.java | 3 +- .../employeehandle/EmployeeDatabase.java | 3 +- .../employeehandle/EmployeeHandle.java | 3 +- .../DatabaseUnavailableException.java | 3 +- .../exceptions/IsEmptyException.java | 3 +- .../exceptions/ItemUnavailableException.java | 3 +- .../PaymentDetailsErrorException.java | 3 +- .../ShippingNotPossibleException.java | 3 +- .../messagingservice/MessagingDatabase.java | 3 +- .../messagingservice/MessagingService.java | 3 +- .../paymentservice/PaymentDatabase.java | 3 +- .../paymentservice/PaymentService.java | 3 +- .../com/iluwatar/commander/queue/Queue.java | 3 +- .../commander/queue/QueueDatabase.java | 3 +- .../iluwatar/commander/queue/QueueTask.java | 3 +- .../shippingservice/ShippingDatabase.java | 3 +- .../shippingservice/ShippingService.java | 3 +- .../com/iluwatar/commander/RetryTest.java | 3 +- composite/pom.xml | 2 +- .../main/java/com/iluwatar/composite/App.java | 2 +- .../java/com/iluwatar/composite/Letter.java | 2 +- .../iluwatar/composite/LetterComposite.java | 2 +- .../com/iluwatar/composite/Messenger.java | 2 +- .../java/com/iluwatar/composite/Sentence.java | 2 +- .../java/com/iluwatar/composite/Word.java | 2 +- .../java/com/iluwatar/composite/AppTest.java | 2 +- .../com/iluwatar/composite/MessengerTest.java | 2 +- converter/pom.xml | 2 +- .../main/java/com/iluwatar/converter/App.java | 8 ++-- .../com/iluwatar/converter/Converter.java | 9 ++--- .../java/com/iluwatar/converter/User.java | 9 ++--- .../com/iluwatar/converter/UserConverter.java | 9 ++--- .../java/com/iluwatar/converter/UserDto.java | 9 ++--- .../java/com/iluwatar/converter/AppTest.java | 2 +- .../com/iluwatar/converter/ConverterTest.java | 2 +- cqrs/pom.xml | 39 ++++++++++++------- .../main/java/com/iluwatar/cqrs/app/App.java | 2 +- .../cqrs/commandes/CommandServiceImpl.java | 2 +- .../cqrs/commandes/ICommandService.java | 2 +- .../iluwatar/cqrs/constants/AppConstants.java | 2 +- .../iluwatar/cqrs/domain/model/Author.java | 2 +- .../com/iluwatar/cqrs/domain/model/Book.java | 2 +- .../java/com/iluwatar/cqrs/dto/Author.java | 2 +- .../main/java/com/iluwatar/cqrs/dto/Book.java | 2 +- .../iluwatar/cqrs/queries/IQueryService.java | 2 +- .../cqrs/queries/QueryServiceImpl.java | 2 +- .../com/iluwatar/cqrs/util/HibernateUtil.java | 2 +- cqrs/src/main/resources/hibernate.cfg.xml | 2 +- cqrs/src/main/resources/logback.xml | 2 +- .../com/iluwatar/cqrs/IntegrationTest.java | 2 +- cqrs/src/test/resources/hibernate.cfg.xml | 2 +- cqrs/src/test/resources/logback.xml | 2 +- dao/pom.xml | 2 +- dao/src/main/java/com/iluwatar/dao/App.java | 3 +- .../com/iluwatar/dao/CustomException.java | 2 +- .../main/java/com/iluwatar/dao/Customer.java | 3 +- .../java/com/iluwatar/dao/CustomerDao.java | 3 +- .../com/iluwatar/dao/CustomerSchemaSql.java | 2 +- .../java/com/iluwatar/dao/DbCustomerDao.java | 3 +- .../com/iluwatar/dao/InMemoryCustomerDao.java | 3 +- dao/src/main/resources/log4j.xml | 2 +- .../test/java/com/iluwatar/dao/AppTest.java | 3 +- .../java/com/iluwatar/dao/CustomerTest.java | 3 +- .../com/iluwatar/dao/DbCustomerDaoTest.java | 2 +- .../iluwatar/dao/InMemoryCustomerDaoTest.java | 3 +- data-bus/pom.xml | 2 +- .../iluwatar/databus/AbstractDataType.java | 2 +- .../main/java/com/iluwatar/databus/App.java | 9 ++--- .../java/com/iluwatar/databus/DataBus.java | 9 ++--- .../java/com/iluwatar/databus/DataType.java | 2 +- .../java/com/iluwatar/databus/Member.java | 2 +- .../iluwatar/databus/data/MessageData.java | 9 ++--- .../iluwatar/databus/data/StartingData.java | 9 ++--- .../iluwatar/databus/data/StoppingData.java | 9 ++--- .../members/MessageCollectorMember.java | 9 ++--- .../databus/members/StatusMember.java | 9 ++--- .../com/iluwatar/databus/DataBusTest.java | 2 +- .../members/MessageCollectorMemberTest.java | 2 +- .../databus/members/StatusMemberTest.java | 2 +- data-locality/pom.xml | 2 +- .../iluwatar/data/locality/Application.java | 2 +- .../data/locality/game/GameEntity.java | 2 +- .../locality/game/component/AiComponent.java | 2 +- .../locality/game/component/Component.java | 2 +- .../game/component/PhysicsComponent.java | 2 +- .../game/component/RenderComponent.java | 2 +- .../component/manager/AiComponentManager.java | 2 +- .../manager/PhysicsComponentManager.java | 2 +- .../manager/RenderComponentManager.java | 2 +- .../data/locality/ApplicationTest.java | 8 ++-- data-mapper/pom.xml | 2 +- .../java/com/iluwatar/datamapper/App.java | 28 +++++++------ .../datamapper/DataMapperException.java | 28 +++++++------ .../java/com/iluwatar/datamapper/Student.java | 28 +++++++------ .../datamapper/StudentDataMapper.java | 28 +++++++------ .../datamapper/StudentDataMapperImpl.java | 28 +++++++------ data-mapper/src/main/resources/log4j.xml | 2 +- .../java/com/iluwatar/datamapper/AppTest.java | 28 +++++++------ .../iluwatar/datamapper/DataMapperTest.java | 28 +++++++------ .../com/iluwatar/datamapper/StudentTest.java | 28 +++++++------ data-transfer-object/pom.xml | 2 +- .../datatransfer/CustomerClientApp.java | 16 ++++---- .../iluwatar/datatransfer/CustomerDto.java | 16 ++++---- .../datatransfer/CustomerResource.java | 16 ++++---- .../datatransfer/CustomerResourceTest.java | 16 ++++---- decorator/pom.xml | 2 +- .../main/java/com/iluwatar/decorator/App.java | 2 +- .../com/iluwatar/decorator/ClubbedTroll.java | 2 +- .../com/iluwatar/decorator/SimpleTroll.java | 2 +- .../java/com/iluwatar/decorator/Troll.java | 2 +- .../java/com/iluwatar/decorator/AppTest.java | 2 +- .../iluwatar/decorator/ClubbedTrollTest.java | 2 +- .../iluwatar/decorator/SimpleTrollTest.java | 2 +- delegation/pom.xml | 3 +- .../com/iluwatar/delegation/simple/App.java | 2 +- .../iluwatar/delegation/simple/Printer.java | 2 +- .../delegation/simple/PrinterController.java | 2 +- .../simple/printers/CanonPrinter.java | 2 +- .../simple/printers/EpsonPrinter.java | 2 +- .../delegation/simple/printers/HpPrinter.java | 2 +- .../iluwatar/delegation/simple/AppTest.java | 2 +- .../delegation/simple/DelegateTest.java | 2 +- dependency-injection/pom.xml | 2 +- .../injection/AdvancedSorceress.java | 2 +- .../dependency/injection/AdvancedWizard.java | 2 +- .../iluwatar/dependency/injection/App.java | 8 ++-- .../dependency/injection/GuiceWizard.java | 2 +- .../dependency/injection/OldTobyTobacco.java | 2 +- .../injection/RivendellTobacco.java | 2 +- .../injection/SecondBreakfastTobacco.java | 2 +- .../dependency/injection/SimpleWizard.java | 2 +- .../dependency/injection/Tobacco.java | 2 +- .../dependency/injection/TobaccoModule.java | 2 +- .../iluwatar/dependency/injection/Wizard.java | 2 +- .../injection/AdvancedSorceressTest.java | 8 ++-- .../injection/AdvancedWizardTest.java | 2 +- .../dependency/injection/AppTest.java | 2 +- .../dependency/injection/GuiceWizardTest.java | 2 +- .../injection/SimpleWizardTest.java | 2 +- .../injection/utils/InMemoryAppender.java | 2 +- dirty-flag/pom.xml | 2 +- .../main/java/com/iluwatar/dirtyflag/App.java | 8 ++-- .../com/iluwatar/dirtyflag/DataFetcher.java | 2 +- .../java/com/iluwatar/dirtyflag/World.java | 2 +- dirty-flag/src/main/resources/world.txt | 2 +- .../src/test/java/org/dirty/flag/AppTest.java | 2 +- .../java/org/dirty/flag/DirtyFlagTest.java | 2 +- double-checked-locking/pom.xml | 2 +- .../iluwatar/doublechecked/locking/App.java | 2 +- .../doublechecked/locking/Inventory.java | 2 +- .../iluwatar/doublechecked/locking/Item.java | 2 +- .../src/main/resources/logback.xml | 2 +- .../doublechecked/locking/AppTest.java | 2 +- .../doublechecked/locking/InventoryTest.java | 2 +- double-dispatch/pom.xml | 2 +- .../java/com/iluwatar/doubledispatch/App.java | 2 +- .../doubledispatch/FlamingAsteroid.java | 2 +- .../iluwatar/doubledispatch/GameObject.java | 2 +- .../iluwatar/doubledispatch/Meteoroid.java | 2 +- .../iluwatar/doubledispatch/Rectangle.java | 2 +- .../doubledispatch/SpaceStationIss.java | 2 +- .../doubledispatch/SpaceStationMir.java | 2 +- .../constants/AppConstants.java | 2 +- .../com/iluwatar/doubledispatch/AppTest.java | 2 +- .../doubledispatch/CollisionTest.java | 2 +- .../doubledispatch/FlamingAsteroidTest.java | 2 +- .../doubledispatch/MeteoroidTest.java | 2 +- .../doubledispatch/RectangleTest.java | 2 +- .../doubledispatch/SpaceStationIssTest.java | 2 +- .../doubledispatch/SpaceStationMirTest.java | 2 +- eip-aggregator/pom.xml | 7 +++- .../java/com/iluwatar/eip/aggregator/App.java | 2 +- .../aggregator/routes/AggregatorRoute.java | 2 +- .../routes/MessageAggregationStrategy.java | 2 +- .../src/main/resources/application.properties | 2 +- .../com/iluwatar/eip/aggregator/AppTest.java | 2 +- .../routes/AggregatorRouteTest.java | 2 +- .../MessageAggregationStrategyTest.java | 2 +- .../resources/application-test.properties | 2 +- eip-message-channel/pom.xml | 2 +- .../com/iluwatar/eip/message/channel/App.java | 2 +- .../iluwatar/eip/message/channel/AppTest.java | 2 +- eip-publish-subscribe/pom.xml | 2 +- .../iluwatar/eip/publish/subscribe/App.java | 2 +- .../src/main/resources/logback.xml | 2 +- .../eip/publish/subscribe/AppTest.java | 2 +- eip-splitter/pom.xml | 7 +++- .../java/com/iluwatar/eip/splitter/App.java | 2 +- .../eip/splitter/routes/SplitterRoute.java | 2 +- .../src/main/resources/application.properties | 2 +- .../com/iluwatar/eip/splitter/AppTest.java | 2 +- .../splitter/routes/SplitterRouteTest.java | 2 +- .../resources/application-test.properties | 2 +- eip-wire-tap/pom.xml | 7 +++- .../java/com/iluwatar/eip/wiretap/App.java | 2 +- .../eip/wiretap/routes/WireTapRoute.java | 2 +- .../src/main/resources/application.properties | 2 +- .../com/iluwatar/eip/wiretap/AppTest.java | 2 +- .../eip/wiretap/routes/WireTapRouteTest.java | 2 +- .../resources/application-test.properties | 2 +- event-aggregator/pom.xml | 2 +- .../com/iluwatar/event/aggregator/App.java | 2 +- .../com/iluwatar/event/aggregator/Event.java | 2 +- .../event/aggregator/EventEmitter.java | 2 +- .../event/aggregator/EventObserver.java | 2 +- .../event/aggregator/KingJoffrey.java | 2 +- .../iluwatar/event/aggregator/KingsHand.java | 2 +- .../event/aggregator/LordBaelish.java | 2 +- .../iluwatar/event/aggregator/LordVarys.java | 2 +- .../com/iluwatar/event/aggregator/Scout.java | 2 +- .../iluwatar/event/aggregator/Weekday.java | 2 +- .../iluwatar/event/aggregator/AppTest.java | 2 +- .../event/aggregator/EventEmitterTest.java | 2 +- .../iluwatar/event/aggregator/EventTest.java | 2 +- .../event/aggregator/KingJoffreyTest.java | 2 +- .../event/aggregator/KingsHandTest.java | 2 +- .../event/aggregator/LordBaelishTest.java | 2 +- .../event/aggregator/LordVarysTest.java | 2 +- .../iluwatar/event/aggregator/ScoutTest.java | 2 +- .../event/aggregator/WeekdayTest.java | 2 +- event-asynchronous/pom.xml | 2 +- .../com/iluwatar/event/asynchronous/App.java | 28 +++++++------ .../iluwatar/event/asynchronous/Event.java | 28 +++++++------ .../EventDoesNotExistException.java | 28 +++++++------ .../event/asynchronous/EventManager.java | 28 +++++++------ .../iluwatar/event/asynchronous/IEvent.java | 28 +++++++------ .../InvalidOperationException.java | 28 +++++++------ .../LongRunningEventException.java | 28 +++++++------ .../MaxNumOfEventsAllowedException.java | 28 +++++++------ .../asynchronous/ThreadCompleteListener.java | 28 +++++++------ .../src/main/resources/config.properties | 2 +- .../iluwatar/event/asynchronous/AppTest.java | 28 +++++++------ .../asynchronous/EventAsynchronousTest.java | 28 +++++++------ event-driven-architecture/pom.xml | 2 +- .../src/main/java/com/iluwatar/eda/App.java | 2 +- .../com/iluwatar/eda/event/AbstractEvent.java | 2 +- .../iluwatar/eda/event/UserCreatedEvent.java | 2 +- .../iluwatar/eda/event/UserUpdatedEvent.java | 2 +- .../com/iluwatar/eda/framework/Event.java | 2 +- .../eda/framework/EventDispatcher.java | 2 +- .../com/iluwatar/eda/framework/Handler.java | 2 +- .../eda/handler/UserCreatedEventHandler.java | 2 +- .../eda/handler/UserUpdatedEventHandler.java | 2 +- .../java/com/iluwatar/eda/model/User.java | 2 +- .../test/java/com/iluwatar/eda/AppTest.java | 2 +- .../eda/event/UserCreatedEventTest.java | 2 +- .../eda/framework/EventDispatcherTest.java | 2 +- event-queue/pom.xml | 2 +- .../java/com/iluwatar/event/queue/App.java | 3 +- .../java/com/iluwatar/event/queue/Audio.java | 3 +- .../com/iluwatar/event/queue/PlayMessage.java | 3 +- .../com/iluwatar/event/queue/AudioTest.java | 3 +- event-sourcing/pom.xml | 2 +- .../com/iluwatar/event/sourcing/app/App.java | 2 +- .../event/sourcing/domain/Account.java | 2 +- .../sourcing/event/AccountCreateEvent.java | 2 +- .../event/sourcing/event/DomainEvent.java | 2 +- .../sourcing/event/MoneyDepositEvent.java | 2 +- .../sourcing/event/MoneyTransferEvent.java | 2 +- .../processor/DomainEventProcessor.java | 2 +- .../sourcing/processor/JsonFileJournal.java | 2 +- .../sourcing/state/AccountAggregate.java | 2 +- .../src/test/java/IntegrationTest.java | 3 +- execute-around/pom.xml | 2 +- .../java/com/iluwatar/execute/around/App.java | 2 +- .../execute/around/FileWriterAction.java | 2 +- .../execute/around/SimpleFileWriter.java | 2 +- .../com/iluwatar/execute/around/AppTest.java | 2 +- .../execute/around/SimpleFileWriterTest.java | 2 +- extension-objects/pom.xml | 2 +- extension-objects/src/main/java/App.java | 2 +- .../CommanderExtension.java | 2 +- .../abstractextensions/SergeantExtension.java | 2 +- .../abstractextensions/SoldierExtension.java | 2 +- .../abstractextensions/UnitExtension.java | 2 +- .../java/concreteextensions/Commander.java | 2 +- .../java/concreteextensions/Sergeant.java | 2 +- .../main/java/concreteextensions/Soldier.java | 2 +- .../src/main/java/units/CommanderUnit.java | 2 +- .../src/main/java/units/SergeantUnit.java | 2 +- .../src/main/java/units/SoldierUnit.java | 2 +- .../src/main/java/units/Unit.java | 2 +- extension-objects/src/test/java/AppTest.java | 3 +- .../concreteextensions/CommanderTest.java | 2 +- .../java/concreteextensions/SergeantTest.java | 2 +- .../java/concreteextensions/SoldierTest.java | 2 +- .../test/java/units/CommanderUnitTest.java | 2 +- .../src/test/java/units/SergeantUnitTest.java | 2 +- .../src/test/java/units/SoldierUnitTest.java | 2 +- .../src/test/java/units/UnitTest.java | 2 +- facade/pom.xml | 2 +- .../main/java/com/iluwatar/facade/App.java | 2 +- .../iluwatar/facade/DwarvenCartOperator.java | 2 +- .../iluwatar/facade/DwarvenGoldDigger.java | 2 +- .../facade/DwarvenGoldmineFacade.java | 2 +- .../iluwatar/facade/DwarvenMineWorker.java | 2 +- .../iluwatar/facade/DwarvenTunnelDigger.java | 2 +- .../java/com/iluwatar/facade/AppTest.java | 2 +- .../facade/DwarvenGoldmineFacadeTest.java | 2 +- factory-kit/pom.xml | 2 +- .../java/com/iluwatar/factorykit/App.java | 2 +- .../java/com/iluwatar/factorykit/Axe.java | 2 +- .../java/com/iluwatar/factorykit/Bow.java | 2 +- .../java/com/iluwatar/factorykit/Builder.java | 2 +- .../java/com/iluwatar/factorykit/Spear.java | 2 +- .../java/com/iluwatar/factorykit/Sword.java | 2 +- .../java/com/iluwatar/factorykit/Weapon.java | 2 +- .../iluwatar/factorykit/WeaponFactory.java | 2 +- .../com/iluwatar/factorykit/WeaponType.java | 2 +- .../com/iluwatar/factorykit/app/AppTest.java | 2 +- .../factorykit/factorykit/FactoryKitTest.java | 4 +- factory-method/etc/presentation.html | 2 +- factory-method/pom.xml | 2 +- .../java/com/iluwatar/factory/method/App.java | 2 +- .../iluwatar/factory/method/Blacksmith.java | 2 +- .../factory/method/ElfBlacksmith.java | 2 +- .../iluwatar/factory/method/ElfWeapon.java | 2 +- .../factory/method/OrcBlacksmith.java | 2 +- .../iluwatar/factory/method/OrcWeapon.java | 2 +- .../com/iluwatar/factory/method/Weapon.java | 2 +- .../iluwatar/factory/method/WeaponType.java | 2 +- .../com/iluwatar/factory/method/AppTest.java | 2 +- .../factory/method/FactoryMethodTest.java | 2 +- feature-toggle/pom.xml | 3 +- .../java/com/iluwatar/featuretoggle/App.java | 9 ++--- .../featuretoggle/pattern/Service.java | 8 ++-- .../PropertiesFeatureToggleVersion.java | 8 ++-- .../TieredFeatureToggleVersion.java | 8 ++-- .../com/iluwatar/featuretoggle/user/User.java | 8 ++-- .../featuretoggle/user/UserGroup.java | 8 ++-- .../PropertiesFeatureToggleVersionTest.java | 9 ++--- .../TieredFeatureToggleVersionTest.java | 8 ++-- .../featuretoggle/user/UserGroupTest.java | 8 ++-- fluentinterface/pom.xml | 2 +- .../com/iluwatar/fluentinterface/app/App.java | 2 +- .../fluentiterable/FluentIterable.java | 2 +- .../lazy/DecoratingIterator.java | 2 +- .../lazy/LazyFluentIterable.java | 2 +- .../simple/SimpleFluentIterable.java | 2 +- .../iluwatar/fluentinterface/app/AppTest.java | 2 +- .../fluentiterable/FluentIterableTest.java | 2 +- .../lazy/LazyFluentIterableTest.java | 2 +- .../simple/SimpleFluentIterableTest.java | 2 +- flux/pom.xml | 2 +- .../java/com/iluwatar/flux/action/Action.java | 2 +- .../com/iluwatar/flux/action/ActionType.java | 2 +- .../com/iluwatar/flux/action/Content.java | 2 +- .../iluwatar/flux/action/ContentAction.java | 2 +- .../com/iluwatar/flux/action/MenuAction.java | 2 +- .../com/iluwatar/flux/action/MenuItem.java | 2 +- .../main/java/com/iluwatar/flux/app/App.java | 2 +- .../iluwatar/flux/dispatcher/Dispatcher.java | 2 +- .../com/iluwatar/flux/store/ContentStore.java | 2 +- .../com/iluwatar/flux/store/MenuStore.java | 2 +- .../java/com/iluwatar/flux/store/Store.java | 2 +- .../com/iluwatar/flux/view/ContentView.java | 2 +- .../java/com/iluwatar/flux/view/MenuView.java | 2 +- .../java/com/iluwatar/flux/view/View.java | 2 +- .../com/iluwatar/flux/action/ContentTest.java | 2 +- .../iluwatar/flux/action/MenuItemTest.java | 2 +- .../java/com/iluwatar/flux/app/AppTest.java | 2 +- .../flux/dispatcher/DispatcherTest.java | 2 +- .../iluwatar/flux/store/ContentStoreTest.java | 2 +- .../iluwatar/flux/store/MenuStoreTest.java | 2 +- .../iluwatar/flux/view/ContentViewTest.java | 2 +- .../com/iluwatar/flux/view/MenuViewTest.java | 2 +- flyweight/pom.xml | 2 +- .../com/iluwatar/flyweight/AlchemistShop.java | 2 +- .../main/java/com/iluwatar/flyweight/App.java | 2 +- .../com/iluwatar/flyweight/HealingPotion.java | 2 +- .../iluwatar/flyweight/HolyWaterPotion.java | 2 +- .../flyweight/InvisibilityPotion.java | 2 +- .../com/iluwatar/flyweight/PoisonPotion.java | 2 +- .../java/com/iluwatar/flyweight/Potion.java | 2 +- .../com/iluwatar/flyweight/PotionFactory.java | 2 +- .../com/iluwatar/flyweight/PotionType.java | 2 +- .../iluwatar/flyweight/StrengthPotion.java | 2 +- .../iluwatar/flyweight/AlchemistShopTest.java | 2 +- .../java/com/iluwatar/flyweight/AppTest.java | 2 +- front-controller/pom.xml | 2 +- .../com/iluwatar/front/controller/App.java | 2 +- .../controller/ApplicationException.java | 2 +- .../front/controller/ArcherCommand.java | 2 +- .../iluwatar/front/controller/ArcherView.java | 2 +- .../front/controller/CatapultCommand.java | 2 +- .../front/controller/CatapultView.java | 2 +- .../iluwatar/front/controller/Command.java | 2 +- .../iluwatar/front/controller/ErrorView.java | 2 +- .../front/controller/FrontController.java | 2 +- .../front/controller/UnknownCommand.java | 2 +- .../com/iluwatar/front/controller/View.java | 2 +- .../iluwatar/front/controller/AppTest.java | 2 +- .../controller/ApplicationExceptionTest.java | 2 +- .../front/controller/CommandTest.java | 2 +- .../front/controller/FrontControllerTest.java | 2 +- .../iluwatar/front/controller/ViewTest.java | 2 +- .../controller/utils/InMemoryAppender.java | 2 +- guarded-suspension/pom.xml | 2 +- .../com/iluwatar/guarded/suspension/App.java | 2 +- .../guarded/suspension/GuardedQueue.java | 8 ++-- .../guarded/suspension/GuardedQueueTest.java | 8 ++-- half-sync-half-async/pom.xml | 2 +- .../com/iluwatar/halfsynchalfasync/App.java | 2 +- .../iluwatar/halfsynchalfasync/AsyncTask.java | 2 +- .../AsynchronousService.java | 2 +- .../iluwatar/halfsynchalfasync/AppTest.java | 2 +- .../AsynchronousServiceTest.java | 2 +- hexagonal/etc/ports_and_adapters.xml | 2 +- hexagonal/etc/presentation.html | 2 +- hexagonal/pom.xml | 2 +- .../main/java/com/iluwatar/hexagonal/App.java | 2 +- .../administration/ConsoleAdministration.java | 2 +- .../ConsoleAdministrationSrv.java | 2 +- .../ConsoleAdministrationSrvImpl.java | 2 +- .../hexagonal/banking/InMemoryBank.java | 2 +- .../iluwatar/hexagonal/banking/MongoBank.java | 2 +- .../hexagonal/banking/WireTransfers.java | 2 +- .../database/InMemoryTicketRepository.java | 2 +- .../database/LotteryTicketRepository.java | 2 +- .../database/MongoTicketRepository.java | 2 +- .../domain/LotteryAdministration.java | 2 +- .../hexagonal/domain/LotteryConstants.java | 2 +- .../hexagonal/domain/LotteryNumbers.java | 2 +- .../hexagonal/domain/LotteryService.java | 2 +- .../hexagonal/domain/LotteryTicket.java | 2 +- .../domain/LotteryTicketCheckResult.java | 2 +- .../hexagonal/domain/LotteryTicketId.java | 2 +- .../hexagonal/domain/LotteryUtils.java | 2 +- .../hexagonal/domain/PlayerDetails.java | 2 +- .../hexagonal/eventlog/LotteryEventLog.java | 2 +- .../hexagonal/eventlog/MongoEventLog.java | 2 +- .../hexagonal/eventlog/StdOutEventLog.java | 2 +- .../hexagonal/module/LotteryModule.java | 2 +- .../module/LotteryTestingModule.java | 2 +- .../MongoConnectionPropertiesLoader.java | 2 +- .../hexagonal/sampledata/SampleData.java | 2 +- .../hexagonal/service/ConsoleLottery.java | 2 +- .../service/LotteryConsoleService.java | 2 +- .../service/LotteryConsoleServiceImpl.java | 2 +- .../java/com/iluwatar/hexagonal/AppTest.java | 2 +- .../hexagonal/banking/InMemoryBankTest.java | 2 +- .../hexagonal/banking/MongoBankTest.java | 2 +- .../InMemoryTicketRepositoryTest.java | 2 +- .../database/MongoTicketRepositoryTest.java | 2 +- .../hexagonal/domain/LotteryNumbersTest.java | 2 +- .../hexagonal/domain/LotteryTest.java | 2 +- .../domain/LotteryTicketCheckResultTest.java | 2 +- .../hexagonal/domain/LotteryTicketIdTest.java | 2 +- .../hexagonal/domain/LotteryTicketTest.java | 2 +- .../hexagonal/domain/PlayerDetailsTest.java | 2 +- .../hexagonal/eventlog/MongoEventLogTest.java | 2 +- .../hexagonal/test/LotteryTestUtils.java | 2 +- intercepting-filter/pom.xml | 2 +- .../intercepting/filter/AbstractFilter.java | 2 +- .../intercepting/filter/AddressFilter.java | 2 +- .../com/iluwatar/intercepting/filter/App.java | 2 +- .../iluwatar/intercepting/filter/Client.java | 2 +- .../intercepting/filter/ContactFilter.java | 2 +- .../intercepting/filter/DepositFilter.java | 2 +- .../iluwatar/intercepting/filter/Filter.java | 2 +- .../intercepting/filter/FilterChain.java | 2 +- .../intercepting/filter/FilterManager.java | 2 +- .../intercepting/filter/NameFilter.java | 2 +- .../iluwatar/intercepting/filter/Order.java | 2 +- .../intercepting/filter/OrderFilter.java | 2 +- .../iluwatar/intercepting/filter/Target.java | 2 +- .../iluwatar/intercepting/filter/AppTest.java | 2 +- .../filter/FilterManagerTest.java | 2 +- .../intercepting/filter/FilterTest.java | 2 +- .../intercepting/filter/OrderTest.java | 2 +- interpreter/pom.xml | 2 +- .../java/com/iluwatar/interpreter/App.java | 2 +- .../com/iluwatar/interpreter/Expression.java | 2 +- .../iluwatar/interpreter/MinusExpression.java | 2 +- .../interpreter/MultiplyExpression.java | 2 +- .../interpreter/NumberExpression.java | 2 +- .../iluwatar/interpreter/PlusExpression.java | 2 +- .../com/iluwatar/interpreter/AppTest.java | 2 +- .../iluwatar/interpreter/ExpressionTest.java | 2 +- .../interpreter/MinusExpressionTest.java | 2 +- .../interpreter/MultiplyExpressionTest.java | 2 +- .../interpreter/NumberExpressionTest.java | 2 +- .../interpreter/PlusExpressionTest.java | 2 +- iterator/pom.xml | 2 +- .../main/java/com/iluwatar/iterator/App.java | 28 +++++++------ .../java/com/iluwatar/iterator/Iterator.java | 28 +++++++------ .../iluwatar/iterator/bst/BstIterator.java | 28 +++++++------ .../com/iluwatar/iterator/bst/TreeNode.java | 28 +++++++------ .../java/com/iluwatar/iterator/list/Item.java | 2 +- .../com/iluwatar/iterator/list/ItemType.java | 2 +- .../iluwatar/iterator/list/TreasureChest.java | 28 +++++++------ .../list/TreasureChestItemIterator.java | 28 +++++++------ .../java/com/iluwatar/iterator/AppTest.java | 35 +++++++++-------- .../iterator/bst/BstIteratorTest.java | 28 +++++++------ .../iterator/list/TreasureChestTest.java | 28 +++++++------ layers/pom.xml | 2 +- .../main/java/com/iluwatar/layers/App.java | 2 +- .../main/java/com/iluwatar/layers/Cake.java | 2 +- .../iluwatar/layers/CakeBakingException.java | 2 +- .../iluwatar/layers/CakeBakingService.java | 2 +- .../layers/CakeBakingServiceImpl.java | 2 +- .../java/com/iluwatar/layers/CakeDao.java | 2 +- .../java/com/iluwatar/layers/CakeInfo.java | 2 +- .../java/com/iluwatar/layers/CakeLayer.java | 2 +- .../com/iluwatar/layers/CakeLayerDao.java | 2 +- .../com/iluwatar/layers/CakeLayerInfo.java | 2 +- .../java/com/iluwatar/layers/CakeTopping.java | 2 +- .../com/iluwatar/layers/CakeToppingDao.java | 2 +- .../com/iluwatar/layers/CakeToppingInfo.java | 2 +- .../com/iluwatar/layers/CakeViewImpl.java | 2 +- .../main/java/com/iluwatar/layers/View.java | 2 +- .../main/resources/META-INF/persistence.xml | 2 +- .../src/main/resources/applicationContext.xml | 2 +- layers/src/main/resources/logback.xml | 2 +- .../java/com/iluwatar/layers/AppTest.java | 2 +- .../layers/CakeBakingExceptionTest.java | 2 +- .../layers/CakeBakingServiceImplTest.java | 2 +- .../java/com/iluwatar/layers/CakeTest.java | 2 +- .../com/iluwatar/layers/CakeViewImplTest.java | 2 +- lazy-loading/pom.xml | 2 +- .../java/com/iluwatar/lazy/loading/App.java | 2 +- .../java/com/iluwatar/lazy/loading/Heavy.java | 2 +- .../iluwatar/lazy/loading/HolderNaive.java | 2 +- .../lazy/loading/HolderThreadSafe.java | 2 +- .../iluwatar/lazy/loading/Java8Holder.java | 2 +- .../lazy/loading/AbstractHolderTest.java | 2 +- .../com/iluwatar/lazy/loading/AppTest.java | 2 +- .../lazy/loading/HolderNaiveTest.java | 2 +- .../lazy/loading/HolderThreadSafeTest.java | 2 +- .../lazy/loading/Java8HolderTest.java | 2 +- leader-election/pom.xml | 4 +- .../leaderelection/AbstractInstance.java | 9 ++--- .../AbstractMessageManager.java | 9 ++--- .../com/iluwatar/leaderelection/Instance.java | 3 +- .../com/iluwatar/leaderelection/Message.java | 3 +- .../leaderelection/MessageManager.java | 3 +- .../iluwatar/leaderelection/MessageType.java | 3 +- .../leaderelection/bully/BullyApp.java | 9 ++--- .../leaderelection/bully/BullyInstance.java | 9 ++--- .../bully/BullyMessageManager.java | 9 ++--- .../iluwatar/leaderelection/ring/RingApp.java | 3 +- .../leaderelection/ring/RingInstance.java | 3 +- .../ring/RingMessageManager.java | 3 +- .../iluwatar/leaderelection/MessageTest.java | 9 ++--- .../leaderelection/bully/BullyAppTest.java | 9 ++--- .../bully/BullyMessageManagerTest.java | 9 ++--- .../bully/BullyinstanceTest.java | 9 ++--- .../leaderelection/ring/RingAppTest.java | 9 ++--- .../leaderelection/ring/RingInstanceTest.java | 9 ++--- .../ring/RingMessageManagerTest.java | 9 ++--- marker/pom.xml | 7 +++- marker/src/main/java/App.java | 2 +- marker/src/main/java/Guard.java | 2 +- marker/src/main/java/Permission.java | 2 +- marker/src/main/java/Thief.java | 2 +- marker/src/test/java/AppTest.java | 3 +- marker/src/test/java/GuardTest.java | 3 +- marker/src/test/java/ThiefTest.java | 3 +- master-worker-pattern/pom.xml | 2 +- .../java/com/iluwatar/masterworker/App.java | 3 +- .../com/iluwatar/masterworker/ArrayInput.java | 3 +- .../iluwatar/masterworker/ArrayResult.java | 3 +- .../masterworker/ArrayUtilityMethods.java | 3 +- .../java/com/iluwatar/masterworker/Input.java | 3 +- .../com/iluwatar/masterworker/Result.java | 3 +- .../system/ArrayTransposeMasterWorker.java | 3 +- .../masterworker/system/MasterWorker.java | 3 +- .../systemmaster/ArrayTransposeMaster.java | 3 +- .../system/systemmaster/Master.java | 3 +- .../systemworkers/ArrayTransposeWorker.java | 3 +- .../system/systemworkers/Worker.java | 3 +- .../iluwatar/masterworker/ArrayInputTest.java | 3 +- .../masterworker/ArrayUtilityMethodsTest.java | 2 +- .../ArrayTransposeMasterWorkerTest.java | 3 +- .../ArrayTransposeWorkerTest.java | 3 +- mediator/pom.xml | 2 +- .../java/com/iluwatar/mediator/Action.java | 2 +- .../main/java/com/iluwatar/mediator/App.java | 2 +- .../java/com/iluwatar/mediator/Hobbit.java | 2 +- .../java/com/iluwatar/mediator/Hunter.java | 2 +- .../java/com/iluwatar/mediator/Party.java | 2 +- .../java/com/iluwatar/mediator/PartyImpl.java | 2 +- .../com/iluwatar/mediator/PartyMember.java | 2 +- .../iluwatar/mediator/PartyMemberBase.java | 2 +- .../java/com/iluwatar/mediator/Rogue.java | 2 +- .../java/com/iluwatar/mediator/Wizard.java | 2 +- .../java/com/iluwatar/mediator/AppTest.java | 2 +- .../com/iluwatar/mediator/PartyImplTest.java | 2 +- .../iluwatar/mediator/PartyMemberTest.java | 2 +- memento/pom.xml | 2 +- .../main/java/com/iluwatar/memento/App.java | 2 +- .../main/java/com/iluwatar/memento/Star.java | 2 +- .../com/iluwatar/memento/StarMemento.java | 2 +- .../java/com/iluwatar/memento/StarType.java | 2 +- .../java/com/iluwatar/memento/AppTest.java | 2 +- .../java/com/iluwatar/memento/StarTest.java | 2 +- model-view-controller/pom.xml | 2 +- .../iluwatar/model/view/controller/App.java | 2 +- .../model/view/controller/Fatigue.java | 2 +- .../view/controller/GiantController.java | 2 +- .../model/view/controller/GiantModel.java | 2 +- .../model/view/controller/GiantView.java | 2 +- .../model/view/controller/Health.java | 2 +- .../model/view/controller/Nourishment.java | 2 +- .../model/view/controller/AppTest.java | 2 +- .../view/controller/GiantControllerTest.java | 2 +- .../model/view/controller/GiantModelTest.java | 2 +- .../model/view/controller/GiantViewTest.java | 2 +- model-view-presenter/etc/data/test.txt | 2 +- model-view-presenter/pom.xml | 2 +- .../iluwatar/model/view/presenter/App.java | 2 +- .../model/view/presenter/FileLoader.java | 2 +- .../view/presenter/FileSelectorJFrame.java | 2 +- .../view/presenter/FileSelectorPresenter.java | 2 +- .../view/presenter/FileSelectorStub.java | 2 +- .../view/presenter/FileSelectorView.java | 2 +- .../model/view/presenter/AppTest.java | 2 +- .../model/view/presenter/FileLoaderTest.java | 2 +- .../presenter/FileSelectorPresenterTest.java | 2 +- module/pom.xml | 2 +- .../main/java/com/iluwatar/module/App.java | 28 +++++++------ .../iluwatar/module/ConsoleLoggerModule.java | 28 +++++++------ .../com/iluwatar/module/FileLoggerModule.java | 28 +++++++------ module/src/main/resources/log4j.xml | 2 +- .../java/com/iluwatar/module/AppTest.java | 28 +++++++------ .../iluwatar/module/FileLoggerModuleTest.java | 28 +++++++------ monad/pom.xml | 2 +- .../src/main/java/com/iluwatar/monad/App.java | 2 +- .../src/main/java/com/iluwatar/monad/Sex.java | 2 +- .../main/java/com/iluwatar/monad/User.java | 2 +- .../java/com/iluwatar/monad/Validator.java | 2 +- .../test/java/com/iluwatar/monad/AppTest.java | 2 +- .../java/com/iluwatar/monad/MonadTest.java | 2 +- monostate/pom.xml | 2 +- .../main/java/com/iluwatar/monostate/App.java | 2 +- .../com/iluwatar/monostate/LoadBalancer.java | 2 +- .../java/com/iluwatar/monostate/Request.java | 2 +- .../java/com/iluwatar/monostate/Server.java | 2 +- .../java/com/iluwatar/monostate/AppTest.java | 2 +- .../iluwatar/monostate/LoadBalancerTest.java | 2 +- multiton/pom.xml | 2 +- .../main/java/com/iluwatar/multiton/App.java | 2 +- .../java/com/iluwatar/multiton/Nazgul.java | 2 +- .../com/iluwatar/multiton/NazgulEnum.java | 2 +- .../com/iluwatar/multiton/NazgulName.java | 2 +- .../java/com/iluwatar/multiton/AppTest.java | 2 +- .../com/iluwatar/multiton/NazgulEnumTest.java | 2 +- .../com/iluwatar/multiton/NazgulTest.java | 2 +- mute-idiom/pom.xml | 39 ++++++++++++------- .../src/main/java/com/iluwatar/mute/App.java | 3 +- .../com/iluwatar/mute/CheckedRunnable.java | 3 +- .../src/main/java/com/iluwatar/mute/Mute.java | 2 +- .../main/java/com/iluwatar/mute/Resource.java | 3 +- .../test/java/com/iluwatar/mute/AppTest.java | 3 +- .../test/java/com/iluwatar/mute/MuteTest.java | 3 +- mutex/pom.xml | 2 +- .../src/main/java/com/iluwatar/mutex/App.java | 2 +- .../src/main/java/com/iluwatar/mutex/Jar.java | 2 +- .../main/java/com/iluwatar/mutex/Lock.java | 2 +- .../main/java/com/iluwatar/mutex/Mutex.java | 2 +- .../main/java/com/iluwatar/mutex/Thief.java | 2 +- .../test/java/com/iluwatar/mutex/AppTest.java | 2 +- .../test/java/com/iluwatar/mutex/JarTest.java | 2 +- .../java/com/iluwatar/mutex/MutexTest.java | 2 +- naked-objects/dom/exclude-pmd.properties | 2 +- naked-objects/dom/pom.xml | 34 +++++++++++----- .../src/main/java/META-INF/persistence.xml | 38 ++++++++++-------- .../dom/app/homepage/HomePageService.java | 30 ++++++++------ .../dom/app/homepage/HomePageViewModel.java | 30 ++++++++------ .../dom/modules/simple/SimpleObject.java | 30 ++++++++------ .../dom/modules/simple/SimpleObjects.java | 30 ++++++++------ .../dom/modules/simple/SimpleObjectTest.java | 28 ++++++++----- .../dom/modules/simple/SimpleObjectsTest.java | 28 ++++++++----- naked-objects/fixture/pom.xml | 34 +++++++++++----- .../fixture/DomainAppFixturesProvider.java | 34 +++++++++------- .../modules/simple/SimpleObjectCreate.java | 31 +++++++++------ .../modules/simple/SimpleObjectsTearDown.java | 31 +++++++++------ .../scenarios/RecreateSimpleObjects.java | 31 +++++++++------ naked-objects/integtests/pom.xml | 34 +++++++++++----- .../bootstrap/SimpleAppSystemInitializer.java | 30 ++++++++------ .../specglue/BootstrappingGlue.java | 28 ++++++++----- .../specglue/CatalogOfFixturesGlue.java | 28 ++++++++----- .../modules/simple/SimpleObjectGlue.java | 28 ++++++++----- .../domainapp/integtests/specs/RunSpecs.java | 28 ++++++++----- .../integtests/tests/SimpleAppIntegTest.java | 34 +++++++++------- .../modules/simple/SimpleObjectIntegTest.java | 34 +++++++++------- .../simple/SimpleObjectsIntegTest.java | 34 +++++++++------- naked-objects/pom.xml | 34 +++++++++++----- .../webapp/ide/intellij/launch/README.txt | 2 +- .../intellij/launch/SimpleApp_PROTOTYPE.xml | 2 +- .../launch/SimpleApp__enhance_only_.xml | 2 +- naked-objects/webapp/pom.xml | 34 +++++++++++----- .../domainapp/webapp/SimpleApplication.java | 34 +++++++++------- .../resources/domainapp/webapp/welcome.html | 38 ++++++++++-------- .../src/main/webapp/WEB-INF/isis.properties | 38 ++++++++++-------- .../main/webapp/WEB-INF/persistor.properties | 38 ++++++++++-------- .../WEB-INF/persistor_datanucleus.properties | 38 ++++++++++-------- .../WEB-INF/viewer_restfulobjects.properties | 38 ++++++++++-------- .../webapp/WEB-INF/viewer_wicket.properties | 38 ++++++++++-------- .../webapp/src/main/webapp/WEB-INF/web.xml | 38 ++++++++++-------- .../webapp/src/main/webapp/about/index.html | 2 +- .../src/main/webapp/css/application.css | 35 +++++++++-------- .../src/main/webapp/scripts/application.js | 2 +- null-object/pom.xml | 2 +- .../java/com/iluwatar/nullobject/App.java | 2 +- .../java/com/iluwatar/nullobject/Node.java | 2 +- .../com/iluwatar/nullobject/NodeImpl.java | 2 +- .../com/iluwatar/nullobject/NullNode.java | 2 +- .../java/com/iluwatar/nullobject/AppTest.java | 2 +- .../com/iluwatar/nullobject/NullNodeTest.java | 2 +- .../com/iluwatar/nullobject/TreeTest.java | 2 +- object-mother/pom.xml | 2 +- .../java/com/iluwatar/objectmother/King.java | 2 +- .../java/com/iluwatar/objectmother/Queen.java | 2 +- .../com/iluwatar/objectmother/Royalty.java | 2 +- .../objectmother/RoyaltyObjectMother.java | 2 +- .../test/RoyaltyObjectMotherTest.java | 2 +- object-pool/pom.xml | 2 +- .../java/com/iluwatar/object/pool/App.java | 2 +- .../com/iluwatar/object/pool/ObjectPool.java | 2 +- .../com/iluwatar/object/pool/Oliphaunt.java | 2 +- .../iluwatar/object/pool/OliphauntPool.java | 2 +- .../com/iluwatar/object/pool/AppTest.java | 2 +- .../object/pool/OliphauntPoolTest.java | 2 +- observer/pom.xml | 2 +- .../main/java/com/iluwatar/observer/App.java | 2 +- .../java/com/iluwatar/observer/Hobbits.java | 2 +- .../main/java/com/iluwatar/observer/Orcs.java | 2 +- .../java/com/iluwatar/observer/Weather.java | 2 +- .../iluwatar/observer/WeatherObserver.java | 2 +- .../com/iluwatar/observer/WeatherType.java | 2 +- .../iluwatar/observer/generic/GHobbits.java | 2 +- .../com/iluwatar/observer/generic/GOrcs.java | 2 +- .../iluwatar/observer/generic/GWeather.java | 2 +- .../iluwatar/observer/generic/Observable.java | 2 +- .../iluwatar/observer/generic/Observer.java | 2 +- .../com/iluwatar/observer/generic/Race.java | 2 +- .../java/com/iluwatar/observer/AppTest.java | 2 +- .../com/iluwatar/observer/HobbitsTest.java | 2 +- .../java/com/iluwatar/observer/OrcsTest.java | 2 +- .../observer/WeatherObserverTest.java | 2 +- .../com/iluwatar/observer/WeatherTest.java | 2 +- .../observer/generic/GHobbitsTest.java | 2 +- .../observer/generic/GWeatherTest.java | 2 +- .../observer/generic/ObserverTest.java | 2 +- .../iluwatar/observer/generic/OrcsTest.java | 2 +- .../observer/utils/InMemoryAppender.java | 2 +- page-object/pom.xml | 2 +- page-object/sample-application/pom.xml | 2 +- .../java/com/iluwatar/pageobject/App.java | 2 +- .../main/resources/sample-ui/album-list.html | 2 +- .../main/resources/sample-ui/album-page.html | 2 +- .../resources/sample-ui/css/album-list.css | 2 +- .../main/resources/sample-ui/css/style.css | 2 +- .../src/main/resources/sample-ui/login.html | 2 +- .../java/com/iluwatar/pageobject/App.java | 2 +- .../main/resources/sample-ui/album-list.html | 2 +- .../main/resources/sample-ui/album-page.html | 2 +- .../resources/sample-ui/css/album-list.css | 2 +- .../main/resources/sample-ui/css/style.css | 2 +- .../src/main/resources/sample-ui/login.html | 2 +- .../pageobject/AlbumListPageTest.java | 8 ++-- .../iluwatar/pageobject/AlbumPageTest.java | 8 ++-- .../iluwatar/pageobject/LoginPageTest.java | 8 ++-- .../pageobject/pages/AlbumListPage.java | 8 ++-- .../iluwatar/pageobject/pages/AlbumPage.java | 8 ++-- .../iluwatar/pageobject/pages/LoginPage.java | 8 ++-- .../com/iluwatar/pageobject/pages/Page.java | 8 ++-- page-object/test-automation/pom.xml | 2 +- .../iluwatar/pageobject/AlbumListPage.java | 8 ++-- .../com/iluwatar/pageobject/AlbumPage.java | 8 ++-- .../com/iluwatar/pageobject/LoginPage.java | 8 ++-- .../java/com/iluwatar/pageobject/Page.java | 8 ++-- .../pageobject/AlbumListPageTest.java | 8 ++-- .../iluwatar/pageobject/AlbumPageTest.java | 8 ++-- .../iluwatar/pageobject/LoginPageTest.java | 8 ++-- partial-response/pom.xml | 2 +- .../com/iluwatar/partialresponse/App.java | 16 ++++---- .../partialresponse/FieldJsonMapper.java | 16 ++++---- .../com/iluwatar/partialresponse/Video.java | 16 ++++---- .../partialresponse/VideoResource.java | 16 ++++---- .../com/iluwatar/partialresponse/AppTest.java | 16 ++++---- .../partialresponse/FieldJsonMapperTest.java | 16 ++++---- .../partialresponse/VideoResourceTest.java | 16 ++++---- pipeline/pom.xml | 2 +- .../main/java/com.iluwatar.pipeline/App.java | 2 +- .../ConvertToCharArrayHandler.java | 8 ++-- .../java/com.iluwatar.pipeline/Handler.java | 2 +- .../java/com.iluwatar.pipeline/Pipeline.java | 2 +- .../RemoveAlphabetsHandler.java | 2 +- .../RemoveDigitsHandler.java | 2 +- .../java/com.iluwatar.pipeline/AppTest.java | 8 ++-- .../com.iluwatar.pipeline/PipelineTest.java | 8 ++-- poison-pill/pom.xml | 2 +- .../java/com/iluwatar/poison/pill/App.java | 2 +- .../com/iluwatar/poison/pill/Consumer.java | 2 +- .../com/iluwatar/poison/pill/Message.java | 2 +- .../iluwatar/poison/pill/MessageQueue.java | 2 +- .../iluwatar/poison/pill/MqPublishPoint.java | 2 +- .../poison/pill/MqSubscribePoint.java | 2 +- .../com/iluwatar/poison/pill/Producer.java | 2 +- .../iluwatar/poison/pill/SimpleMessage.java | 2 +- .../poison/pill/SimpleMessageQueue.java | 2 +- .../com/iluwatar/poison/pill/AppTest.java | 2 +- .../iluwatar/poison/pill/ConsumerTest.java | 2 +- .../poison/pill/PoisonMessageTest.java | 2 +- .../iluwatar/poison/pill/ProducerTest.java | 2 +- .../poison/pill/SimpleMessageTest.java | 2 +- pom.xml | 9 ++++- priority-queue/pom.xml | 2 +- .../iluwatar/priority/queue/Application.java | 8 ++-- .../com/iluwatar/priority/queue/Message.java | 2 +- .../priority/queue/PriorityMessageQueue.java | 8 ++-- .../iluwatar/priority/queue/QueueManager.java | 8 ++-- .../com/iluwatar/priority/queue/Worker.java | 8 ++-- .../queue/PriorityMessageQueueTest.java | 2 +- .../priority/queue/QueueManagerTest.java | 2 +- private-class-data/pom.xml | 2 +- .../com/iluwatar/privateclassdata/App.java | 2 +- .../privateclassdata/ImmutableStew.java | 2 +- .../com/iluwatar/privateclassdata/Stew.java | 2 +- .../iluwatar/privateclassdata/StewData.java | 2 +- .../iluwatar/privateclassdata/AppTest.java | 2 +- .../privateclassdata/ImmutableStewTest.java | 2 +- .../iluwatar/privateclassdata/StewTest.java | 2 +- .../utils/InMemoryAppender.java | 2 +- producer-consumer/pom.xml | 2 +- .../com/iluwatar/producer/consumer/App.java | 2 +- .../iluwatar/producer/consumer/Consumer.java | 2 +- .../com/iluwatar/producer/consumer/Item.java | 2 +- .../iluwatar/producer/consumer/ItemQueue.java | 2 +- .../iluwatar/producer/consumer/Producer.java | 2 +- .../iluwatar/producer/consumer/AppTest.java | 2 +- .../producer/consumer/ConsumerTest.java | 2 +- .../producer/consumer/ProducerTest.java | 2 +- promise/pom.xml | 2 +- .../main/java/com/iluwatar/promise/App.java | 2 +- .../java/com/iluwatar/promise/Promise.java | 2 +- .../com/iluwatar/promise/PromiseSupport.java | 2 +- .../java/com/iluwatar/promise/Utility.java | 2 +- .../java/com/iluwatar/promise/AppTest.java | 2 +- .../com/iluwatar/promise/PromiseTest.java | 2 +- property/pom.xml | 2 +- .../main/java/com/iluwatar/property/App.java | 2 +- .../java/com/iluwatar/property/Character.java | 2 +- .../java/com/iluwatar/property/Prototype.java | 2 +- .../java/com/iluwatar/property/Stats.java | 2 +- .../java/com/iluwatar/property/AppTest.java | 2 +- .../com/iluwatar/property/CharacterTest.java | 2 +- prototype/pom.xml | 2 +- .../main/java/com/iluwatar/prototype/App.java | 2 +- .../java/com/iluwatar/prototype/Beast.java | 2 +- .../java/com/iluwatar/prototype/ElfBeast.java | 2 +- .../java/com/iluwatar/prototype/ElfMage.java | 2 +- .../com/iluwatar/prototype/ElfWarlord.java | 2 +- .../com/iluwatar/prototype/HeroFactory.java | 2 +- .../iluwatar/prototype/HeroFactoryImpl.java | 2 +- .../java/com/iluwatar/prototype/Mage.java | 2 +- .../java/com/iluwatar/prototype/OrcBeast.java | 2 +- .../java/com/iluwatar/prototype/OrcMage.java | 2 +- .../com/iluwatar/prototype/OrcWarlord.java | 2 +- .../com/iluwatar/prototype/Prototype.java | 2 +- .../java/com/iluwatar/prototype/Warlord.java | 2 +- .../java/com/iluwatar/prototype/AppTest.java | 2 +- .../prototype/HeroFactoryImplTest.java | 2 +- .../com/iluwatar/prototype/PrototypeTest.java | 2 +- proxy/etc/presentation.html | 2 +- proxy/etc/proxy-concept.xml | 2 +- proxy/pom.xml | 2 +- .../src/main/java/com/iluwatar/proxy/App.java | 2 +- .../java/com/iluwatar/proxy/IvoryTower.java | 2 +- .../main/java/com/iluwatar/proxy/Wizard.java | 2 +- .../java/com/iluwatar/proxy/WizardTower.java | 2 +- .../com/iluwatar/proxy/WizardTowerProxy.java | 2 +- .../test/java/com/iluwatar/proxy/AppTest.java | 2 +- .../com/iluwatar/proxy/IvoryTowerTest.java | 2 +- .../java/com/iluwatar/proxy/WizardTest.java | 2 +- .../iluwatar/proxy/WizardTowerProxyTest.java | 2 +- .../proxy/utils/InMemoryAppender.java | 2 +- queue-load-leveling/pom.xml | 2 +- .../com/iluwatar/queue/load/leveling/App.java | 3 +- .../iluwatar/queue/load/leveling/Message.java | 2 +- .../queue/load/leveling/MessageQueue.java | 2 +- .../queue/load/leveling/ServiceExecutor.java | 3 +- .../iluwatar/queue/load/leveling/Task.java | 2 +- .../queue/load/leveling/TaskGenerator.java | 2 +- .../iluwatar/queue/load/leveling/AppTest.java | 2 +- .../queue/load/leveling/MessageQueueTest.java | 2 +- .../queue/load/leveling/MessageTest.java | 2 +- .../load/leveling/TaskGenSrvExeTest.java | 2 +- reactor/pom.xml | 2 +- .../java/com/iluwatar/reactor/app/App.java | 2 +- .../com/iluwatar/reactor/app/AppClient.java | 2 +- .../iluwatar/reactor/app/LoggingHandler.java | 2 +- .../reactor/framework/AbstractNioChannel.java | 2 +- .../reactor/framework/ChannelHandler.java | 2 +- .../reactor/framework/Dispatcher.java | 2 +- .../reactor/framework/NioDatagramChannel.java | 2 +- .../reactor/framework/NioReactor.java | 2 +- .../framework/NioServerSocketChannel.java | 2 +- .../framework/SameThreadDispatcher.java | 2 +- .../framework/ThreadPoolDispatcher.java | 2 +- .../com/iluwatar/reactor/app/ReactorTest.java | 2 +- reader-writer-lock/pom.xml | 3 +- .../com/iluwatar/reader/writer/lock/App.java | 3 +- .../iluwatar/reader/writer/lock/Reader.java | 2 +- .../reader/writer/lock/ReaderWriterLock.java | 2 +- .../iluwatar/reader/writer/lock/Writer.java | 2 +- .../iluwatar/reader/writer/lock/AppTest.java | 2 +- .../writer/lock/ReaderAndWriterTest.java | 3 +- .../reader/writer/lock/ReaderTest.java | 2 +- .../reader/writer/lock/WriterTest.java | 2 +- .../writer/lock/utils/InMemoryAppender.java | 2 +- repository/pom.xml | 2 +- .../java/com/iluwatar/repository/App.java | 2 +- .../com/iluwatar/repository/AppConfig.java | 2 +- .../java/com/iluwatar/repository/Person.java | 2 +- .../iluwatar/repository/PersonRepository.java | 2 +- .../repository/PersonSpecifications.java | 2 +- .../main/resources/META-INF/persistence.xml | 2 +- .../src/main/resources/applicationContext.xml | 2 +- repository/src/main/resources/logback.xml | 2 +- .../AnnotationBasedRepositoryTest.java | 2 +- .../iluwatar/repository/AppConfigTest.java | 2 +- .../java/com/iluwatar/repository/AppTest.java | 2 +- .../iluwatar/repository/RepositoryTest.java | 2 +- .../pom.xml | 2 +- .../acquisition/is/initialization/App.java | 2 +- .../is/initialization/SlidingDoor.java | 2 +- .../is/initialization/TreasureChest.java | 2 +- .../is/initialization/AppTest.java | 2 +- .../is/initialization/ClosableTest.java | 2 +- retry/pom.xml | 4 +- .../src/main/java/com/iluwatar/retry/App.java | 22 +++++------ .../com/iluwatar/retry/BusinessException.java | 22 +++++------ .../com/iluwatar/retry/BusinessOperation.java | 22 +++++------ .../retry/CustomerNotFoundException.java | 22 +++++------ .../retry/DatabaseNotAvailableException.java | 22 +++++------ .../java/com/iluwatar/retry/FindCustomer.java | 22 +++++------ .../main/java/com/iluwatar/retry/Retry.java | 22 +++++------ .../retry/RetryExponentialBackoff.java | 16 ++++---- .../com/iluwatar/retry/FindCustomerTest.java | 22 +++++------ .../retry/RetryExponentialBackoffTest.java | 16 ++++---- .../java/com/iluwatar/retry/RetryTest.java | 22 +++++------ semaphore/pom.xml | 2 +- .../main/java/com/iluwatar/semaphore/App.java | 2 +- .../java/com/iluwatar/semaphore/Customer.java | 2 +- .../java/com/iluwatar/semaphore/Fruit.java | 2 +- .../com/iluwatar/semaphore/FruitBowl.java | 2 +- .../com/iluwatar/semaphore/FruitShop.java | 2 +- .../java/com/iluwatar/semaphore/Lock.java | 2 +- .../com/iluwatar/semaphore/Semaphore.java | 2 +- .../java/com/iluwatar/semaphore/AppTest.java | 2 +- .../com/iluwatar/semaphore/FruitBowlTest.java | 2 +- .../com/iluwatar/semaphore/SemaphoreTest.java | 2 +- servant/pom.xml | 2 +- servant/src/etc/servant.xml | 2 +- .../main/java/com/iluwatar/servant/App.java | 2 +- .../main/java/com/iluwatar/servant/King.java | 2 +- .../main/java/com/iluwatar/servant/Queen.java | 2 +- .../java/com/iluwatar/servant/Royalty.java | 2 +- .../java/com/iluwatar/servant/Servant.java | 2 +- .../java/com/iluwatar/servant/AppTest.java | 2 +- .../java/com/iluwatar/servant/KingTest.java | 2 +- .../java/com/iluwatar/servant/QueenTest.java | 2 +- .../com/iluwatar/servant/ServantTest.java | 2 +- serverless/pom.xml | 7 +++- serverless/serverless.yml | 2 +- .../baas/api/AbstractDynamoDbHandler.java | 2 +- .../baas/api/FindPersonApiHandler.java | 2 +- .../baas/api/SavePersonApiHandler.java | 2 +- .../serverless/baas/model/Address.java | 2 +- .../serverless/baas/model/Person.java | 2 +- .../serverless/faas/ApiGatewayResponse.java | 2 +- .../iluwatar/serverless/faas/LambdaInfo.java | 2 +- .../faas/api/LambdaInfoApiHandler.java | 2 +- .../src/main/resources/log4j.properties | 2 +- .../baas/api/FindPersonApiHandlerTest.java | 2 +- .../baas/api/SavePersonApiHandlerTest.java | 2 +- .../faas/api/LambdaInfoApiHandlerTest.java | 8 ++-- service-layer/pom.xml | 2 +- .../com/iluwatar/servicelayer/app/App.java | 2 +- .../servicelayer/common/BaseEntity.java | 2 +- .../com/iluwatar/servicelayer/common/Dao.java | 2 +- .../servicelayer/common/DaoBaseImpl.java | 2 +- .../servicelayer/hibernate/HibernateUtil.java | 2 +- .../servicelayer/magic/MagicService.java | 2 +- .../servicelayer/magic/MagicServiceImpl.java | 2 +- .../iluwatar/servicelayer/spell/Spell.java | 2 +- .../iluwatar/servicelayer/spell/SpellDao.java | 2 +- .../servicelayer/spell/SpellDaoImpl.java | 2 +- .../servicelayer/spellbook/Spellbook.java | 2 +- .../servicelayer/spellbook/SpellbookDao.java | 2 +- .../spellbook/SpellbookDaoImpl.java | 2 +- .../iluwatar/servicelayer/wizard/Wizard.java | 2 +- .../servicelayer/wizard/WizardDao.java | 2 +- .../servicelayer/wizard/WizardDaoImpl.java | 2 +- service-layer/src/main/resources/logback.xml | 2 +- .../iluwatar/servicelayer/app/AppTest.java | 2 +- .../servicelayer/common/BaseDaoTest.java | 2 +- .../magic/MagicServiceImplTest.java | 2 +- .../servicelayer/spell/SpellDaoImplTest.java | 2 +- .../spellbook/SpellbookDaoImplTest.java | 2 +- .../wizard/WizardDaoImplTest.java | 2 +- service-locator/pom.xml | 2 +- .../java/com/iluwatar/servicelocator/App.java | 2 +- .../iluwatar/servicelocator/InitContext.java | 2 +- .../com/iluwatar/servicelocator/Service.java | 2 +- .../iluwatar/servicelocator/ServiceCache.java | 2 +- .../iluwatar/servicelocator/ServiceImpl.java | 2 +- .../servicelocator/ServiceLocator.java | 2 +- .../com/iluwatar/servicelocator/AppTest.java | 2 +- .../servicelocator/ServiceLocatorTest.java | 2 +- singleton/pom.xml | 2 +- .../main/java/com/iluwatar/singleton/App.java | 2 +- .../iluwatar/singleton/EnumIvoryTower.java | 2 +- .../InitializingOnDemandHolderIdiom.java | 2 +- .../com/iluwatar/singleton/IvoryTower.java | 2 +- .../ThreadSafeDoubleCheckLocking.java | 2 +- .../ThreadSafeLazyLoadedIvoryTower.java | 28 +++++++------ .../java/com/iluwatar/singleton/AppTest.java | 2 +- .../singleton/EnumIvoryTowerTest.java | 2 +- .../InitializingOnDemandHolderIdiomTest.java | 2 +- .../iluwatar/singleton/IvoryTowerTest.java | 2 +- .../com/iluwatar/singleton/SingletonTest.java | 2 +- .../ThreadSafeDoubleCheckLockingTest.java | 2 +- .../ThreadSafeLazyLoadedIvoryTowerTest.java | 2 +- spatial-partition/pom.xml | 2 +- .../com/iluwatar/spatialpartition/App.java | 3 +- .../com/iluwatar/spatialpartition/Bubble.java | 3 +- .../com/iluwatar/spatialpartition/Point.java | 3 +- .../iluwatar/spatialpartition/QuadTree.java | 3 +- .../com/iluwatar/spatialpartition/Rect.java | 3 +- .../SpatialPartitionBubbles.java | 3 +- .../SpatialPartitionGeneric.java | 3 +- .../iluwatar/spatialpartition/BubbleTest.java | 3 +- .../spatialpartition/QuadTreeTest.java | 3 +- .../iluwatar/spatialpartition/RectTest.java | 3 +- .../SpatialPartitionBubblesTest.java | 3 +- specification/pom.xml | 2 +- .../com/iluwatar/specification/app/App.java | 2 +- .../creature/AbstractCreature.java | 2 +- .../specification/creature/Creature.java | 2 +- .../specification/creature/Dragon.java | 2 +- .../specification/creature/Goblin.java | 2 +- .../specification/creature/KillerBee.java | 2 +- .../specification/creature/Octopus.java | 2 +- .../specification/creature/Shark.java | 2 +- .../specification/creature/Troll.java | 2 +- .../specification/property/Color.java | 2 +- .../specification/property/Movement.java | 2 +- .../iluwatar/specification/property/Size.java | 2 +- .../specification/selector/ColorSelector.java | 2 +- .../selector/MovementSelector.java | 2 +- .../specification/selector/SizeSelector.java | 2 +- .../iluwatar/specification/app/AppTest.java | 2 +- .../specification/creature/CreatureTest.java | 2 +- .../selector/ColorSelectorTest.java | 2 +- .../selector/MovementSelectorTest.java | 2 +- .../selector/SizeSelectorTest.java | 2 +- state/pom.xml | 2 +- .../java/com/iluwatar/state/AngryState.java | 2 +- .../src/main/java/com/iluwatar/state/App.java | 2 +- .../main/java/com/iluwatar/state/Mammoth.java | 2 +- .../com/iluwatar/state/PeacefulState.java | 2 +- .../main/java/com/iluwatar/state/State.java | 2 +- .../test/java/com/iluwatar/state/AppTest.java | 2 +- .../java/com/iluwatar/state/MammothTest.java | 2 +- step-builder/pom.xml | 2 +- .../java/com/iluwatar/stepbuilder/App.java | 2 +- .../com/iluwatar/stepbuilder/Character.java | 2 +- .../stepbuilder/CharacterStepBuilder.java | 2 +- .../com/iluwatar/stepbuilder/AppTest.java | 2 +- .../stepbuilder/CharacterStepBuilderTest.java | 2 +- strategy/pom.xml | 2 +- .../main/java/com/iluwatar/strategy/App.java | 2 +- .../com/iluwatar/strategy/DragonSlayer.java | 2 +- .../strategy/DragonSlayingStrategy.java | 2 +- .../com/iluwatar/strategy/MeleeStrategy.java | 2 +- .../iluwatar/strategy/ProjectileStrategy.java | 2 +- .../com/iluwatar/strategy/SpellStrategy.java | 2 +- .../java/com/iluwatar/strategy/AppTest.java | 2 +- .../iluwatar/strategy/DragonSlayerTest.java | 2 +- .../strategy/DragonSlayingStrategyTest.java | 2 +- template-method/pom.xml | 2 +- .../java/com/iluwatar/templatemethod/App.java | 2 +- .../templatemethod/HalflingThief.java | 2 +- .../templatemethod/HitAndRunMethod.java | 2 +- .../templatemethod/StealingMethod.java | 2 +- .../iluwatar/templatemethod/SubtleMethod.java | 2 +- .../com/iluwatar/templatemethod/AppTest.java | 2 +- .../templatemethod/HalflingThiefTest.java | 2 +- .../templatemethod/HitAndRunMethodTest.java | 2 +- .../templatemethod/StealingMethodTest.java | 2 +- .../templatemethod/SubtleMethodTest.java | 2 +- thread-pool/pom.xml | 2 +- .../java/com/iluwatar/threadpool/App.java | 2 +- .../iluwatar/threadpool/CoffeeMakingTask.java | 2 +- .../threadpool/PotatoPeelingTask.java | 2 +- .../java/com/iluwatar/threadpool/Task.java | 2 +- .../java/com/iluwatar/threadpool/Worker.java | 2 +- .../java/com/iluwatar/threadpool/AppTest.java | 2 +- .../threadpool/CoffeeMakingTaskTest.java | 2 +- .../threadpool/PotatoPeelingTaskTest.java | 2 +- .../com/iluwatar/threadpool/TaskTest.java | 2 +- .../com/iluwatar/threadpool/WorkerTest.java | 2 +- throttling/pom.xml | 2 +- .../java/com/iluwatar/throttling/App.java | 3 +- .../com/iluwatar/throttling/B2BService.java | 2 +- .../com/iluwatar/throttling/CallsCount.java | 2 +- .../java/com/iluwatar/throttling/Tenant.java | 2 +- .../throttling/timer/ThrottleTimerImpl.java | 2 +- .../iluwatar/throttling/timer/Throttler.java | 2 +- .../java/com/iluwatar/throttling/AppTest.java | 2 +- .../iluwatar/throttling/B2BServiceTest.java | 2 +- .../com/iluwatar/throttling/TenantTest.java | 2 +- tls/pom.xml | 3 +- tls/src/main/java/com/iluwatar/tls/App.java | 3 +- .../com/iluwatar/tls/DateFormatCallable.java | 3 +- .../main/java/com/iluwatar/tls/Result.java | 2 +- .../test/java/com/iluwatar/tls/AppTest.java | 3 +- .../iluwatar/tls/DateFormatCallableTest.java | 3 +- ...FormatCallableTestIncorrectDateFormat.java | 3 +- .../DateFormatCallableTestMultiThread.java | 3 +- tolerant-reader/pom.xml | 2 +- .../java/com/iluwatar/tolerantreader/App.java | 2 +- .../iluwatar/tolerantreader/RainbowFish.java | 2 +- .../tolerantreader/RainbowFishSerializer.java | 2 +- .../tolerantreader/RainbowFishV2.java | 2 +- .../com/iluwatar/tolerantreader/AppTest.java | 2 +- .../RainbowFishSerializerTest.java | 2 +- .../tolerantreader/RainbowFishTest.java | 2 +- .../tolerantreader/RainbowFishV2Test.java | 2 +- trampoline/pom.xml | 2 +- .../com/iluwatar/trampoline/Trampoline.java | 2 +- .../iluwatar/trampoline/TrampolineApp.java | 9 ++--- .../trampoline/TrampolineAppTest.java | 2 +- twin/pom.xml | 2 +- twin/src/main/java/com/iluwatar/twin/App.java | 2 +- .../main/java/com/iluwatar/twin/BallItem.java | 3 +- .../java/com/iluwatar/twin/BallThread.java | 3 +- .../main/java/com/iluwatar/twin/GameItem.java | 3 +- .../test/java/com/iluwatar/twin/AppTest.java | 2 +- .../java/com/iluwatar/twin/BallItemTest.java | 2 +- .../com/iluwatar/twin/BallThreadTest.java | 2 +- typeobjectpattern/pom.xml | 2 +- .../java/com/iluwatar/typeobject/App.java | 3 +- .../java/com/iluwatar/typeobject/Candy.java | 3 +- .../com/iluwatar/typeobject/CandyGame.java | 3 +- .../java/com/iluwatar/typeobject/Cell.java | 3 +- .../com/iluwatar/typeobject/CellPool.java | 3 +- .../com/iluwatar/typeobject/JsonParser.java | 3 +- .../iluwatar/typeobject/CandyGameTest.java | 3 +- .../com/iluwatar/typeobject/CellPoolTest.java | 3 +- .../com/iluwatar/typeobject/CellTest.java | 3 +- unit-of-work/pom.xml | 2 +- .../java/com/iluwatar/unitofwork/App.java | 16 ++++---- .../com/iluwatar/unitofwork/IUnitOfWork.java | 16 ++++---- .../java/com/iluwatar/unitofwork/Student.java | 16 ++++---- .../iluwatar/unitofwork/StudentDatabase.java | 16 ++++---- .../unitofwork/StudentRepository.java | 16 ++++---- .../java/com/iluwatar/unitofwork/AppTest.java | 16 ++++---- .../unitofwork/StudentRepositoryTest.java | 16 ++++---- update-ghpages.sh | 2 +- value-object/pom.xml | 2 +- .../java/com/iluwatar/value/object/App.java | 2 +- .../com/iluwatar/value/object/HeroStat.java | 2 +- .../com/iluwatar/value/object/AppTest.java | 2 +- .../iluwatar/value/object/HeroStatTest.java | 2 +- visitor/pom.xml | 2 +- .../main/java/com/iluwatar/visitor/App.java | 2 +- .../java/com/iluwatar/visitor/Commander.java | 2 +- .../iluwatar/visitor/CommanderVisitor.java | 2 +- .../java/com/iluwatar/visitor/Sergeant.java | 2 +- .../com/iluwatar/visitor/SergeantVisitor.java | 2 +- .../java/com/iluwatar/visitor/Soldier.java | 2 +- .../com/iluwatar/visitor/SoldierVisitor.java | 2 +- .../main/java/com/iluwatar/visitor/Unit.java | 2 +- .../com/iluwatar/visitor/UnitVisitor.java | 2 +- .../java/com/iluwatar/visitor/AppTest.java | 2 +- .../com/iluwatar/visitor/CommanderTest.java | 2 +- .../visitor/CommanderVisitorTest.java | 2 +- .../com/iluwatar/visitor/SergeantTest.java | 2 +- .../iluwatar/visitor/SergeantVisitorTest.java | 2 +- .../com/iluwatar/visitor/SoldierTest.java | 2 +- .../iluwatar/visitor/SoldierVisitorTest.java | 2 +- .../java/com/iluwatar/visitor/UnitTest.java | 2 +- .../com/iluwatar/visitor/VisitorTest.java | 2 +- 1421 files changed, 3147 insertions(+), 2877 deletions(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 1bd690065c42..c6b26bf5df8b 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,6 +1,6 @@ # # The MIT License -# Copyright (c) 2014 Ilkka Seppälä +# Copyright © 2014-2019 Ilkka Seppälä # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/abstract-document/pom.xml b/abstract-document/pom.xml index c3f783184d33..ec1bd16dc633 100644 --- a/abstract-document/pom.xml +++ b/abstract-document/pom.xml @@ -2,7 +2,7 @@ + diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/app/App.java b/cqrs/src/main/java/com/iluwatar/cqrs/app/App.java index 0f766e5c727f..7f79116268a0 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/app/App.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/app/App.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/commandes/CommandServiceImpl.java b/cqrs/src/main/java/com/iluwatar/cqrs/commandes/CommandServiceImpl.java index a15f8a45716d..dd7914d7eb3e 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/commandes/CommandServiceImpl.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/commandes/CommandServiceImpl.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/commandes/ICommandService.java b/cqrs/src/main/java/com/iluwatar/cqrs/commandes/ICommandService.java index 1da3f6c42392..acaef10726ba 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/commandes/ICommandService.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/commandes/ICommandService.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java b/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java index 07a8b96190b3..52de88d34adc 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Author.java b/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Author.java index 9825de9f7b25..179be3da32c2 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Author.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Author.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java b/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java index 8a11fcdd4166..14e141412a54 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/dto/Author.java b/cqrs/src/main/java/com/iluwatar/cqrs/dto/Author.java index c5473354dd59..1715e1718fc9 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/dto/Author.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/dto/Author.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/dto/Book.java b/cqrs/src/main/java/com/iluwatar/cqrs/dto/Book.java index f121a2ca7c2c..720e5655d96a 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/dto/Book.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/dto/Book.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/queries/IQueryService.java b/cqrs/src/main/java/com/iluwatar/cqrs/queries/IQueryService.java index 9c0252b0aeab..e5f040b7a47d 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/queries/IQueryService.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/queries/IQueryService.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/queries/QueryServiceImpl.java b/cqrs/src/main/java/com/iluwatar/cqrs/queries/QueryServiceImpl.java index 86eb4dd2f351..b6a8c6275ea6 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/queries/QueryServiceImpl.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/queries/QueryServiceImpl.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/util/HibernateUtil.java b/cqrs/src/main/java/com/iluwatar/cqrs/util/HibernateUtil.java index a5b59e20dc27..1a762537575d 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/util/HibernateUtil.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/util/HibernateUtil.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cqrs/src/main/resources/hibernate.cfg.xml b/cqrs/src/main/resources/hibernate.cfg.xml index 4ea1421667e1..019cd3917c84 100644 --- a/cqrs/src/main/resources/hibernate.cfg.xml +++ b/cqrs/src/main/resources/hibernate.cfg.xml @@ -2,7 +2,7 @@ - diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/App.java b/delegation/src/main/java/com/iluwatar/delegation/simple/App.java index 83e00fd1fb1c..4f8a363abc93 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/App.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/App.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/Printer.java b/delegation/src/main/java/com/iluwatar/delegation/simple/Printer.java index ee4d54938a86..64739467847c 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/Printer.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/Printer.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/PrinterController.java b/delegation/src/main/java/com/iluwatar/delegation/simple/PrinterController.java index c54f611ee213..a0ceed8dbc1d 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/PrinterController.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/PrinterController.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/printers/CanonPrinter.java b/delegation/src/main/java/com/iluwatar/delegation/simple/printers/CanonPrinter.java index 8f024122f15f..5c1785d9119a 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/printers/CanonPrinter.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/printers/CanonPrinter.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/printers/EpsonPrinter.java b/delegation/src/main/java/com/iluwatar/delegation/simple/printers/EpsonPrinter.java index fb763d21a862..3d12e0b63358 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/printers/EpsonPrinter.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/printers/EpsonPrinter.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/printers/HpPrinter.java b/delegation/src/main/java/com/iluwatar/delegation/simple/printers/HpPrinter.java index d80bb7aa7c9f..47d1057d2918 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/printers/HpPrinter.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/printers/HpPrinter.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/delegation/src/test/java/com/iluwatar/delegation/simple/AppTest.java b/delegation/src/test/java/com/iluwatar/delegation/simple/AppTest.java index ffdc96b807bd..1a62f34d6269 100644 --- a/delegation/src/test/java/com/iluwatar/delegation/simple/AppTest.java +++ b/delegation/src/test/java/com/iluwatar/delegation/simple/AppTest.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/delegation/src/test/java/com/iluwatar/delegation/simple/DelegateTest.java b/delegation/src/test/java/com/iluwatar/delegation/simple/DelegateTest.java index 422da5685ffc..452f9dd76aa0 100644 --- a/delegation/src/test/java/com/iluwatar/delegation/simple/DelegateTest.java +++ b/delegation/src/test/java/com/iluwatar/delegation/simple/DelegateTest.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/dependency-injection/pom.xml b/dependency-injection/pom.xml index 2347cb14f946..fd9584ed2ac8 100644 --- a/dependency-injection/pom.xml +++ b/dependency-injection/pom.xml @@ -2,7 +2,7 @@ - diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/App.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/App.java index 351936b2cd64..b5271ee0836c 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/App.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/App.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - package com.iluwatar.featuretoggle; import com.iluwatar.featuretoggle.pattern.Service; diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/Service.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/Service.java index 284ccf2ab2cb..9b5bcc035b44 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/Service.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/Service.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersion.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersion.java index 1ded334ec7d7..4a0fbc4b5b73 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersion.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersion.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersion.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersion.java index 887c9f663bfe..00277c9e093e 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersion.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersion.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/User.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/User.java index baf25aa8b7d6..a90c13e7deaf 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/User.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/User.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/UserGroup.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/UserGroup.java index cb84ec533274..17d21d705c7e 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/UserGroup.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/user/UserGroup.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/feature-toggle/src/test/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersionTest.java b/feature-toggle/src/test/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersionTest.java index 8b85e93496ae..7d87c1f4d601 100644 --- a/feature-toggle/src/test/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersionTest.java +++ b/feature-toggle/src/test/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersionTest.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - package com.iluwatar.featuretoggle.pattern.propertiesversion; import com.iluwatar.featuretoggle.pattern.Service; diff --git a/feature-toggle/src/test/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersionTest.java b/feature-toggle/src/test/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersionTest.java index 4755d569e09e..ca374a90462a 100644 --- a/feature-toggle/src/test/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersionTest.java +++ b/feature-toggle/src/test/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersionTest.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/feature-toggle/src/test/java/com/iluwatar/featuretoggle/user/UserGroupTest.java b/feature-toggle/src/test/java/com/iluwatar/featuretoggle/user/UserGroupTest.java index 2771655ddefa..4489b86c9896 100644 --- a/feature-toggle/src/test/java/com/iluwatar/featuretoggle/user/UserGroupTest.java +++ b/feature-toggle/src/test/java/com/iluwatar/featuretoggle/user/UserGroupTest.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/fluentinterface/pom.xml b/fluentinterface/pom.xml index 23fc5d806866..1e76ea628f9d 100644 --- a/fluentinterface/pom.xml +++ b/fluentinterface/pom.xml @@ -2,7 +2,7 @@ - + diff --git a/mute-idiom/src/main/java/com/iluwatar/mute/App.java b/mute-idiom/src/main/java/com/iluwatar/mute/App.java index c35559dcd97f..f8ac25f5c42c 100644 --- a/mute-idiom/src/main/java/com/iluwatar/mute/App.java +++ b/mute-idiom/src/main/java/com/iluwatar/mute/App.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - package com.iluwatar.mute; import org.slf4j.Logger; diff --git a/mute-idiom/src/main/java/com/iluwatar/mute/CheckedRunnable.java b/mute-idiom/src/main/java/com/iluwatar/mute/CheckedRunnable.java index 7a37ef03dfe0..9a3feefc1033 100644 --- a/mute-idiom/src/main/java/com/iluwatar/mute/CheckedRunnable.java +++ b/mute-idiom/src/main/java/com/iluwatar/mute/CheckedRunnable.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - package com.iluwatar.mute; /** diff --git a/mute-idiom/src/main/java/com/iluwatar/mute/Mute.java b/mute-idiom/src/main/java/com/iluwatar/mute/Mute.java index d5d9b802849f..6c2c417017ae 100644 --- a/mute-idiom/src/main/java/com/iluwatar/mute/Mute.java +++ b/mute-idiom/src/main/java/com/iluwatar/mute/Mute.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/mute-idiom/src/main/java/com/iluwatar/mute/Resource.java b/mute-idiom/src/main/java/com/iluwatar/mute/Resource.java index 11bb3a6ec875..366f014b4fba 100644 --- a/mute-idiom/src/main/java/com/iluwatar/mute/Resource.java +++ b/mute-idiom/src/main/java/com/iluwatar/mute/Resource.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - package com.iluwatar.mute; import java.io.Closeable; diff --git a/mute-idiom/src/test/java/com/iluwatar/mute/AppTest.java b/mute-idiom/src/test/java/com/iluwatar/mute/AppTest.java index 31624c99449b..8d2299492197 100644 --- a/mute-idiom/src/test/java/com/iluwatar/mute/AppTest.java +++ b/mute-idiom/src/test/java/com/iluwatar/mute/AppTest.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - package com.iluwatar.mute; import org.junit.jupiter.api.Test; diff --git a/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java b/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java index 07498645e83c..9d946810fee0 100644 --- a/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java +++ b/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - package com.iluwatar.mute; import org.junit.jupiter.api.Test; diff --git a/mutex/pom.xml b/mutex/pom.xml index 2075fb4a2462..05f9295eead8 100644 --- a/mutex/pom.xml +++ b/mutex/pom.xml @@ -2,7 +2,7 @@ + 4.0.0 diff --git a/naked-objects/dom/src/main/java/META-INF/persistence.xml b/naked-objects/dom/src/main/java/META-INF/persistence.xml index 8824aa1ace92..fd916b0456bd 100644 --- a/naked-objects/dom/src/main/java/META-INF/persistence.xml +++ b/naked-objects/dom/src/main/java/META-INF/persistence.xml @@ -1,21 +1,27 @@ - + 4.0.0 diff --git a/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesProvider.java b/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesProvider.java index ccc11f2b8ece..4496d2e32dd2 100644 --- a/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesProvider.java +++ b/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesProvider.java @@ -1,16 +1,24 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you 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. +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. */ package domainapp.fixture; diff --git a/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java b/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java index 58b656a9816f..89eadad31f0c 100644 --- a/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java +++ b/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java @@ -1,18 +1,25 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you 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 +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * 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. + * 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 NONINFRINGEMENT. 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. */ - package domainapp.fixture.modules.simple; import org.apache.isis.applib.fixturescripts.FixtureScript; diff --git a/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java b/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java index c0319d95383e..a5092c2ec70e 100644 --- a/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java +++ b/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java @@ -1,18 +1,25 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you 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 +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * 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. + * 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 NONINFRINGEMENT. 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. */ - package domainapp.fixture.modules.simple; import org.apache.isis.applib.fixturescripts.FixtureScript; diff --git a/naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java b/naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java index be891158a0d7..33e5570a6063 100644 --- a/naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java +++ b/naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java @@ -1,18 +1,25 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you 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 +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * 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. + * 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 NONINFRINGEMENT. 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. */ - package domainapp.fixture.scenarios; import java.util.Arrays; diff --git a/naked-objects/integtests/pom.xml b/naked-objects/integtests/pom.xml index 7365a71a9acb..62d25df032c9 100644 --- a/naked-objects/integtests/pom.xml +++ b/naked-objects/integtests/pom.xml @@ -1,14 +1,28 @@ - + 4.0.0 diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java b/naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java index 3ac5a1d75f2e..d5f0cd55265a 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java @@ -1,16 +1,24 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you 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 +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * 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. + * 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 NONINFRINGEMENT. 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. */ package domainapp.integtests.bootstrap; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/BootstrappingGlue.java b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/BootstrappingGlue.java index e41399fdd7d8..b53e88af0c0e 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/BootstrappingGlue.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/BootstrappingGlue.java @@ -1,16 +1,24 @@ /** - * O * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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 + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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: * - * 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. + * 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 NONINFRINGEMENT. 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. */ package domainapp.integtests.specglue; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/CatalogOfFixturesGlue.java b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/CatalogOfFixturesGlue.java index 7a75a038139f..acc1485eca51 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/CatalogOfFixturesGlue.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/CatalogOfFixturesGlue.java @@ -1,16 +1,24 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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 + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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: * - * 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. + * 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 NONINFRINGEMENT. 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. */ package domainapp.integtests.specglue; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java index b7af9f05232d..6c98b008c462 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java @@ -1,16 +1,24 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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 + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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: * - * 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. + * 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 NONINFRINGEMENT. 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. */ package domainapp.integtests.specglue.modules.simple; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/specs/RunSpecs.java b/naked-objects/integtests/src/test/java/domainapp/integtests/specs/RunSpecs.java index 8a842a0f3140..8f197985d6b5 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/specs/RunSpecs.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/specs/RunSpecs.java @@ -1,16 +1,24 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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 + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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: * - * 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. + * 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 NONINFRINGEMENT. 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. */ package domainapp.integtests.specs; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/SimpleAppIntegTest.java b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/SimpleAppIntegTest.java index 66deaeb84034..0db09fceb69f 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/SimpleAppIntegTest.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/SimpleAppIntegTest.java @@ -1,20 +1,24 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * 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. + * 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 NONINFRINGEMENT. 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. */ package domainapp.integtests.tests; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java index 3d9009bf88af..0fc7c8f0b0e1 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java @@ -1,20 +1,24 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * 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. + * 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 NONINFRINGEMENT. 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. */ package domainapp.integtests.tests.modules.simple; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java index 168d4865a574..a150bdb5a726 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java @@ -1,20 +1,24 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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: * - * http://www.apache.org/licenses/LICENSE-2.0 + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * 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. + * 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 NONINFRINGEMENT. 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. */ package domainapp.integtests.tests.modules.simple; diff --git a/naked-objects/pom.xml b/naked-objects/pom.xml index 271a07705589..b035c3894058 100644 --- a/naked-objects/pom.xml +++ b/naked-objects/pom.xml @@ -1,14 +1,28 @@ - + 4.0.0 diff --git a/naked-objects/webapp/ide/intellij/launch/README.txt b/naked-objects/webapp/ide/intellij/launch/README.txt index 6659454efdbe..2977f3068716 100644 --- a/naked-objects/webapp/ide/intellij/launch/README.txt +++ b/naked-objects/webapp/ide/intellij/launch/README.txt @@ -1,6 +1,6 @@ ==== The MIT License - Copyright (c) 2014-2016 Ilkka Seppälä + Copyright © 2014-2019 Ilkka Seppälä Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/naked-objects/webapp/ide/intellij/launch/SimpleApp_PROTOTYPE.xml b/naked-objects/webapp/ide/intellij/launch/SimpleApp_PROTOTYPE.xml index 9831f9a1f7bf..c27b5fbdd00a 100644 --- a/naked-objects/webapp/ide/intellij/launch/SimpleApp_PROTOTYPE.xml +++ b/naked-objects/webapp/ide/intellij/launch/SimpleApp_PROTOTYPE.xml @@ -1,7 +1,7 @@ + 4.0.0 diff --git a/naked-objects/webapp/src/main/java/domainapp/webapp/SimpleApplication.java b/naked-objects/webapp/src/main/java/domainapp/webapp/SimpleApplication.java index 459e4b7de9e0..cf15632faf53 100644 --- a/naked-objects/webapp/src/main/java/domainapp/webapp/SimpleApplication.java +++ b/naked-objects/webapp/src/main/java/domainapp/webapp/SimpleApplication.java @@ -1,16 +1,24 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you 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. +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. */ package domainapp.webapp; diff --git a/naked-objects/webapp/src/main/resources/domainapp/webapp/welcome.html b/naked-objects/webapp/src/main/resources/domainapp/webapp/welcome.html index a87d67384a9f..e81389640efc 100644 --- a/naked-objects/webapp/src/main/resources/domainapp/webapp/welcome.html +++ b/naked-objects/webapp/src/main/resources/domainapp/webapp/welcome.html @@ -1,21 +1,27 @@

Apache Isis™ is a platform to let you rapidly develop diff --git a/naked-objects/webapp/src/main/webapp/WEB-INF/isis.properties b/naked-objects/webapp/src/main/webapp/WEB-INF/isis.properties index 929d1775a8b9..2ebd42968626 100644 --- a/naked-objects/webapp/src/main/webapp/WEB-INF/isis.properties +++ b/naked-objects/webapp/src/main/webapp/WEB-INF/isis.properties @@ -1,19 +1,25 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. +# +# The MIT License +# Copyright © 2014-2019 Ilkka Seppälä +# +# 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 NONINFRINGEMENT. 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. +# ################################################################################# diff --git a/naked-objects/webapp/src/main/webapp/WEB-INF/persistor.properties b/naked-objects/webapp/src/main/webapp/WEB-INF/persistor.properties index c73af73c78d4..594b97edec95 100644 --- a/naked-objects/webapp/src/main/webapp/WEB-INF/persistor.properties +++ b/naked-objects/webapp/src/main/webapp/WEB-INF/persistor.properties @@ -1,19 +1,25 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. +# +# The MIT License +# Copyright © 2014-2019 Ilkka Seppälä +# +# 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 NONINFRINGEMENT. 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. +# diff --git a/naked-objects/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties b/naked-objects/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties index 675ced3bf8c0..572b2e194c95 100644 --- a/naked-objects/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties +++ b/naked-objects/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties @@ -1,19 +1,25 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. +# +# The MIT License +# Copyright © 2014-2019 Ilkka Seppälä +# +# 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 NONINFRINGEMENT. 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. +# # # configuration file for the JDO/DataNucleus objectstore diff --git a/naked-objects/webapp/src/main/webapp/WEB-INF/viewer_restfulobjects.properties b/naked-objects/webapp/src/main/webapp/WEB-INF/viewer_restfulobjects.properties index 0a85fb681bc9..34f639a549fd 100644 --- a/naked-objects/webapp/src/main/webapp/WEB-INF/viewer_restfulobjects.properties +++ b/naked-objects/webapp/src/main/webapp/WEB-INF/viewer_restfulobjects.properties @@ -1,19 +1,25 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. +# +# The MIT License +# Copyright © 2014-2019 Ilkka Seppälä +# +# 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 NONINFRINGEMENT. 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. +# # # configuration file for the Restful Objects viewer diff --git a/naked-objects/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties b/naked-objects/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties index ba9eaaffb873..b52c7fa6e42e 100644 --- a/naked-objects/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties +++ b/naked-objects/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties @@ -1,19 +1,25 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. +# +# The MIT License +# Copyright © 2014-2019 Ilkka Seppälä +# +# 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 NONINFRINGEMENT. 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. +# # # configuration file for the Wicket viewer diff --git a/naked-objects/webapp/src/main/webapp/WEB-INF/web.xml b/naked-objects/webapp/src/main/webapp/WEB-INF/web.xml index bb6098f0bcfa..6a3ecd65dfdc 100644 --- a/naked-objects/webapp/src/main/webapp/WEB-INF/web.xml +++ b/naked-objects/webapp/src/main/webapp/WEB-INF/web.xml @@ -1,21 +1,27 @@ + * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/page-object/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java b/page-object/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java index 4b567fcad2ed..9f8419be1af7 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/page-object/src/test/java/com/iluwatar/pageobject/LoginPageTest.java b/page-object/src/test/java/com/iluwatar/pageobject/LoginPageTest.java index 59f69552bc22..911ee5769656 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/LoginPageTest.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/LoginPageTest.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumListPage.java b/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumListPage.java index d212b33f301a..20673c8779dd 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumListPage.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumListPage.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumPage.java b/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumPage.java index 7d2318257930..e33ffc4af32a 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumPage.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumPage.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/page-object/src/test/java/com/iluwatar/pageobject/pages/LoginPage.java b/page-object/src/test/java/com/iluwatar/pageobject/pages/LoginPage.java index b648dfdafc36..843a5e1dc433 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/pages/LoginPage.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/pages/LoginPage.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/page-object/src/test/java/com/iluwatar/pageobject/pages/Page.java b/page-object/src/test/java/com/iluwatar/pageobject/pages/Page.java index f292588d2951..fbdc1b28c7be 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/pages/Page.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/pages/Page.java @@ -1,17 +1,17 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä - *

+ * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/page-object/test-automation/pom.xml b/page-object/test-automation/pom.xml index f657a8dab0b6..5b275084c4cf 100644 --- a/page-object/test-automation/pom.xml +++ b/page-object/test-automation/pom.xml @@ -2,7 +2,7 @@ @@ -25,7 +30,7 @@ java-design-patterns 1.22.0-SNAPSHOT pom - 2014 + 2014-2019 UTF-8 5.2.18.Final diff --git a/priority-queue/pom.xml b/priority-queue/pom.xml index aaf172ef3953..3e5ac50e81ab 100644 --- a/priority-queue/pom.xml +++ b/priority-queue/pom.xml @@ -2,7 +2,7 @@ - 4.0.0 diff --git a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/App.java b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/App.java index 42335f313f1c..2ee3fa948845 100644 --- a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/App.java +++ b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/App.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - package com.iluwatar.reader.writer.lock; import java.util.concurrent.ExecutorService; diff --git a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Reader.java b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Reader.java index b0ccecabadaf..3bc46c4524f7 100644 --- a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Reader.java +++ b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Reader.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/ReaderWriterLock.java b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/ReaderWriterLock.java index f0f5a009040a..d35703801c67 100644 --- a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/ReaderWriterLock.java +++ b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/ReaderWriterLock.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Writer.java b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Writer.java index dc379eef97ba..4aa5ab5a9571 100644 --- a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Writer.java +++ b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Writer.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/AppTest.java b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/AppTest.java index fbdf3f846a97..8815e6c8e451 100644 --- a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/AppTest.java +++ b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/AppTest.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderAndWriterTest.java b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderAndWriterTest.java index c8de8c511b55..d190dfb9ef4c 100644 --- a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderAndWriterTest.java +++ b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderAndWriterTest.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ - package com.iluwatar.reader.writer.lock; import com.iluwatar.reader.writer.lock.utils.InMemoryAppender; diff --git a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderTest.java b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderTest.java index 8fe5912ea3a5..d49a472e05a8 100644 --- a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderTest.java +++ b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderTest.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/WriterTest.java b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/WriterTest.java index bb01e11b09eb..55a8b7f95685 100644 --- a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/WriterTest.java +++ b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/WriterTest.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/utils/InMemoryAppender.java b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/utils/InMemoryAppender.java index b8ad531ce856..c6b8319d2a5d 100644 --- a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/utils/InMemoryAppender.java +++ b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/utils/InMemoryAppender.java @@ -1,6 +1,6 @@ /** * The MIT License - * Copyright (c) 2014-2016 Ilkka Seppälä + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/repository/pom.xml b/repository/pom.xml index f0340f1260ef..906389282945 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -2,7 +2,7 @@ 4.0.0 diff --git a/retry/src/main/java/com/iluwatar/retry/App.java b/retry/src/main/java/com/iluwatar/retry/App.java index 20205bdf3973..76ec43363525 100644 --- a/retry/src/main/java/com/iluwatar/retry/App.java +++ b/retry/src/main/java/com/iluwatar/retry/App.java @@ -1,27 +1,25 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Ilkka Seppälä - * +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * * 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 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 NONINFRINGEMENT. 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. + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ - package com.iluwatar.retry; import org.slf4j.Logger; diff --git a/retry/src/main/java/com/iluwatar/retry/BusinessException.java b/retry/src/main/java/com/iluwatar/retry/BusinessException.java index eefbf2813cbf..d88aa8a105b7 100644 --- a/retry/src/main/java/com/iluwatar/retry/BusinessException.java +++ b/retry/src/main/java/com/iluwatar/retry/BusinessException.java @@ -1,27 +1,25 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Ilkka Seppälä - * +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * * 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 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 NONINFRINGEMENT. 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. + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ - package com.iluwatar.retry; /** diff --git a/retry/src/main/java/com/iluwatar/retry/BusinessOperation.java b/retry/src/main/java/com/iluwatar/retry/BusinessOperation.java index aefb589c79c3..37846f54d751 100644 --- a/retry/src/main/java/com/iluwatar/retry/BusinessOperation.java +++ b/retry/src/main/java/com/iluwatar/retry/BusinessOperation.java @@ -1,27 +1,25 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Ilkka Seppälä - * +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * * 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 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 NONINFRINGEMENT. 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. + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ - package com.iluwatar.retry; /** diff --git a/retry/src/main/java/com/iluwatar/retry/CustomerNotFoundException.java b/retry/src/main/java/com/iluwatar/retry/CustomerNotFoundException.java index 596d8584d67b..990229ebed04 100644 --- a/retry/src/main/java/com/iluwatar/retry/CustomerNotFoundException.java +++ b/retry/src/main/java/com/iluwatar/retry/CustomerNotFoundException.java @@ -1,27 +1,25 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Ilkka Seppälä - * +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * * 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 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 NONINFRINGEMENT. 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. + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ - package com.iluwatar.retry; /** diff --git a/retry/src/main/java/com/iluwatar/retry/DatabaseNotAvailableException.java b/retry/src/main/java/com/iluwatar/retry/DatabaseNotAvailableException.java index 2a93e992d333..be78a9e6fd8b 100644 --- a/retry/src/main/java/com/iluwatar/retry/DatabaseNotAvailableException.java +++ b/retry/src/main/java/com/iluwatar/retry/DatabaseNotAvailableException.java @@ -1,27 +1,25 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Ilkka Seppälä - * +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * * 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 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 NONINFRINGEMENT. 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. + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ - package com.iluwatar.retry; /** diff --git a/retry/src/main/java/com/iluwatar/retry/FindCustomer.java b/retry/src/main/java/com/iluwatar/retry/FindCustomer.java index 421f450e59f1..83ab9a25c3f4 100644 --- a/retry/src/main/java/com/iluwatar/retry/FindCustomer.java +++ b/retry/src/main/java/com/iluwatar/retry/FindCustomer.java @@ -1,27 +1,25 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Ilkka Seppälä - * +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * * 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 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 NONINFRINGEMENT. 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. + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ - package com.iluwatar.retry; import java.util.ArrayDeque; diff --git a/retry/src/main/java/com/iluwatar/retry/Retry.java b/retry/src/main/java/com/iluwatar/retry/Retry.java index da5c76d5d3ac..d5d16bf30e62 100644 --- a/retry/src/main/java/com/iluwatar/retry/Retry.java +++ b/retry/src/main/java/com/iluwatar/retry/Retry.java @@ -1,27 +1,25 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Ilkka Seppälä - * +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * * 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 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 NONINFRINGEMENT. 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. + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ - package com.iluwatar.retry; import java.util.ArrayList; diff --git a/retry/src/main/java/com/iluwatar/retry/RetryExponentialBackoff.java b/retry/src/main/java/com/iluwatar/retry/RetryExponentialBackoff.java index b24bebbce192..551914dad138 100644 --- a/retry/src/main/java/com/iluwatar/retry/RetryExponentialBackoff.java +++ b/retry/src/main/java/com/iluwatar/retry/RetryExponentialBackoff.java @@ -1,7 +1,6 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Ilkka Seppälä +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -10,18 +9,17 @@ * 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 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 NONINFRINGEMENT. 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. + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ - package com.iluwatar.retry; import java.util.ArrayList; diff --git a/retry/src/test/java/com/iluwatar/retry/FindCustomerTest.java b/retry/src/test/java/com/iluwatar/retry/FindCustomerTest.java index 5c0cc66ed36b..d1cd87b21772 100644 --- a/retry/src/test/java/com/iluwatar/retry/FindCustomerTest.java +++ b/retry/src/test/java/com/iluwatar/retry/FindCustomerTest.java @@ -1,27 +1,25 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Ilkka Seppälä - * +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * * 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 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 NONINFRINGEMENT. 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. + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ - package com.iluwatar.retry; import org.junit.jupiter.api.Test; diff --git a/retry/src/test/java/com/iluwatar/retry/RetryExponentialBackoffTest.java b/retry/src/test/java/com/iluwatar/retry/RetryExponentialBackoffTest.java index d14b1eef68a6..23fd8add732c 100644 --- a/retry/src/test/java/com/iluwatar/retry/RetryExponentialBackoffTest.java +++ b/retry/src/test/java/com/iluwatar/retry/RetryExponentialBackoffTest.java @@ -1,7 +1,6 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Ilkka Seppälä +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -10,18 +9,17 @@ * 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 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 NONINFRINGEMENT. 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. + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ - package com.iluwatar.retry; import org.junit.jupiter.api.Test; diff --git a/retry/src/test/java/com/iluwatar/retry/RetryTest.java b/retry/src/test/java/com/iluwatar/retry/RetryTest.java index d435c7e84331..5366b525bc1e 100644 --- a/retry/src/test/java/com/iluwatar/retry/RetryTest.java +++ b/retry/src/test/java/com/iluwatar/retry/RetryTest.java @@ -1,27 +1,25 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 Ilkka Seppälä - * +/** + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * * 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 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 NONINFRINGEMENT. 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. + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ - package com.iluwatar.retry; import org.junit.jupiter.api.Test; diff --git a/semaphore/pom.xml b/semaphore/pom.xml index 3761e5e49a8f..1ae865f02442 100644 --- a/semaphore/pom.xml +++ b/semaphore/pom.xml @@ -2,7 +2,7 @@ + * Copyright © 2014-2019 Ilkka Seppälä + * * 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 NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/service-layer/pom.xml b/service-layer/pom.xml index 057a701341a7..31fc6f625b68 100644 --- a/service-layer/pom.xml +++ b/service-layer/pom.xml @@ -2,7 +2,7 @@ - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.jacoco - - jacoco-maven-plugin - - - [0.6.2,) - - - prepare-agent - - - - - - - - - - org.apache.maven.plugins maven-compiler-plugin @@ -410,20 +379,6 @@ - - org.jacoco - jacoco-maven-plugin - ${jacoco.version} - - - prepare-agent - - prepare-agent - - - - - @@ -471,6 +426,27 @@ + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + prepare-agent + + prepare-agent + + + + report + + report + + + + + From cfdfedbd2e2ed4b140c0f82e6322d335a1e4f39d Mon Sep 17 00:00:00 2001 From: Joshua Jimenez Date: Mon, 14 Oct 2019 04:41:11 +0800 Subject: [PATCH 053/197] #970 single logging framework should be enforced (#982) * #496 Add pipeline module to parent pom :sparkles: * #496: Add main application class and test for pipeline * #496: Checkstyle format and add log messages on pipeline stages :art: * #496: Fill readme sections of pipeline :sparkles: * #496: Javadocs and checkstyle formatting :art: * #496: Follow PMD checks and add more explanation as block comment on App.java * #496: Apply requested PR changes by iluwatar :art: * #970: Replace log4j usage on commander pattern to Slf4j API :art: * #970: Replace log4j usage on dao pattern to Slf4j API :art: * #970: Replace log4j usage on data mapper pattern to Slf4j API :art: * #970: Remove log4j dependency on data transfer object pom :fire: * #970: Replace log4j usage on module pattern to Slf4j API :art: * #970: Replace log4j usage on serverless pattern to Slf4j API :art: This also removes the aws log4j dependency * #970: Remove unnecessary gitignore line for log4j.xml :fire: * #970: Remove remaining remnants of log4j :fire: * #970: Replace System.out logging with appropriate logging methods :art: * #970: Replace System.out method references to Logger::info :art: --- .gitignore | 1 - .../iluwatar/collectionpipeline/AppTest.java | 7 ++- commander/pom.xml | 5 -- commander/properties/log4j.properties | 41 ---------------- .../com/iluwatar/commander/Commander.java | 19 +++---- .../messagingservice/MessagingService.java | 5 +- .../main/java/com/iluwatar/converter/App.java | 14 ++++-- dao/pom.xml | 49 ------------------- dao/src/main/java/com/iluwatar/dao/App.java | 9 ++-- .../java/com/iluwatar/dao/DbCustomerDao.java | 7 +-- dao/src/main/resources/log4j.xml | 41 ---------------- data-mapper/pom.xml | 4 -- .../java/com/iluwatar/datamapper/App.java | 7 +-- data-mapper/src/main/resources/log4j.xml | 41 ---------------- data-transfer-object/pom.xml | 4 -- .../main/java/com/iluwatar/dirtyflag/App.java | 9 +++- .../com/iluwatar/dirtyflag/DataFetcher.java | 8 ++- .../java/com/iluwatar/event/queue/App.java | 7 ++- .../administration/ConsoleAdministration.java | 2 +- .../hexagonal/service/ConsoleLottery.java | 2 +- .../service/LotteryConsoleServiceImpl.java | 2 +- .../java/com/iluwatar/masterworker/App.java | 8 +-- .../masterworker/ArrayUtilityMethods.java | 10 ++-- module/pom.xml | 4 -- .../iluwatar/module/ConsoleLoggerModule.java | 7 +-- .../com/iluwatar/module/FileLoggerModule.java | 7 +-- module/src/main/resources/log4j.xml | 41 ---------------- .../iluwatar/module/FileLoggerModuleTest.java | 5 +- naked-objects/dom/exclude-pmd.properties | 24 --------- naked-objects/dom/pom.xml | 1 - .../bootstrap/SimpleAppSystemInitializer.java | 1 - .../specglue/BootstrappingGlue.java | 1 - .../integtests/tests/SimpleAppIntegTest.java | 1 - naked-objects/webapp/pom.xml | 20 -------- .../domainapp/webapp/SimpleApplication.java | 5 +- .../ConvertToCharArrayHandler.java | 4 +- .../RemoveAlphabetsHandler.java | 4 +- .../RemoveDigitsHandler.java | 4 +- pom.xml | 7 --- serverless/pom.xml | 5 -- .../baas/api/FindPersonApiHandler.java | 11 +++-- .../baas/api/SavePersonApiHandler.java | 5 +- .../faas/api/LambdaInfoApiHandler.java | 7 ++- .../src/main/resources/log4j.properties | 29 ----------- .../com/iluwatar/spatialpartition/App.java | 14 ++++-- .../com/iluwatar/spatialpartition/Bubble.java | 6 ++- tls/src/main/java/com/iluwatar/tls/App.java | 15 ++++-- .../com/iluwatar/tls/DateFormatCallable.java | 9 +++- .../java/com/iluwatar/typeobject/App.java | 17 ++++--- .../com/iluwatar/typeobject/CandyGame.java | 17 ++++--- 50 files changed, 163 insertions(+), 410 deletions(-) delete mode 100644 commander/properties/log4j.properties delete mode 100644 dao/src/main/resources/log4j.xml delete mode 100644 data-mapper/src/main/resources/log4j.xml delete mode 100644 module/src/main/resources/log4j.xml delete mode 100644 naked-objects/dom/exclude-pmd.properties delete mode 100644 serverless/src/main/resources/log4j.properties diff --git a/.gitignore b/.gitignore index fd0bb7810faf..ada1e7d10ce5 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,4 @@ datanucleus.log /bin/ /bin/ *.log -data-mapper/src/main/resources/log4j.xml event-sourcing/Journal.json diff --git a/collection-pipeline/src/test/java/com/iluwatar/collectionpipeline/AppTest.java b/collection-pipeline/src/test/java/com/iluwatar/collectionpipeline/AppTest.java index 83756985fe06..938cce195a27 100644 --- a/collection-pipeline/src/test/java/com/iluwatar/collectionpipeline/AppTest.java +++ b/collection-pipeline/src/test/java/com/iluwatar/collectionpipeline/AppTest.java @@ -30,12 +30,15 @@ import java.util.Map; import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Tests that Collection Pipeline methods work as expected. */ public class AppTest { - + private static final Logger LOGGER = LoggerFactory.getLogger(AppTest.class); + private List cars = CarFactory.createCars(); @Test @@ -61,7 +64,7 @@ public void testGetGroupingOfCarsByCategory() { new Car("Jeep", "Comanche", 1990, Category.JEEP))); Map> modelsFunctional = FunctionalProgramming.getGroupingOfCarsByCategory(cars); Map> modelsImperative = ImperativeProgramming.getGroupingOfCarsByCategory(cars); - System.out.println("Category " + modelsFunctional); + LOGGER.info("Category " + modelsFunctional); assertEquals(modelsExpected, modelsFunctional); assertEquals(modelsExpected, modelsImperative); } diff --git a/commander/pom.xml b/commander/pom.xml index 4db6b12e7e06..fbe45337707e 100644 --- a/commander/pom.xml +++ b/commander/pom.xml @@ -36,10 +36,5 @@ junit-jupiter-engine test - - log4j - log4j - 1.2.17 - diff --git a/commander/properties/log4j.properties b/commander/properties/log4j.properties deleted file mode 100644 index 6569015544ba..000000000000 --- a/commander/properties/log4j.properties +++ /dev/null @@ -1,41 +0,0 @@ -# -# The MIT License -# Copyright © 2014-2019 Ilkka Seppälä -# -# 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 NONINFRINGEMENT. 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. -# - -#Define root logger options -log4j.rootLogger=TRACE, file, console - -#Define console appender -log4j.appender.console=org.apache.log4j.ConsoleAppender -logrj.appender.console.Target=System.out -log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd} %d{HH:mm:ss} %5p[%t] %m%n - -#Define rolling file appender -log4j.appender.file=org.apache.log4j.RollingFileAppender -log4j.appender.file.File=/log/logFile.log -log4j.appender.file.Append=true -log4j.appender.file.ImmediateFlush=true -log4j.appender.file.MaxFileSize=10MB -log4j.appender.file.MaxBackupIndex=5 -log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=%d %d{HH:mm:ss} %5p[%t] %m%n diff --git a/commander/src/main/java/com/iluwatar/commander/Commander.java b/commander/src/main/java/com/iluwatar/commander/Commander.java index 8729ea75aeef..dee12df1cee8 100644 --- a/commander/src/main/java/com/iluwatar/commander/Commander.java +++ b/commander/src/main/java/com/iluwatar/commander/Commander.java @@ -23,7 +23,6 @@ package com.iluwatar.commander; import java.util.ArrayList; -import org.apache.log4j.Logger; import com.iluwatar.commander.employeehandle.EmployeeHandle; import com.iluwatar.commander.exceptions.DatabaseUnavailableException; import com.iluwatar.commander.exceptions.ItemUnavailableException; @@ -37,6 +36,8 @@ import com.iluwatar.commander.queue.QueueTask; import com.iluwatar.commander.queue.QueueTask.TaskType; import com.iluwatar.commander.shippingservice.ShippingService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** *

Commander pattern is used to handle all issues that can come up while making a @@ -86,7 +87,7 @@ public class Commander { private final long messageTime; private final long employeeTime; private boolean finalSiteMsgShown; - static final Logger LOG = Logger.getLogger(Commander.class); + static final Logger LOG = LoggerFactory.getLogger(Commander.class); //we could also have another db where it stores all orders Commander(EmployeeHandle empDb, PaymentService pService, ShippingService sService, @@ -125,27 +126,27 @@ private void sendShippingRequest(Order order) throws Exception { String transactionId = shippingService.receiveRequest(order.item, order.user.address); //could save this transaction id in a db too LOG.info("Order " + order.id + ": Shipping placed successfully, transaction id: " + transactionId); - System.out.println("Order has been placed and will be shipped to you. Please wait while we make your" + LOG.info("Order has been placed and will be shipped to you. Please wait while we make your" + " payment... "); sendPaymentRequest(order); return; }; Retry.HandleErrorIssue handleError = (o,err) -> { if (ShippingNotPossibleException.class.isAssignableFrom(err.getClass())) { - System.out.println("Shipping is currently not possible to your address. We are working on the problem " + LOG.info("Shipping is currently not possible to your address. We are working on the problem " + "and will get back to you asap."); finalSiteMsgShown = true; LOG.info("Order " + order.id + ": Shipping not possible to address, trying to add problem to employee db.."); employeeHandleIssue(o); } else if (ItemUnavailableException.class.isAssignableFrom(err.getClass())) { - System.out.println("This item is currently unavailable. We will inform you as soon as the item becomes " + LOG.info("This item is currently unavailable. We will inform you as soon as the item becomes " + "available again."); finalSiteMsgShown = true; LOG.info("Order " + order.id + ": Item " + order.item + " unavailable, trying to add problem to employee " + "handle.."); employeeHandleIssue(o); } else { - System.out.println("Sorry, there was a problem in creating your order. Please try later."); + LOG.info("Sorry, there was a problem in creating your order. Please try later."); LOG.error("Order " + order.id + ": Shipping service unavailable, order not placed.."); finalSiteMsgShown = true; } @@ -183,7 +184,7 @@ public void run() { order.paid = PaymentStatus.Done; LOG.info("Order " + order.id + ": Payment successful, transaction Id: " + transactionId); if (!finalSiteMsgShown) { - System.out.println("Payment made successfully, thank you for shopping with us!!"); + LOG.info("Payment made successfully, thank you for shopping with us!!"); finalSiteMsgShown = true; } sendSuccessMessage(order); @@ -193,7 +194,7 @@ public void run() { Retry.HandleErrorIssue handleError = (o,err) -> { if (PaymentDetailsErrorException.class.isAssignableFrom(err.getClass())) { if (!finalSiteMsgShown) { - System.out.println("There was an error in payment. Your account/card details may have been incorrect. " + LOG.info("There was an error in payment. Your account/card details may have been incorrect. " + "Meanwhile, your order has been converted to COD and will be shipped."); finalSiteMsgShown = true; } @@ -204,7 +205,7 @@ public void run() { try { if (o.messageSent.equals(MessageSent.NoneSent)) { if (!finalSiteMsgShown) { - System.out.println("There was an error in payment. We are on it, and will get back to you " + LOG.info("There was an error in payment. We are on it, and will get back to you " + "asap. Don't worry, your order has been placed and will be shipped."); finalSiteMsgShown = true; } diff --git a/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingService.java b/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingService.java index 27c1eee3f1f2..5023cfa1faa2 100644 --- a/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingService.java +++ b/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingService.java @@ -24,6 +24,8 @@ import com.iluwatar.commander.Service; import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * The MessagingService is used to send messages to user regarding their order and @@ -32,6 +34,7 @@ */ public class MessagingService extends Service { + private static final Logger LOGGER = LoggerFactory.getLogger(MessagingService.class); enum MessageToSend { PaymentFail, PaymentTrying, PaymentSuccessful @@ -74,7 +77,7 @@ protected String updateDb(Object...parameters) throws DatabaseUnavailableExcepti MessageRequest req = (MessageRequest) parameters[0]; if (this.database.get(req.reqId) == null) { //idempotence, in case db fails here database.add(req); //if successful: - System.out.println(sendMessage(req.msg)); + LOGGER.info(sendMessage(req.msg)); return req.reqId; } return null; diff --git a/converter/src/main/java/com/iluwatar/converter/App.java b/converter/src/main/java/com/iluwatar/converter/App.java index 7d0821c5b501..b21d4dd6afe8 100644 --- a/converter/src/main/java/com/iluwatar/converter/App.java +++ b/converter/src/main/java/com/iluwatar/converter/App.java @@ -24,6 +24,8 @@ import com.google.common.collect.Lists; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; @@ -35,6 +37,8 @@ * objects between types. */ public class App { + + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** * Program entry point * @@ -45,16 +49,16 @@ public static void main(String[] args) { UserDto dtoUser = new UserDto("John", "Doe", true, "whatever[at]wherever.com"); User user = userConverter.convertFromDto(dtoUser); - System.out.println("Entity converted from DTO:" + user); + LOGGER.info("Entity converted from DTO:" + user); ArrayList users = Lists.newArrayList(new User("Camile", "Tough", false, "124sad"), new User("Marti", "Luther", true, "42309fd"), new User("Kate", "Smith", true, "if0243")); - System.out.println("Domain entities:"); - users.forEach(System.out::println); + LOGGER.info("Domain entities:"); + users.stream().map(User::toString).forEach(LOGGER::info); - System.out.println("DTO entities converted from domain:"); + LOGGER.info("DTO entities converted from domain:"); List dtoEntities = userConverter.createFromEntities(users); - dtoEntities.forEach(System.out::println); + dtoEntities.stream().map(UserDto::toString).forEach(LOGGER::info); } } diff --git a/dao/pom.xml b/dao/pom.xml index b8453f6a574d..5d6bc94546fa 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -40,10 +40,6 @@ junit-jupiter-engine test - - log4j - log4j - com.h2database h2 @@ -53,49 +49,4 @@ mockito-core - - - - - - - - src/main/resources - - - src/main/resources - - log4j.xml - - .. - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.6 - - - log4j.xml - - - - true - - - - - - - diff --git a/dao/src/main/java/com/iluwatar/dao/App.java b/dao/src/main/java/com/iluwatar/dao/App.java index 5824d48cfea6..08d0a42bda3d 100644 --- a/dao/src/main/java/com/iluwatar/dao/App.java +++ b/dao/src/main/java/com/iluwatar/dao/App.java @@ -31,8 +31,9 @@ import javax.sql.DataSource; -import org.apache.log4j.Logger; import org.h2.jdbcx.JdbcDataSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Data Access Object (DAO) is an object that provides an abstract interface to some type of @@ -50,7 +51,7 @@ */ public class App { private static final String DB_URL = "jdbc:h2:~/dao"; - private static Logger log = Logger.getLogger(App.class); + private static Logger log = LoggerFactory.getLogger(App.class); private static final String ALL_CUSTOMERS = "customerDao.getAllCustomers(): "; /** @@ -94,7 +95,7 @@ private static void performOperationsUsing(final CustomerDao customerDao) throws addCustomers(customerDao); log.info(ALL_CUSTOMERS); try (Stream customerStream = customerDao.getAll()) { - customerStream.forEach((customer) -> log.info(customer)); + customerStream.forEach((customer) -> log.info(customer.toString())); } log.info("customerDao.getCustomerById(2): " + customerDao.getById(2)); final Customer customer = new Customer(4, "Dan", "Danson"); @@ -105,7 +106,7 @@ private static void performOperationsUsing(final CustomerDao customerDao) throws customerDao.update(customer); log.info(ALL_CUSTOMERS); try (Stream customerStream = customerDao.getAll()) { - customerStream.forEach((cust) -> log.info(cust)); + customerStream.forEach((cust) -> log.info(cust.toString())); } customerDao.delete(customer); log.info(ALL_CUSTOMERS + customerDao.getAll()); diff --git a/dao/src/main/java/com/iluwatar/dao/DbCustomerDao.java b/dao/src/main/java/com/iluwatar/dao/DbCustomerDao.java index 9d183e91284e..d8640dcb911d 100644 --- a/dao/src/main/java/com/iluwatar/dao/DbCustomerDao.java +++ b/dao/src/main/java/com/iluwatar/dao/DbCustomerDao.java @@ -22,6 +22,9 @@ */ package com.iluwatar.dao; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -35,15 +38,13 @@ import javax.sql.DataSource; -import org.apache.log4j.Logger; - /** * An implementation of {@link CustomerDao} that persists customers in RDBMS. * */ public class DbCustomerDao implements CustomerDao { - private static final Logger LOGGER = Logger.getLogger(DbCustomerDao.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DbCustomerDao.class); private final DataSource dataSource; diff --git a/dao/src/main/resources/log4j.xml b/dao/src/main/resources/log4j.xml deleted file mode 100644 index 5c7e49d51a98..000000000000 --- a/dao/src/main/resources/log4j.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data-mapper/pom.xml b/data-mapper/pom.xml index cf53fdf65814..7da70f8fd243 100644 --- a/data-mapper/pom.xml +++ b/data-mapper/pom.xml @@ -37,9 +37,5 @@ junit-jupiter-engine test - - log4j - log4j - diff --git a/data-mapper/src/main/java/com/iluwatar/datamapper/App.java b/data-mapper/src/main/java/com/iluwatar/datamapper/App.java index 3504ebbe1c94..6b1d9925333f 100644 --- a/data-mapper/src/main/java/com/iluwatar/datamapper/App.java +++ b/data-mapper/src/main/java/com/iluwatar/datamapper/App.java @@ -22,9 +22,10 @@ */ package com.iluwatar.datamapper; -import java.util.Optional; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import org.apache.log4j.Logger; +import java.util.Optional; /** * The Data Mapper (DM) is a layer of software that separates the in-memory objects from the @@ -39,7 +40,7 @@ */ public final class App { - private static Logger log = Logger.getLogger(App.class); + private static Logger log = LoggerFactory.getLogger(App.class); private static final String STUDENT_STRING = "App.main(), student : "; diff --git a/data-mapper/src/main/resources/log4j.xml b/data-mapper/src/main/resources/log4j.xml deleted file mode 100644 index 5c7e49d51a98..000000000000 --- a/data-mapper/src/main/resources/log4j.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data-transfer-object/pom.xml b/data-transfer-object/pom.xml index 20c8a52f6c0a..ebdb15afa3dd 100644 --- a/data-transfer-object/pom.xml +++ b/data-transfer-object/pom.xml @@ -37,9 +37,5 @@ junit-jupiter-engine test - - log4j - log4j - diff --git a/dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java b/dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java index af95b57bca88..e5368bc3a5a6 100644 --- a/dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java +++ b/dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java @@ -22,6 +22,9 @@ */ package com.iluwatar.dirtyflag; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; @@ -48,6 +51,8 @@ * when needed. {@link World} mainly serves the data to the front-end. */ public class App { + + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** * Program execution point */ @@ -59,9 +64,9 @@ public void run() { @Override public void run() { List countries = world.fetch(); - System.out.println("Our world currently has the following countries:-"); + LOGGER.info("Our world currently has the following countries:-"); for (String country : countries) { - System.out.println("\t" + country); + LOGGER.info("\t" + country); } } }, 0, 15, TimeUnit.SECONDS); // Run at every 15 seconds. diff --git a/dirty-flag/src/main/java/com/iluwatar/dirtyflag/DataFetcher.java b/dirty-flag/src/main/java/com/iluwatar/dirtyflag/DataFetcher.java index 3b91ccd7debb..eca422a86165 100644 --- a/dirty-flag/src/main/java/com/iluwatar/dirtyflag/DataFetcher.java +++ b/dirty-flag/src/main/java/com/iluwatar/dirtyflag/DataFetcher.java @@ -22,6 +22,10 @@ */ package com.iluwatar.dirtyflag; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.xml.crypto.Data; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -37,6 +41,8 @@ */ public class DataFetcher { + private static final Logger LOGGER = LoggerFactory.getLogger(DataFetcher.class); + private final String filename = "world.txt"; private long lastFetched; @@ -62,7 +68,7 @@ public List fetch() { File file = new File(classLoader.getResource(filename).getFile()); if (isDirty(file.lastModified())) { - System.out.println(filename + " is dirty! Re-fetching file content..."); + LOGGER.info(filename + " is dirty! Re-fetching file content..."); List data = new ArrayList(); try (BufferedReader br = new BufferedReader(new FileReader(file))) { diff --git a/event-queue/src/main/java/com/iluwatar/event/queue/App.java b/event-queue/src/main/java/com/iluwatar/event/queue/App.java index 88cc0bf570ae..87ad78ae6d40 100644 --- a/event-queue/src/main/java/com/iluwatar/event/queue/App.java +++ b/event-queue/src/main/java/com/iluwatar/event/queue/App.java @@ -22,6 +22,9 @@ */ package com.iluwatar.event.queue; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -39,6 +42,8 @@ * items from the queue at a later time. */ public class App { + + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** * Program entry point. * @@ -51,7 +56,7 @@ public static void main(String[] args) throws UnsupportedAudioFileException, IOE audio.playSound(audio.getAudioStream("./etc/Bass-Drum-1.wav"), -10.0f); audio.playSound(audio.getAudioStream("./etc/Closed-Hi-Hat-1.wav"), -8.0f); - System.out.println("Press Enter key to stop the program..."); + LOGGER.info("Press Enter key to stop the program..."); try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { br.read(); } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministration.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministration.java index f2aa6d681ba5..4d51710b9d04 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministration.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministration.java @@ -81,7 +81,7 @@ private static void printMainMenu() { } private static String readString(Scanner scanner) { - System.out.print("> "); + LOGGER.info("> "); return scanner.next(); } } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java index 583bf348fc7e..3a41e1ef322f 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java @@ -82,7 +82,7 @@ private static void printMainMenu() { } private static String readString(Scanner scanner) { - System.out.print("> "); + LOGGER.info("> "); return scanner.next(); } } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleServiceImpl.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleServiceImpl.java index 17f5f1a9bc09..d61ec9108156 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleServiceImpl.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleServiceImpl.java @@ -122,7 +122,7 @@ public void queryLotteryAccountFunds(WireTransfers bank, Scanner scanner) { } private String readString(Scanner scanner) { - System.out.print( "> " ); + logger.info( "> " ); return scanner.next(); } } diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/App.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/App.java index ce1f7b625653..46c0baf8d16c 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/App.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/App.java @@ -23,6 +23,8 @@ package com.iluwatar.masterworker; import com.iluwatar.masterworker.system.ArrayTransposeMasterWorker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** *

The Master-Worker pattern is used when the problem at hand can be solved by dividing into @@ -45,7 +47,8 @@ */ public class App { - + + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** * Program entry point. * @param args command line args @@ -60,10 +63,9 @@ public static void main(String[] args) { ArrayResult result = (ArrayResult) mw.getResult(input); if (result != null) { ArrayUtilityMethods.printMatrix(inputMatrix); - System.out.println(""); ArrayUtilityMethods.printMatrix(result.data); } else { - System.out.println("Please enter non-zero input"); + LOGGER.info("Please enter non-zero input"); } } diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayUtilityMethods.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayUtilityMethods.java index e3125abe8032..fb27e5b486a4 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayUtilityMethods.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayUtilityMethods.java @@ -22,6 +22,9 @@ */ package com.iluwatar.masterworker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.Random; /** @@ -29,7 +32,8 @@ */ public class ArrayUtilityMethods { - + + private static final Logger LOGGER = LoggerFactory.getLogger(ArrayUtilityMethods.class); /** * Method arraysSame compares 2 arrays @param a1 and @param a2 * and @return whether their values are equal (boolean). @@ -100,9 +104,9 @@ public static void printMatrix(int[][] matrix) { //prints out int[][] for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix[0].length; j++) { - System.out.print(matrix[i][j] + " "); + LOGGER.info(matrix[i][j] + " "); } - System.out.println(""); + LOGGER.info(""); } } diff --git a/module/pom.xml b/module/pom.xml index 920efc01c9da..0a60960b53c6 100644 --- a/module/pom.xml +++ b/module/pom.xml @@ -37,9 +37,5 @@ junit-jupiter-engine test - - log4j - log4j - diff --git a/module/src/main/java/com/iluwatar/module/ConsoleLoggerModule.java b/module/src/main/java/com/iluwatar/module/ConsoleLoggerModule.java index 6ab358777f6e..12eaae1d9be4 100644 --- a/module/src/main/java/com/iluwatar/module/ConsoleLoggerModule.java +++ b/module/src/main/java/com/iluwatar/module/ConsoleLoggerModule.java @@ -22,9 +22,10 @@ */ package com.iluwatar.module; -import java.io.PrintStream; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import org.apache.log4j.Logger; +import java.io.PrintStream; /** * The ConsoleLoggerModule is responsible for showing logs on System Console @@ -34,7 +35,7 @@ */ public final class ConsoleLoggerModule { - private static final Logger LOGGER = Logger.getLogger(ConsoleLoggerModule.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleLoggerModule.class); private static ConsoleLoggerModule singleton = null; diff --git a/module/src/main/java/com/iluwatar/module/FileLoggerModule.java b/module/src/main/java/com/iluwatar/module/FileLoggerModule.java index 1ec85ea47547..65f954b6cccd 100644 --- a/module/src/main/java/com/iluwatar/module/FileLoggerModule.java +++ b/module/src/main/java/com/iluwatar/module/FileLoggerModule.java @@ -22,12 +22,13 @@ */ package com.iluwatar.module; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; -import org.apache.log4j.Logger; - /** * The FileLoggerModule is responsible for showing logs on File System *

@@ -36,7 +37,7 @@ */ public final class FileLoggerModule { - private static final Logger LOGGER = Logger.getLogger(FileLoggerModule.class); + private static final Logger LOGGER = LoggerFactory.getLogger(FileLoggerModule.class); private static FileLoggerModule singleton = null; diff --git a/module/src/main/resources/log4j.xml b/module/src/main/resources/log4j.xml deleted file mode 100644 index 5c7e49d51a98..000000000000 --- a/module/src/main/resources/log4j.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/module/src/test/java/com/iluwatar/module/FileLoggerModuleTest.java b/module/src/test/java/com/iluwatar/module/FileLoggerModuleTest.java index 5f7616f02321..30f0baae5703 100644 --- a/module/src/test/java/com/iluwatar/module/FileLoggerModuleTest.java +++ b/module/src/test/java/com/iluwatar/module/FileLoggerModuleTest.java @@ -22,8 +22,9 @@ */ package com.iluwatar.module; -import org.apache.log4j.Logger; import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.FileNotFoundException; @@ -45,7 +46,7 @@ */ public final class FileLoggerModuleTest { - private static final Logger LOGGER = Logger.getLogger(FileLoggerModuleTest.class); + private static final Logger LOGGER = LoggerFactory.getLogger(FileLoggerModuleTest.class); private static final String OUTPUT_FILE = "output.txt"; private static final String ERROR_FILE = "error.txt"; diff --git a/naked-objects/dom/exclude-pmd.properties b/naked-objects/dom/exclude-pmd.properties deleted file mode 100644 index e281170f75a4..000000000000 --- a/naked-objects/dom/exclude-pmd.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# The MIT License -# Copyright © 2014-2019 Ilkka Seppälä -# -# 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 NONINFRINGEMENT. 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. -# - -domainapp.dom.modules.simple.QSimpleObject=UnusedFormalParameter \ No newline at end of file diff --git a/naked-objects/dom/pom.xml b/naked-objects/dom/pom.xml index b8a04a53bb24..2709edda03f4 100644 --- a/naked-objects/dom/pom.xml +++ b/naked-objects/dom/pom.xml @@ -143,7 +143,6 @@ ${datanucleus-maven-plugin.version} false - ${basedir}/log4j.properties true ${basedir}/datanucleus.properties diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java b/naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java index d5f0cd55265a..930a805d5fe2 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java @@ -49,7 +49,6 @@ public static void initIsft() { private static class SimpleAppSystemBuilder extends IsisSystemForTest.Builder { public SimpleAppSystemBuilder() { - withLoggingAt(org.apache.log4j.Level.INFO); with(testConfiguration()); with(new DataNucleusPersistenceMechanismInstaller()); diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/BootstrappingGlue.java b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/BootstrappingGlue.java index b53e88af0c0e..4b22615ecc96 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/BootstrappingGlue.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/BootstrappingGlue.java @@ -36,7 +36,6 @@ public class BootstrappingGlue extends CukeGlueAbstract { @Before(value = {"@integration"}, order = 100) public void beforeScenarioIntegrationScope() { - org.apache.log4j.PropertyConfigurator.configure("logging.properties"); SimpleAppSystemInitializer.initIsft(); before(ScenarioExecutionScope.INTEGRATION); diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/SimpleAppIntegTest.java b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/SimpleAppIntegTest.java index 0db09fceb69f..0c19714253ba 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/SimpleAppIntegTest.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/SimpleAppIntegTest.java @@ -36,7 +36,6 @@ public abstract class SimpleAppIntegTest extends IntegrationTestAbstract { @BeforeClass public static void initClass() { - org.apache.log4j.PropertyConfigurator.configure("logging.properties"); SimpleAppSystemInitializer.initIsft(); // instantiating will install onto ThreadLocal diff --git a/naked-objects/webapp/pom.xml b/naked-objects/webapp/pom.xml index e26c5f5610ad..e0697b855b31 100644 --- a/naked-objects/webapp/pom.xml +++ b/naked-objects/webapp/pom.xml @@ -216,26 +216,6 @@ hsqldb - - - - - - - org.lazyluke - log4jdbc-remix - - - org.slf4j - slf4j-api - - - - - junit junit diff --git a/naked-objects/webapp/src/main/java/domainapp/webapp/SimpleApplication.java b/naked-objects/webapp/src/main/java/domainapp/webapp/SimpleApplication.java index cf15632faf53..875212963b67 100644 --- a/naked-objects/webapp/src/main/java/domainapp/webapp/SimpleApplication.java +++ b/naked-objects/webapp/src/main/java/domainapp/webapp/SimpleApplication.java @@ -50,6 +50,8 @@ import de.agilecoders.wicket.core.settings.IBootstrapSettings; import de.agilecoders.wicket.themes.markup.html.bootswatch.BootswatchTheme; import de.agilecoders.wicket.themes.markup.html.bootswatch.BootswatchThemeProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -72,6 +74,7 @@ */ public class SimpleApplication extends IsisWicketApplication { + private static final Logger LOGGER = LoggerFactory.getLogger(SimpleApplication.class); private static final long serialVersionUID = 1L; /** @@ -124,7 +127,7 @@ public WebRequest newWebRequest(HttpServletRequest servletRequest, String filter servletRequest.getSession().invalidate(); } } catch (Exception e) { - System.out.println(e); + LOGGER.error(e.getMessage()); } return super.newWebRequest(servletRequest, filterPath); } diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/ConvertToCharArrayHandler.java b/pipeline/src/main/java/com.iluwatar.pipeline/ConvertToCharArrayHandler.java index 3e8df8eefe3f..6a418fef4cf1 100644 --- a/pipeline/src/main/java/com.iluwatar.pipeline/ConvertToCharArrayHandler.java +++ b/pipeline/src/main/java/com.iluwatar.pipeline/ConvertToCharArrayHandler.java @@ -32,12 +32,12 @@ */ class ConvertToCharArrayHandler implements Handler { - private final Logger logger = LoggerFactory.getLogger(ConvertToCharArrayHandler.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ConvertToCharArrayHandler.class); @Override public char[] process(String input) { char[] characters = input.toCharArray(); - logger.info(String.format("Current handler: %s, input is %s of type %s, output is %s, of type %s", + LOGGER.info(String.format("Current handler: %s, input is %s of type %s, output is %s, of type %s", ConvertToCharArrayHandler.class, input, String.class, Arrays.toString(characters), Character[].class)); return characters; diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/RemoveAlphabetsHandler.java b/pipeline/src/main/java/com.iluwatar.pipeline/RemoveAlphabetsHandler.java index 76219249d312..342ed86c23c7 100644 --- a/pipeline/src/main/java/com.iluwatar.pipeline/RemoveAlphabetsHandler.java +++ b/pipeline/src/main/java/com.iluwatar.pipeline/RemoveAlphabetsHandler.java @@ -30,7 +30,7 @@ */ class RemoveAlphabetsHandler implements Handler { - private final Logger logger = LoggerFactory.getLogger(RemoveAlphabetsHandler.class); + private static final Logger LOGGER = LoggerFactory.getLogger(RemoveAlphabetsHandler.class); @Override public String process(String input) { @@ -46,7 +46,7 @@ public String process(String input) { } String inputWithoutAlphabetsStr = inputWithoutAlphabets.toString(); - logger.info(String.format("Current handler: %s, input is %s of type %s, output is %s, of type %s", + LOGGER.info(String.format("Current handler: %s, input is %s of type %s, output is %s, of type %s", RemoveAlphabetsHandler.class, input, String.class, inputWithoutAlphabetsStr, String.class)); return inputWithoutAlphabetsStr; diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/RemoveDigitsHandler.java b/pipeline/src/main/java/com.iluwatar.pipeline/RemoveDigitsHandler.java index d1785c340858..a5320a0a55c4 100644 --- a/pipeline/src/main/java/com.iluwatar.pipeline/RemoveDigitsHandler.java +++ b/pipeline/src/main/java/com.iluwatar.pipeline/RemoveDigitsHandler.java @@ -30,7 +30,7 @@ */ class RemoveDigitsHandler implements Handler { - private final Logger logger = LoggerFactory.getLogger(RemoveDigitsHandler.class); + private static final Logger LOGGER = LoggerFactory.getLogger(RemoveDigitsHandler.class); @Override public String process(String input) { @@ -46,7 +46,7 @@ public String process(String input) { } String inputWithoutDigitsStr = inputWithoutDigits.toString(); - logger.info(String.format("Current handler: %s, input is %s of type %s, output is %s, of type %s", + LOGGER.info(String.format("Current handler: %s, input is %s of type %s, output is %s, of type %s", RemoveDigitsHandler.class, input, String.class, inputWithoutDigitsStr, String.class)); return inputWithoutDigitsStr; diff --git a/pom.xml b/pom.xml index d6cd3a6e60c3..50e7c7de5439 100644 --- a/pom.xml +++ b/pom.xml @@ -56,10 +56,8 @@ 1.2.3 1.1.0 1.11.289 - 1.0.0 2.0.1 2.8.5 - 1.2.17 2.3.1 2.3.2 1.3.2 @@ -304,11 +302,6 @@ mongo-java-driver ${mongo-java-driver.version} - - log4j - log4j - ${log4j.version} - javax.xml.bind jaxb-api diff --git a/serverless/pom.xml b/serverless/pom.xml index 9e142cb3aa30..292df78c55f1 100644 --- a/serverless/pom.xml +++ b/serverless/pom.xml @@ -60,11 +60,6 @@ aws-lambda-java-events ${aws-lambda-java-events.version} - - com.amazonaws - aws-lambda-java-log4j - ${aws-lambda-log4j.version} - com.fasterxml.jackson.core jackson-core diff --git a/serverless/src/main/java/com/iluwatar/serverless/baas/api/FindPersonApiHandler.java b/serverless/src/main/java/com/iluwatar/serverless/baas/api/FindPersonApiHandler.java index 0dac4c614b33..14f2b25a5153 100644 --- a/serverless/src/main/java/com/iluwatar/serverless/baas/api/FindPersonApiHandler.java +++ b/serverless/src/main/java/com/iluwatar/serverless/baas/api/FindPersonApiHandler.java @@ -27,7 +27,10 @@ import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; import com.iluwatar.serverless.baas.model.Person; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Map; /** * find person from persons collection @@ -36,13 +39,15 @@ public class FindPersonApiHandler extends AbstractDynamoDbHandler implements RequestHandler { - private static final Logger LOG = Logger.getLogger(FindPersonApiHandler.class); + private static final Logger LOG = LoggerFactory.getLogger(FindPersonApiHandler.class); private static final Integer SUCCESS_STATUS_CODE = 200; @Override public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent apiGatewayProxyRequestEvent, Context context) { - LOG.info(apiGatewayProxyRequestEvent.getPathParameters()); + Map pathParameters = apiGatewayProxyRequestEvent.getPathParameters(); + pathParameters.keySet().stream().map(key -> key + "=" + pathParameters.get(key)).forEach(LOG::info); + Person person = this.getDynamoDbMapper().load(Person.class, apiGatewayProxyRequestEvent .getPathParameters().get("id")); diff --git a/serverless/src/main/java/com/iluwatar/serverless/baas/api/SavePersonApiHandler.java b/serverless/src/main/java/com/iluwatar/serverless/baas/api/SavePersonApiHandler.java index d77687d23b1f..8ef4b839ec63 100644 --- a/serverless/src/main/java/com/iluwatar/serverless/baas/api/SavePersonApiHandler.java +++ b/serverless/src/main/java/com/iluwatar/serverless/baas/api/SavePersonApiHandler.java @@ -27,7 +27,8 @@ import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; import com.iluwatar.serverless.baas.model.Person; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; @@ -38,7 +39,7 @@ public class SavePersonApiHandler extends AbstractDynamoDbHandler implements RequestHandler { - private static final Logger LOG = Logger.getLogger(SavePersonApiHandler.class); + private static final Logger LOG = LoggerFactory.getLogger(SavePersonApiHandler.class); private static final Integer CREATED_STATUS_CODE = 201; private static final Integer BAD_REQUEST_STATUS_CODE = 400; diff --git a/serverless/src/main/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandler.java b/serverless/src/main/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandler.java index 1157c962cb7c..174e409c35c6 100644 --- a/serverless/src/main/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandler.java +++ b/serverless/src/main/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandler.java @@ -27,8 +27,8 @@ import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestHandler; import com.iluwatar.serverless.faas.LambdaInfo; -import org.apache.log4j.BasicConfigurator; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; @@ -39,13 +39,12 @@ */ public class LambdaInfoApiHandler implements RequestHandler, ApiGatewayResponse> { - private static final Logger LOG = Logger.getLogger(LambdaInfoApiHandler.class); + private static final Logger LOG = LoggerFactory.getLogger(LambdaInfoApiHandler.class); private static final Integer SUCCESS_STATUS_CODE = 200; @Override public ApiGatewayResponse handleRequest(Map input, Context context) { - BasicConfigurator.configure(); LOG.info("received: " + input); return new ApiGatewayResponse diff --git a/serverless/src/main/resources/log4j.properties b/serverless/src/main/resources/log4j.properties deleted file mode 100644 index 2c666e2869ad..000000000000 --- a/serverless/src/main/resources/log4j.properties +++ /dev/null @@ -1,29 +0,0 @@ -# -# The MIT License -# Copyright © 2014-2019 Ilkka Seppälä -# -# 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 NONINFRINGEMENT. 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. -# - -log = . -log4j.rootLogger = DEBUG, LAMBDA - -log4j.appender.LAMBDA=com.amazonaws.services.lambda.runtime.log4j.LambdaAppender -log4j.appender.LAMBDA.layout=org.apache.log4j.PatternLayout -log4j.appender.LAMBDA.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} <%X{AWSRequestId}> %-5p %c:%L - %m%n diff --git a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/App.java b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/App.java index 179f11d045f2..f6a07de62f6a 100644 --- a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/App.java +++ b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/App.java @@ -22,6 +22,9 @@ */ package com.iluwatar.spatialpartition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; @@ -52,6 +55,7 @@ */ public class App { + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); static void noSpatialPartition(int height, int width, int numOfMovements, Hashtable bubbles) { @@ -73,7 +77,7 @@ static void noSpatialPartition(int height, int width, } for (Integer key : bubbles.keySet()) { //bubbles not popped - System.out.println("Bubble " + key + " not popped"); + LOGGER.info("Bubble " + key + " not popped"); } } @@ -101,7 +105,7 @@ static void withSpatialPartition(int height, int width, } for (Integer key : bubbles.keySet()) { //bubbles not popped - System.out.println("Bubble " + key + " not popped"); + LOGGER.info("Bubble " + key + " not popped"); } } @@ -119,7 +123,7 @@ public static void main(String[] args) { Bubble b = new Bubble(rand.nextInt(300), rand.nextInt(300), i, rand.nextInt(2) + 1); bubbles1.put(i, b); bubbles2.put(i, b); - System.out.println("Bubble " + i + " with radius " + b.radius + " added at (" + b.x + "," + b.y + ")"); + LOGGER.info("Bubble " + i + " with radius " + b.radius + " added at (" + b.x + "," + b.y + ")"); } long start1 = System.currentTimeMillis(); @@ -128,8 +132,8 @@ public static void main(String[] args) { long start2 = System.currentTimeMillis(); App.withSpatialPartition(300,300,20,bubbles2); long end2 = System.currentTimeMillis(); - System.out.println("Without spatial partition takes " + (end1 - start1) + "ms"); - System.out.println("With spatial partition takes " + (end2 - start2) + "ms"); + LOGGER.info("Without spatial partition takes " + (end1 - start1) + "ms"); + LOGGER.info("With spatial partition takes " + (end2 - start2) + "ms"); } } diff --git a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Bubble.java b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Bubble.java index 3e3d418373ff..01faa8371378 100644 --- a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Bubble.java +++ b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Bubble.java @@ -22,6 +22,9 @@ */ package com.iluwatar.spatialpartition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.ArrayList; import java.util.Hashtable; import java.util.Random; @@ -32,6 +35,7 @@ */ public class Bubble extends Point { + private static final Logger LOGGER = LoggerFactory.getLogger(Bubble.class); final int radius; @@ -54,7 +58,7 @@ boolean touches(Bubble b) { } void pop(Hashtable allBubbles) { - System.out.println("Bubble " + this.id + " popped at (" + this.x + "," + this.y + ")!"); + LOGGER.info("Bubble " + this.id + " popped at (" + this.x + "," + this.y + ")!"); allBubbles.remove(this.id); } diff --git a/tls/src/main/java/com/iluwatar/tls/App.java b/tls/src/main/java/com/iluwatar/tls/App.java index cd216ac75f1e..33f8c312907f 100644 --- a/tls/src/main/java/com/iluwatar/tls/App.java +++ b/tls/src/main/java/com/iluwatar/tls/App.java @@ -22,6 +22,9 @@ */ package com.iluwatar.tls; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.Calendar; import java.util.Date; import java.util.concurrent.ExecutorService; @@ -64,6 +67,8 @@ * @author Thomas Bauer, 2017 */ public class App { + + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** * Program entry point * @@ -99,11 +104,11 @@ public static void main(String[] args) { // a correct run should deliver 20 times 15.12.2015 // and a correct run shouldn't deliver any exception - System.out.println("The List dateList contains " + counterDateValues + " date values"); - System.out.println("The List exceptionList contains " + counterExceptions + " exceptions"); + LOGGER.info("The List dateList contains " + counterDateValues + " date values"); + LOGGER.info("The List exceptionList contains " + counterExceptions + " exceptions"); } catch (Exception e) { - System.out.println("Abnormal end of program. Program throws exception: " + e); + LOGGER.info("Abnormal end of program. Program throws exception: " + e); } executor.shutdown(); } @@ -121,7 +126,7 @@ private static int printAndCountDates(Result res) { Calendar cal = Calendar.getInstance(); cal.setTime(dt); // Formatted output of the date value: DD.MM.YYYY - System.out.println( + LOGGER.info( cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + +cal.get(Calendar.YEAR)); } return counter; @@ -138,7 +143,7 @@ private static int printAndCountExceptions(Result res) { int counter = 0; for (String ex : res.getExceptionList()) { counter++; - System.out.println(ex); + LOGGER.info(ex); } return counter; } diff --git a/tls/src/main/java/com/iluwatar/tls/DateFormatCallable.java b/tls/src/main/java/com/iluwatar/tls/DateFormatCallable.java index 8018e7996cb9..a047828ce3e6 100644 --- a/tls/src/main/java/com/iluwatar/tls/DateFormatCallable.java +++ b/tls/src/main/java/com/iluwatar/tls/DateFormatCallable.java @@ -22,6 +22,9 @@ */ package com.iluwatar.tls; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.concurrent.Callable; @@ -40,6 +43,8 @@ * @author Thomas Bauer, 2017 */ public class DateFormatCallable implements Callable { + + private static final Logger LOGGER = LoggerFactory.getLogger(DateFormatCallable.class); // class variables (members) private ThreadLocal df; //TLTL // private DateFormat df; //NTLNTL @@ -72,7 +77,7 @@ protected DateFormat initialValue() { //TLTL */ @Override public Result call() { - System.out.println(Thread.currentThread() + " started executing..."); + LOGGER.info(Thread.currentThread() + " started executing..."); Result result = new Result(); // Convert date value to date 5 times @@ -90,7 +95,7 @@ public Result call() { } - System.out.println(Thread.currentThread() + " finished processing part of the thread"); + LOGGER.info(Thread.currentThread() + " finished processing part of the thread"); return result; } diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/App.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/App.java index 93e7a4ea84b9..2e6db9dd68a3 100644 --- a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/App.java +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/App.java @@ -25,6 +25,8 @@ import java.io.FileNotFoundException; import java.io.IOException; import org.json.simple.parser.ParseException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /**

Type object pattern is the pattern we use when the OOP concept of creating a base class and * inheriting from it just doesn't work for the case in hand. This happens when we either don't know @@ -45,6 +47,7 @@ public class App { + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** * Program entry point. * @param args command line args @@ -62,9 +65,9 @@ public static void main(String[] args) throws FileNotFoundException, IOException CellPool pool = new CellPool(numOfRows * numOfRows + 5); CandyGame cg = new CandyGame(numOfRows, pool); if (round > 1) { - System.out.println("Refreshing.."); + LOGGER.info("Refreshing.."); } else { - System.out.println("Starting game.."); + LOGGER.info("Starting game.."); } cg.printGameStatus(); end = System.currentTimeMillis(); @@ -72,13 +75,13 @@ public static void main(String[] args) throws FileNotFoundException, IOException pointsWon += cg.totalPoints; end = System.currentTimeMillis(); } - System.out.println("Game Over"); + LOGGER.info("Game Over"); if (pointsWon >= toWin) { - System.out.println(pointsWon); - System.out.println("You win!!"); + LOGGER.info("" + pointsWon); + LOGGER.info("You win!!"); } else { - System.out.println(pointsWon); - System.out.println("Sorry, you lose!"); + LOGGER.info("" + pointsWon); + LOGGER.info("Sorry, you lose!"); } } } diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CandyGame.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CandyGame.java index 200a96f8b9c5..516b4cf76bfd 100644 --- a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CandyGame.java +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CandyGame.java @@ -24,6 +24,8 @@ import java.util.ArrayList; import com.iluwatar.typeobject.Candy.Type; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * The CandyGame class contains the rules for the continuation of the game and has @@ -31,6 +33,9 @@ */ public class CandyGame { + + private static final Logger LOGGER = LoggerFactory.getLogger(CandyGame.class); + Cell[][] cells; CellPool pool; int totalPoints; @@ -57,21 +62,21 @@ static String numOfSpaces(int num) { } void printGameStatus() { - System.out.println(""); + LOGGER.info(""); for (int i = 0; i < cells.length; i++) { for (int j = 0; j < cells.length; j++) { String candyName = cells[i][j].candy.name; if (candyName.length() < 20) { int totalSpaces = 20 - candyName.length(); - System.out.print(numOfSpaces(totalSpaces / 2) + cells[i][j].candy.name + LOGGER.info(numOfSpaces(totalSpaces / 2) + cells[i][j].candy.name + numOfSpaces(totalSpaces - totalSpaces / 2) + "|"); } else { - System.out.print(candyName + "|"); + LOGGER.info(candyName + "|"); } } - System.out.println(""); + LOGGER.info(""); } - System.out.println(""); + LOGGER.info(""); } ArrayList adjacentCells(int yIndex, int xIndex) { @@ -121,7 +126,7 @@ boolean continueRound() { } void handleChange(int points) { - System.out.println("+" + points + " points!"); + LOGGER.info("+" + points + " points!"); this.totalPoints += points; printGameStatus(); } From 47d92bbffb0e75fcbf9ea6d80dec8e15402834f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Mon, 14 Oct 2019 08:17:52 +0300 Subject: [PATCH 054/197] #996 set sonar host url --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6cd971428327..f8d204071a49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ addons: secure: "FpHwMYPMkdWU6CeIB7+O3qIeIM4vJMp47UjkKK53f0w0s6tPZofZZkab+gcL2TqKSil7sFVB/AQXU1cUubflRszwcLbNsc8H2yFehD79o0o0Mqd1Dd5ip/q0KQbHkkln+InFlVLfvrLB4Xd4mlQVxbGhqpULBhXjKzFzQlRFcuU=" script: # the following command line builds the project, runs the tests with coverage and then execute the SonarCloud analysis - - mvn clean verify sonar:sonar -Dsonar.projectKey=iluwatar_java-design-patterns + - mvn clean verify sonar:sonar -Dsonar.projectKey=iluwatar_java-design-patterns -Dsonar.host.url=https://sonarcloud.io after_success: - bash update-ghpages.sh From 088bb764f35ec5d37e58ef1eb66bfce80378db5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Mon, 14 Oct 2019 20:25:35 +0300 Subject: [PATCH 055/197] #996 disable sonar analysis for pull requests (#999) --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f8d204071a49..bfb6d8422e29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,8 +18,10 @@ addons: token: secure: "FpHwMYPMkdWU6CeIB7+O3qIeIM4vJMp47UjkKK53f0w0s6tPZofZZkab+gcL2TqKSil7sFVB/AQXU1cUubflRszwcLbNsc8H2yFehD79o0o0Mqd1Dd5ip/q0KQbHkkln+InFlVLfvrLB4Xd4mlQVxbGhqpULBhXjKzFzQlRFcuU=" script: - # the following command line builds the project, runs the tests with coverage and then execute the SonarCloud analysis - - mvn clean verify sonar:sonar -Dsonar.projectKey=iluwatar_java-design-patterns -Dsonar.host.url=https://sonarcloud.io + # Because of Travis security restrictions, SonarCloud analysis cannot be run on pull requests originated from forks + # See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions + - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then mvn clean verify; fi' + - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then mvn clean verify sonar:sonar -Dsonar.projectKey=iluwatar_java-design-patterns -Dsonar.host.url=https://sonarcloud.io; fi' after_success: - bash update-ghpages.sh From 7e698a90dd7664e119ec0b082883ea48dc12ae2e Mon Sep 17 00:00:00 2001 From: Aditya Pal Date: Tue, 15 Oct 2019 00:02:19 +0530 Subject: [PATCH 056/197] Fix for issue #413: Circuit Breaker Pattern (#986) * Fix Issue #413: Circuit-Breaker Pattern * Fix Image Links * Remove Javadoc plugin to ensure correct build * Implementing code review feedback * Sync README with actual code --- circuit-breaker/README.md | 188 ++++++++++++++++++ circuit-breaker/etc/ServiceDiagram.PNG | Bin 0 -> 24371 bytes circuit-breaker/etc/StateDiagram.PNG | Bin 0 -> 19396 bytes circuit-breaker/pom.xml | 40 ++++ .../java/com/iluwatar/circuitbreaker/App.java | 86 ++++++++ .../circuitbreaker/CircuitBreaker.java | 128 ++++++++++++ .../circuitbreaker/DelayedService.java | 61 ++++++ .../circuitbreaker/MonitoringService.java | 50 +++++ .../com/iluwatar/circuitbreaker/State.java | 33 +++ .../circuitbreaker/CircuitBreakerTest.java | 80 ++++++++ .../circuitbreaker/DelayedServiceTest.java | 42 ++++ .../circuitbreaker/MonitoringServiceTest.java | 63 ++++++ pom.xml | 1 + 13 files changed, 772 insertions(+) create mode 100644 circuit-breaker/README.md create mode 100644 circuit-breaker/etc/ServiceDiagram.PNG create mode 100644 circuit-breaker/etc/StateDiagram.PNG create mode 100644 circuit-breaker/pom.xml create mode 100644 circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java create mode 100644 circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/CircuitBreaker.java create mode 100644 circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/DelayedService.java create mode 100644 circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/MonitoringService.java create mode 100644 circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/State.java create mode 100644 circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/CircuitBreakerTest.java create mode 100644 circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/DelayedServiceTest.java create mode 100644 circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/MonitoringServiceTest.java diff --git a/circuit-breaker/README.md b/circuit-breaker/README.md new file mode 100644 index 000000000000..db75ca58c0d0 --- /dev/null +++ b/circuit-breaker/README.md @@ -0,0 +1,188 @@ +--- +layout: pattern +title: CircuitBreaker +folder: circuit-breaker +permalink: /patterns/circuit-breaker/ +categories: Other +tags: + - Java + - Performance + - Difficulty-Intermediate +--- + +## Intent + +Handle costly remote *procedure/service* calls in such a way that the failure of a **single** service/component cannot bring the whole application down, and we can reconnect to the service as soon as possible. + +## Explanation + +Real world example + +> Imagine a Web App that has both local (example: files and images) and remote (example: database entries) to serve. The database might not be responding due to a variety of reasons, so if the application keeps trying to read from the database using multiple threads/processes, soon all of them will hang and our entire web application will crash. We should be able to detect this situation and show the user an appropriate message so that he/she can explore other parts of the app unaffected by the database failure without any problem. + +In plain words + +> Allows us to save resources when we know a remote service failed. Useful when all parts of our application are highly decoupled from each other, and failure of one component doesn't mean the other parts will stop working. + +Wikipedia says + +> **Circuit breaker** is a design pattern used in modern software development. It is used to detect failures and encapsulates the logic of preventing a failure from constantly recurring, during maintenance, temporary external system failure or unexpected system difficulties. + +So, how does this all come together? + +## Programmatic Example +With the above example in mind we will imitate the functionality in a simple manner. We have two services: A *monitoring service* which will mimic the web app and will make both **local** and **remote** calls. + +The service architecture is as follows: + +![alt text](./etc/ServiceDiagram.PNG "Service Diagram") + +In terms of code, the End user application is: + +```java +public class App { + + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); + + public static void main(String[] args) { + var obj = new MonitoringService(); + var circuitBreaker = new CircuitBreaker(3000, 1, 2000 * 1000 * 1000); + var serverStartTime = System.nanoTime(); + while (true) { + LOGGER.info(obj.localResourceResponse()); + LOGGER.info(obj.remoteResourceResponse(circuitBreaker, serverStartTime)); + LOGGER.info(circuitBreaker.getState()); + try { + Thread.sleep(5 * 1000); + } catch (InterruptedException e) { + LOGGER.error(e.getMessage()); + } + } + } +} +``` + +The monitoring service is: + +``` java +public class MonitoringService { + + public String localResourceResponse() { + return "Local Service is working"; + } + + public String remoteResourceResponse(CircuitBreaker circuitBreaker, long serverStartTime) { + try { + return circuitBreaker.call("delayedService", serverStartTime); + } catch (Exception e) { + return e.getMessage(); + } + } +} +``` +As it can be seen, it does the call to get local resources directly, but it wraps the call to remote (costly) service in a circuit breaker object, which prevents faults as follows: + +```java +public class CircuitBreaker { + private final long timeout; + private final long retryTimePeriod; + long lastFailureTime; + int failureCount; + private final int failureThreshold; + private State state; + private final long futureTime = 1000 * 1000 * 1000 * 1000; + + CircuitBreaker(long timeout, int failureThreshold, long retryTimePeriod) { + this.state = State.CLOSED; + this.failureThreshold = failureThreshold; + this.timeout = timeout; + this.retryTimePeriod = retryTimePeriod; + this.lastFailureTime = System.nanoTime() + futureTime; + this.failureCount = 0; + } + + private void reset() { + this.failureCount = 0; + this.lastFailureTime = System.nanoTime() + futureTime; + this.state = State.CLOSED; + } + + private void recordFailure() { + failureCount = failureCount + 1; + this.lastFailureTime = System.nanoTime(); + } + + protected void setState() { + if (failureCount > failureThreshold) { + if ((System.nanoTime() - lastFailureTime) > retryTimePeriod) { + state = State.HALF_OPEN; + } else { + state = State.OPEN; + } + } else { + state = State.CLOSED; + } + } + + public String getState() { + return state.name(); + } + + public void setStateForBypass(State state) { + this.state = state; + } + + public String call(String serviceToCall, long serverStartTime) throws Exception { + setState(); + if (state == State.OPEN) { + return "This is stale response from API"; + } else { + if (serviceToCall.equals("delayedService")) { + var delayedService = new DelayedService(20); + var response = delayedService.response(serverStartTime); + if (response.split(" ")[3].equals("working")) { + reset(); + return response; + } else { + recordFailure(); + throw new Exception("Remote service not responding"); + } + } else { + throw new Exception("Unknown Service Name"); + } + } + } +} +``` + +How does the above pattern prevent failures? Let's understand via this finite state machine implemented by it. + +![alt text](./etc/StateDiagram.PNG "State Diagram") + +- We initialize the Circuit Breaker object with certain parameters: **timeout**, **failureThreshold** and **retryTimePeriod** which help determine how resilient the API is. +- Initially, we are in the **closed** state and the remote call to API happens. +- Every time the call succeeds, we reset the state to as it was in the beginning. +- If the number of failures cross a certain threshold, we move to the **open** state, which acts just like an open circuit and prevents remote service calls from being made, thus saving resources. (Here, we return the response called ```stale response from API```) +- Once we exceed the retry timeout period, we move to the **half-open** state and make another call to the remote service again to check if the service is working so that we can serve fresh content. A *failure* sets it back to **open** state and another attempt is made after retry timeout period, while a *success* sets it to **closed** state so that everything starts working normally again. + + +## Applicability +Use the Circuit Breaker pattern when + +- Building a fault-tolerant application where failure of some services shouldn't bring the entire application down. +- Building an continuously incremental/continuous delivery application, as some of it's components can be upgraded without shutting it down entirely. + +## Related Patterns + +- [Retry Pattern](https://github.com/iluwatar/java-design-patterns/tree/master/retry) + +## Real world examples +* [Spring Circuit Breaker module](https://spring.io/guides/gs/circuit-breaker) +* [Netflix Hystrix API](https://github.com/Netflix/Hystrix) + +## Credits + +* [Understanding Circuit Breaker Pattern](https://itnext.io/understand-circuitbreaker-design-pattern-with-simple-practical-example-92a752615b42) +* [Martin Fowler on Circuit Breaker](https://martinfowler.com/bliki/CircuitBreaker.html) +* [Fault tolerance in a high volume, distributed system](https://medium.com/netflix-techblog/fault-tolerance-in-a-high-volume-distributed-system-91ab4faae74a) +* [Microsoft docs](https://docs.microsoft.com/en-us/azure/architecture/patterns/circuit-breaker) diff --git a/circuit-breaker/etc/ServiceDiagram.PNG b/circuit-breaker/etc/ServiceDiagram.PNG new file mode 100644 index 0000000000000000000000000000000000000000..661f1a1058181b689b0724418e598f7b5b245c31 GIT binary patch literal 24371 zcmdqJcTf{yxGx+FD4?JMqEssg2&fQ{8nA#$@4bn%K#&%CQ4kRou+c&<0-^U_1Vof7 zB|!)ssi8wCfsp&I=iEDU|Ge|foHOV9!@-a&yV-sBd4BELFby@O)Aa20Fc|Fg<3|s) zV6dZ+;2+ybTJRgn*D_u3D+Y}a>vk&a)HDec-dwAM-%*G8_@5EThANGJFd2zB&uh2}@>o^Q1f9-UTG5A%Aj=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>;{>{ah|1ps2P>(3t=OR# z0nzgUGV)x1anqblg{GOl4&yl*c7Z68itW_G--Me8GN_-&7goiA4ZUDqlgLotM8~CO zf(1Qv_($wIJ+t)4T+(tyEFU7uw)>4|$V~m>KBN(itnrWK4F?pD zgoW^j9jtk%%Q)^$yLH-7wR^Cvi5z|`NOFv|)ZgCw$-olHo_Q+>uBV~bXUt;%856y7 z=ZjGf)t3E;2ah(62^*^q6b#ut9K!XLDHaQrP#~sNAY*x}fa|4BA|~ z%pK{>+z{7%#b(E0o+aSkXSVw4G#%7(INB#mHIBk$ zgr|17k&AlA@kToxF@Z|3gTvDI?>Y&FQW(G5jf9gq{rIe*{7%;PlV^Bq=A{=zkg7cg z8}^mDMA~RHp7dXYL9==!Lo6;dJN-e!^8geG_5q5YPmAAQ5>=0{P&~OWhaLVx4)o?Y zV2ushIUpCb1Kqf%D`6TBZszaUck>zUL-R1^6VIBY20|RqCjIa91Xw}-W77G*G3>xy f{~rf@;7hh$$hypLZIiJA4g^`7+g~AHx{>%lET70d literal 0 HcmV?d00001 diff --git a/circuit-breaker/etc/StateDiagram.PNG b/circuit-breaker/etc/StateDiagram.PNG new file mode 100644 index 0000000000000000000000000000000000000000..38485526d34288bac6d2b0435437c13503f3c567 GIT binary patch literal 19396 zcmeIac|6qr|MxqTmhq7a$=+VbQrTrmNtE3fyOb=$*mnjgBq2#;U$V^@`#KCoMcJ1b zj4fmxLt<=WIIsEqu5+&2?VRh6>wM2SxAV{SM~xXXZ}08(d_5lb=i@a|dO8|xP+lkm z0%6m9aL)h&VeW)Lm|h<{0$w>Q$Gr(2m^=+M)F36@{EOhpVf#DUcOa1RIMzKI7V!MI z+XGWi2;{_9#y_S+(Gz?S$U{@jdv}cdtSIBh)3m7vZEJBS-(ByUgXf$dd3`}&-{8Et zdUMs)jfd*2RCcV^$MTFIJSoBRR;K|Uu90N6@x&zvNx4iF)#n8uZoyk0< z_HhGaft#}m>&lrlC3|Ri%Rk`Ht6D_*sW5>bzTSDv*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uit-breaker/pom.xml new file mode 100644 index 000000000000..b6587b061f7a --- /dev/null +++ b/circuit-breaker/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.22.0-SNAPSHOT + + circuit-breaker + + + org.junit.jupiter + junit-jupiter-engine + test + + + diff --git a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java new file mode 100644 index 000000000000..d1d361b16063 --- /dev/null +++ b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java @@ -0,0 +1,86 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.circuitbreaker; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + *

+ * The intention of the Circuit Builder pattern is to handle remote failures + * robustly, which is to mean that if a service is dependant on n number of + * other services, and m of them fail, we should be able to recover from that + * failure by ensuring that the user can still use the services that are actually + * functional, and resources are not tied up by uselessly by the services which + * are not working. However, we should also be able to detect when any of the m + * failing services become operational again, so that we can use it + *

+ *

+ * In this example, the circuit breaker pattern is demonstrated by using two services: + * {@link MonitoringService} and {@link DelayedService}. The monitoring service + * is responsible for calling two services: a local service and a remote service {@link DelayedService} + * , and by using the circuit breaker construction we ensure that if the call to + * remote service is going to fail, we are going to save our resources and not make the + * function call at all, by wrapping our call to the remote service in the circuit + * breaker object. + *

+ *

+ * This works as follows: The {@link CircuitBreaker} object can be in one of three + * states: Open, Closed and Half-Open, which represents the real + * world circuits. If the state is closed (initial), we assume everything is alright + * and perform the function call. However, every time the call fails, we note it + * and once it crosses a threshold, we set the state to Open, preventing any further + * calls to the remote server. Then, after a certain retry period (during which we + * expect thee service to recover), we make another call to the remote server and + * this state is called the Half-Open state, where it stays till the service is down, + * and once it recovers, it goes back to the closed state and the cycle continues. + *

+ */ +public class App { + + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); + + /** + * Program entry point + * + * @param args command line args + */ + public static void main(String[] args) { + //Create an object of monitoring service which makes both local and remote calls + var obj = new MonitoringService(); + //Set the circuit Breaker parameters + var circuitBreaker = new CircuitBreaker(3000, 1, 2000 * 1000 * 1000); + var serverStartTime = System.nanoTime(); + while (true) { + LOGGER.info(obj.localResourceResponse()); + LOGGER.info(obj.remoteResourceResponse(circuitBreaker, serverStartTime)); + LOGGER.info(circuitBreaker.getState()); + try { + Thread.sleep(5 * 1000); + } catch (InterruptedException e) { + LOGGER.error(e.getMessage()); + } + } + } +} diff --git a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/CircuitBreaker.java b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/CircuitBreaker.java new file mode 100644 index 000000000000..ad014f9fdae0 --- /dev/null +++ b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/CircuitBreaker.java @@ -0,0 +1,128 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.circuitbreaker; + +/** + * The circuit breaker class with all configurations + */ +public class CircuitBreaker { + private final long timeout; + private final long retryTimePeriod; + long lastFailureTime; + int failureCount; + private final int failureThreshold; + private State state; + private final long futureTime = 1000 * 1000 * 1000 * 1000; + + /** + * Constructor to create an instance of Circuit Breaker + * @param timeout Timeout for the API request. Not necessary for this simple example + * @param failureThreshold Number of failures we receive from the depended service before changing state to 'OPEN' + * @param retryTimePeriod Time period after which a new request is made to remote service for status check. + */ + CircuitBreaker(long timeout, int failureThreshold, long retryTimePeriod) { + // We start in a closed state hoping that everything is fine + this.state = State.CLOSED; + this.failureThreshold = failureThreshold; + // Timeout for the API request. Used to break the calls made to remote resource if it exceeds the limit + this.timeout = timeout; + this.retryTimePeriod = retryTimePeriod; + //An absurd amount of time in future which basically indicates the last failure never happened + this.lastFailureTime = System.nanoTime() + futureTime; + this.failureCount = 0; + } + + //Reset everything to defaults + private void reset() { + this.failureCount = 0; + this.lastFailureTime = System.nanoTime() + futureTime; + this.state = State.CLOSED; + } + + private void recordFailure() { + failureCount = failureCount + 1; + this.lastFailureTime = System.nanoTime(); + } + + protected void setState() { + if (failureCount > failureThreshold) { //Then something is wrong with remote service + if ((System.nanoTime() - lastFailureTime) > retryTimePeriod) { + //We have waited long enough and should try checking if service is up + state = State.HALF_OPEN; + } else { + //Service would still probably be down + state = State.OPEN; + } + } else { + //Everything is working fine + state = State.CLOSED; + } + } + + public String getState() { + return state.name(); + } + + /** + * Break the circuit beforehand if it is known service is down + * Or connect the circuit manually if service comes online before expected + * @param state State at which circuit is in + */ + public void setStateForBypass(State state) { + this.state = state; + } + + /** + * @param serviceToCall The name of the service in String. Can be changed to data URLs in case of web applications + * @param serverStartTime Time at which actual server was started which makes calls to this service + * @return Value from the remote resource, stale response or a custom exception + */ + public String call(String serviceToCall, long serverStartTime) throws Exception { + setState(); + if (state == State.OPEN) { + // return cached response if no the circuit is in OPEN state + return "This is stale response from API"; + } else { + // Make the API request if the circuit is not OPEN + if (serviceToCall.equals("delayedService")) { + var delayedService = new DelayedService(20); + var response = delayedService.response(serverStartTime); + //In a real application, this would be run in a thread and the timeout + //parameter of the circuit breaker would be utilized to know if service + //is working. Here, we simulate that based on server response itself + if (response.split(" ")[3].equals("working")) { + // Yay!! the API responded fine. Let's reset everything. + reset(); + return response; + } else { + // Uh-oh!! the call still failed. Let's update that in our records. + recordFailure(); + throw new Exception("Remote service not responding"); + } + } else { + throw new Exception("Unknown Service Name"); + } + } + } +} \ No newline at end of file diff --git a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/DelayedService.java b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/DelayedService.java new file mode 100644 index 000000000000..33217b8e721b --- /dev/null +++ b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/DelayedService.java @@ -0,0 +1,61 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.circuitbreaker; + +/** +* This simulates the remote service +* It responds only after a certain timeout period (default set to 20 seconds) +*/ +public class DelayedService { + private final int delay; + + /** + * Constructor to create an instance of DelayedService, which is down for first few seconds + * @param delay the delay after which service would behave properly, in seconds + */ + public DelayedService(int delay) { + this.delay = delay; + } + + public DelayedService() { + this.delay = 60; + } + + /** + * @param serverStartTime Time at which actual server was started which makes calls to this service + * @return The state of the service + */ + public String response(long serverStartTime) { + var currentTime = System.nanoTime(); + //Since currentTime and serverStartTime are both in nanoseconds, we convert it to + //seconds by diving by 10e9 and ensure floating point division by multiplying it + //with 1.0 first. We then check if it is greater or less than specified delay and then + //send the reply + if ((currentTime - serverStartTime) * 1.0 / (1000 * 1000 * 1000) < delay) { + //Can use Thread.sleep() here to block and simulate a hung server + return "Delayed service is down"; + } else { + return "Delayed service is working"; + } + } +} diff --git a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/MonitoringService.java b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/MonitoringService.java new file mode 100644 index 000000000000..e301ff3ca52b --- /dev/null +++ b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/MonitoringService.java @@ -0,0 +1,50 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.circuitbreaker; + +/** + * The service class which makes local and remote calls + * Uses {@link CircuitBreaker} object to ensure remote calls don't use up resources + */ +public class MonitoringService { + + //Assumption: Local service won't fail, no need to wrap it in a circuit breaker logic + public String localResourceResponse() { + return "Local Service is working"; + } + + /** + * Try to get result from remote server + * @param circuitBreaker The circuitBreaker object with all parameters + * @param serverStartTime Time at which actual server was started which makes calls to this service + * @return result from the remote response or exception raised by it. + */ + public String remoteResourceResponse(CircuitBreaker circuitBreaker, long serverStartTime) { + try { + return circuitBreaker.call("delayedService", serverStartTime); + } catch (Exception e) { + return e.getMessage(); + } + } +} \ No newline at end of file diff --git a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/State.java b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/State.java new file mode 100644 index 000000000000..87982153ccd0 --- /dev/null +++ b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/State.java @@ -0,0 +1,33 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.circuitbreaker; + +/** + * Enumeration for states the circuit breaker could be in + */ +public enum State { + CLOSED, + OPEN, + HALF_OPEN +} \ No newline at end of file diff --git a/circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/CircuitBreakerTest.java b/circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/CircuitBreakerTest.java new file mode 100644 index 000000000000..5780e9355c58 --- /dev/null +++ b/circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/CircuitBreakerTest.java @@ -0,0 +1,80 @@ +/** + * The MIT License + * Copyright (c) 2014 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.circuitbreaker; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; + +/** + * + * Circuit Breaker test + * + */ +public class CircuitBreakerTest { + + //long timeout, int failureThreshold, long retryTimePeriod + @Test + public void testSetState() { + var circuitBreaker = new CircuitBreaker(1,1,100); + //Right now, failureCountfailureThreshold, and lastFailureTime is nearly equal to current time, + //state should be half-open + assertEquals(circuitBreaker.getState(), "HALF_OPEN"); + //Since failureCount>failureThreshold, and lastFailureTime is much lesser current time, + //state should be open + circuitBreaker.lastFailureTime = System.nanoTime() - 1000 * 1000 * 1000 * 1000; + circuitBreaker.setState(); + assertEquals(circuitBreaker.getState(), "OPEN"); + //Now set it back again to closed to test idempotency + circuitBreaker.failureCount = 0; + circuitBreaker.setState(); + assertEquals(circuitBreaker.getState(), "CLOSED"); + } + + @Test + public void testSetStateForBypass() { + var circuitBreaker = new CircuitBreaker(1,1,100); + //Right now, failureCountbytecode leader-election data-locality + circuit-breaker From e6c71b63fcfe9b2dd3c98821e8650cac9dd72445 Mon Sep 17 00:00:00 2001 From: Christopher O'Connell Date: Tue, 15 Oct 2019 12:14:08 -0400 Subject: [PATCH 057/197] 988: Replaced all of the Apache HttpClients with Java's java.net.http (#1003) * 988: Took out the apache http component from root pom.xml * 988: Updated the aggregator sub projects to use java.net.http instead of apache * 988: Updated the api-gateway-service sub projects to use java.net.http instead of apache * Applied the code style formatter --- .../aggregator-service/pom.xml | 4 --- .../ProductInformationClientImpl.java | 28 ++++++++--------- .../ProductInventoryClientImpl.java | 29 +++++++++-------- api-gateway/api-gateway-service/pom.xml | 4 --- .../iluwatar/api/gateway/ImageClientImpl.java | 30 +++++++++++------- .../iluwatar/api/gateway/PriceClientImpl.java | 31 ++++++++++++------- pom.xml | 6 ---- 7 files changed, 64 insertions(+), 68 deletions(-) diff --git a/aggregator-microservices/aggregator-service/pom.xml b/aggregator-microservices/aggregator-service/pom.xml index 62695d9e9cba..d6ebc823c307 100644 --- a/aggregator-microservices/aggregator-service/pom.xml +++ b/aggregator-microservices/aggregator-service/pom.xml @@ -53,10 +53,6 @@ mockito-core test
- - org.apache.httpcomponents - httpclient -
diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java index 2588fac81e01..b42b5b55a337 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java @@ -22,18 +22,16 @@ */ package com.iluwatar.aggregator.microservices; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.io.IOException; - /** * An adapter to communicate with information micro-service. */ @@ -45,15 +43,15 @@ public class ProductInformationClientImpl implements ProductInformationClient { @Override public String getProductTitle() { String response = null; - try (CloseableHttpClient httpClient = HttpClients.createDefault()) { - HttpGet httpGet = new HttpGet("http://localhost:51515/information"); - try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { - response = EntityUtils.toString(httpResponse.getEntity()); - } - } catch (ClientProtocolException cpe) { - LOGGER.error("ClientProtocolException Occured", cpe); + HttpRequest request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51515/information")).build(); + HttpClient client = HttpClient.newHttpClient(); + try { + HttpResponse httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString()); + response = httpResponse.body(); } catch (IOException ioe) { LOGGER.error("IOException Occurred", ioe); + } catch (InterruptedException ie) { + LOGGER.error("InterruptedException Occurred", ie); } return response; } diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java index 586699f85629..59a050c9e563 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java @@ -22,18 +22,16 @@ */ package com.iluwatar.aggregator.microservices; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.io.IOException; - /** * An adapter to communicate with inventory micro-service. */ @@ -45,15 +43,16 @@ public class ProductInventoryClientImpl implements ProductInventoryClient { @Override public int getProductInventories() { String response = "0"; - try (CloseableHttpClient httpClient = HttpClients.createDefault()) { - HttpGet httpGet = new HttpGet("http://localhost:51516/inventories"); - try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { - response = EntityUtils.toString(httpResponse.getEntity()); - } - } catch (ClientProtocolException cpe) { - LOGGER.error("ClientProtocolException Occured", cpe); + + HttpRequest request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51516/inventories")).build(); + HttpClient client = HttpClient.newHttpClient(); + try { + HttpResponse httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString()); + response = httpResponse.body(); } catch (IOException ioe) { LOGGER.error("IOException Occurred", ioe); + } catch (InterruptedException ie) { + LOGGER.error("InterruptedException Occurred", ie); } return Integer.parseInt(response); } diff --git a/api-gateway/api-gateway-service/pom.xml b/api-gateway/api-gateway-service/pom.xml index 8821d6b4f21c..fa3e7286ba85 100644 --- a/api-gateway/api-gateway-service/pom.xml +++ b/api-gateway/api-gateway-service/pom.xml @@ -39,10 +39,6 @@ org.springframework spring-webmvc
- - org.apache.httpcomponents - httpclient - org.springframework.boot spring-boot-starter-web diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClientImpl.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClientImpl.java index e94657a6cd0b..dddd0dc20f60 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClientImpl.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClientImpl.java @@ -22,14 +22,14 @@ */ package com.iluwatar.api.gateway; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.springframework.stereotype.Component; - import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandlers; + +import org.springframework.stereotype.Component; /** * An adapter to communicate with the Image microservice @@ -38,19 +38,25 @@ public class ImageClientImpl implements ImageClient { /** * Makes a simple HTTP Get request to the Image microservice + * * @return The path to the image */ @Override public String getImagePath() { String response = null; - try (CloseableHttpClient httpClient = HttpClients.createDefault()) { - HttpGet httpGet = new HttpGet("http://localhost:50005/image-path"); - try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { - response = EntityUtils.toString(httpResponse.getEntity()); - } + + HttpClient httpClient = HttpClient.newHttpClient(); + HttpRequest httpGet = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:50005/image-path")).build(); + + try { + HttpResponse httpResponse = httpClient.send(httpGet, BodyHandlers.ofString()); + response = httpResponse.body(); } catch (IOException e) { e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); } + return response; } } diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClientImpl.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClientImpl.java index 4a645b809f24..25d7f0b1169c 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClientImpl.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClientImpl.java @@ -22,14 +22,14 @@ */ package com.iluwatar.api.gateway; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.springframework.stereotype.Component; - import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandlers; + +import org.springframework.stereotype.Component; /** * An adapter to communicate with the Price microservice @@ -38,19 +38,26 @@ public class PriceClientImpl implements PriceClient { /** * Makes a simple HTTP Get request to the Price microservice + * * @return The price of the product */ @Override public String getPrice() { + String response = null; - try (CloseableHttpClient httpClient = HttpClients.createDefault()) { - HttpGet httpGet = new HttpGet("http://localhost:50006/price"); - try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { - response = EntityUtils.toString(httpResponse.getEntity()); - } + + HttpClient httpClient = HttpClient.newHttpClient(); + HttpRequest httpGet = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:50006/price")).build(); + + try { + HttpResponse httpResponse = httpClient.send(httpGet, BodyHandlers.ofString()); + response = httpResponse.body(); } catch (IOException e) { e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); } + return response; } } diff --git a/pom.xml b/pom.xml index 9e61e716b864..d330bbfcb6cd 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,6 @@ 2.24.0 19.0 1.10.19 - 4.5.10 2.22 4.0 3.3.0 @@ -216,11 +215,6 @@ spring-webmvc ${spring.version} - - org.apache.httpcomponents - httpclient - ${apache-httpcomponents.version} - com.h2database h2 From dd5997b49502495ec5a6b978fa48fe294dac708c Mon Sep 17 00:00:00 2001 From: Christopher O'Connell Date: Tue, 15 Oct 2019 12:21:07 -0400 Subject: [PATCH 058/197] 993: Fixed the pipeines project layout so that it will load in Eclipse (#1004) The source directory was not working in the 2019.09 version of Eclipse. The problem was in the layout of the project: after the src/main/java and src/test/java, the directory was naed com.iluwatar.pipeline. It should've been com/iluwatar/pipeline. This follows the hierarchy of all of the other patterns. Once these files were moved, the Pipeline project compiled without errors. --- .../{com.iluwatar.pipeline => com/iluwatar/pipeline}/App.java | 0 .../iluwatar/pipeline}/ConvertToCharArrayHandler.java | 0 .../{com.iluwatar.pipeline => com/iluwatar/pipeline}/Handler.java | 0 .../iluwatar/pipeline}/Pipeline.java | 0 .../iluwatar/pipeline}/RemoveAlphabetsHandler.java | 0 .../iluwatar/pipeline}/RemoveDigitsHandler.java | 0 .../{com.iluwatar.pipeline => com/iluwatar/pipeline}/AppTest.java | 0 .../iluwatar/pipeline}/PipelineTest.java | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename pipeline/src/main/java/{com.iluwatar.pipeline => com/iluwatar/pipeline}/App.java (100%) rename pipeline/src/main/java/{com.iluwatar.pipeline => com/iluwatar/pipeline}/ConvertToCharArrayHandler.java (100%) rename pipeline/src/main/java/{com.iluwatar.pipeline => com/iluwatar/pipeline}/Handler.java (100%) rename pipeline/src/main/java/{com.iluwatar.pipeline => com/iluwatar/pipeline}/Pipeline.java (100%) rename pipeline/src/main/java/{com.iluwatar.pipeline => com/iluwatar/pipeline}/RemoveAlphabetsHandler.java (100%) rename pipeline/src/main/java/{com.iluwatar.pipeline => com/iluwatar/pipeline}/RemoveDigitsHandler.java (100%) rename pipeline/src/test/java/{com.iluwatar.pipeline => com/iluwatar/pipeline}/AppTest.java (100%) rename pipeline/src/test/java/{com.iluwatar.pipeline => com/iluwatar/pipeline}/PipelineTest.java (100%) diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/App.java b/pipeline/src/main/java/com/iluwatar/pipeline/App.java similarity index 100% rename from pipeline/src/main/java/com.iluwatar.pipeline/App.java rename to pipeline/src/main/java/com/iluwatar/pipeline/App.java diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/ConvertToCharArrayHandler.java b/pipeline/src/main/java/com/iluwatar/pipeline/ConvertToCharArrayHandler.java similarity index 100% rename from pipeline/src/main/java/com.iluwatar.pipeline/ConvertToCharArrayHandler.java rename to pipeline/src/main/java/com/iluwatar/pipeline/ConvertToCharArrayHandler.java diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/Handler.java b/pipeline/src/main/java/com/iluwatar/pipeline/Handler.java similarity index 100% rename from pipeline/src/main/java/com.iluwatar.pipeline/Handler.java rename to pipeline/src/main/java/com/iluwatar/pipeline/Handler.java diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/Pipeline.java b/pipeline/src/main/java/com/iluwatar/pipeline/Pipeline.java similarity index 100% rename from pipeline/src/main/java/com.iluwatar.pipeline/Pipeline.java rename to pipeline/src/main/java/com/iluwatar/pipeline/Pipeline.java diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/RemoveAlphabetsHandler.java b/pipeline/src/main/java/com/iluwatar/pipeline/RemoveAlphabetsHandler.java similarity index 100% rename from pipeline/src/main/java/com.iluwatar.pipeline/RemoveAlphabetsHandler.java rename to pipeline/src/main/java/com/iluwatar/pipeline/RemoveAlphabetsHandler.java diff --git a/pipeline/src/main/java/com.iluwatar.pipeline/RemoveDigitsHandler.java b/pipeline/src/main/java/com/iluwatar/pipeline/RemoveDigitsHandler.java similarity index 100% rename from pipeline/src/main/java/com.iluwatar.pipeline/RemoveDigitsHandler.java rename to pipeline/src/main/java/com/iluwatar/pipeline/RemoveDigitsHandler.java diff --git a/pipeline/src/test/java/com.iluwatar.pipeline/AppTest.java b/pipeline/src/test/java/com/iluwatar/pipeline/AppTest.java similarity index 100% rename from pipeline/src/test/java/com.iluwatar.pipeline/AppTest.java rename to pipeline/src/test/java/com/iluwatar/pipeline/AppTest.java diff --git a/pipeline/src/test/java/com.iluwatar.pipeline/PipelineTest.java b/pipeline/src/test/java/com/iluwatar/pipeline/PipelineTest.java similarity index 100% rename from pipeline/src/test/java/com.iluwatar.pipeline/PipelineTest.java rename to pipeline/src/test/java/com/iluwatar/pipeline/PipelineTest.java From c438ec0557b31cdc58a6c0bdbba0987a0525621e Mon Sep 17 00:00:00 2001 From: Sharad Paul Date: Tue, 15 Oct 2019 22:03:36 +0530 Subject: [PATCH 059/197] Intermittent test failure in Spatial Partition pattern #1001 (#1006) * Intermittent test failure in Spatial Partition pattern #1001 * Intermittent test failure in Spatial Partition pattern #1001 --- .../java/com/iluwatar/spatialpartition/QuadTreeTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spatial-partition/src/test/java/com/iluwatar/spatialpartition/QuadTreeTest.java b/spatial-partition/src/test/java/com/iluwatar/spatialpartition/QuadTreeTest.java index 0f9dc1e4ea57..15f1022fdae9 100644 --- a/spatial-partition/src/test/java/com/iluwatar/spatialpartition/QuadTreeTest.java +++ b/spatial-partition/src/test/java/com/iluwatar/spatialpartition/QuadTreeTest.java @@ -26,6 +26,8 @@ import java.util.ArrayList; import java.util.Hashtable; import java.util.Random; + + import org.junit.jupiter.api.Test; /** @@ -50,12 +52,12 @@ void queryTest() { static Hashtable quadTreeTest(ArrayList points, Rect field, Rect queryRange) { //creating quadtree and inserting all points - QuadTree qTree = new QuadTree(field, 4); + QuadTree qTree = new QuadTree(queryRange, 4); for (int i = 0; i < points.size(); i++) { qTree.insert(points.get(i)); } - ArrayList queryResult = qTree.query(queryRange, new ArrayList()); + ArrayList queryResult = qTree.query(field, new ArrayList()); Hashtable result = new Hashtable(); for (int i = 0; i < queryResult.size(); i++) { Point p = queryResult.get(i); From 27c131c2cb850a92b5b346b24dce20eae91cc84f Mon Sep 17 00:00:00 2001 From: Michele Giacobazzi Date: Tue, 15 Oct 2019 18:37:35 +0200 Subject: [PATCH 060/197] #1001 fix intermittent test failure (#1008) --- .../main/java/com/iluwatar/spatialpartition/Rect.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Rect.java b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Rect.java index 3d2f01d77d3d..71d4eda5bfa7 100644 --- a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Rect.java +++ b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Rect.java @@ -28,14 +28,14 @@ */ public class Rect { - int x; - int y; - int width; - int height; + double x; + double y; + double width; + double height; //(x,y) - centre of rectangle - Rect(int x, int y, int width, int height) { + Rect(double x, double y, double width, double height) { this.x = x; this.y = y; this.width = width; From a5646b63c19455051fb49fd5a455a28159708d49 Mon Sep 17 00:00:00 2001 From: Azureyjt Date: Wed, 16 Oct 2019 23:21:06 +0800 Subject: [PATCH 061/197] #554: Subclass Sandbox pattern (#998) * Fix issue #761: ThreadSafeDoubleCheckLocking.java: Instantiating by Reflection call will be successful if you do that firstly * Create leader election module * Create Interface of Instance and MessageManager * Create implementations with token ring algorithm * Change package structure. Create basic message system. * Implement heartbeat and heartbeat invoking message system * Implement election message handler * Add leader message handler * Add main entry point * Add comments * Update README.md * Fix checkstyle issue * Add Unit Tests * Add Unit Tests * Add bully leader selection * Change System.out to log print. Add MIT license in each file. * Add More java doc comments * Add unit test * Add unit tests * Add subclass-sandbox * Add Unit Test * Add Unit Test * Fix Typo * Move dependency into parent pom.xml * Change local valuable reference to be var --- pom.xml | 9 +- subclass-sandbox/README.md | 29 ++++++ subclass-sandbox/pom.xml | 49 ++++++++++ .../com/iluwatar/subclasssandbox/App.java | 53 +++++++++++ .../iluwatar/subclasssandbox/GroundDive.java | 44 +++++++++ .../iluwatar/subclasssandbox/SkyLaunch.java | 44 +++++++++ .../iluwatar/subclasssandbox/Superpower.java | 69 ++++++++++++++ .../com/iluwatar/subclasssandbox/AppTest.java | 38 ++++++++ .../subclasssandbox/GroundDiveTest.java | 92 +++++++++++++++++++ .../subclasssandbox/SkyLaunchTest.java | 91 ++++++++++++++++++ 10 files changed, 517 insertions(+), 1 deletion(-) create mode 100644 subclass-sandbox/README.md create mode 100644 subclass-sandbox/pom.xml create mode 100644 subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/App.java create mode 100644 subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/GroundDive.java create mode 100644 subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/SkyLaunch.java create mode 100644 subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/Superpower.java create mode 100644 subclass-sandbox/src/test/java/com/iluwatar/subclasssandbox/AppTest.java create mode 100644 subclass-sandbox/src/test/java/com/iluwatar/subclasssandbox/GroundDiveTest.java create mode 100644 subclass-sandbox/src/test/java/com/iluwatar/subclasssandbox/SkyLaunchTest.java diff --git a/pom.xml b/pom.xml index d330bbfcb6cd..020c784c62fd 100644 --- a/pom.xml +++ b/pom.xml @@ -60,6 +60,7 @@ 2.3.1 2.3.2 1.3.2 + 1.19.0 abstract-factory @@ -180,8 +181,8 @@ bytecode leader-election data-locality + subclass-sandbox circuit-breaker - @@ -317,6 +318,12 @@ javassist 3.25.0-GA + + com.github.stefanbirkner + system-rules + ${system-rules.version} + test +
diff --git a/subclass-sandbox/README.md b/subclass-sandbox/README.md new file mode 100644 index 000000000000..674991f0895c --- /dev/null +++ b/subclass-sandbox/README.md @@ -0,0 +1,29 @@ + +--- +layout: pattern +title: Subclass Sandbox +folder: subclass-sandbox +permalink: /patterns/subclass-sandbox/ +categories: Other +tags: + - Java + - Difficulty-Beginner +--- + +## Intent +The subclass sandbox pattern describes a basic idea, while not having a lot of detailed mechanics. You will need the pattern when you have several similar subclasses. If you have to make a tiny change, then change the base class, while all subclasses shouldn't have to be touched. So the base class has to be able to provide all of the operations a derived class needs to perform. + +## Applicability +The Subclass Sandbox pattern is a very simple, common pattern lurking in lots of codebases, even outside of games. If you have a non-virtual protected method laying around, you’re probably already using something like this. Subclass Sandbox is a good fit when: + +- You have a base class with a number of derived classes. + +- The base class is able to provide all of the operations that a derived class may need to perform. + +- There is behavioral overlap in the subclasses and you want to make it easier to share code between them. + +- You want to minimize coupling between those derived classes and the rest of the program. + +## Credits + +* [Game Programming Patterns - Subclass Sandbox]([http://gameprogrammingpatterns.com/subclass-sandbox.html](http://gameprogrammingpatterns.com/subclass-sandbox.html)) \ No newline at end of file diff --git a/subclass-sandbox/pom.xml b/subclass-sandbox/pom.xml new file mode 100644 index 000000000000..8016ba471ed0 --- /dev/null +++ b/subclass-sandbox/pom.xml @@ -0,0 +1,49 @@ + + + + + java-design-patterns + com.iluwatar + 1.22.0-SNAPSHOT + + 4.0.0 + + subclass-sandbox + + + + junit + junit + + + com.github.stefanbirkner + system-rules + + + + \ No newline at end of file diff --git a/subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/App.java b/subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/App.java new file mode 100644 index 000000000000..2e1f41c056c4 --- /dev/null +++ b/subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/App.java @@ -0,0 +1,53 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.subclasssandbox; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The subclass sandbox pattern describes a basic idea, while not having a lot + * of detailed mechanics. You will need the pattern when you have several similar + * subclasses. If you have to make a tiny change, then change the base class, + * while all subclasses shouldn't have to be touched. So the base class has to be + * able to provide all of the operations a derived class needs to perform. + */ +public class App { + + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); + + /** + * Entry point of the main program. + * @param args Program runtime arguments. + */ + public static void main(String[] args) { + LOGGER.info("Use superpower: sky launch"); + var skyLaunch = new SkyLaunch(); + skyLaunch.activate(); + LOGGER.info("Use superpower: ground dive"); + var groundDive = new GroundDive(); + groundDive.activate(); + } + +} diff --git a/subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/GroundDive.java b/subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/GroundDive.java new file mode 100644 index 000000000000..f284e125fba7 --- /dev/null +++ b/subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/GroundDive.java @@ -0,0 +1,44 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.subclasssandbox; + +import org.slf4j.LoggerFactory; + +/** + * GroundDive superpower. + */ +public class GroundDive extends Superpower { + + public GroundDive() { + super(); + logger = LoggerFactory.getLogger(GroundDive.class); + } + + @Override + protected void activate() { + move(0, 0, -20); + playSound("GROUNDDIVE_SOUND", 5); + spawnParticles("GROUNDDIVE_PARTICLE", 20); + } +} diff --git a/subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/SkyLaunch.java b/subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/SkyLaunch.java new file mode 100644 index 000000000000..16c94bd0ca57 --- /dev/null +++ b/subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/SkyLaunch.java @@ -0,0 +1,44 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.subclasssandbox; + +import org.slf4j.LoggerFactory; + +/** + * SkyLaunch superpower. + */ +public class SkyLaunch extends Superpower { + + public SkyLaunch() { + super(); + logger = LoggerFactory.getLogger(SkyLaunch.class); + } + + @Override + protected void activate() { + move(0, 0, 20); + playSound("SKYLAUNCH_SOUND", 1); + spawnParticles("SKYLAUNCH_PARTICLE", 100); + } +} diff --git a/subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/Superpower.java b/subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/Superpower.java new file mode 100644 index 000000000000..d4875d586d62 --- /dev/null +++ b/subclass-sandbox/src/main/java/com/iluwatar/subclasssandbox/Superpower.java @@ -0,0 +1,69 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.subclasssandbox; + +import org.slf4j.Logger; + +/** + * Superpower abstract class. In this class the basic operations of all types of + * superpowers are provided as protected methods. + */ +public abstract class Superpower { + + protected Logger logger; + + /** + * Subclass of superpower should implement this sandbox method by calling the + * methods provided in this super class. + */ + protected abstract void activate(); + + /** + * Move to (x, y, z). + * @param x X coordinate. + * @param y Y coordinate. + * @param z Z coordinate. + */ + protected void move(double x, double y, double z) { + logger.info("Move to ( " + x + ", " + y + ", " + z + " )"); + } + + /** + * Play sound effect for the superpower. + * @param soundName Sound name. + * @param volumn Value of volumn. + */ + protected void playSound(String soundName, int volumn) { + logger.info("Play " + soundName + " with volumn " + volumn); + } + + /** + * Spawn particles for the superpower. + * @param particleType Particle type. + * @param count Count of particles to be spawned. + */ + protected void spawnParticles(String particleType, int count) { + logger.info("Spawn " + count + " particle with type " + particleType); + } +} diff --git a/subclass-sandbox/src/test/java/com/iluwatar/subclasssandbox/AppTest.java b/subclass-sandbox/src/test/java/com/iluwatar/subclasssandbox/AppTest.java new file mode 100644 index 000000000000..207c71ef9ef0 --- /dev/null +++ b/subclass-sandbox/src/test/java/com/iluwatar/subclasssandbox/AppTest.java @@ -0,0 +1,38 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.subclasssandbox; + +import org.junit.Test; + +/** + * App unit tests. + */ +public class AppTest { + + @Test + public void testMain() { + String[] args = {}; + App.main(args); + } +} diff --git a/subclass-sandbox/src/test/java/com/iluwatar/subclasssandbox/GroundDiveTest.java b/subclass-sandbox/src/test/java/com/iluwatar/subclasssandbox/GroundDiveTest.java new file mode 100644 index 000000000000..7b4645742376 --- /dev/null +++ b/subclass-sandbox/src/test/java/com/iluwatar/subclasssandbox/GroundDiveTest.java @@ -0,0 +1,92 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.subclasssandbox; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.SystemOutRule; + +/** + * GroundDive unit tests. + */ +public class GroundDiveTest { + + @Rule + public SystemOutRule log = new SystemOutRule().enableLog(); + + @Test + public void testMove() { + log.clearLog(); + var groundDive = new GroundDive(); + groundDive.move(1.0, 1.0, 1.0); + var outputLog = getLogContent(log.getLog()); + var expectedLog = "Move to ( 1.0, 1.0, 1.0 )"; + Assert.assertEquals(outputLog, expectedLog); + } + + @Test + public void testPlaySound() { + log.clearLog(); + var groundDive = new GroundDive(); + groundDive.playSound("SOUND_NAME", 1); + var outputLog = getLogContent(log.getLog()); + var expectedLog = "Play SOUND_NAME with volumn 1"; + Assert.assertEquals(outputLog, expectedLog); + } + + @Test + public void testSpawnParticles() { + log.clearLog(); + var groundDive = new GroundDive(); + groundDive.spawnParticles("PARTICLE_TYPE", 100); + final var outputLog = getLogContent(log.getLog()); + final var expectedLog = "Spawn 100 particle with type PARTICLE_TYPE"; + Assert.assertEquals(outputLog, expectedLog); + } + + @Test + public void testActivate() { + log.clearLog(); + var groundDive = new GroundDive(); + groundDive.activate();; + String[] logs = log.getLog().split("\n"); + final var expectedSize = 3; + final var log1 = logs[0].split("-")[1].trim() + " -" + logs[0].split("-")[2].trim(); + final var expectedLog1 = "Move to ( 0.0, 0.0, -20.0 )"; + final var log2 = getLogContent(logs[1]); + final var expectedLog2 = "Play GROUNDDIVE_SOUND with volumn 5"; + final var log3 = getLogContent(logs[2]); + final var expectedLog3 = "Spawn 20 particle with type GROUNDDIVE_PARTICLE"; + Assert.assertEquals(logs.length, expectedSize); + Assert.assertEquals(log1, expectedLog1); + Assert.assertEquals(log2, expectedLog2); + Assert.assertEquals(log3, expectedLog3); + } + + private String getLogContent(String log) { + return log.split("-")[1].trim(); + } + +} diff --git a/subclass-sandbox/src/test/java/com/iluwatar/subclasssandbox/SkyLaunchTest.java b/subclass-sandbox/src/test/java/com/iluwatar/subclasssandbox/SkyLaunchTest.java new file mode 100644 index 000000000000..5ba84c0b55cc --- /dev/null +++ b/subclass-sandbox/src/test/java/com/iluwatar/subclasssandbox/SkyLaunchTest.java @@ -0,0 +1,91 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

+ * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.subclasssandbox; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.SystemOutRule; + +/** + * SkyLaunch unit tests. + */ +public class SkyLaunchTest { + + @Rule + public SystemOutRule log = new SystemOutRule().enableLog(); + + @Test + public void testMove() { + log.clearLog(); + var skyLaunch = new SkyLaunch(); + skyLaunch.move(1.0, 1.0, 1.0); + var outputLog = getLogContent(log.getLog()); + var expectedLog = "Move to ( 1.0, 1.0, 1.0 )"; + Assert.assertEquals(outputLog, expectedLog); + } + + @Test + public void testPlaySound() { + log.clearLog(); + var skyLaunch = new SkyLaunch(); + skyLaunch.playSound("SOUND_NAME", 1); + var outputLog = getLogContent(log.getLog()); + var expectedLog = "Play SOUND_NAME with volumn 1"; + Assert.assertEquals(outputLog, expectedLog); + } + + @Test + public void testSpawnParticles() { + log.clearLog(); + var skyLaunch = new SkyLaunch(); + skyLaunch.spawnParticles("PARTICLE_TYPE", 100); + var outputLog = getLogContent(log.getLog()); + var expectedLog = "Spawn 100 particle with type PARTICLE_TYPE"; + Assert.assertEquals(outputLog, expectedLog); + } + + @Test + public void testActivate() { + log.clearLog(); + var skyLaunch = new SkyLaunch(); + skyLaunch.activate();; + String[] logs = log.getLog().split("\n"); + final var expectedSize = 3; + final var log1 = getLogContent(logs[0]); + final var expectedLog1 = "Move to ( 0.0, 0.0, 20.0 )"; + final var log2 = getLogContent(logs[1]); + final var expectedLog2 = "Play SKYLAUNCH_SOUND with volumn 1"; + final var log3 = getLogContent(logs[2]); + final var expectedLog3 = "Spawn 100 particle with type SKYLAUNCH_PARTICLE"; + Assert.assertEquals(logs.length, expectedSize); + Assert.assertEquals(log1, expectedLog1); + Assert.assertEquals(log2, expectedLog2); + Assert.assertEquals(log3, expectedLog3); + } + + private String getLogContent(String log) { + return log.split("-")[1].trim(); + } +} From 880b234d8fa328619e2505650849fec4c319d9fa Mon Sep 17 00:00:00 2001 From: Kai Winter Date: Thu, 17 Oct 2019 20:00:32 +0200 Subject: [PATCH 062/197] Fixes #1007 by updating JUnit to 5.5.2 (#1015) The missing class PreconditionViolationException is contained in junit-platform-commons which comes in transitively by this JUnit version. junit-jupiter-api had to be added because spring-boot-dependencies imports an older version of this dependency. --- pom.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 020c784c62fd..22dedc14a59e 100644 --- a/pom.xml +++ b/pom.xml @@ -39,7 +39,7 @@ 2.0.14.RELEASE 1.4.190 4.12 - 5.0.2 + 5.5.2 ${junit.version}.2 1.0.2 3.8.1 @@ -242,6 +242,12 @@ ${junit.version} test + + org.junit.jupiter + junit-jupiter-api + ${junit-jupiter.version} + test + org.junit.jupiter junit-jupiter-engine From c308ca09e5018aecd9ee409d6fdddb0d18d3a3de Mon Sep 17 00:00:00 2001 From: Christopher O'Connell Date: Fri, 18 Oct 2019 01:50:02 -0400 Subject: [PATCH 063/197] 1011: Fixed all of the SonarCloud blocking errors (#1017) * 1011: Added the method to the RequestMapping annotation * 1011: Changed all of the a href blank targets to include rel="noopener noreferrer" --- .../aggregator/microservices/Aggregator.java | 7 ++++--- .../java/com/iluwatar/api/gateway/ApiGateway.java | 5 +++-- .../webapp/src/main/webapp/about/index.html | 12 ++++++------ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java index cd30afc4807c..ccbe6f2fe68c 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java @@ -22,11 +22,12 @@ */ package com.iluwatar.aggregator.microservices; +import javax.annotation.Resource; + import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -import javax.annotation.Resource; - /** * The aggregator aggregates calls on various micro-services, collects * data and further publishes them under a REST endpoint. @@ -47,7 +48,7 @@ public class Aggregator { * * @return a Product. */ - @RequestMapping("/product") + @RequestMapping(path = "/product", method = RequestMethod.GET) public Product getProduct() { Product product = new Product(); product.setTitle(informationClient.getProductTitle()); diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ApiGateway.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ApiGateway.java index cbabad1e6ff6..dc4249c6eb3d 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ApiGateway.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ApiGateway.java @@ -23,6 +23,7 @@ package com.iluwatar.api.gateway; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @@ -43,7 +44,7 @@ public class ApiGateway { * Retrieves product information that desktop clients need * @return Product information for clients on a desktop */ - @RequestMapping("/desktop") + @RequestMapping(path = "/desktop", method = RequestMethod.GET) public DesktopProduct getProductDesktop() { DesktopProduct desktopProduct = new DesktopProduct(); desktopProduct.setImagePath(imageClient.getImagePath()); @@ -55,7 +56,7 @@ public DesktopProduct getProductDesktop() { * Retrieves product information that mobile clients need * @return Product information for clients on a mobile device */ - @RequestMapping("/mobile") + @RequestMapping(path = "/mobile", method = RequestMethod.GET) public MobileProduct getProductMobile() { MobileProduct mobileProduct = new MobileProduct(); mobileProduct.setPrice(priceClient.getPrice()); diff --git a/naked-objects/webapp/src/main/webapp/about/index.html b/naked-objects/webapp/src/main/webapp/about/index.html index 176bfc13a3f6..e929c5b6da33 100644 --- a/naked-objects/webapp/src/main/webapp/about/index.html +++ b/naked-objects/webapp/src/main/webapp/about/index.html @@ -82,12 +82,12 @@

This app has been generated using Apache Isis' - SimpleApp archetype, + SimpleApp archetype, to create a purposefully minimal application that nevertheless includes fixture data, integration tests and BDD specs.

- The app itself consists of a single domain class, SimpleObject, - along with an equally simple (factory/repository) domain service, SimpleObjects. + The app itself consists of a single domain class, SimpleObject, + along with an equally simple (factory/repository) domain service, SimpleObjects.

To access the app:

@@ -98,8 +98,8 @@

provides accesses to a generic UI for end-users, - Isis' Wicket Viewer. - As its name suggests, this viewer is built on top of Apache Wicket™. + Isis' Wicket Viewer. + As its name suggests, this viewer is built on top of Apache Wicket™.

  • @@ -118,7 +118,7 @@

    The default user/password is sven/pass (as configured in the - shiro.ini file). + shiro.ini file).

    From 2982db456db68f5a1e30eb7f53bea1dac054f974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Fri, 18 Oct 2019 23:09:27 +0300 Subject: [PATCH 064/197] Update README.md --- README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c41a48a8898d..4642b9989c83 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,15 @@ are familiar with the patterns. # Getting started +This site showcases Java Design Patterns. The solutions have been developed by +experienced programmers and architects from the open source community. The +patterns can be browsed by their high level descriptions or by looking at their +source code. The source code examples are well commented and can be thought as +programming tutorials how to implement a specific pattern. We use the most +popular battle-proven open source Java technologies. + Before you dive into the material, you should be familiar with various -Programming/Software Design Principles. +software design principles. All designs should be as simple as possible. You should start with KISS, YAGNI, and Do The Simplest Thing That Could Possibly Work principles. Complexity and @@ -38,9 +45,14 @@ patterns by any of the following approaches - Using pattern categories, `Creational`, `Behavioral` and others. - Search for a specific pattern. Can't find one? Please report a new pattern [here](https://github.com/iluwatar/java-design-patterns/issues). +Hopefully you find the object oriented solutions presented on this site useful +in your architectures and have as much fun learning them as we had developing them. + # How to contribute -If you are willing to contribute to the project you will find the relevant information in our [developer wiki](https://github.com/iluwatar/java-design-patterns/wiki). We will help you and answer your questions in the [Gitter chatroom](https://gitter.im/iluwatar/java-design-patterns). +If you are willing to contribute to the project you will find the relevant information in +our [developer wiki](https://github.com/iluwatar/java-design-patterns/wiki). We will help +you and answer your questions in the [Gitter chatroom](https://gitter.im/iluwatar/java-design-patterns). # License From a204383f4571480cccd1d6802e72b89d630dfe5d Mon Sep 17 00:00:00 2001 From: Besok Date: Sat, 19 Oct 2019 16:17:59 +0100 Subject: [PATCH 065/197] init repo for role object --- role-object/README.md | 20 ++++++++++++++++++++ role-object/pom.xml | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 role-object/README.md create mode 100644 role-object/pom.xml diff --git a/role-object/README.md b/role-object/README.md new file mode 100644 index 000000000000..8ffe47400dd8 --- /dev/null +++ b/role-object/README.md @@ -0,0 +1,20 @@ +--- +layout: pattern +title: Role object +folder: Migration +permalink: /patterns/role-object/ +categories: Behavioral +tags: + - Java + - Easy-to-implement +--- + +## Also known as + +## Intent + +## Applicability + +## Real world examples + +## Credits diff --git a/role-object/pom.xml b/role-object/pom.xml new file mode 100644 index 000000000000..9d7e9b88be6e --- /dev/null +++ b/role-object/pom.xml @@ -0,0 +1,38 @@ + + + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.22.0-SNAPSHOT + + + role-object + + + From c3656109a78ecad0604b92b21bf538866016dbee Mon Sep 17 00:00:00 2001 From: Besok Date: Sat, 19 Oct 2019 16:23:39 +0100 Subject: [PATCH 066/197] add to init --- .../com/iluwatar/roleobject/ApplicationRoleObject.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/ApplicationRoleObject.java diff --git a/role-object/src/main/java/com/iluwatar/roleobject/ApplicationRoleObject.java b/role-object/src/main/java/com/iluwatar/roleobject/ApplicationRoleObject.java new file mode 100644 index 000000000000..89388099fd4e --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/ApplicationRoleObject.java @@ -0,0 +1,7 @@ +package com.iluwatar.roleobject; + +public class ApplicationRoleObject { + public static void main(String[] args) { + System.out.println("Role-object"); + } +} From 0c60a95d8f0da0275db6b16f685444db96fe1837 Mon Sep 17 00:00:00 2001 From: Kai Winter Date: Sat, 19 Oct 2019 17:41:12 +0200 Subject: [PATCH 067/197] Switched to embedded Google checkstyle rules (#1018) * Switched to embedded Google checkstyle rules Moved the configuration out of the execution to make it used in all executions. Fixes #1016 * #1016: Moved checkstyle configuration back into execution This refactoring may be better done in a new issue as it may have too many implication. * Replaced consoleOutput and failsOnError by failOnViolation consoleOutput outputs everything while failsOnError just fails the build but doesn't log the error. failOnViolation fails on a violation and logs it (logViolationsToConsole defaults to true). --- checkstyle.xml | 197 ------------------------------------------------- pom.xml | 5 +- 2 files changed, 2 insertions(+), 200 deletions(-) delete mode 100644 checkstyle.xml diff --git a/checkstyle.xml b/checkstyle.xml deleted file mode 100644 index d66281f178c6..000000000000 --- a/checkstyle.xml +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pom.xml b/pom.xml index 22dedc14a59e..0ef4890ca065 100644 --- a/pom.xml +++ b/pom.xml @@ -395,11 +395,10 @@ validate - checkstyle.xml + google_checks.xml checkstyle-suppressions.xml UTF-8 - true - true + true true From 8a4844792ff7780dd35d781af792ed362f1fdc16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 19 Oct 2019 19:44:57 +0300 Subject: [PATCH 068/197] Remove obsolete file --- CODE_COVERAGE.md | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 CODE_COVERAGE.md diff --git a/CODE_COVERAGE.md b/CODE_COVERAGE.md deleted file mode 100644 index 333ee199f8e0..000000000000 --- a/CODE_COVERAGE.md +++ /dev/null @@ -1,13 +0,0 @@ -# Code Coverage Report generation - -To generate the code coverage report, execute the following command: -> mvn clean verify jacoco:report - -This will generate code coverage report in each of the modules. In order to view the same, open the following file in your browser. -> target/site/jacoco/index.html - -Please note that the above folder is created under each of the modules. For example: -* adapter/target/site/jacoco/index.html -* business-delegate/target/site/jacoco/index.html - - From 7c5d5f6b0d82942195ae12fb987c5dfd8eabaff5 Mon Sep 17 00:00:00 2001 From: Christopher O'Connell Date: Sat, 19 Oct 2019 13:04:44 -0400 Subject: [PATCH 069/197] 1010: Fixed all of the blocking and critical Sonarcloud errors (#1020) * 1011: Added SuppressWarnings for SonarCloud errors All of these files are causing SonarCloud to report the following error: Loops should not be infinite Since these instances all require an infinite loop that will never end, these warnings should be disabled so that SonarCloud no longer reports them as error. The rule is: squid:S2189 * 1011: Made all of the randoms static and final According to SonarCloud rule: "Random" objects should be reused, randoms should not be recreated. This commit has taken all of the Randoms and made them constant variables in the files that are using them. --- .../src/main/java/com/iluwatar/circuitbreaker/App.java | 1 + commander/src/main/java/com/iluwatar/commander/Order.java | 4 ++-- commander/src/main/java/com/iluwatar/commander/Retry.java | 5 +++-- commander/src/main/java/com/iluwatar/commander/Service.java | 4 ++-- .../java/com/iluwatar/hexagonal/sampledata/SampleData.java | 4 ++-- .../java/com/iluwatar/leaderelection/AbstractInstance.java | 1 + .../java/com/iluwatar/masterworker/ArrayUtilityMethods.java | 5 +++-- .../src/main/java/com/iluwatar/priority/queue/Worker.java | 1 + .../main/java/com/iluwatar/producer/consumer/Producer.java | 5 +++-- .../java/com/iluwatar/retry/RetryExponentialBackoff.java | 4 ++-- .../src/main/java/com/iluwatar/spatialpartition/Bubble.java | 6 +++--- .../src/main/java/com/iluwatar/typeobject/CellPool.java | 4 ++-- 12 files changed, 25 insertions(+), 19 deletions(-) diff --git a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java index d1d361b16063..2520b64ceb3c 100644 --- a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java +++ b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java @@ -66,6 +66,7 @@ public class App { * * @param args command line args */ + @SuppressWarnings("squid:S2189") public static void main(String[] args) { //Create an object of monitoring service which makes both local and remote calls var obj = new MonitoringService(); diff --git a/commander/src/main/java/com/iluwatar/commander/Order.java b/commander/src/main/java/com/iluwatar/commander/Order.java index 9a454a5f7782..959ebd93ccc2 100644 --- a/commander/src/main/java/com/iluwatar/commander/Order.java +++ b/commander/src/main/java/com/iluwatar/commander/Order.java @@ -44,6 +44,7 @@ enum MessageSent { public final String id; final float price; final long createdTime; + private static final Random RANDOM = new Random(); private static final String ALL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; private static final Hashtable USED_IDS = new Hashtable(); PaymentStatus paid; @@ -70,9 +71,8 @@ enum MessageSent { String createUniqueId() { StringBuilder random = new StringBuilder(); - Random rand = new Random(); while (random.length() < 12) { // length of the random string. - int index = (int) (rand.nextFloat() * ALL_CHARS.length()); + int index = (int) (RANDOM.nextFloat() * ALL_CHARS.length()); random.append(ALL_CHARS.charAt(index)); } return random.toString(); diff --git a/commander/src/main/java/com/iluwatar/commander/Retry.java b/commander/src/main/java/com/iluwatar/commander/Retry.java index d4da5e8dac4d..e9c9fb1f6689 100644 --- a/commander/src/main/java/com/iluwatar/commander/Retry.java +++ b/commander/src/main/java/com/iluwatar/commander/Retry.java @@ -51,6 +51,8 @@ public interface Operation { public interface HandleErrorIssue { void handleIssue(T obj, Exception e); } + + private static final Random RANDOM = new Random(); private final Operation op; private final HandleErrorIssue handleError; @@ -89,8 +91,7 @@ public void perform(ArrayList list, T obj) throws Exception { return; //return here...dont go further } try { - Random rand = new Random(); - long testDelay = (long) Math.pow(2, this.attempts.intValue()) * 1000 + rand.nextInt(1000); + long testDelay = (long) Math.pow(2, this.attempts.intValue()) * 1000 + RANDOM.nextInt(1000); long delay = testDelay < this.maxDelay ? testDelay : maxDelay; Thread.sleep(delay); } catch (InterruptedException f) { diff --git a/commander/src/main/java/com/iluwatar/commander/Service.java b/commander/src/main/java/com/iluwatar/commander/Service.java index 8c64d1d18410..259b8c6cc56c 100644 --- a/commander/src/main/java/com/iluwatar/commander/Service.java +++ b/commander/src/main/java/com/iluwatar/commander/Service.java @@ -42,6 +42,7 @@ public abstract class Service { protected final Database database; public ArrayList exceptionsList; + private static final Random RANDOM = new Random(); private static final String ALL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; private static final Hashtable USED_IDS = new Hashtable(); @@ -55,9 +56,8 @@ protected Service(Database db, Exception...exc) { protected String generateId() { StringBuilder random = new StringBuilder(); - Random rand = new Random(); while (random.length() < 12) { // length of the random string. - int index = (int) (rand.nextFloat() * ALL_CHARS.length()); + int index = (int) (RANDOM.nextFloat() * ALL_CHARS.length()); random.append(ALL_CHARS.charAt(index)); } String id = random.toString(); diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java index 3dddb6d9b4f6..bc4e963e1808 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java @@ -40,6 +40,7 @@ public class SampleData { private static final List PLAYERS; + private static final Random RANDOM = new Random(); static { PLAYERS = new ArrayList<>(); @@ -83,10 +84,9 @@ public class SampleData { PLAYERS.add(new PlayerDetails("xavier@google.com", "143-947", "+375245")); PLAYERS.add(new PlayerDetails("harriet@google.com", "842-404", "+131243252")); InMemoryBank wireTransfers = new InMemoryBank(); - Random random = new Random(); for (PlayerDetails player : PLAYERS) { wireTransfers.setFunds(player.getBankAccount(), - random.nextInt(LotteryConstants.PLAYER_MAX_BALANCE)); + RANDOM.nextInt(LotteryConstants.PLAYER_MAX_BALANCE)); } } diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractInstance.java b/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractInstance.java index 556d725da0b1..abece1edc0ee 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractInstance.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractInstance.java @@ -58,6 +58,7 @@ public AbstractInstance(MessageManager messageManager, int localId, int leaderId * The instance will execute the message in its message queue periodically once it is alive. */ @Override + @SuppressWarnings("squid:S2189") public void run() { while (true) { if (!this.messageQueue.isEmpty()) { diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayUtilityMethods.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayUtilityMethods.java index fb27e5b486a4..576ffb6bf000 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayUtilityMethods.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayUtilityMethods.java @@ -34,6 +34,8 @@ public class ArrayUtilityMethods { private static final Logger LOGGER = LoggerFactory.getLogger(ArrayUtilityMethods.class); + + private static final Random RANDOM = new Random(); /** * Method arraysSame compares 2 arrays @param a1 and @param a2 * and @return whether their values are equal (boolean). @@ -86,11 +88,10 @@ public static boolean matricesSame(int[][] m1, int[][] m2) { public static int[][] createRandomIntMatrix(int rows, int columns) { int[][] matrix = new int[rows][columns]; - Random rand = new Random(); for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { //filling cells in matrix - matrix[i][j] = rand.nextInt(10); + matrix[i][j] = RANDOM.nextInt(10); } } return matrix; diff --git a/priority-queue/src/main/java/com/iluwatar/priority/queue/Worker.java b/priority-queue/src/main/java/com/iluwatar/priority/queue/Worker.java index dbccd5d66cbd..e37feb679d3e 100644 --- a/priority-queue/src/main/java/com/iluwatar/priority/queue/Worker.java +++ b/priority-queue/src/main/java/com/iluwatar/priority/queue/Worker.java @@ -41,6 +41,7 @@ public Worker(QueueManager queueManager) { /** * Keep checking queue for message */ + @SuppressWarnings("squid:S2189") public void run() throws Exception { while (true) { Message message = queueManager.receiveMessage(); diff --git a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Producer.java b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Producer.java index 4cc1a6567d87..3681c017d223 100644 --- a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Producer.java +++ b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Producer.java @@ -29,6 +29,8 @@ * to queue */ public class Producer { + + private static final Random RANDOM = new Random(); private final ItemQueue queue; @@ -48,7 +50,6 @@ public void produce() throws InterruptedException { Item item = new Item(name, itemId++); queue.put(item); - Random random = new Random(); - Thread.sleep(random.nextInt(2000)); + Thread.sleep(RANDOM.nextInt(2000)); } } diff --git a/retry/src/main/java/com/iluwatar/retry/RetryExponentialBackoff.java b/retry/src/main/java/com/iluwatar/retry/RetryExponentialBackoff.java index 551914dad138..b7024c9184d0 100644 --- a/retry/src/main/java/com/iluwatar/retry/RetryExponentialBackoff.java +++ b/retry/src/main/java/com/iluwatar/retry/RetryExponentialBackoff.java @@ -37,6 +37,7 @@ * @param the remote op's return type */ public final class RetryExponentialBackoff implements BusinessOperation { + private static final Random RANDOM = new Random(); private final BusinessOperation op; private final int maxAttempts; private final long maxDelay; @@ -98,8 +99,7 @@ public T perform() throws BusinessException { } try { - Random rand = new Random(); - long testDelay = (long) Math.pow(2, this.attempts()) * 1000 + rand.nextInt(1000); + long testDelay = (long) Math.pow(2, this.attempts()) * 1000 + RANDOM.nextInt(1000); long delay = testDelay < this.maxDelay ? testDelay : maxDelay; Thread.sleep(delay); } catch (InterruptedException f) { diff --git a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Bubble.java b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Bubble.java index 01faa8371378..8147c4ea3f5d 100644 --- a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Bubble.java +++ b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Bubble.java @@ -36,6 +36,7 @@ public class Bubble extends Point { private static final Logger LOGGER = LoggerFactory.getLogger(Bubble.class); + private static final Random RANDOM = new Random(); final int radius; @@ -45,10 +46,9 @@ public class Bubble extends Point { } void move() { - Random rand = new Random(); //moves by 1 unit in either direction - this.x += rand.nextInt(3) - 1; - this.y += rand.nextInt(3) - 1; + this.x += RANDOM.nextInt(3) - 1; + this.y += RANDOM.nextInt(3) - 1; } boolean touches(Bubble b) { diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java index 9e855b4d6d61..e04cce4f018a 100644 --- a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java @@ -37,6 +37,7 @@ */ public class CellPool { + private static final Random RANDOM = new Random(); ArrayList pool; int pointer; Candy[] randomCode; @@ -57,8 +58,7 @@ public class CellPool { } for (int i = 0; i < num; i++) { Cell c = new Cell(); - Random rand = new Random(); - c.candy = randomCode[rand.nextInt(randomCode.length)]; + c.candy = randomCode[RANDOM.nextInt(randomCode.length)]; this.pool.add(c); } this.pointer = num - 1; From f09a7eb468731ca32d099223d3e1c00221ed259a Mon Sep 17 00:00:00 2001 From: Besok Date: Sat, 19 Oct 2019 18:15:20 +0100 Subject: [PATCH 070/197] add to init --- role-object/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/role-object/README.md b/role-object/README.md index 8ffe47400dd8..44f99228926c 100644 --- a/role-object/README.md +++ b/role-object/README.md @@ -3,13 +3,15 @@ layout: pattern title: Role object folder: Migration permalink: /patterns/role-object/ -categories: Behavioral +categories: Structural tags: - Java - - Easy-to-implement + - Difficulty-Medium + - Handle Body Pattern --- ## Also known as +Post pattern, Extension Object pattern ## Intent From f671f03d13966c9c5b3b65625224912336db86dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 19 Oct 2019 22:14:01 +0300 Subject: [PATCH 071/197] Update FAQ metadata --- faq.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/faq.md b/faq.md index f630c0e4eb13..141f5090d996 100644 --- a/faq.md +++ b/faq.md @@ -1,6 +1,8 @@ --- layout: page -title: FAQ +link-title: FAQ +title: FAQ - Java Design Patterns +description: design patterns java program best practises tutorials design principles development examples coders programmers developers architects paradigms object oriented systems architecture solutions problems permalink: /faq/ icon: fa-question page-index: 5 From 82f9a6c2323b412036965fc51e5ec155b6cf7741 Mon Sep 17 00:00:00 2001 From: Christopher O'Connell Date: Sun, 20 Oct 2019 02:02:36 -0400 Subject: [PATCH 072/197] 1010: Fixed the two remaining SonarCloud errors (#1023) The two remaining files were still creating a Random everytime the method was called. These were missed in the previous commit because the previous commit had fixed only one of the methods; in other words, there were multiple methods that were creating the Random object on each call. --- .../java/com/iluwatar/hexagonal/sampledata/SampleData.java | 3 +-- .../src/main/java/com/iluwatar/typeobject/CellPool.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java index bc4e963e1808..29a9d3233889 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java @@ -102,8 +102,7 @@ public static void submitTickets(LotteryService lotteryService, int numTickets) } private static PlayerDetails getRandomPlayerDetails() { - Random random = new Random(); - int idx = random.nextInt(PLAYERS.size()); + int idx = RANDOM.nextInt(PLAYERS.size()); return PLAYERS.get(idx); } } diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java index e04cce4f018a..6014da0cf1ce 100644 --- a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java @@ -71,8 +71,7 @@ Cell getNewCell() { } void addNewCell(Cell c) { - Random rand = new Random(); - c.candy = randomCode[rand.nextInt(randomCode.length)]; //changing candytype to new + c.candy = randomCode[RANDOM.nextInt(randomCode.length)]; //changing candytype to new this.pool.add(c); pointer++; } From 2217fbc5ff5deeff78be4540499061db21840e1d Mon Sep 17 00:00:00 2001 From: Azureyjt Date: Sun, 20 Oct 2019 23:55:36 +0800 Subject: [PATCH 073/197] Issue#550: double buffer pattern (#1024) * Basic implementation * implement double buffer * add unit test * add unit test * Add Readme * Change local value declaration to var * Remove unused fields --- double-buffer/README.md | 29 ++++++ double-buffer/pom.xml | 49 ++++++++++ .../java/com/iluwatar/doublebuffer/App.java | 85 ++++++++++++++++ .../com/iluwatar/doublebuffer/Buffer.java | 56 +++++++++++ .../iluwatar/doublebuffer/FrameBuffer.java | 68 +++++++++++++ .../java/com/iluwatar/doublebuffer/Pixel.java | 39 ++++++++ .../java/com/iluwatar/doublebuffer/Scene.java | 86 ++++++++++++++++ .../com/iluwatar/doublebuffer/AppTest.java | 39 ++++++++ .../doublebuffer/FrameBufferTest.java | 97 +++++++++++++++++++ .../com/iluwatar/doublebuffer/SceneTest.java | 74 ++++++++++++++ pom.xml | 1 + 11 files changed, 623 insertions(+) create mode 100644 double-buffer/README.md create mode 100644 double-buffer/pom.xml create mode 100644 double-buffer/src/main/java/com/iluwatar/doublebuffer/App.java create mode 100644 double-buffer/src/main/java/com/iluwatar/doublebuffer/Buffer.java create mode 100644 double-buffer/src/main/java/com/iluwatar/doublebuffer/FrameBuffer.java create mode 100644 double-buffer/src/main/java/com/iluwatar/doublebuffer/Pixel.java create mode 100644 double-buffer/src/main/java/com/iluwatar/doublebuffer/Scene.java create mode 100644 double-buffer/src/test/java/com/iluwatar/doublebuffer/AppTest.java create mode 100644 double-buffer/src/test/java/com/iluwatar/doublebuffer/FrameBufferTest.java create mode 100644 double-buffer/src/test/java/com/iluwatar/doublebuffer/SceneTest.java diff --git a/double-buffer/README.md b/double-buffer/README.md new file mode 100644 index 000000000000..8e8e7acf6bfd --- /dev/null +++ b/double-buffer/README.md @@ -0,0 +1,29 @@ + +--- +layout: pattern +title: Double Buffer +folder: double-buffer +permalink: /patterns/double-buffer/ +categories: Other +tags: + - Java + - Difficulty-Beginner +--- + +## Intent +Double buffering is a term used to describe a device that has two buffers. The usage of multiple buffers increases the overall throughput of a device and helps prevents bottlenecks. This example shows using double buffer pattern on graphics. It is used to show one image or frame while a separate frame is being buffered to be shown next. This method makes animations and games look more realistic than the same done in a single buffer mode. + +## Applicability +This pattern is one of those ones where you’ll know when you need it. If you have a system that lacks double buffering, it will probably look visibly wrong (tearing, etc.) or will behave incorrectly. But saying, “you’ll know when you need it” doesn’t give you much to go on. More specifically, this pattern is appropriate when all of these are true: + +- We have some state that is being modified incrementally. + +- That same state may be accessed in the middle of modification. + +- We want to prevent the code that’s accessing the state from seeing the work in progress. + +- We want to be able to read the state and we don’t want to have to wait while it’s being written. + +## Credits + +* [Game Programming Patterns - Double Buffer]([http://gameprogrammingpatterns.com/double-buffer.html](http://gameprogrammingpatterns.com/double-buffer.html)) \ No newline at end of file diff --git a/double-buffer/pom.xml b/double-buffer/pom.xml new file mode 100644 index 000000000000..a904c58842ef --- /dev/null +++ b/double-buffer/pom.xml @@ -0,0 +1,49 @@ + + + + + java-design-patterns + com.iluwatar + 1.22.0-SNAPSHOT + + 4.0.0 + + double-buffer + + + + junit + junit + + + org.apache.commons + commons-lang3 + + + + \ No newline at end of file diff --git a/double-buffer/src/main/java/com/iluwatar/doublebuffer/App.java b/double-buffer/src/main/java/com/iluwatar/doublebuffer/App.java new file mode 100644 index 000000000000..78c4a747a867 --- /dev/null +++ b/double-buffer/src/main/java/com/iluwatar/doublebuffer/App.java @@ -0,0 +1,85 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

    + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.doublebuffer; + +import org.apache.commons.lang3.tuple.MutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; + +/** + * Double buffering is a term used to describe a device that has two buffers. + * The usage of multiple buffers increases the overall throughput of a device + * and helps prevents bottlenecks. This example shows using double buffer pattern + * on graphics. It is used to show one image or frame while a separate frame + * is being buffered to be shown next. This method makes animations and games + * look more realistic than the same done in a single buffer mode. + */ +public class App { + + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); + + /** + * Program main entry point. + * @param args runtime arguments + */ + public static void main(String[] args) { + var scene = new Scene(); + List> drawPixels = new ArrayList<>(); + Pair pixel1 = new MutablePair<>(1, 1); + Pair pixel2 = new MutablePair<>(5, 6); + Pair pixel3 = new MutablePair<>(3, 2); + drawPixels.add(pixel1); + drawPixels.add(pixel2); + drawPixels.add(pixel3); + scene.draw(drawPixels); + var buffer1 = scene.getBuffer(); + printBlackPixelCoordinate(buffer1); + + drawPixels.clear(); + Pair pixel4 = new MutablePair<>(3, 7); + Pair pixel5 = new MutablePair<>(6, 1); + drawPixels.add(pixel4); + drawPixels.add(pixel5); + scene.draw(drawPixels); + Buffer buffer2 = scene.getBuffer(); + printBlackPixelCoordinate(buffer2); + } + + private static void printBlackPixelCoordinate(Buffer buffer) { + var log = "Black Pixels: "; + Pixel[] pixels = buffer.getPixels(); + for (var i = 0; i < pixels.length; ++i) { + if (pixels[i] == Pixel.BLACK) { + var y = i / FrameBuffer.WIDTH; + var x = i % FrameBuffer.WIDTH; + log += " (" + x + ", " + y + ")"; + } + } + LOGGER.info(log); + } +} diff --git a/double-buffer/src/main/java/com/iluwatar/doublebuffer/Buffer.java b/double-buffer/src/main/java/com/iluwatar/doublebuffer/Buffer.java new file mode 100644 index 000000000000..b8c15a914e35 --- /dev/null +++ b/double-buffer/src/main/java/com/iluwatar/doublebuffer/Buffer.java @@ -0,0 +1,56 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

    + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.doublebuffer; + +/** + * Buffer interface. + */ +public interface Buffer { + + /** + * Clear the pixel in (x, y). + * @param x X coordinate + * @param y Y coordinate + */ + void clear(int x, int y); + + /** + * Draw the pixel in (x, y). + * @param x X coordinate + * @param y Y coordinate + */ + void draw(int x, int y); + + /** + * Clear all the pixels. + */ + void clearAll(); + + /** + * Get all the pixels. + * @return pixel list + */ + Pixel[] getPixels(); + +} diff --git a/double-buffer/src/main/java/com/iluwatar/doublebuffer/FrameBuffer.java b/double-buffer/src/main/java/com/iluwatar/doublebuffer/FrameBuffer.java new file mode 100644 index 000000000000..2730140a3d99 --- /dev/null +++ b/double-buffer/src/main/java/com/iluwatar/doublebuffer/FrameBuffer.java @@ -0,0 +1,68 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

    + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.doublebuffer; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * FrameBuffer implementation class. + */ +public class FrameBuffer implements Buffer { + + public static final int WIDTH = 10; + public static final int HEIGHT = 8; + + private Pixel[] pixels = new Pixel[WIDTH * HEIGHT]; + + public FrameBuffer() { + clearAll(); + } + + @Override + public void clear(int x, int y) { + pixels[getIndex(x, y)] = Pixel.WHITE; + } + + @Override + public void draw(int x, int y) { + pixels[getIndex(x, y)] = Pixel.BLACK; + } + + @Override + public void clearAll() { + for (var i = 0; i < pixels.length; ++i) { + pixels[i] = Pixel.WHITE; + } + } + + @Override + public Pixel[] getPixels() { + return pixels; + } + + private int getIndex(int x, int y) { + return x + WIDTH * y; + } +} diff --git a/double-buffer/src/main/java/com/iluwatar/doublebuffer/Pixel.java b/double-buffer/src/main/java/com/iluwatar/doublebuffer/Pixel.java new file mode 100644 index 000000000000..d693f4e2801c --- /dev/null +++ b/double-buffer/src/main/java/com/iluwatar/doublebuffer/Pixel.java @@ -0,0 +1,39 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

    + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.doublebuffer; + +/** + * Pixel enum. Each pixel can be white (not drawn) or black (drawn). + */ +public enum Pixel { + + WHITE(0), + BLACK(1); + + private int color; + + Pixel(int color) { + this.color = color; + } +} diff --git a/double-buffer/src/main/java/com/iluwatar/doublebuffer/Scene.java b/double-buffer/src/main/java/com/iluwatar/doublebuffer/Scene.java new file mode 100644 index 000000000000..2f5b668e2ac0 --- /dev/null +++ b/double-buffer/src/main/java/com/iluwatar/doublebuffer/Scene.java @@ -0,0 +1,86 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

    + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.doublebuffer; + +import org.apache.commons.lang3.tuple.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; + +/** + * Scene class. Render the output frame. + */ +public class Scene { + + private static final Logger LOGGER = LoggerFactory.getLogger(Scene.class); + + private Buffer[] frameBuffers; + + private int current; + + private int next; + + /** + * Constructor of Scene. + */ + public Scene() { + frameBuffers = new FrameBuffer[2]; + frameBuffers[0] = new FrameBuffer(); + frameBuffers[1] = new FrameBuffer(); + current = 0; + next = 1; + } + + /** + * Draw the next frame. + * @param coordinateList list of pixels of which the color should be black + */ + public void draw(List> coordinateList) { + LOGGER.info("Start drawing next frame"); + LOGGER.info("Current buffer: " + current + " Next buffer: " + next); + frameBuffers[next].clearAll(); + for (Pair coordinate : coordinateList) { + var x = coordinate.getKey(); + var y = coordinate.getValue(); + frameBuffers[next].draw(x, y); + } + LOGGER.info("Swap current and next buffer"); + swap(); + LOGGER.info("Finish swapping"); + LOGGER.info("Current buffer: " + current + " Next buffer: " + next); + } + + public Buffer getBuffer() { + LOGGER.info("Get current buffer: " + current); + return frameBuffers[current]; + } + + private void swap() { + current = current ^ next; + next = current ^ next; + current = current ^ next; + } + +} diff --git a/double-buffer/src/test/java/com/iluwatar/doublebuffer/AppTest.java b/double-buffer/src/test/java/com/iluwatar/doublebuffer/AppTest.java new file mode 100644 index 000000000000..ebbabf980476 --- /dev/null +++ b/double-buffer/src/test/java/com/iluwatar/doublebuffer/AppTest.java @@ -0,0 +1,39 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

    + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.doublebuffer; + +import org.junit.Test; + +/** + * App unit test. + */ +public class AppTest { + + @Test + public void testMain() { + String[] args = {}; + App.main(args); + } + +} diff --git a/double-buffer/src/test/java/com/iluwatar/doublebuffer/FrameBufferTest.java b/double-buffer/src/test/java/com/iluwatar/doublebuffer/FrameBufferTest.java new file mode 100644 index 000000000000..689af2919e9f --- /dev/null +++ b/double-buffer/src/test/java/com/iluwatar/doublebuffer/FrameBufferTest.java @@ -0,0 +1,97 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

    + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.doublebuffer; + +import org.junit.Assert; +import org.junit.Test; + +/** + * FrameBuffer unit test. + */ +public class FrameBufferTest { + + @Test + public void testClearAll() { + try { + var field = FrameBuffer.class.getDeclaredField("pixels"); + Pixel[] pixels = new Pixel[FrameBuffer.HEIGHT * FrameBuffer.WIDTH]; + for (int i = 0; i < pixels.length; ++i) { + pixels[i] = Pixel.WHITE; + } + pixels[0] = Pixel.BLACK; + var frameBuffer = new FrameBuffer(); + field.setAccessible(true); + field.set(frameBuffer, pixels); + frameBuffer.clearAll(); + Assert.assertEquals(Pixel.WHITE, frameBuffer.getPixels()[0]); + } catch (NoSuchFieldException | IllegalAccessException e) { + Assert.fail("Fail to modify field access."); + } + } + + @Test + public void testClear() { + try { + var field = FrameBuffer.class.getDeclaredField("pixels"); + Pixel[] pixels = new Pixel[FrameBuffer.HEIGHT * FrameBuffer.WIDTH]; + for (int i = 0; i < pixels.length; ++i) { + pixels[i] = Pixel.WHITE; + } + pixels[0] = Pixel.BLACK; + var frameBuffer = new FrameBuffer(); + field.setAccessible(true); + field.set(frameBuffer, pixels); + frameBuffer.clear(0, 0); + Assert.assertEquals(Pixel.WHITE, frameBuffer.getPixels()[0]); + } catch (NoSuchFieldException | IllegalAccessException e) { + Assert.fail("Fail to modify field access."); + } + } + + @Test + public void testDraw() { + var frameBuffer = new FrameBuffer(); + frameBuffer.draw(0, 0); + Assert.assertEquals(Pixel.BLACK, frameBuffer.getPixels()[0]); + } + + @Test + public void testGetPixels() { + try { + var field = FrameBuffer.class.getDeclaredField("pixels"); + Pixel[] pixels = new Pixel[FrameBuffer.HEIGHT * FrameBuffer.WIDTH]; + for (int i = 0; i < pixels.length; ++i) { + pixels[i] = Pixel.WHITE; + } + pixels[0] = Pixel.BLACK; + var frameBuffer = new FrameBuffer(); + field.setAccessible(true); + field.set(frameBuffer, pixels); + Assert.assertEquals(pixels, frameBuffer.getPixels()); + } catch (NoSuchFieldException | IllegalAccessException e) { + Assert.fail("Fail to modify field access."); + } + } + +} diff --git a/double-buffer/src/test/java/com/iluwatar/doublebuffer/SceneTest.java b/double-buffer/src/test/java/com/iluwatar/doublebuffer/SceneTest.java new file mode 100644 index 000000000000..ab332aa22360 --- /dev/null +++ b/double-buffer/src/test/java/com/iluwatar/doublebuffer/SceneTest.java @@ -0,0 +1,74 @@ +/** + * The MIT License + * Copyright (c) 2014-2016 Ilkka Seppälä + *

    + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.doublebuffer; + +import org.junit.Assert; +import org.junit.Test; + +import java.lang.reflect.Field; +import java.util.ArrayList; + +/** + * Scene unit tests. + */ +public class SceneTest { + + @Test + public void testGetBuffer() { + try { + var scene = new Scene(); + var field1 = Scene.class.getDeclaredField("current"); + field1.setAccessible(true); + field1.set(scene, 0); + FrameBuffer[] frameBuffers = new FrameBuffer[2]; + FrameBuffer frameBuffer = new FrameBuffer(); + frameBuffer.draw(0, 0); + frameBuffers[0] = frameBuffer; + var field2 = Scene.class.getDeclaredField("frameBuffers"); + field2.setAccessible(true); + field2.set(scene, frameBuffers); + Assert.assertEquals(frameBuffer, scene.getBuffer()); + } catch (NoSuchFieldException | IllegalAccessException e) { + Assert.fail("Fail to access private field."); + } + } + + @Test + public void testDraw() { + try { + var scene = new Scene(); + var field1 = Scene.class.getDeclaredField("current"); + var field2 = Scene.class.getDeclaredField("next"); + field1.setAccessible(true); + field1.set(scene, 0); + field2.setAccessible(true); + field2.set(scene, 1); + scene.draw(new ArrayList<>()); + Assert.assertEquals(1, field1.get(scene)); + Assert.assertEquals(0, field2.get(scene)); + } catch (NoSuchFieldException | IllegalAccessException e) { + Assert.fail("Fail to access private field"); + } + } +} diff --git a/pom.xml b/pom.xml index 0ef4890ca065..913f600e7aff 100644 --- a/pom.xml +++ b/pom.xml @@ -183,6 +183,7 @@ data-locality subclass-sandbox circuit-breaker + double-buffer From f00ebe1a8de224dadcc1526e1771825522be8c15 Mon Sep 17 00:00:00 2001 From: Anurag870 Date: Sun, 20 Oct 2019 21:31:02 +0530 Subject: [PATCH 074/197] #984 local variable inference changes (#1025) * #984 Fix for abstract-document, abstract-factory, acyclic-visitor, adapter, aggregator-microservices * #984 Fix for abstract-document, abstract-factory, acyclic-visitor, adapter, aggregator-microservices --- .../iluwatar/abstractdocument/AbstractDocument.java | 2 +- .../java/com/iluwatar/abstractdocument/App.java | 9 ++++----- .../main/java/com/iluwatar/acyclicvisitor/App.java | 8 ++++---- .../acyclicvisitor/ConfigureForDosVisitorTest.java | 12 ++---------- .../acyclicvisitor/ConfigureForUnixVisitorTest.java | 4 ++-- .../java/com/iluwatar/acyclicvisitor/HayesTest.java | 13 ++++--------- .../java/com/iluwatar/acyclicvisitor/ZoomTest.java | 13 ++++--------- adapter/src/main/java/com/iluwatar/adapter/App.java | 2 +- .../com/iluwatar/adapter/AdapterPatternTest.java | 6 +++--- .../aggregator/microservices/Aggregator.java | 2 +- .../microservices/ProductInformationClientImpl.java | 6 +++--- .../microservices/ProductInventoryClientImpl.java | 8 ++++---- 12 files changed, 33 insertions(+), 52 deletions(-) diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java index ec5ff822ec7d..dee8302c1539 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java @@ -61,7 +61,7 @@ public Stream children(String key, Function, T> const @Override public String toString() { - StringBuilder builder = new StringBuilder(); + var builder = new StringBuilder(); builder.append(getClass().getName()).append("["); properties.forEach((key, value) -> builder.append("[").append(key).append(" : ").append(value).append("]")); builder.append("]"); diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java index 1566b32f1b42..e8b2410a8bb6 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java @@ -24,7 +24,6 @@ import java.util.Arrays; import java.util.HashMap; -import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,23 +51,23 @@ public class App { public App() { LOGGER.info("Constructing parts and car"); - Map carProperties = new HashMap<>(); + var carProperties = new HashMap(); carProperties.put(Property.MODEL.toString(), "300SL"); carProperties.put(Property.PRICE.toString(), 10000L); - Map wheelProperties = new HashMap<>(); + var wheelProperties = new HashMap(); wheelProperties.put(Property.TYPE.toString(), "wheel"); wheelProperties.put(Property.MODEL.toString(), "15C"); wheelProperties.put(Property.PRICE.toString(), 100L); - Map doorProperties = new HashMap<>(); + var doorProperties = new HashMap(); doorProperties.put(Property.TYPE.toString(), "door"); doorProperties.put(Property.MODEL.toString(), "Lambo"); doorProperties.put(Property.PRICE.toString(), 300L); carProperties.put(Property.PARTS.toString(), Arrays.asList(wheelProperties, doorProperties)); - Car car = new Car(carProperties); + var car = new Car(carProperties); LOGGER.info("Here is our car:"); LOGGER.info("-> model: {}", car.getModel().get()); diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/App.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/App.java index 19a48ef6131e..be96f3a60d31 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/App.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/App.java @@ -41,11 +41,11 @@ public class App { */ public static void main(String[] args) { - ConfigureForUnixVisitor conUnix = new ConfigureForUnixVisitor(); - ConfigureForDosVisitor conDos = new ConfigureForDosVisitor(); + var conUnix = new ConfigureForUnixVisitor(); + var conDos = new ConfigureForDosVisitor(); - Zoom zoom = new Zoom(); - Hayes hayes = new Hayes(); + var zoom = new Zoom(); + var hayes = new Hayes(); hayes.accept(conDos); // Hayes modem with Dos configurator zoom.accept(conDos); // Zoom modem with Dos configurator diff --git a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitorTest.java b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitorTest.java index db7856b7ca8c..b90bafb0f5e6 100644 --- a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitorTest.java +++ b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitorTest.java @@ -24,18 +24,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.groups.Tuple.tuple; -import static org.mockito.Mockito.mock; import static uk.org.lidalia.slf4jext.Level.INFO; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; - -import com.iluwatar.acyclicvisitor.ConfigureForDosVisitor; -import com.iluwatar.acyclicvisitor.Hayes; -import com.iluwatar.acyclicvisitor.HayesVisitor; -import com.iluwatar.acyclicvisitor.Zoom; -import com.iluwatar.acyclicvisitor.ZoomVisitor; - import uk.org.lidalia.slf4jtest.TestLogger; import uk.org.lidalia.slf4jtest.TestLoggerFactory; @@ -48,8 +40,8 @@ public class ConfigureForDosVisitorTest { @Test public void testVisitForZoom() { - ConfigureForDosVisitor conDos = new ConfigureForDosVisitor(); - Zoom zoom = new Zoom(); + var conDos = new ConfigureForDosVisitor(); + var zoom = new Zoom(); conDos.visit(zoom); diff --git a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitorTest.java b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitorTest.java index 394bd95586b6..ef6fd4d8ede3 100644 --- a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitorTest.java +++ b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitorTest.java @@ -46,8 +46,8 @@ public void clearLoggers() { @Test public void testVisitForZoom() { - ConfigureForUnixVisitor conUnix = new ConfigureForUnixVisitor(); - Zoom zoom = new Zoom(); + var conUnix = new ConfigureForUnixVisitor(); + var zoom = new Zoom(); conUnix.visit(zoom); diff --git a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/HayesTest.java b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/HayesTest.java index d18b7a34fc03..477354b1347f 100644 --- a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/HayesTest.java +++ b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/HayesTest.java @@ -29,11 +29,6 @@ import org.junit.jupiter.api.Test; -import com.iluwatar.acyclicvisitor.ConfigureForDosVisitor; -import com.iluwatar.acyclicvisitor.ConfigureForUnixVisitor; -import com.iluwatar.acyclicvisitor.Hayes; -import com.iluwatar.acyclicvisitor.HayesVisitor; - /** * Hayes test class */ @@ -41,8 +36,8 @@ public class HayesTest { @Test public void testAcceptForDos() { - Hayes hayes = new Hayes(); - ConfigureForDosVisitor mockVisitor = mock(ConfigureForDosVisitor.class); + var hayes = new Hayes(); + var mockVisitor = mock(ConfigureForDosVisitor.class); hayes.accept(mockVisitor); verify((HayesVisitor)mockVisitor).visit(eq(hayes)); @@ -50,8 +45,8 @@ public void testAcceptForDos() { @Test public void testAcceptForUnix() { - Hayes hayes = new Hayes(); - ConfigureForUnixVisitor mockVisitor = mock(ConfigureForUnixVisitor.class); + var hayes = new Hayes(); + var mockVisitor = mock(ConfigureForUnixVisitor.class); hayes.accept(mockVisitor); diff --git a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ZoomTest.java b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ZoomTest.java index 924d97b2e1b7..ff24d526d227 100644 --- a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ZoomTest.java +++ b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ZoomTest.java @@ -29,11 +29,6 @@ import org.junit.jupiter.api.Test; -import com.iluwatar.acyclicvisitor.ConfigureForDosVisitor; -import com.iluwatar.acyclicvisitor.ConfigureForUnixVisitor; -import com.iluwatar.acyclicvisitor.Zoom; -import com.iluwatar.acyclicvisitor.ZoomVisitor; - /** * Zoom test class */ @@ -41,8 +36,8 @@ public class ZoomTest { @Test public void testAcceptForDos() { - Zoom zoom = new Zoom(); - ConfigureForDosVisitor mockVisitor = mock(ConfigureForDosVisitor.class); + var zoom = new Zoom(); + var mockVisitor = mock(ConfigureForDosVisitor.class); zoom.accept(mockVisitor); verify((ZoomVisitor)mockVisitor).visit(eq(zoom)); @@ -50,8 +45,8 @@ public void testAcceptForDos() { @Test public void testAcceptForUnix() { - Zoom zoom = new Zoom(); - ConfigureForUnixVisitor mockVisitor = mock(ConfigureForUnixVisitor.class); + var zoom = new Zoom(); + var mockVisitor = mock(ConfigureForUnixVisitor.class); zoom.accept(mockVisitor); verify((ZoomVisitor)mockVisitor).visit(eq(zoom)); diff --git a/adapter/src/main/java/com/iluwatar/adapter/App.java b/adapter/src/main/java/com/iluwatar/adapter/App.java index f04e26e76281..4f31af795f6b 100644 --- a/adapter/src/main/java/com/iluwatar/adapter/App.java +++ b/adapter/src/main/java/com/iluwatar/adapter/App.java @@ -54,7 +54,7 @@ public class App { */ public static void main(String[] args) { // The captain can only operate rowing boats but with adapter he is able to use fishing boats as well - Captain captain = new Captain(new FishingBoatAdapter()); + var captain = new Captain(new FishingBoatAdapter()); captain.row(); } } diff --git a/adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java b/adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java index d76f37403cf0..b5164c68de2f 100644 --- a/adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java +++ b/adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java @@ -53,7 +53,7 @@ public void setup() { FishingBoatAdapter fishingBoatAdapter = spy(new FishingBoatAdapter()); beans.put(FISHING_BEAN, fishingBoatAdapter); - Captain captain = new Captain(); + var captain = new Captain(); captain.setRowingBoat((FishingBoatAdapter) beans.get(FISHING_BEAN)); beans.put(ROWING_BEAN, captain); } @@ -66,13 +66,13 @@ public void setup() { */ @Test public void testAdapter() { - Captain captain = (Captain) beans.get(ROWING_BEAN); + var captain = (Captain) beans.get(ROWING_BEAN); // when captain moves captain.row(); // the captain internally calls the battleship object to move - RowingBoat adapter = (RowingBoat) beans.get(FISHING_BEAN); + var adapter = (RowingBoat) beans.get(FISHING_BEAN); verify(adapter).row(); } } diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java index ccbe6f2fe68c..593d83e1378e 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java @@ -50,7 +50,7 @@ public class Aggregator { */ @RequestMapping(path = "/product", method = RequestMethod.GET) public Product getProduct() { - Product product = new Product(); + var product = new Product(); product.setTitle(informationClient.getProductTitle()); product.setProductInventories(inventoryClient.getProductInventories()); return product; diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java index b42b5b55a337..f04906b476d2 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java @@ -43,10 +43,10 @@ public class ProductInformationClientImpl implements ProductInformationClient { @Override public String getProductTitle() { String response = null; - HttpRequest request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51515/information")).build(); - HttpClient client = HttpClient.newHttpClient(); + var request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51515/information")).build(); + var client = HttpClient.newHttpClient(); try { - HttpResponse httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString()); + var httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString()); response = httpResponse.body(); } catch (IOException ioe) { LOGGER.error("IOException Occurred", ioe); diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java index 59a050c9e563..c92eb678c152 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java @@ -42,12 +42,12 @@ public class ProductInventoryClientImpl implements ProductInventoryClient { @Override public int getProductInventories() { - String response = "0"; + var response = "0"; - HttpRequest request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51516/inventories")).build(); - HttpClient client = HttpClient.newHttpClient(); + var request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51516/inventories")).build(); + var client = HttpClient.newHttpClient(); try { - HttpResponse httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString()); + var httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString()); response = httpResponse.body(); } catch (IOException ioe) { LOGGER.error("IOException Occurred", ioe); From 20b4195fb2bd0c5a6bff4280c758a4e6b4e3ef6e Mon Sep 17 00:00:00 2001 From: Besok Date: Sun, 20 Oct 2019 20:22:54 +0100 Subject: [PATCH 075/197] add first impl --- role-object/README.md | 17 +++++- .../roleobject/ApplicationRoleObject.java | 55 ++++++++++++++++++- .../com/iluwatar/roleobject/BorrowerRole.java | 4 ++ .../com/iluwatar/roleobject/Customer.java | 12 ++++ .../com/iluwatar/roleobject/CustomerCore.java | 35 ++++++++++++ .../com/iluwatar/roleobject/CustomerRole.java | 25 +++++++++ .../com/iluwatar/roleobject/InvestorRole.java | 4 ++ .../java/com/iluwatar/roleobject/Role.java | 30 ++++++++++ 8 files changed, 179 insertions(+), 3 deletions(-) create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/BorrowerRole.java create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/Customer.java create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/CustomerCore.java create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/CustomerRole.java create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/InvestorRole.java create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/Role.java diff --git a/role-object/README.md b/role-object/README.md index 44f99228926c..3f71341e18fb 100644 --- a/role-object/README.md +++ b/role-object/README.md @@ -14,9 +14,22 @@ tags: Post pattern, Extension Object pattern ## Intent +Adapt an object to different client’s needs through transparently attached role objects, each one representing a role +the object has to play in that client’s context. The object manages its role set dynamically. By representing roles as +individual objects, different contexts are kept separate and system configuration is simplified. ## Applicability - -## Real world examples +Use the Role Object pattern, if: +- you want to handle a key abstraction in different contexts and you do not want to put the resulting contextspecific interfaces into the same class interface. +Words: 4895 Page 3 of 11 +- you want to handle the available roles dynamically so that they can be attached and removed on demand, that is +at runtime, rather than fixing them statically at compile-time. +- you want to treat the extensions transparently and need to preserve the logical object identity of the resulting +object conglomerate. +- you want to keep role/client pairs independent from each other so that changes to a role do not affect clients +that are not interested in that role. ## Credits +- [Hillside - Role object pattern](https://hillside.net/plop/plop97/Proceedings/riehle.pdf) +- [Role object](http://wiki.c2.com/?RoleObject) +- [Fowler - Dealing with roles](https://martinfowler.com/apsupp/roles.pdf) \ No newline at end of file diff --git a/role-object/src/main/java/com/iluwatar/roleobject/ApplicationRoleObject.java b/role-object/src/main/java/com/iluwatar/roleobject/ApplicationRoleObject.java index 89388099fd4e..3dc83e470b77 100644 --- a/role-object/src/main/java/com/iluwatar/roleobject/ApplicationRoleObject.java +++ b/role-object/src/main/java/com/iluwatar/roleobject/ApplicationRoleObject.java @@ -1,7 +1,60 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.roleobject; +/** + * The Role Object pattern suggests to model context-specific views + * of an object as separate role objects which are + * dynamically attached to and removed from the core object. + * We call the resulting composite object structure, + * consisting of the core and its role objects, a subject. + * A subject often plays several roles and the same role is likely to + * be played by different subjects. + * As an example consider two different customers playing the role of borrower and + * investor, respectively. Both roles could as well be played by a single Customer object. + * The common superclass for customer-specific roles is provided by CustomerRole, + * which also supports the Customer interface. + * The CustomerRole class is abstract and not meant to be instantiated. + * Concrete subclasses of CustomerRole, for example Borrower or Investor, + * define and implement the interface for specific roles. It is only + * these subclasses which are instantiated at runtime. + * The Borrower class defines the context-specific view of + * Customer objects as needed by the loan department. + * It defines additional operations to manage the customer’s + * credits and securities. Similarly, the Investor class adds operations specific + * to the investment department’s view of customers. + * A client like the loan application may either work with objects of the CustomerCore class, using the interface class + * Customer, or with objects of concrete CustomerRole subclasses. Suppose the loan application knows a particular + * Customer instance through its Customer interface. The loan application may want to check whether the Customer + * object plays the role of Borrower. + * To this end it calls hasRole() with a suitable role specification. For the purpose of + * our example, let’s assume we can name roles with a simple string. + * If the Customer object can play the role named + * “Borrower,” the loan application will ask it to return a reference to the corresponding object. + * The loan application may now use this reference to call Borrower-specific operations. + * + */ public class ApplicationRoleObject { public static void main(String[] args) { - System.out.println("Role-object"); } } diff --git a/role-object/src/main/java/com/iluwatar/roleobject/BorrowerRole.java b/role-object/src/main/java/com/iluwatar/roleobject/BorrowerRole.java new file mode 100644 index 000000000000..c900e3eed743 --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/BorrowerRole.java @@ -0,0 +1,4 @@ +package com.iluwatar.roleobject; + +public class BorrowerRole extends CustomerRole{ +} diff --git a/role-object/src/main/java/com/iluwatar/roleobject/Customer.java b/role-object/src/main/java/com/iluwatar/roleobject/Customer.java new file mode 100644 index 000000000000..c9cdab4e1dab --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/Customer.java @@ -0,0 +1,12 @@ +package com.iluwatar.roleobject; + +import java.util.Optional; + +public abstract class Customer { + + public abstract boolean addRole(Role role); + public abstract boolean hasRole(Role role); + public abstract boolean remRole(Role role); + public abstract Optional getRole(Role role,Class expectedRole); + +} diff --git a/role-object/src/main/java/com/iluwatar/roleobject/CustomerCore.java b/role-object/src/main/java/com/iluwatar/roleobject/CustomerCore.java new file mode 100644 index 000000000000..496022c06fe5 --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/CustomerCore.java @@ -0,0 +1,35 @@ +package com.iluwatar.roleobject; + +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +public class CustomerCore extends Customer { + + private Map roles; + + + @Override + public boolean addRole(Role role) { + return role.instance() + .map(rI -> roles.put(role, rI)) + .isPresent(); + } + + @Override + public boolean hasRole(Role role) { + return roles.containsKey(role); + } + + @Override + public boolean remRole(Role role) { + return Objects.nonNull(roles.remove(role)); + } + + @Override + public Optional getRole(Role role, Class expectedRole) { + return Optional.ofNullable(roles.get(role)) + .filter(expectedRole::isInstance) + .map(expectedRole::cast); + } +} diff --git a/role-object/src/main/java/com/iluwatar/roleobject/CustomerRole.java b/role-object/src/main/java/com/iluwatar/roleobject/CustomerRole.java new file mode 100644 index 000000000000..af2801f3dd6e --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/CustomerRole.java @@ -0,0 +1,25 @@ +package com.iluwatar.roleobject; + +import java.util.Optional; + +public class CustomerRole extends Customer{ + @Override + public boolean addRole(Role role) { + return false; + } + + @Override + public boolean hasRole(Role role) { + return false; + } + + @Override + public boolean remRole(Role role) { + return false; + } + + @Override + public Optional getRole(Role role, Class expectedRole) { + return Optional.empty(); + } +} diff --git a/role-object/src/main/java/com/iluwatar/roleobject/InvestorRole.java b/role-object/src/main/java/com/iluwatar/roleobject/InvestorRole.java new file mode 100644 index 000000000000..a8a85d9da578 --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/InvestorRole.java @@ -0,0 +1,4 @@ +package com.iluwatar.roleobject; + +public class InvestorRole extends CustomerRole{ +} diff --git a/role-object/src/main/java/com/iluwatar/roleobject/Role.java b/role-object/src/main/java/com/iluwatar/roleobject/Role.java new file mode 100644 index 000000000000..a59d6377beb6 --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/Role.java @@ -0,0 +1,30 @@ +package com.iluwatar.roleobject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import sun.rmi.runtime.Log; + +import java.util.Optional; + +public enum Role { + Borrower(BorrowerRole.class), Investor(InvestorRole.class); + + private Class typeCst; + + Role(Class typeCst) { + this.typeCst = typeCst; + } + private static final Logger logger = LoggerFactory.getLogger(Role.class); + + @SuppressWarnings("unchecked") + Optional instance(){ + Class typeCst = this.typeCst; + try { + return (Optional) Optional.of(typeCst.newInstance()); + } catch (InstantiationException | IllegalAccessException e) { + logger.error("error creating an object",e); + } + return Optional.empty(); + } + +} From 5fc03ee9f820307ccf2667b946057d0d53ec0a70 Mon Sep 17 00:00:00 2001 From: Jonathan Lao-kan Date: Sun, 20 Oct 2019 22:21:48 +0200 Subject: [PATCH 076/197] improve grammar of README (#945) * improve grammar of README * Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4642b9989c83..1d8245d5dc7a 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ solve common problems when designing an application or system. Design patterns can speed up the development process by providing tested, proven development paradigms. -Reusing design patterns help prevent subtle issues which cause major +Reusing design patterns help prevent subtle issues that cause major problems, and it also improves code readability for coders and architects who are familiar with the patterns. @@ -42,7 +42,7 @@ Once you are familiar with these concepts you can start drilling down into patterns by any of the following approaches - Using difficulty tags, `Difficulty-Beginner`, `Difficulty-Intermediate` & `Difficulty-Expert`. - - Using pattern categories, `Creational`, `Behavioral` and others. + - Using pattern categories, `Creational`, `Behavioral`, and others. - Search for a specific pattern. Can't find one? Please report a new pattern [here](https://github.com/iluwatar/java-design-patterns/issues). Hopefully you find the object oriented solutions presented on this site useful From c81c3ff1c7c5509f3421d230e61893beb1d587bb Mon Sep 17 00:00:00 2001 From: Zack Beach Date: Mon, 21 Oct 2019 01:09:29 -0400 Subject: [PATCH 077/197] Use local variable type inference (#995) * "visitor" pattern: Use local variable type inference Update "visitor" pattern with local variable type inference. * "value-object" pattern: Use local variable type inference Update "value-object" pattern with local variable type inference. * "unit-of-work" pattern: Use local variable type inference Update "value-object" pattern with local variable type inference. * "typeobjectpattern" pattern: Use local variable type inference Update "value-object" pattern with local variable type inference. --- .../java/com/iluwatar/typeobject/App.java | 18 ++++---- .../com/iluwatar/typeobject/CandyGame.java | 46 +++++++++---------- .../java/com/iluwatar/typeobject/Cell.java | 6 +-- .../com/iluwatar/typeobject/CellPool.java | 14 +++--- .../com/iluwatar/typeobject/JsonParser.java | 22 ++++----- .../iluwatar/typeobject/CandyGameTest.java | 26 +++++------ .../com/iluwatar/typeobject/CellPoolTest.java | 8 ++-- .../com/iluwatar/typeobject/CellTest.java | 18 ++++---- .../java/com/iluwatar/unitofwork/App.java | 10 ++-- .../unitofwork/StudentRepository.java | 14 +++--- .../unitofwork/StudentRepositoryTest.java | 4 +- .../java/com/iluwatar/value/object/App.java | 6 +-- .../com/iluwatar/value/object/HeroStat.java | 6 +-- .../iluwatar/value/object/HeroStatTest.java | 10 ++-- .../main/java/com/iluwatar/visitor/App.java | 2 +- .../main/java/com/iluwatar/visitor/Unit.java | 2 +- .../java/com/iluwatar/visitor/UnitTest.java | 8 ++-- 17 files changed, 110 insertions(+), 110 deletions(-) diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/App.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/App.java index 2e6db9dd68a3..daa1539acd22 100644 --- a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/App.java +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/App.java @@ -53,17 +53,17 @@ public class App { * @param args command line args */ public static void main(String[] args) throws FileNotFoundException, IOException, ParseException { - int givenTime = 50; //50ms - int toWin = 500; //points - int pointsWon = 0; - int numOfRows = 3; - long start = System.currentTimeMillis(); - long end = System.currentTimeMillis(); - int round = 0; + var givenTime = 50; //50ms + var toWin = 500; //points + var pointsWon = 0; + var numOfRows = 3; + var start = System.currentTimeMillis(); + var end = System.currentTimeMillis(); + var round = 0; while (pointsWon < toWin && end - start < givenTime) { round++; - CellPool pool = new CellPool(numOfRows * numOfRows + 5); - CandyGame cg = new CandyGame(numOfRows, pool); + var pool = new CellPool(numOfRows * numOfRows + 5); + var cg = new CandyGame(numOfRows, pool); if (round > 1) { LOGGER.info("Refreshing.."); } else { diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CandyGame.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CandyGame.java index 516b4cf76bfd..5932acfc6c97 100644 --- a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CandyGame.java +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CandyGame.java @@ -44,8 +44,8 @@ public class CandyGame { this.cells = new Cell[num][num]; this.pool = pool; this.totalPoints = 0; - for (int i = 0; i < num; i++) { - for (int j = 0; j < num; j++) { + for (var i = 0; i < num; i++) { + for (var j = 0; j < num; j++) { this.cells[i][j] = this.pool.getNewCell(); this.cells[i][j].xIndex = j; this.cells[i][j].yIndex = i; @@ -55,7 +55,7 @@ public class CandyGame { static String numOfSpaces(int num) { String result = ""; - for (int i = 0; i < num; i++) { + for (var i = 0; i < num; i++) { result += " "; } return result; @@ -63,11 +63,11 @@ static String numOfSpaces(int num) { void printGameStatus() { LOGGER.info(""); - for (int i = 0; i < cells.length; i++) { - for (int j = 0; j < cells.length; j++) { - String candyName = cells[i][j].candy.name; + for (var i = 0; i < cells.length; i++) { + for (var j = 0; j < cells.length; j++) { + var candyName = cells[i][j].candy.name; if (candyName.length() < 20) { - int totalSpaces = 20 - candyName.length(); + var totalSpaces = 20 - candyName.length(); LOGGER.info(numOfSpaces(totalSpaces / 2) + cells[i][j].candy.name + numOfSpaces(totalSpaces - totalSpaces / 2) + "|"); } else { @@ -105,16 +105,16 @@ ArrayList adjacentCells(int yIndex, int xIndex) { } boolean continueRound() { - for (int i = 0; i < this.cells.length; i++) { + for (var i = 0; i < this.cells.length; i++) { if (this.cells[cells.length - 1][i].candy.getType().equals(Type.rewardFruit)) { return true; } } - for (int i = 0; i < this.cells.length; i++) { - for (int j = 0; j < this.cells.length; j++) { + for (var i = 0; i < this.cells.length; i++) { + for (var j = 0; j < this.cells.length; j++) { if (!this.cells[i][j].candy.getType().equals(Type.rewardFruit)) { - ArrayList adj = adjacentCells(i,j); - for (int a = 0; a < adj.size(); a++) { + var adj = adjacentCells(i,j); + for (var a = 0; a < adj.size(); a++) { if (this.cells[i][j].candy.name.equals(adj.get(a).candy.name)) { return true; } @@ -132,21 +132,21 @@ void handleChange(int points) { } void round(int timeSoFar, int totalTime) { - long start = System.currentTimeMillis(); - long end = System.currentTimeMillis(); + var start = System.currentTimeMillis(); + var end = System.currentTimeMillis(); while (end - start + timeSoFar < totalTime && continueRound()) { - for (int i = 0; i < this.cells.length; i++) { - int points = 0; - int j = this.cells.length - 1; + for (var i = 0; i < this.cells.length; i++) { + var points = 0; + var j = this.cells.length - 1; while (this.cells[j][i].candy.getType().equals(Type.rewardFruit)) { points = this.cells[j][i].candy.getPoints(); this.cells[j][i].crush(pool, this.cells); handleChange(points); } } - for (int i = 0; i < this.cells.length; i++) { - int j = cells.length - 1; - int points = 0; + for (var i = 0; i < this.cells.length; i++) { + var j = cells.length - 1; + var points = 0; while (j > 0) { points = this.cells[j][i].interact(this.cells[j - 1][i], this.pool, this.cells); if (points != 0) { @@ -156,9 +156,9 @@ void round(int timeSoFar, int totalTime) { } } } - for (int i = 0; i < this.cells.length; i++) { - int j = 0; - int points = 0; + for (var i = 0; i < this.cells.length; i++) { + var j = 0; + var points = 0; while (j < cells.length - 1) { points = this.cells[i][j].interact(this.cells[i][j + 1], this.pool, this.cells); if (points != 0) { diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/Cell.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/Cell.java index 9171cc03064d..bf6b671c71ac 100644 --- a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/Cell.java +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/Cell.java @@ -53,11 +53,11 @@ void crush(CellPool pool, Cell[][] cellMatrix) { } void fillThisSpace(CellPool pool, Cell[][] cellMatrix) { - for (int y = this.yIndex; y > 0; y--) { + for (var y = this.yIndex; y > 0; y--) { cellMatrix[y][this.xIndex] = cellMatrix[y - 1][this.xIndex]; cellMatrix[y][this.xIndex].yIndex = y; } - Cell newC = pool.getNewCell(); + var newC = pool.getNewCell(); cellMatrix[0][this.xIndex] = newC; cellMatrix[0][this.xIndex].xIndex = this.xIndex; cellMatrix[0][this.xIndex].yIndex = 0; @@ -78,7 +78,7 @@ int interact(Cell c, CellPool pool, Cell[][] cellMatrix) { return 0; } else { if (this.candy.name.equals(c.candy.name)) { - int pointsWon = this.candy.getPoints() + c.candy.getPoints(); + var pointsWon = this.candy.getPoints() + c.candy.getPoints(); handleCrush(c,pool,cellMatrix); return pointsWon; } else { diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java index 6014da0cf1ce..c381c23f6cfb 100644 --- a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/CellPool.java @@ -57,7 +57,7 @@ public class CellPool { randomCode[4] = new Candy("orange gum", "candy", Type.crushableCandy, 10); } for (int i = 0; i < num; i++) { - Cell c = new Cell(); + var c = new Cell(); c.candy = randomCode[RANDOM.nextInt(randomCode.length)]; this.pool.add(c); } @@ -65,7 +65,7 @@ public class CellPool { } Cell getNewCell() { - Cell newCell = this.pool.remove(pointer); + var newCell = this.pool.remove(pointer); pointer--; return newCell; } @@ -77,12 +77,12 @@ void addNewCell(Cell c) { } Candy[] assignRandomCandytypes() throws FileNotFoundException, IOException, ParseException { - JsonParser jp = new JsonParser(); + var jp = new JsonParser(); jp.parse(); - Candy[] randomCode = new Candy[jp.candies.size() - 2]; //exclude generic types 'fruit' and 'candy' - int i = 0; - for (Enumeration e = jp.candies.keys(); e.hasMoreElements();) { - String s = e.nextElement(); + var randomCode = new Candy[jp.candies.size() - 2]; //exclude generic types 'fruit' and 'candy' + var i = 0; + for (var e = jp.candies.keys(); e.hasMoreElements();) { + var s = e.nextElement(); if (!s.equals("fruit") && !s.equals("candy")) { //not generic randomCode[i] = jp.candies.get(s); diff --git a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/JsonParser.java b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/JsonParser.java index 55c25e1ef5ab..36234da4c5d2 100644 --- a/typeobjectpattern/src/main/java/com/iluwatar/typeobject/JsonParser.java +++ b/typeobjectpattern/src/main/java/com/iluwatar/typeobject/JsonParser.java @@ -47,23 +47,23 @@ public class JsonParser { } void parse() throws FileNotFoundException, IOException, ParseException { - JSONParser parser = new JSONParser(); - JSONObject jo = (JSONObject) parser.parse(new FileReader(new File("").getAbsolutePath() + var parser = new JSONParser(); + var jo = (JSONObject) parser.parse(new FileReader(new File("").getAbsolutePath() + "\\src\\main\\java\\com\\iluwatar\\typeobject\\candy.json")); - JSONArray a = (JSONArray) jo.get("candies"); - for (Object o : a) { - JSONObject candy = (JSONObject) o; - String name = (String) candy.get("name"); - String parentName = (String) candy.get("parent"); - String t = (String) candy.get("type"); + var a = (JSONArray) jo.get("candies"); + for (var o : a) { + var candy = (JSONObject) o; + var name = (String) candy.get("name"); + var parentName = (String) candy.get("parent"); + var t = (String) candy.get("type"); Type type = null; if (t.equals("rewardFruit")) { type = Type.rewardFruit; } else { type = Type.crushableCandy; } - int points = Integer.parseInt((String) candy.get("points")); - Candy c = new Candy(name, parentName, type, points); + var points = Integer.parseInt((String) candy.get("points")); + var c = new Candy(name, parentName, type, points); this.candies.put(name, c); } setParentAndPoints(); @@ -71,7 +71,7 @@ void parse() throws FileNotFoundException, IOException, ParseException { void setParentAndPoints() { for (Enumeration e = this.candies.keys(); e.hasMoreElements();) { - Candy c = this.candies.get(e.nextElement()); + var c = this.candies.get(e.nextElement()); if (c.parentName == null) { c.parent = null; } else { diff --git a/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CandyGameTest.java b/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CandyGameTest.java index b813ee881c2a..7192ff507e6a 100644 --- a/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CandyGameTest.java +++ b/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CandyGameTest.java @@ -35,33 +35,33 @@ class CandyGameTest { @Test void adjacentCellsTest() { - CandyGame cg = new CandyGame(3,new CellPool(9)); - ArrayList arr1 = cg.adjacentCells(0, 0); - ArrayList arr2 = cg.adjacentCells(1, 2); - ArrayList arr3 = cg.adjacentCells(1, 1); + var cg = new CandyGame(3,new CellPool(9)); + var arr1 = cg.adjacentCells(0, 0); + var arr2 = cg.adjacentCells(1, 2); + var arr3 = cg.adjacentCells(1, 1); assertTrue(arr1.size() == 2 && arr2.size() == 3 && arr3.size() == 4); } @Test void continueRoundTest() { - Cell[][] matrix = new Cell[2][2]; - Candy c1 = new Candy("green jelly", "jelly", Type.crushableCandy, 5); - Candy c2 = new Candy("purple jelly", "jelly", Type.crushableCandy, 5); - Candy c3 = new Candy("green apple", "apple", Type.rewardFruit, 10); + var matrix = new Cell[2][2]; + var c1 = new Candy("green jelly", "jelly", Type.crushableCandy, 5); + var c2 = new Candy("purple jelly", "jelly", Type.crushableCandy, 5); + var c3 = new Candy("green apple", "apple", Type.rewardFruit, 10); matrix[0][0] = new Cell(c1,0,0);; matrix[0][1] = new Cell(c2,1,0); matrix[1][0] = new Cell(c3,0,1); matrix[1][1] = new Cell(c2,1,1); - CellPool p = new CellPool(4); - CandyGame cg = new CandyGame(2,p); + var p = new CellPool(4); + var cg = new CandyGame(2,p); cg.cells = matrix; - boolean fruitInLastRow = cg.continueRound(); + var fruitInLastRow = cg.continueRound(); matrix[1][0].crush(p, matrix); matrix[0][0] = new Cell(c3,0,0); - boolean matchingCandy = cg.continueRound(); + var matchingCandy = cg.continueRound(); matrix[0][1].crush(p,matrix); matrix[0][1] = new Cell(c3,1,0); - boolean noneLeft = cg.continueRound(); + var noneLeft = cg.continueRound(); assertTrue(fruitInLastRow && matchingCandy && !noneLeft); } diff --git a/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellPoolTest.java b/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellPoolTest.java index 289c7b944766..4de7589f2629 100644 --- a/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellPoolTest.java +++ b/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellPoolTest.java @@ -34,10 +34,10 @@ class CellPoolTest { @Test void assignRandomCandyTypesTest() { - CellPool cp = new CellPool(10); - Hashtable ht = new Hashtable(); - int parentTypes = 0; - for (int i = 0; i < cp.randomCode.length; i++) { + var cp = new CellPool(10); + var ht = new Hashtable(); + var parentTypes = 0; + for (var i = 0; i < cp.randomCode.length; i++) { if (ht.get(cp.randomCode[i].name) == null) { ht.put(cp.randomCode[i].name, true); } diff --git a/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellTest.java b/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellTest.java index c7beefdb15f7..b9cf09a4c5ee 100644 --- a/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellTest.java +++ b/typeobjectpattern/src/test/java/com/iluwatar/typeobject/CellTest.java @@ -34,24 +34,24 @@ class CellTest { @Test void interactTest() { - Candy c1 = new Candy("green jelly", "jelly", Type.crushableCandy, 5); - Candy c2 = new Candy("green apple", "apple", Type.rewardFruit, 10); - Cell[][] matrix = new Cell[4][4]; + var c1 = new Candy("green jelly", "jelly", Type.crushableCandy, 5); + var c2 = new Candy("green apple", "apple", Type.rewardFruit, 10); + var matrix = new Cell[4][4]; matrix[0][0] = new Cell(c1,0,0); matrix[0][1] = new Cell(c1,1,0); matrix[0][2] = new Cell(c2,2,0); matrix[0][3] = new Cell(c1,3,0); - CellPool cp = new CellPool(5); - int points1 = matrix[0][0].interact(matrix[0][1], cp, matrix); - int points2 = matrix[0][2].interact(matrix[0][3], cp, matrix); + var cp = new CellPool(5); + var points1 = matrix[0][0].interact(matrix[0][1], cp, matrix); + var points2 = matrix[0][2].interact(matrix[0][3], cp, matrix); assertTrue(points1 > 0 && points2 == 0); } @Test void crushTest() { - Candy c1 = new Candy("green jelly", "jelly", Type.crushableCandy, 5); - Candy c2 = new Candy("purple candy", "candy", Type.crushableCandy, 5); - Cell[][] matrix = new Cell[4][4]; + var c1 = new Candy("green jelly", "jelly", Type.crushableCandy, 5); + var c2 = new Candy("purple candy", "candy", Type.crushableCandy, 5); + var matrix = new Cell[4][4]; matrix[0][0] = new Cell(c1,0,0); matrix[1][0] = new Cell(c2,0,1); matrix[1][0].crush(new CellPool(5), matrix); diff --git a/unit-of-work/src/main/java/com/iluwatar/unitofwork/App.java b/unit-of-work/src/main/java/com/iluwatar/unitofwork/App.java index 38cc474108b5..7ef9b566fd9c 100644 --- a/unit-of-work/src/main/java/com/iluwatar/unitofwork/App.java +++ b/unit-of-work/src/main/java/com/iluwatar/unitofwork/App.java @@ -34,13 +34,13 @@ public class App { * @param args no argument sent */ public static void main(String[] args) { - Student ram = new Student(1, "Ram", "Street 9, Cupertino"); - Student shyam = new Student(2, "Shyam", "Z bridge, Pune"); - Student gopi = new Student(3, "Gopi", "Street 10, Mumbai"); + var ram = new Student(1, "Ram", "Street 9, Cupertino"); + var shyam = new Student(2, "Shyam", "Z bridge, Pune"); + var gopi = new Student(3, "Gopi", "Street 10, Mumbai"); HashMap> context = new HashMap<>(); - StudentDatabase studentDatabase = new StudentDatabase(); - StudentRepository studentRepository = new StudentRepository(context, studentDatabase); + var studentDatabase = new StudentDatabase(); + var studentRepository = new StudentRepository(context, studentDatabase); studentRepository.registerNew(ram); studentRepository.registerModified(shyam); diff --git a/unit-of-work/src/main/java/com/iluwatar/unitofwork/StudentRepository.java b/unit-of-work/src/main/java/com/iluwatar/unitofwork/StudentRepository.java index 2ca1977c68bc..081b0f13a51c 100644 --- a/unit-of-work/src/main/java/com/iluwatar/unitofwork/StudentRepository.java +++ b/unit-of-work/src/main/java/com/iluwatar/unitofwork/StudentRepository.java @@ -68,7 +68,7 @@ public void registerDeleted(Student student) { } private void register(Student student, String operation) { - List studentsToOperate = context.get(operation); + var studentsToOperate = context.get(operation); if (studentsToOperate == null) { studentsToOperate = new ArrayList<>(); } @@ -99,24 +99,24 @@ public void commit() { } private void commitInsert() { - List studentsToBeInserted = context.get(IUnitOfWork.INSERT); - for (Student student : studentsToBeInserted) { + var studentsToBeInserted = context.get(IUnitOfWork.INSERT); + for (var student : studentsToBeInserted) { LOGGER.info("Saving {} to database.", student.getName()); studentDatabase.insert(student); } } private void commitModify() { - List modifiedStudents = context.get(IUnitOfWork.MODIFY); - for (Student student : modifiedStudents) { + var modifiedStudents = context.get(IUnitOfWork.MODIFY); + for (var student : modifiedStudents) { LOGGER.info("Modifying {} to database.", student.getName()); studentDatabase.modify(student); } } private void commitDelete() { - List deletedStudents = context.get(IUnitOfWork.DELETE); - for (Student student : deletedStudents) { + var deletedStudents = context.get(IUnitOfWork.DELETE); + for (var student : deletedStudents) { LOGGER.info("Deleting {} to database.", student.getName()); studentDatabase.delete(student); } diff --git a/unit-of-work/src/test/java/com/iluwatar/unitofwork/StudentRepositoryTest.java b/unit-of-work/src/test/java/com/iluwatar/unitofwork/StudentRepositoryTest.java index c4f45b8b5b4a..5a75be8b583d 100644 --- a/unit-of-work/src/test/java/com/iluwatar/unitofwork/StudentRepositoryTest.java +++ b/unit-of-work/src/test/java/com/iluwatar/unitofwork/StudentRepositoryTest.java @@ -97,7 +97,7 @@ public void shouldSaveAllLocalChangesToDb() { @Test public void shouldNotWriteToDbIfContextIsNull() { - StudentRepository studentRepository = new StudentRepository(null, studentDatabase); + var studentRepository = new StudentRepository(null, studentDatabase); studentRepository.commit(); @@ -106,7 +106,7 @@ public void shouldNotWriteToDbIfContextIsNull() { @Test public void shouldNotWriteToDbIfNothingToCommit() { - StudentRepository studentRepository = new StudentRepository(new HashMap<>(), studentDatabase); + var studentRepository = new StudentRepository(new HashMap<>(), studentDatabase); studentRepository.commit(); diff --git a/value-object/src/main/java/com/iluwatar/value/object/App.java b/value-object/src/main/java/com/iluwatar/value/object/App.java index 9cc62f24602f..f2d773373fd6 100644 --- a/value-object/src/main/java/com/iluwatar/value/object/App.java +++ b/value-object/src/main/java/com/iluwatar/value/object/App.java @@ -48,9 +48,9 @@ public class App { * This practice creates three HeroStats(Value object) and checks equality between those. */ public static void main(String[] args) { - HeroStat statA = HeroStat.valueOf(10, 5, 0); - HeroStat statB = HeroStat.valueOf(10, 5, 0); - HeroStat statC = HeroStat.valueOf(5, 1, 8); + var statA = HeroStat.valueOf(10, 5, 0); + var statB = HeroStat.valueOf(10, 5, 0); + var statC = HeroStat.valueOf(5, 1, 8); LOGGER.info(statA.toString()); diff --git a/value-object/src/main/java/com/iluwatar/value/object/HeroStat.java b/value-object/src/main/java/com/iluwatar/value/object/HeroStat.java index 6ec2f541f5c0..f31f29d9dafa 100644 --- a/value-object/src/main/java/com/iluwatar/value/object/HeroStat.java +++ b/value-object/src/main/java/com/iluwatar/value/object/HeroStat.java @@ -76,8 +76,8 @@ public String toString() { @Override public int hashCode() { - final int prime = 31; - int result = 1; + final var prime = 31; + var result = 1; result = prime * result + intelligence; result = prime * result + luck; result = prime * result + strength; @@ -95,7 +95,7 @@ public boolean equals(Object obj) { if (getClass() != obj.getClass()) { return false; } - HeroStat other = (HeroStat) obj; + var other = (HeroStat) obj; if (intelligence != other.intelligence) { return false; } diff --git a/value-object/src/test/java/com/iluwatar/value/object/HeroStatTest.java b/value-object/src/test/java/com/iluwatar/value/object/HeroStatTest.java index e6c3f89525ae..a78092d363f6 100644 --- a/value-object/src/test/java/com/iluwatar/value/object/HeroStatTest.java +++ b/value-object/src/test/java/com/iluwatar/value/object/HeroStatTest.java @@ -45,8 +45,8 @@ public class HeroStatTest { */ @Test public void testEquals() { - HeroStat heroStatA = HeroStat.valueOf(3, 9, 2); - HeroStat heroStatB = HeroStat.valueOf(3, 9, 2); + var heroStatA = HeroStat.valueOf(3, 9, 2); + var heroStatB = HeroStat.valueOf(3, 9, 2); new EqualsTester().addEqualityGroup(heroStatA, heroStatB).testEquals(); } @@ -56,9 +56,9 @@ public void testEquals() { */ @Test public void testToString() { - HeroStat heroStatA = HeroStat.valueOf(3, 9, 2); - HeroStat heroStatB = HeroStat.valueOf(3, 9, 2); - HeroStat heroStatC = HeroStat.valueOf(3, 9, 8); + var heroStatA = HeroStat.valueOf(3, 9, 2); + var heroStatB = HeroStat.valueOf(3, 9, 2); + var heroStatC = HeroStat.valueOf(3, 9, 8); assertThat(heroStatA.toString(), is(heroStatB.toString())); assertThat(heroStatA.toString(), is(not(heroStatC.toString()))); diff --git a/visitor/src/main/java/com/iluwatar/visitor/App.java b/visitor/src/main/java/com/iluwatar/visitor/App.java index 9c8359cb1d8c..143b915d823e 100644 --- a/visitor/src/main/java/com/iluwatar/visitor/App.java +++ b/visitor/src/main/java/com/iluwatar/visitor/App.java @@ -41,7 +41,7 @@ public class App { */ public static void main(String[] args) { - Commander commander = + var commander = new Commander(new Sergeant(new Soldier(), new Soldier(), new Soldier()), new Sergeant( new Soldier(), new Soldier(), new Soldier())); commander.accept(new SoldierVisitor()); diff --git a/visitor/src/main/java/com/iluwatar/visitor/Unit.java b/visitor/src/main/java/com/iluwatar/visitor/Unit.java index 27bcc26de566..794308aaf0af 100644 --- a/visitor/src/main/java/com/iluwatar/visitor/Unit.java +++ b/visitor/src/main/java/com/iluwatar/visitor/Unit.java @@ -39,7 +39,7 @@ public Unit(Unit... children) { * Accept visitor */ public void accept(UnitVisitor visitor) { - for (Unit child : children) { + for (var child : children) { child.accept(visitor); } } diff --git a/visitor/src/test/java/com/iluwatar/visitor/UnitTest.java b/visitor/src/test/java/com/iluwatar/visitor/UnitTest.java index d0807bab814f..e375f4ce4609 100644 --- a/visitor/src/test/java/com/iluwatar/visitor/UnitTest.java +++ b/visitor/src/test/java/com/iluwatar/visitor/UnitTest.java @@ -56,15 +56,15 @@ public UnitTest(final Function factory) { @Test public void testAccept() { - final Unit[] children = new Unit[5]; + final var children = new Unit[5]; Arrays.setAll(children, (i) -> mock(Unit.class)); - final U unit = this.factory.apply(children); - final UnitVisitor visitor = mock(UnitVisitor.class); + final var unit = this.factory.apply(children); + final var visitor = mock(UnitVisitor.class); unit.accept(visitor); verifyVisit(unit, visitor); - for (final Unit child : children) { + for (final var child : children) { verify(child).accept(eq(visitor)); } From 4904d7eea047b5b924dcf33092ed887300f44d10 Mon Sep 17 00:00:00 2001 From: Alexander Ivanov Date: Tue, 22 Oct 2019 07:15:35 +0200 Subject: [PATCH 078/197] #1021: Fix checkstyle warnings by changing the license header template (#1027) * Add custom license header style in order to comply with Google's Checkstyle format * Update license headers to comply with Google's Checkstyle format --- .../abstractdocument/AbstractDocument.java | 3 +- .../com/iluwatar/abstractdocument/App.java | 3 +- .../iluwatar/abstractdocument/Document.java | 3 +- .../iluwatar/abstractdocument/domain/Car.java | 3 +- .../abstractdocument/domain/HasModel.java | 3 +- .../abstractdocument/domain/HasParts.java | 3 +- .../abstractdocument/domain/HasPrice.java | 3 +- .../abstractdocument/domain/HasType.java | 3 +- .../abstractdocument/domain/Part.java | 3 +- .../domain/enums/Property.java | 3 +- .../AbstractDocumentTest.java | 3 +- .../iluwatar/abstractdocument/AppTest.java | 3 +- .../iluwatar/abstractdocument/DomainTest.java | 3 +- .../com/iluwatar/abstractfactory/App.java | 3 +- .../com/iluwatar/abstractfactory/Army.java | 3 +- .../com/iluwatar/abstractfactory/Castle.java | 3 +- .../com/iluwatar/abstractfactory/ElfArmy.java | 3 +- .../iluwatar/abstractfactory/ElfCastle.java | 3 +- .../com/iluwatar/abstractfactory/ElfKing.java | 3 +- .../abstractfactory/ElfKingdomFactory.java | 3 +- .../com/iluwatar/abstractfactory/King.java | 3 +- .../abstractfactory/KingdomFactory.java | 3 +- .../com/iluwatar/abstractfactory/OrcArmy.java | 3 +- .../iluwatar/abstractfactory/OrcCastle.java | 3 +- .../com/iluwatar/abstractfactory/OrcKing.java | 3 +- .../abstractfactory/OrcKingdomFactory.java | 3 +- .../abstractfactory/AbstractFactoryTest.java | 3 +- .../com/iluwatar/abstractfactory/AppTest.java | 3 +- .../acyclicvisitor/AllModemVisitor.java | 3 +- .../java/com/iluwatar/acyclicvisitor/App.java | 3 +- .../ConfigureForDosVisitor.java | 3 +- .../ConfigureForUnixVisitor.java | 3 +- .../com/iluwatar/acyclicvisitor/Hayes.java | 3 +- .../iluwatar/acyclicvisitor/HayesVisitor.java | 3 +- .../com/iluwatar/acyclicvisitor/Modem.java | 3 +- .../iluwatar/acyclicvisitor/ModemVisitor.java | 3 +- .../com/iluwatar/acyclicvisitor/Zoom.java | 3 +- .../iluwatar/acyclicvisitor/ZoomVisitor.java | 3 +- .../com/iluwatar/acyclicvisitor/AppTest.java | 3 +- .../ConfigureForDosVisitorTest.java | 3 +- .../ConfigureForUnixVisitorTest.java | 3 +- .../iluwatar/acyclicvisitor/HayesTest.java | 3 +- .../com/iluwatar/acyclicvisitor/ZoomTest.java | 3 +- .../main/java/com/iluwatar/adapter/App.java | 3 +- .../java/com/iluwatar/adapter/Captain.java | 3 +- .../com/iluwatar/adapter/FishingBoat.java | 3 +- .../iluwatar/adapter/FishingBoatAdapter.java | 3 +- .../java/com/iluwatar/adapter/RowingBoat.java | 3 +- .../iluwatar/adapter/AdapterPatternTest.java | 3 +- .../java/com/iluwatar/adapter/AppTest.java | 3 +- .../aggregator/microservices/Aggregator.java | 3 +- .../aggregator/microservices/App.java | 3 +- .../aggregator/microservices/Product.java | 3 +- .../ProductInformationClient.java | 3 +- .../ProductInformationClientImpl.java | 3 +- .../microservices/ProductInventoryClient.java | 3 +- .../ProductInventoryClientImpl.java | 3 +- .../microservices/AggregatorTest.java | 3 +- .../microservice/InformationApplication.java | 3 +- .../microservice/InformationController.java | 3 +- .../InformationControllerTest.java | 3 +- .../microservice/InventoryApplication.java | 3 +- .../microservice/InventoryController.java | 3 +- .../microservice/InventoryControllerTest.java | 3 +- .../java/com/iluwatar/ambassador/App.java | 3 +- .../java/com/iluwatar/ambassador/Client.java | 3 +- .../iluwatar/ambassador/RemoteService.java | 3 +- .../ambassador/RemoteServiceInterface.java | 3 +- .../ambassador/ServiceAmbassador.java | 3 +- .../ambassador/util/RandomProvider.java | 3 +- .../java/com/iluwatar/ambassador/AppTest.java | 3 +- .../com/iluwatar/ambassador/ClientTest.java | 3 +- .../ambassador/RemoteServiceTest.java | 3 +- .../ambassador/ServiceAmbassadorTest.java | 3 +- .../com/iluwatar/api/gateway/ApiGateway.java | 3 +- .../java/com/iluwatar/api/gateway/App.java | 3 +- .../iluwatar/api/gateway/DesktopProduct.java | 3 +- .../com/iluwatar/api/gateway/ImageClient.java | 3 +- .../iluwatar/api/gateway/ImageClientImpl.java | 3 +- .../iluwatar/api/gateway/MobileProduct.java | 3 +- .../com/iluwatar/api/gateway/PriceClient.java | 3 +- .../iluwatar/api/gateway/PriceClientImpl.java | 3 +- .../iluwatar/api/gateway/ApiGatewayTest.java | 3 +- .../image/microservice/ImageApplication.java | 3 +- .../image/microservice/ImageController.java | 3 +- .../microservice/ImageControllerTest.java | 3 +- .../price/microservice/PriceApplication.java | 3 +- .../price/microservice/PriceController.java | 3 +- .../microservice/PriceControllerTest.java | 3 +- .../iluwatar/async/method/invocation/App.java | 3 +- .../method/invocation/AsyncCallback.java | 3 +- .../method/invocation/AsyncExecutor.java | 3 +- .../async/method/invocation/AsyncResult.java | 3 +- .../invocation/ThreadAsyncExecutor.java | 3 +- .../async/method/invocation/AppTest.java | 3 +- .../invocation/ThreadAsyncExecutorTest.java | 3 +- .../main/java/com/iluwatar/balking/App.java | 3 +- .../com/iluwatar/balking/DelayProvider.java | 3 +- .../com/iluwatar/balking/WashingMachine.java | 3 +- .../iluwatar/balking/WashingMachineState.java | 3 +- .../java/com/iluwatar/balking/AppTest.java | 3 +- .../iluwatar/balking/WashingMachineTest.java | 3 +- .../main/java/com/iluwatar/bridge/App.java | 3 +- .../java/com/iluwatar/bridge/Enchantment.java | 3 +- .../iluwatar/bridge/FlyingEnchantment.java | 3 +- .../main/java/com/iluwatar/bridge/Hammer.java | 3 +- .../bridge/SoulEatingEnchantment.java | 3 +- .../main/java/com/iluwatar/bridge/Sword.java | 3 +- .../main/java/com/iluwatar/bridge/Weapon.java | 3 +- .../java/com/iluwatar/bridge/AppTest.java | 3 +- .../java/com/iluwatar/bridge/HammerTest.java | 3 +- .../java/com/iluwatar/bridge/SwordTest.java | 3 +- .../java/com/iluwatar/bridge/WeaponTest.java | 3 +- .../main/java/com/iluwatar/builder/App.java | 3 +- .../main/java/com/iluwatar/builder/Armor.java | 3 +- .../java/com/iluwatar/builder/HairColor.java | 3 +- .../java/com/iluwatar/builder/HairType.java | 3 +- .../main/java/com/iluwatar/builder/Hero.java | 3 +- .../java/com/iluwatar/builder/Profession.java | 3 +- .../java/com/iluwatar/builder/Weapon.java | 3 +- .../java/com/iluwatar/builder/AppTest.java | 3 +- .../java/com/iluwatar/builder/HeroTest.java | 3 +- .../com/iluwatar/business/delegate/App.java | 3 +- .../business/delegate/BusinessDelegate.java | 3 +- .../business/delegate/BusinessLookup.java | 3 +- .../business/delegate/BusinessService.java | 3 +- .../iluwatar/business/delegate/Client.java | 3 +- .../business/delegate/EjbService.java | 3 +- .../business/delegate/JmsService.java | 3 +- .../business/delegate/ServiceType.java | 3 +- .../iluwatar/business/delegate/AppTest.java | 3 +- .../delegate/BusinessDelegateTest.java | 3 +- .../main/java/com/iluwatar/bytecode/App.java | 3 +- .../com/iluwatar/bytecode/Instruction.java | 3 +- .../com/iluwatar/bytecode/VirtualMachine.java | 3 +- .../java/com/iluwatar/bytecode/Wizard.java | 3 +- .../util/InstructionConverterUtil.java | 3 +- .../java/com/iluwatar/bytecode/AppTest.java | 3 +- .../iluwatar/bytecode/VirtualMachineTest.java | 3 +- .../util/InstructionConverterUtilTest.java | 3 +- .../main/java/com/iluwatar/caching/App.java | 3 +- .../java/com/iluwatar/caching/AppManager.java | 3 +- .../java/com/iluwatar/caching/CacheStore.java | 3 +- .../com/iluwatar/caching/CachingPolicy.java | 3 +- .../java/com/iluwatar/caching/DbManager.java | 3 +- .../java/com/iluwatar/caching/LruCache.java | 3 +- .../com/iluwatar/caching/UserAccount.java | 3 +- .../caching/constants/CachingConstants.java | 3 +- .../java/com/iluwatar/caching/AppTest.java | 3 +- .../com/iluwatar/caching/CachingTest.java | 3 +- .../main/java/com/iluwatar/callback/App.java | 3 +- .../java/com/iluwatar/callback/Callback.java | 3 +- .../com/iluwatar/callback/LambdasApp.java | 3 +- .../com/iluwatar/callback/SimpleTask.java | 3 +- .../main/java/com/iluwatar/callback/Task.java | 3 +- .../java/com/iluwatar/callback/AppTest.java | 3 +- .../com/iluwatar/callback/CallbackTest.java | 3 +- .../src/main/java/com/iluwatar/chain/App.java | 3 +- .../java/com/iluwatar/chain/OrcCommander.java | 3 +- .../main/java/com/iluwatar/chain/OrcKing.java | 3 +- .../java/com/iluwatar/chain/OrcOfficer.java | 3 +- .../java/com/iluwatar/chain/OrcSoldier.java | 3 +- .../main/java/com/iluwatar/chain/Request.java | 3 +- .../com/iluwatar/chain/RequestHandler.java | 3 +- .../java/com/iluwatar/chain/RequestType.java | 3 +- .../test/java/com/iluwatar/chain/AppTest.java | 3 +- .../java/com/iluwatar/chain/OrcKingTest.java | 3 +- circuit-breaker/pom.xml | 2 +- .../java/com/iluwatar/circuitbreaker/App.java | 4 +- .../circuitbreaker/CircuitBreaker.java | 4 +- .../circuitbreaker/DelayedService.java | 5 ++- .../circuitbreaker/MonitoringService.java | 4 +- .../com/iluwatar/circuitbreaker/State.java | 4 +- .../circuitbreaker/CircuitBreakerTest.java | 4 +- .../circuitbreaker/DelayedServiceTest.java | 4 +- .../circuitbreaker/MonitoringServiceTest.java | 4 +- .../com/iluwatar/collectionpipeline/App.java | 3 +- .../com/iluwatar/collectionpipeline/Car.java | 3 +- .../collectionpipeline/CarFactory.java | 3 +- .../iluwatar/collectionpipeline/Category.java | 3 +- .../FunctionalProgramming.java | 3 +- .../ImperativeProgramming.java | 3 +- .../iluwatar/collectionpipeline/Person.java | 3 +- .../iluwatar/collectionpipeline/AppTest.java | 3 +- .../main/java/com/iluwatar/command/App.java | 3 +- .../java/com/iluwatar/command/Command.java | 3 +- .../java/com/iluwatar/command/Goblin.java | 3 +- .../iluwatar/command/InvisibilitySpell.java | 3 +- .../com/iluwatar/command/ShrinkSpell.java | 3 +- .../main/java/com/iluwatar/command/Size.java | 3 +- .../java/com/iluwatar/command/Target.java | 3 +- .../java/com/iluwatar/command/Visibility.java | 3 +- .../java/com/iluwatar/command/Wizard.java | 3 +- .../java/com/iluwatar/command/AppTest.java | 3 +- .../com/iluwatar/command/CommandTest.java | 3 +- .../commander/AppEmployeeDbFailCases.java | 3 +- .../commander/AppMessagingFailCases.java | 3 +- .../commander/AppPaymentFailCases.java | 3 +- .../iluwatar/commander/AppQueueFailCases.java | 3 +- .../commander/AppShippingFailCases.java | 3 +- .../com/iluwatar/commander/Commander.java | 3 +- .../java/com/iluwatar/commander/Database.java | 3 +- .../java/com/iluwatar/commander/Order.java | 3 +- .../java/com/iluwatar/commander/Retry.java | 3 +- .../java/com/iluwatar/commander/Service.java | 3 +- .../java/com/iluwatar/commander/User.java | 3 +- .../employeehandle/EmployeeDatabase.java | 3 +- .../employeehandle/EmployeeHandle.java | 3 +- .../DatabaseUnavailableException.java | 3 +- .../exceptions/IsEmptyException.java | 3 +- .../exceptions/ItemUnavailableException.java | 3 +- .../PaymentDetailsErrorException.java | 3 +- .../ShippingNotPossibleException.java | 3 +- .../messagingservice/MessagingDatabase.java | 3 +- .../messagingservice/MessagingService.java | 3 +- .../paymentservice/PaymentDatabase.java | 3 +- .../paymentservice/PaymentService.java | 3 +- .../com/iluwatar/commander/queue/Queue.java | 3 +- .../commander/queue/QueueDatabase.java | 3 +- .../iluwatar/commander/queue/QueueTask.java | 3 +- .../shippingservice/ShippingDatabase.java | 3 +- .../shippingservice/ShippingService.java | 3 +- .../com/iluwatar/commander/RetryTest.java | 3 +- .../main/java/com/iluwatar/composite/App.java | 3 +- .../java/com/iluwatar/composite/Letter.java | 3 +- .../iluwatar/composite/LetterComposite.java | 3 +- .../com/iluwatar/composite/Messenger.java | 3 +- .../java/com/iluwatar/composite/Sentence.java | 3 +- .../java/com/iluwatar/composite/Word.java | 3 +- .../java/com/iluwatar/composite/AppTest.java | 3 +- .../com/iluwatar/composite/MessengerTest.java | 3 +- .../main/java/com/iluwatar/converter/App.java | 3 +- .../com/iluwatar/converter/Converter.java | 3 +- .../java/com/iluwatar/converter/User.java | 3 +- .../com/iluwatar/converter/UserConverter.java | 3 +- .../java/com/iluwatar/converter/UserDto.java | 3 +- .../java/com/iluwatar/converter/AppTest.java | 3 +- .../com/iluwatar/converter/ConverterTest.java | 3 +- .../main/java/com/iluwatar/cqrs/app/App.java | 3 +- .../cqrs/commandes/CommandServiceImpl.java | 3 +- .../cqrs/commandes/ICommandService.java | 3 +- .../iluwatar/cqrs/constants/AppConstants.java | 3 +- .../iluwatar/cqrs/domain/model/Author.java | 3 +- .../com/iluwatar/cqrs/domain/model/Book.java | 3 +- .../java/com/iluwatar/cqrs/dto/Author.java | 3 +- .../main/java/com/iluwatar/cqrs/dto/Book.java | 3 +- .../iluwatar/cqrs/queries/IQueryService.java | 3 +- .../cqrs/queries/QueryServiceImpl.java | 3 +- .../com/iluwatar/cqrs/util/HibernateUtil.java | 3 +- .../com/iluwatar/cqrs/IntegrationTest.java | 3 +- dao/src/main/java/com/iluwatar/dao/App.java | 3 +- .../com/iluwatar/dao/CustomException.java | 3 +- .../main/java/com/iluwatar/dao/Customer.java | 3 +- .../java/com/iluwatar/dao/CustomerDao.java | 3 +- .../com/iluwatar/dao/CustomerSchemaSql.java | 3 +- .../java/com/iluwatar/dao/DbCustomerDao.java | 3 +- .../com/iluwatar/dao/InMemoryCustomerDao.java | 3 +- .../test/java/com/iluwatar/dao/AppTest.java | 3 +- .../java/com/iluwatar/dao/CustomerTest.java | 3 +- .../com/iluwatar/dao/DbCustomerDaoTest.java | 3 +- .../iluwatar/dao/InMemoryCustomerDaoTest.java | 3 +- .../iluwatar/databus/AbstractDataType.java | 3 +- .../main/java/com/iluwatar/databus/App.java | 3 +- .../java/com/iluwatar/databus/DataBus.java | 3 +- .../java/com/iluwatar/databus/DataType.java | 3 +- .../java/com/iluwatar/databus/Member.java | 3 +- .../iluwatar/databus/data/MessageData.java | 3 +- .../iluwatar/databus/data/StartingData.java | 3 +- .../iluwatar/databus/data/StoppingData.java | 3 +- .../members/MessageCollectorMember.java | 3 +- .../databus/members/StatusMember.java | 3 +- .../com/iluwatar/databus/DataBusTest.java | 3 +- .../members/MessageCollectorMemberTest.java | 3 +- .../databus/members/StatusMemberTest.java | 3 +- .../iluwatar/data/locality/Application.java | 3 +- .../data/locality/game/GameEntity.java | 3 +- .../locality/game/component/AiComponent.java | 3 +- .../locality/game/component/Component.java | 3 +- .../game/component/PhysicsComponent.java | 3 +- .../game/component/RenderComponent.java | 3 +- .../component/manager/AiComponentManager.java | 3 +- .../manager/PhysicsComponentManager.java | 3 +- .../manager/RenderComponentManager.java | 3 +- .../data/locality/ApplicationTest.java | 3 +- .../java/com/iluwatar/datamapper/App.java | 3 +- .../datamapper/DataMapperException.java | 3 +- .../java/com/iluwatar/datamapper/Student.java | 3 +- .../datamapper/StudentDataMapper.java | 3 +- .../datamapper/StudentDataMapperImpl.java | 3 +- .../java/com/iluwatar/datamapper/AppTest.java | 3 +- .../iluwatar/datamapper/DataMapperTest.java | 3 +- .../com/iluwatar/datamapper/StudentTest.java | 3 +- .../datatransfer/CustomerClientApp.java | 3 +- .../iluwatar/datatransfer/CustomerDto.java | 3 +- .../datatransfer/CustomerResource.java | 3 +- .../datatransfer/CustomerResourceTest.java | 3 +- .../main/java/com/iluwatar/decorator/App.java | 3 +- .../com/iluwatar/decorator/ClubbedTroll.java | 3 +- .../com/iluwatar/decorator/SimpleTroll.java | 3 +- .../java/com/iluwatar/decorator/Troll.java | 3 +- .../java/com/iluwatar/decorator/AppTest.java | 3 +- .../iluwatar/decorator/ClubbedTrollTest.java | 3 +- .../iluwatar/decorator/SimpleTrollTest.java | 3 +- .../com/iluwatar/delegation/simple/App.java | 3 +- .../iluwatar/delegation/simple/Printer.java | 3 +- .../delegation/simple/PrinterController.java | 3 +- .../simple/printers/CanonPrinter.java | 3 +- .../simple/printers/EpsonPrinter.java | 3 +- .../delegation/simple/printers/HpPrinter.java | 3 +- .../iluwatar/delegation/simple/AppTest.java | 3 +- .../delegation/simple/DelegateTest.java | 3 +- .../injection/AdvancedSorceress.java | 3 +- .../dependency/injection/AdvancedWizard.java | 3 +- .../iluwatar/dependency/injection/App.java | 3 +- .../dependency/injection/GuiceWizard.java | 3 +- .../dependency/injection/OldTobyTobacco.java | 3 +- .../injection/RivendellTobacco.java | 3 +- .../injection/SecondBreakfastTobacco.java | 3 +- .../dependency/injection/SimpleWizard.java | 3 +- .../dependency/injection/Tobacco.java | 3 +- .../dependency/injection/TobaccoModule.java | 3 +- .../iluwatar/dependency/injection/Wizard.java | 3 +- .../injection/AdvancedSorceressTest.java | 3 +- .../injection/AdvancedWizardTest.java | 3 +- .../dependency/injection/AppTest.java | 3 +- .../dependency/injection/GuiceWizardTest.java | 3 +- .../injection/SimpleWizardTest.java | 3 +- .../injection/utils/InMemoryAppender.java | 3 +- .../main/java/com/iluwatar/dirtyflag/App.java | 3 +- .../com/iluwatar/dirtyflag/DataFetcher.java | 3 +- .../java/com/iluwatar/dirtyflag/World.java | 3 +- .../src/test/java/org/dirty/flag/AppTest.java | 3 +- .../java/org/dirty/flag/DirtyFlagTest.java | 3 +- .../java/com/iluwatar/doublebuffer/App.java | 10 ++--- .../com/iluwatar/doublebuffer/Buffer.java | 10 ++--- .../iluwatar/doublebuffer/FrameBuffer.java | 10 ++--- .../java/com/iluwatar/doublebuffer/Pixel.java | 10 ++--- .../java/com/iluwatar/doublebuffer/Scene.java | 10 ++--- .../com/iluwatar/doublebuffer/AppTest.java | 10 ++--- .../doublebuffer/FrameBufferTest.java | 10 ++--- .../com/iluwatar/doublebuffer/SceneTest.java | 10 ++--- .../iluwatar/doublechecked/locking/App.java | 3 +- .../doublechecked/locking/Inventory.java | 3 +- .../iluwatar/doublechecked/locking/Item.java | 3 +- .../doublechecked/locking/AppTest.java | 3 +- .../doublechecked/locking/InventoryTest.java | 3 +- .../java/com/iluwatar/doubledispatch/App.java | 3 +- .../doubledispatch/FlamingAsteroid.java | 3 +- .../iluwatar/doubledispatch/GameObject.java | 3 +- .../iluwatar/doubledispatch/Meteoroid.java | 3 +- .../iluwatar/doubledispatch/Rectangle.java | 3 +- .../doubledispatch/SpaceStationIss.java | 3 +- .../doubledispatch/SpaceStationMir.java | 3 +- .../constants/AppConstants.java | 3 +- .../com/iluwatar/doubledispatch/AppTest.java | 3 +- .../doubledispatch/CollisionTest.java | 3 +- .../doubledispatch/FlamingAsteroidTest.java | 3 +- .../doubledispatch/MeteoroidTest.java | 3 +- .../doubledispatch/RectangleTest.java | 3 +- .../doubledispatch/SpaceStationIssTest.java | 3 +- .../doubledispatch/SpaceStationMirTest.java | 3 +- .../java/com/iluwatar/eip/aggregator/App.java | 3 +- .../aggregator/routes/AggregatorRoute.java | 3 +- .../routes/MessageAggregationStrategy.java | 3 +- .../com/iluwatar/eip/aggregator/AppTest.java | 3 +- .../routes/AggregatorRouteTest.java | 3 +- .../MessageAggregationStrategyTest.java | 3 +- .../com/iluwatar/eip/message/channel/App.java | 3 +- .../iluwatar/eip/message/channel/AppTest.java | 3 +- .../iluwatar/eip/publish/subscribe/App.java | 3 +- .../eip/publish/subscribe/AppTest.java | 3 +- .../java/com/iluwatar/eip/splitter/App.java | 3 +- .../eip/splitter/routes/SplitterRoute.java | 3 +- .../com/iluwatar/eip/splitter/AppTest.java | 3 +- .../splitter/routes/SplitterRouteTest.java | 3 +- .../java/com/iluwatar/eip/wiretap/App.java | 3 +- .../eip/wiretap/routes/WireTapRoute.java | 3 +- .../com/iluwatar/eip/wiretap/AppTest.java | 3 +- .../eip/wiretap/routes/WireTapRouteTest.java | 3 +- .../com/iluwatar/event/aggregator/App.java | 3 +- .../com/iluwatar/event/aggregator/Event.java | 3 +- .../event/aggregator/EventEmitter.java | 3 +- .../event/aggregator/EventObserver.java | 3 +- .../event/aggregator/KingJoffrey.java | 3 +- .../iluwatar/event/aggregator/KingsHand.java | 3 +- .../event/aggregator/LordBaelish.java | 3 +- .../iluwatar/event/aggregator/LordVarys.java | 3 +- .../com/iluwatar/event/aggregator/Scout.java | 3 +- .../iluwatar/event/aggregator/Weekday.java | 3 +- .../iluwatar/event/aggregator/AppTest.java | 3 +- .../event/aggregator/EventEmitterTest.java | 3 +- .../iluwatar/event/aggregator/EventTest.java | 3 +- .../event/aggregator/KingJoffreyTest.java | 3 +- .../event/aggregator/KingsHandTest.java | 3 +- .../event/aggregator/LordBaelishTest.java | 3 +- .../event/aggregator/LordVarysTest.java | 3 +- .../iluwatar/event/aggregator/ScoutTest.java | 3 +- .../event/aggregator/WeekdayTest.java | 3 +- .../com/iluwatar/event/asynchronous/App.java | 3 +- .../iluwatar/event/asynchronous/Event.java | 3 +- .../EventDoesNotExistException.java | 3 +- .../event/asynchronous/EventManager.java | 3 +- .../iluwatar/event/asynchronous/IEvent.java | 3 +- .../InvalidOperationException.java | 3 +- .../LongRunningEventException.java | 3 +- .../MaxNumOfEventsAllowedException.java | 3 +- .../asynchronous/ThreadCompleteListener.java | 3 +- .../iluwatar/event/asynchronous/AppTest.java | 3 +- .../asynchronous/EventAsynchronousTest.java | 3 +- .../src/main/java/com/iluwatar/eda/App.java | 3 +- .../com/iluwatar/eda/event/AbstractEvent.java | 3 +- .../iluwatar/eda/event/UserCreatedEvent.java | 3 +- .../iluwatar/eda/event/UserUpdatedEvent.java | 3 +- .../com/iluwatar/eda/framework/Event.java | 3 +- .../eda/framework/EventDispatcher.java | 3 +- .../com/iluwatar/eda/framework/Handler.java | 3 +- .../eda/handler/UserCreatedEventHandler.java | 3 +- .../eda/handler/UserUpdatedEventHandler.java | 3 +- .../java/com/iluwatar/eda/model/User.java | 3 +- .../test/java/com/iluwatar/eda/AppTest.java | 3 +- .../eda/event/UserCreatedEventTest.java | 3 +- .../eda/framework/EventDispatcherTest.java | 3 +- .../java/com/iluwatar/event/queue/App.java | 3 +- .../java/com/iluwatar/event/queue/Audio.java | 3 +- .../com/iluwatar/event/queue/PlayMessage.java | 3 +- .../com/iluwatar/event/queue/AudioTest.java | 3 +- .../com/iluwatar/event/sourcing/app/App.java | 3 +- .../event/sourcing/domain/Account.java | 3 +- .../sourcing/event/AccountCreateEvent.java | 3 +- .../event/sourcing/event/DomainEvent.java | 3 +- .../sourcing/event/MoneyDepositEvent.java | 3 +- .../sourcing/event/MoneyTransferEvent.java | 3 +- .../processor/DomainEventProcessor.java | 3 +- .../sourcing/processor/JsonFileJournal.java | 3 +- .../sourcing/state/AccountAggregate.java | 3 +- .../src/test/java/IntegrationTest.java | 3 +- .../java/com/iluwatar/execute/around/App.java | 3 +- .../execute/around/FileWriterAction.java | 3 +- .../execute/around/SimpleFileWriter.java | 3 +- .../com/iluwatar/execute/around/AppTest.java | 3 +- .../execute/around/SimpleFileWriterTest.java | 3 +- extension-objects/src/main/java/App.java | 3 +- .../CommanderExtension.java | 3 +- .../abstractextensions/SergeantExtension.java | 3 +- .../abstractextensions/SoldierExtension.java | 3 +- .../abstractextensions/UnitExtension.java | 3 +- .../java/concreteextensions/Commander.java | 3 +- .../java/concreteextensions/Sergeant.java | 3 +- .../main/java/concreteextensions/Soldier.java | 3 +- .../src/main/java/units/CommanderUnit.java | 3 +- .../src/main/java/units/SergeantUnit.java | 3 +- .../src/main/java/units/SoldierUnit.java | 3 +- .../src/main/java/units/Unit.java | 3 +- extension-objects/src/test/java/AppTest.java | 3 +- .../concreteextensions/CommanderTest.java | 3 +- .../java/concreteextensions/SergeantTest.java | 3 +- .../java/concreteextensions/SoldierTest.java | 3 +- .../test/java/units/CommanderUnitTest.java | 3 +- .../src/test/java/units/SergeantUnitTest.java | 3 +- .../src/test/java/units/SoldierUnitTest.java | 3 +- .../src/test/java/units/UnitTest.java | 3 +- .../main/java/com/iluwatar/facade/App.java | 3 +- .../iluwatar/facade/DwarvenCartOperator.java | 3 +- .../iluwatar/facade/DwarvenGoldDigger.java | 3 +- .../facade/DwarvenGoldmineFacade.java | 3 +- .../iluwatar/facade/DwarvenMineWorker.java | 3 +- .../iluwatar/facade/DwarvenTunnelDigger.java | 3 +- .../java/com/iluwatar/facade/AppTest.java | 3 +- .../facade/DwarvenGoldmineFacadeTest.java | 3 +- .../java/com/iluwatar/factorykit/App.java | 3 +- .../java/com/iluwatar/factorykit/Axe.java | 3 +- .../java/com/iluwatar/factorykit/Bow.java | 3 +- .../java/com/iluwatar/factorykit/Builder.java | 3 +- .../java/com/iluwatar/factorykit/Spear.java | 3 +- .../java/com/iluwatar/factorykit/Sword.java | 3 +- .../java/com/iluwatar/factorykit/Weapon.java | 3 +- .../iluwatar/factorykit/WeaponFactory.java | 3 +- .../com/iluwatar/factorykit/WeaponType.java | 3 +- .../com/iluwatar/factorykit/app/AppTest.java | 3 +- .../factorykit/factorykit/FactoryKitTest.java | 3 +- .../java/com/iluwatar/factory/method/App.java | 3 +- .../iluwatar/factory/method/Blacksmith.java | 3 +- .../factory/method/ElfBlacksmith.java | 3 +- .../iluwatar/factory/method/ElfWeapon.java | 3 +- .../factory/method/OrcBlacksmith.java | 3 +- .../iluwatar/factory/method/OrcWeapon.java | 3 +- .../com/iluwatar/factory/method/Weapon.java | 3 +- .../iluwatar/factory/method/WeaponType.java | 3 +- .../com/iluwatar/factory/method/AppTest.java | 3 +- .../factory/method/FactoryMethodTest.java | 3 +- .../java/com/iluwatar/featuretoggle/App.java | 3 +- .../featuretoggle/pattern/Service.java | 3 +- .../PropertiesFeatureToggleVersion.java | 3 +- .../TieredFeatureToggleVersion.java | 3 +- .../com/iluwatar/featuretoggle/user/User.java | 3 +- .../featuretoggle/user/UserGroup.java | 3 +- .../PropertiesFeatureToggleVersionTest.java | 3 +- .../TieredFeatureToggleVersionTest.java | 3 +- .../featuretoggle/user/UserGroupTest.java | 3 +- .../com/iluwatar/fluentinterface/app/App.java | 3 +- .../fluentiterable/FluentIterable.java | 3 +- .../lazy/DecoratingIterator.java | 3 +- .../lazy/LazyFluentIterable.java | 3 +- .../simple/SimpleFluentIterable.java | 3 +- .../iluwatar/fluentinterface/app/AppTest.java | 3 +- .../fluentiterable/FluentIterableTest.java | 3 +- .../lazy/LazyFluentIterableTest.java | 3 +- .../simple/SimpleFluentIterableTest.java | 3 +- .../java/com/iluwatar/flux/action/Action.java | 3 +- .../com/iluwatar/flux/action/ActionType.java | 3 +- .../com/iluwatar/flux/action/Content.java | 3 +- .../iluwatar/flux/action/ContentAction.java | 3 +- .../com/iluwatar/flux/action/MenuAction.java | 3 +- .../com/iluwatar/flux/action/MenuItem.java | 3 +- .../main/java/com/iluwatar/flux/app/App.java | 3 +- .../iluwatar/flux/dispatcher/Dispatcher.java | 3 +- .../com/iluwatar/flux/store/ContentStore.java | 3 +- .../com/iluwatar/flux/store/MenuStore.java | 3 +- .../java/com/iluwatar/flux/store/Store.java | 3 +- .../com/iluwatar/flux/view/ContentView.java | 3 +- .../java/com/iluwatar/flux/view/MenuView.java | 3 +- .../java/com/iluwatar/flux/view/View.java | 3 +- .../com/iluwatar/flux/action/ContentTest.java | 3 +- .../iluwatar/flux/action/MenuItemTest.java | 3 +- .../java/com/iluwatar/flux/app/AppTest.java | 3 +- .../flux/dispatcher/DispatcherTest.java | 3 +- .../iluwatar/flux/store/ContentStoreTest.java | 3 +- .../iluwatar/flux/store/MenuStoreTest.java | 3 +- .../iluwatar/flux/view/ContentViewTest.java | 3 +- .../com/iluwatar/flux/view/MenuViewTest.java | 3 +- .../com/iluwatar/flyweight/AlchemistShop.java | 3 +- .../main/java/com/iluwatar/flyweight/App.java | 3 +- .../com/iluwatar/flyweight/HealingPotion.java | 3 +- .../iluwatar/flyweight/HolyWaterPotion.java | 3 +- .../flyweight/InvisibilityPotion.java | 3 +- .../com/iluwatar/flyweight/PoisonPotion.java | 3 +- .../java/com/iluwatar/flyweight/Potion.java | 3 +- .../com/iluwatar/flyweight/PotionFactory.java | 3 +- .../com/iluwatar/flyweight/PotionType.java | 3 +- .../iluwatar/flyweight/StrengthPotion.java | 3 +- .../iluwatar/flyweight/AlchemistShopTest.java | 3 +- .../java/com/iluwatar/flyweight/AppTest.java | 3 +- .../com/iluwatar/front/controller/App.java | 3 +- .../controller/ApplicationException.java | 3 +- .../front/controller/ArcherCommand.java | 3 +- .../iluwatar/front/controller/ArcherView.java | 3 +- .../front/controller/CatapultCommand.java | 3 +- .../front/controller/CatapultView.java | 3 +- .../iluwatar/front/controller/Command.java | 3 +- .../iluwatar/front/controller/ErrorView.java | 3 +- .../front/controller/FrontController.java | 3 +- .../front/controller/UnknownCommand.java | 3 +- .../com/iluwatar/front/controller/View.java | 3 +- .../iluwatar/front/controller/AppTest.java | 3 +- .../controller/ApplicationExceptionTest.java | 3 +- .../front/controller/CommandTest.java | 3 +- .../front/controller/FrontControllerTest.java | 3 +- .../iluwatar/front/controller/ViewTest.java | 3 +- .../controller/utils/InMemoryAppender.java | 3 +- .../com/iluwatar/guarded/suspension/App.java | 3 +- .../guarded/suspension/GuardedQueue.java | 3 +- .../guarded/suspension/GuardedQueueTest.java | 3 +- .../com/iluwatar/halfsynchalfasync/App.java | 3 +- .../iluwatar/halfsynchalfasync/AsyncTask.java | 3 +- .../AsynchronousService.java | 3 +- .../iluwatar/halfsynchalfasync/AppTest.java | 3 +- .../AsynchronousServiceTest.java | 3 +- .../main/java/com/iluwatar/hexagonal/App.java | 3 +- .../administration/ConsoleAdministration.java | 3 +- .../ConsoleAdministrationSrv.java | 3 +- .../ConsoleAdministrationSrvImpl.java | 3 +- .../hexagonal/banking/InMemoryBank.java | 3 +- .../iluwatar/hexagonal/banking/MongoBank.java | 3 +- .../hexagonal/banking/WireTransfers.java | 3 +- .../database/InMemoryTicketRepository.java | 3 +- .../database/LotteryTicketRepository.java | 3 +- .../database/MongoTicketRepository.java | 3 +- .../domain/LotteryAdministration.java | 3 +- .../hexagonal/domain/LotteryConstants.java | 3 +- .../hexagonal/domain/LotteryNumbers.java | 3 +- .../hexagonal/domain/LotteryService.java | 3 +- .../hexagonal/domain/LotteryTicket.java | 3 +- .../domain/LotteryTicketCheckResult.java | 3 +- .../hexagonal/domain/LotteryTicketId.java | 3 +- .../hexagonal/domain/LotteryUtils.java | 3 +- .../hexagonal/domain/PlayerDetails.java | 3 +- .../hexagonal/eventlog/LotteryEventLog.java | 3 +- .../hexagonal/eventlog/MongoEventLog.java | 3 +- .../hexagonal/eventlog/StdOutEventLog.java | 3 +- .../hexagonal/module/LotteryModule.java | 3 +- .../module/LotteryTestingModule.java | 3 +- .../MongoConnectionPropertiesLoader.java | 3 +- .../hexagonal/sampledata/SampleData.java | 3 +- .../hexagonal/service/ConsoleLottery.java | 3 +- .../service/LotteryConsoleService.java | 3 +- .../service/LotteryConsoleServiceImpl.java | 3 +- .../java/com/iluwatar/hexagonal/AppTest.java | 3 +- .../hexagonal/banking/InMemoryBankTest.java | 3 +- .../hexagonal/banking/MongoBankTest.java | 3 +- .../InMemoryTicketRepositoryTest.java | 3 +- .../database/MongoTicketRepositoryTest.java | 3 +- .../hexagonal/domain/LotteryNumbersTest.java | 3 +- .../hexagonal/domain/LotteryTest.java | 3 +- .../domain/LotteryTicketCheckResultTest.java | 3 +- .../hexagonal/domain/LotteryTicketIdTest.java | 3 +- .../hexagonal/domain/LotteryTicketTest.java | 3 +- .../hexagonal/domain/PlayerDetailsTest.java | 3 +- .../hexagonal/eventlog/MongoEventLogTest.java | 3 +- .../hexagonal/test/LotteryTestUtils.java | 3 +- .../intercepting/filter/AbstractFilter.java | 3 +- .../intercepting/filter/AddressFilter.java | 3 +- .../com/iluwatar/intercepting/filter/App.java | 3 +- .../iluwatar/intercepting/filter/Client.java | 3 +- .../intercepting/filter/ContactFilter.java | 3 +- .../intercepting/filter/DepositFilter.java | 3 +- .../iluwatar/intercepting/filter/Filter.java | 3 +- .../intercepting/filter/FilterChain.java | 3 +- .../intercepting/filter/FilterManager.java | 3 +- .../intercepting/filter/NameFilter.java | 3 +- .../iluwatar/intercepting/filter/Order.java | 3 +- .../intercepting/filter/OrderFilter.java | 3 +- .../iluwatar/intercepting/filter/Target.java | 3 +- .../iluwatar/intercepting/filter/AppTest.java | 3 +- .../filter/FilterManagerTest.java | 3 +- .../intercepting/filter/FilterTest.java | 3 +- .../intercepting/filter/OrderTest.java | 3 +- .../java/com/iluwatar/interpreter/App.java | 3 +- .../com/iluwatar/interpreter/Expression.java | 3 +- .../iluwatar/interpreter/MinusExpression.java | 3 +- .../interpreter/MultiplyExpression.java | 3 +- .../interpreter/NumberExpression.java | 3 +- .../iluwatar/interpreter/PlusExpression.java | 3 +- .../com/iluwatar/interpreter/AppTest.java | 3 +- .../iluwatar/interpreter/ExpressionTest.java | 3 +- .../interpreter/MinusExpressionTest.java | 3 +- .../interpreter/MultiplyExpressionTest.java | 3 +- .../interpreter/NumberExpressionTest.java | 3 +- .../interpreter/PlusExpressionTest.java | 3 +- .../main/java/com/iluwatar/iterator/App.java | 3 +- .../java/com/iluwatar/iterator/Iterator.java | 3 +- .../iluwatar/iterator/bst/BstIterator.java | 3 +- .../com/iluwatar/iterator/bst/TreeNode.java | 3 +- .../java/com/iluwatar/iterator/list/Item.java | 3 +- .../com/iluwatar/iterator/list/ItemType.java | 3 +- .../iluwatar/iterator/list/TreasureChest.java | 3 +- .../list/TreasureChestItemIterator.java | 3 +- .../java/com/iluwatar/iterator/AppTest.java | 3 +- .../iterator/bst/BstIteratorTest.java | 3 +- .../iterator/list/TreasureChestTest.java | 3 +- .../main/java/com/iluwatar/layers/App.java | 3 +- .../main/java/com/iluwatar/layers/Cake.java | 3 +- .../iluwatar/layers/CakeBakingException.java | 3 +- .../iluwatar/layers/CakeBakingService.java | 3 +- .../layers/CakeBakingServiceImpl.java | 3 +- .../java/com/iluwatar/layers/CakeDao.java | 3 +- .../java/com/iluwatar/layers/CakeInfo.java | 3 +- .../java/com/iluwatar/layers/CakeLayer.java | 3 +- .../com/iluwatar/layers/CakeLayerDao.java | 3 +- .../com/iluwatar/layers/CakeLayerInfo.java | 3 +- .../java/com/iluwatar/layers/CakeTopping.java | 3 +- .../com/iluwatar/layers/CakeToppingDao.java | 3 +- .../com/iluwatar/layers/CakeToppingInfo.java | 3 +- .../com/iluwatar/layers/CakeViewImpl.java | 3 +- .../main/java/com/iluwatar/layers/View.java | 3 +- .../java/com/iluwatar/layers/AppTest.java | 3 +- .../layers/CakeBakingExceptionTest.java | 3 +- .../layers/CakeBakingServiceImplTest.java | 3 +- .../java/com/iluwatar/layers/CakeTest.java | 3 +- .../com/iluwatar/layers/CakeViewImplTest.java | 3 +- .../java/com/iluwatar/lazy/loading/App.java | 3 +- .../java/com/iluwatar/lazy/loading/Heavy.java | 3 +- .../iluwatar/lazy/loading/HolderNaive.java | 3 +- .../lazy/loading/HolderThreadSafe.java | 3 +- .../iluwatar/lazy/loading/Java8Holder.java | 3 +- .../lazy/loading/AbstractHolderTest.java | 3 +- .../com/iluwatar/lazy/loading/AppTest.java | 3 +- .../lazy/loading/HolderNaiveTest.java | 3 +- .../lazy/loading/HolderThreadSafeTest.java | 3 +- .../lazy/loading/Java8HolderTest.java | 3 +- .../leaderelection/AbstractInstance.java | 3 +- .../AbstractMessageManager.java | 3 +- .../com/iluwatar/leaderelection/Instance.java | 3 +- .../com/iluwatar/leaderelection/Message.java | 3 +- .../leaderelection/MessageManager.java | 3 +- .../iluwatar/leaderelection/MessageType.java | 3 +- .../leaderelection/bully/BullyApp.java | 3 +- .../leaderelection/bully/BullyInstance.java | 3 +- .../bully/BullyMessageManager.java | 3 +- .../iluwatar/leaderelection/ring/RingApp.java | 3 +- .../leaderelection/ring/RingInstance.java | 3 +- .../ring/RingMessageManager.java | 3 +- .../iluwatar/leaderelection/MessageTest.java | 3 +- .../leaderelection/bully/BullyAppTest.java | 3 +- .../bully/BullyMessageManagerTest.java | 3 +- .../bully/BullyinstanceTest.java | 3 +- .../leaderelection/ring/RingAppTest.java | 3 +- .../leaderelection/ring/RingInstanceTest.java | 3 +- .../ring/RingMessageManagerTest.java | 3 +- license-plugin-header-style.xml | 41 +++++++++++++++++++ marker/src/main/java/App.java | 3 +- marker/src/main/java/Guard.java | 3 +- marker/src/main/java/Permission.java | 3 +- marker/src/main/java/Thief.java | 3 +- marker/src/test/java/AppTest.java | 3 +- marker/src/test/java/GuardTest.java | 3 +- marker/src/test/java/ThiefTest.java | 3 +- .../java/com/iluwatar/masterworker/App.java | 3 +- .../com/iluwatar/masterworker/ArrayInput.java | 3 +- .../iluwatar/masterworker/ArrayResult.java | 3 +- .../masterworker/ArrayUtilityMethods.java | 3 +- .../java/com/iluwatar/masterworker/Input.java | 3 +- .../com/iluwatar/masterworker/Result.java | 3 +- .../system/ArrayTransposeMasterWorker.java | 3 +- .../masterworker/system/MasterWorker.java | 3 +- .../systemmaster/ArrayTransposeMaster.java | 3 +- .../system/systemmaster/Master.java | 3 +- .../systemworkers/ArrayTransposeWorker.java | 3 +- .../system/systemworkers/Worker.java | 3 +- .../iluwatar/masterworker/ArrayInputTest.java | 3 +- .../masterworker/ArrayUtilityMethodsTest.java | 3 +- .../ArrayTransposeMasterWorkerTest.java | 3 +- .../ArrayTransposeWorkerTest.java | 3 +- .../java/com/iluwatar/mediator/Action.java | 3 +- .../main/java/com/iluwatar/mediator/App.java | 3 +- .../java/com/iluwatar/mediator/Hobbit.java | 3 +- .../java/com/iluwatar/mediator/Hunter.java | 3 +- .../java/com/iluwatar/mediator/Party.java | 3 +- .../java/com/iluwatar/mediator/PartyImpl.java | 3 +- .../com/iluwatar/mediator/PartyMember.java | 3 +- .../iluwatar/mediator/PartyMemberBase.java | 3 +- .../java/com/iluwatar/mediator/Rogue.java | 3 +- .../java/com/iluwatar/mediator/Wizard.java | 3 +- .../java/com/iluwatar/mediator/AppTest.java | 3 +- .../com/iluwatar/mediator/PartyImplTest.java | 3 +- .../iluwatar/mediator/PartyMemberTest.java | 3 +- .../main/java/com/iluwatar/memento/App.java | 3 +- .../main/java/com/iluwatar/memento/Star.java | 3 +- .../com/iluwatar/memento/StarMemento.java | 3 +- .../java/com/iluwatar/memento/StarType.java | 3 +- .../java/com/iluwatar/memento/AppTest.java | 3 +- .../java/com/iluwatar/memento/StarTest.java | 3 +- .../iluwatar/model/view/controller/App.java | 3 +- .../model/view/controller/Fatigue.java | 3 +- .../view/controller/GiantController.java | 3 +- .../model/view/controller/GiantModel.java | 3 +- .../model/view/controller/GiantView.java | 3 +- .../model/view/controller/Health.java | 3 +- .../model/view/controller/Nourishment.java | 3 +- .../model/view/controller/AppTest.java | 3 +- .../view/controller/GiantControllerTest.java | 3 +- .../model/view/controller/GiantModelTest.java | 3 +- .../model/view/controller/GiantViewTest.java | 3 +- .../iluwatar/model/view/presenter/App.java | 3 +- .../model/view/presenter/FileLoader.java | 3 +- .../view/presenter/FileSelectorJFrame.java | 3 +- .../view/presenter/FileSelectorPresenter.java | 3 +- .../view/presenter/FileSelectorStub.java | 3 +- .../view/presenter/FileSelectorView.java | 3 +- .../model/view/presenter/AppTest.java | 3 +- .../model/view/presenter/FileLoaderTest.java | 3 +- .../presenter/FileSelectorPresenterTest.java | 3 +- .../main/java/com/iluwatar/module/App.java | 3 +- .../iluwatar/module/ConsoleLoggerModule.java | 3 +- .../com/iluwatar/module/FileLoggerModule.java | 3 +- .../java/com/iluwatar/module/AppTest.java | 3 +- .../iluwatar/module/FileLoggerModuleTest.java | 3 +- .../src/main/java/com/iluwatar/monad/App.java | 3 +- .../src/main/java/com/iluwatar/monad/Sex.java | 3 +- .../main/java/com/iluwatar/monad/User.java | 3 +- .../java/com/iluwatar/monad/Validator.java | 3 +- .../test/java/com/iluwatar/monad/AppTest.java | 3 +- .../java/com/iluwatar/monad/MonadTest.java | 3 +- .../main/java/com/iluwatar/monostate/App.java | 3 +- .../com/iluwatar/monostate/LoadBalancer.java | 3 +- .../java/com/iluwatar/monostate/Request.java | 3 +- .../java/com/iluwatar/monostate/Server.java | 3 +- .../java/com/iluwatar/monostate/AppTest.java | 3 +- .../iluwatar/monostate/LoadBalancerTest.java | 3 +- .../main/java/com/iluwatar/multiton/App.java | 3 +- .../java/com/iluwatar/multiton/Nazgul.java | 3 +- .../com/iluwatar/multiton/NazgulEnum.java | 3 +- .../com/iluwatar/multiton/NazgulName.java | 3 +- .../java/com/iluwatar/multiton/AppTest.java | 3 +- .../com/iluwatar/multiton/NazgulEnumTest.java | 3 +- .../com/iluwatar/multiton/NazgulTest.java | 3 +- .../src/main/java/com/iluwatar/mute/App.java | 3 +- .../com/iluwatar/mute/CheckedRunnable.java | 3 +- .../src/main/java/com/iluwatar/mute/Mute.java | 3 +- .../main/java/com/iluwatar/mute/Resource.java | 3 +- .../test/java/com/iluwatar/mute/AppTest.java | 3 +- .../test/java/com/iluwatar/mute/MuteTest.java | 3 +- .../src/main/java/com/iluwatar/mutex/App.java | 3 +- .../src/main/java/com/iluwatar/mutex/Jar.java | 3 +- .../main/java/com/iluwatar/mutex/Lock.java | 3 +- .../main/java/com/iluwatar/mutex/Mutex.java | 3 +- .../main/java/com/iluwatar/mutex/Thief.java | 3 +- .../test/java/com/iluwatar/mutex/AppTest.java | 3 +- .../test/java/com/iluwatar/mutex/JarTest.java | 3 +- .../java/com/iluwatar/mutex/MutexTest.java | 3 +- .../dom/app/homepage/HomePageService.java | 3 +- .../dom/app/homepage/HomePageViewModel.java | 3 +- .../dom/modules/simple/SimpleObject.java | 3 +- .../dom/modules/simple/SimpleObjects.java | 3 +- .../dom/modules/simple/SimpleObjectTest.java | 3 +- .../dom/modules/simple/SimpleObjectsTest.java | 3 +- .../fixture/DomainAppFixturesProvider.java | 3 +- .../modules/simple/SimpleObjectCreate.java | 3 +- .../modules/simple/SimpleObjectsTearDown.java | 3 +- .../scenarios/RecreateSimpleObjects.java | 3 +- .../bootstrap/SimpleAppSystemInitializer.java | 3 +- .../specglue/BootstrappingGlue.java | 3 +- .../specglue/CatalogOfFixturesGlue.java | 3 +- .../modules/simple/SimpleObjectGlue.java | 3 +- .../domainapp/integtests/specs/RunSpecs.java | 3 +- .../integtests/tests/SimpleAppIntegTest.java | 3 +- .../modules/simple/SimpleObjectIntegTest.java | 3 +- .../simple/SimpleObjectsIntegTest.java | 3 +- .../domainapp/webapp/SimpleApplication.java | 3 +- .../java/com/iluwatar/nullobject/App.java | 3 +- .../java/com/iluwatar/nullobject/Node.java | 3 +- .../com/iluwatar/nullobject/NodeImpl.java | 3 +- .../com/iluwatar/nullobject/NullNode.java | 3 +- .../java/com/iluwatar/nullobject/AppTest.java | 3 +- .../com/iluwatar/nullobject/NullNodeTest.java | 3 +- .../com/iluwatar/nullobject/TreeTest.java | 3 +- .../java/com/iluwatar/objectmother/King.java | 3 +- .../java/com/iluwatar/objectmother/Queen.java | 3 +- .../com/iluwatar/objectmother/Royalty.java | 3 +- .../objectmother/RoyaltyObjectMother.java | 3 +- .../test/RoyaltyObjectMotherTest.java | 3 +- .../java/com/iluwatar/object/pool/App.java | 3 +- .../com/iluwatar/object/pool/ObjectPool.java | 3 +- .../com/iluwatar/object/pool/Oliphaunt.java | 3 +- .../iluwatar/object/pool/OliphauntPool.java | 3 +- .../com/iluwatar/object/pool/AppTest.java | 3 +- .../object/pool/OliphauntPoolTest.java | 3 +- .../main/java/com/iluwatar/observer/App.java | 3 +- .../java/com/iluwatar/observer/Hobbits.java | 3 +- .../main/java/com/iluwatar/observer/Orcs.java | 3 +- .../java/com/iluwatar/observer/Weather.java | 3 +- .../iluwatar/observer/WeatherObserver.java | 3 +- .../com/iluwatar/observer/WeatherType.java | 3 +- .../iluwatar/observer/generic/GHobbits.java | 3 +- .../com/iluwatar/observer/generic/GOrcs.java | 3 +- .../iluwatar/observer/generic/GWeather.java | 3 +- .../iluwatar/observer/generic/Observable.java | 3 +- .../iluwatar/observer/generic/Observer.java | 3 +- .../com/iluwatar/observer/generic/Race.java | 3 +- .../java/com/iluwatar/observer/AppTest.java | 3 +- .../com/iluwatar/observer/HobbitsTest.java | 3 +- .../java/com/iluwatar/observer/OrcsTest.java | 3 +- .../observer/WeatherObserverTest.java | 3 +- .../com/iluwatar/observer/WeatherTest.java | 3 +- .../observer/generic/GHobbitsTest.java | 3 +- .../observer/generic/GWeatherTest.java | 3 +- .../observer/generic/ObserverTest.java | 3 +- .../iluwatar/observer/generic/OrcsTest.java | 3 +- .../observer/utils/InMemoryAppender.java | 3 +- .../java/com/iluwatar/pageobject/App.java | 3 +- .../java/com/iluwatar/pageobject/App.java | 3 +- .../pageobject/AlbumListPageTest.java | 3 +- .../iluwatar/pageobject/AlbumPageTest.java | 3 +- .../iluwatar/pageobject/LoginPageTest.java | 3 +- .../pageobject/pages/AlbumListPage.java | 3 +- .../iluwatar/pageobject/pages/AlbumPage.java | 3 +- .../iluwatar/pageobject/pages/LoginPage.java | 3 +- .../com/iluwatar/pageobject/pages/Page.java | 3 +- .../iluwatar/pageobject/AlbumListPage.java | 3 +- .../com/iluwatar/pageobject/AlbumPage.java | 3 +- .../com/iluwatar/pageobject/LoginPage.java | 3 +- .../java/com/iluwatar/pageobject/Page.java | 3 +- .../pageobject/AlbumListPageTest.java | 3 +- .../iluwatar/pageobject/AlbumPageTest.java | 3 +- .../iluwatar/pageobject/LoginPageTest.java | 3 +- .../com/iluwatar/partialresponse/App.java | 3 +- .../partialresponse/FieldJsonMapper.java | 3 +- .../com/iluwatar/partialresponse/Video.java | 3 +- .../partialresponse/VideoResource.java | 3 +- .../com/iluwatar/partialresponse/AppTest.java | 3 +- .../partialresponse/FieldJsonMapperTest.java | 3 +- .../partialresponse/VideoResourceTest.java | 3 +- .../main/java/com/iluwatar/pipeline/App.java | 3 +- .../pipeline/ConvertToCharArrayHandler.java | 3 +- .../java/com/iluwatar/pipeline/Handler.java | 3 +- .../java/com/iluwatar/pipeline/Pipeline.java | 3 +- .../pipeline/RemoveAlphabetsHandler.java | 3 +- .../pipeline/RemoveDigitsHandler.java | 3 +- .../java/com/iluwatar/pipeline/AppTest.java | 3 +- .../com/iluwatar/pipeline/PipelineTest.java | 3 +- .../java/com/iluwatar/poison/pill/App.java | 3 +- .../com/iluwatar/poison/pill/Consumer.java | 3 +- .../com/iluwatar/poison/pill/Message.java | 3 +- .../iluwatar/poison/pill/MessageQueue.java | 3 +- .../iluwatar/poison/pill/MqPublishPoint.java | 3 +- .../poison/pill/MqSubscribePoint.java | 3 +- .../com/iluwatar/poison/pill/Producer.java | 3 +- .../iluwatar/poison/pill/SimpleMessage.java | 3 +- .../poison/pill/SimpleMessageQueue.java | 3 +- .../com/iluwatar/poison/pill/AppTest.java | 3 +- .../iluwatar/poison/pill/ConsumerTest.java | 3 +- .../poison/pill/PoisonMessageTest.java | 3 +- .../iluwatar/poison/pill/ProducerTest.java | 3 +- .../poison/pill/SimpleMessageTest.java | 3 +- pom.xml | 6 +++ .../iluwatar/priority/queue/Application.java | 3 +- .../com/iluwatar/priority/queue/Message.java | 3 +- .../priority/queue/PriorityMessageQueue.java | 3 +- .../iluwatar/priority/queue/QueueManager.java | 3 +- .../com/iluwatar/priority/queue/Worker.java | 3 +- .../queue/PriorityMessageQueueTest.java | 3 +- .../priority/queue/QueueManagerTest.java | 3 +- .../com/iluwatar/privateclassdata/App.java | 3 +- .../privateclassdata/ImmutableStew.java | 3 +- .../com/iluwatar/privateclassdata/Stew.java | 3 +- .../iluwatar/privateclassdata/StewData.java | 3 +- .../iluwatar/privateclassdata/AppTest.java | 3 +- .../privateclassdata/ImmutableStewTest.java | 3 +- .../iluwatar/privateclassdata/StewTest.java | 3 +- .../utils/InMemoryAppender.java | 3 +- .../com/iluwatar/producer/consumer/App.java | 3 +- .../iluwatar/producer/consumer/Consumer.java | 3 +- .../com/iluwatar/producer/consumer/Item.java | 3 +- .../iluwatar/producer/consumer/ItemQueue.java | 3 +- .../iluwatar/producer/consumer/Producer.java | 3 +- .../iluwatar/producer/consumer/AppTest.java | 3 +- .../producer/consumer/ConsumerTest.java | 3 +- .../producer/consumer/ProducerTest.java | 3 +- .../main/java/com/iluwatar/promise/App.java | 3 +- .../java/com/iluwatar/promise/Promise.java | 3 +- .../com/iluwatar/promise/PromiseSupport.java | 3 +- .../java/com/iluwatar/promise/Utility.java | 3 +- .../java/com/iluwatar/promise/AppTest.java | 3 +- .../com/iluwatar/promise/PromiseTest.java | 3 +- .../main/java/com/iluwatar/property/App.java | 3 +- .../java/com/iluwatar/property/Character.java | 3 +- .../java/com/iluwatar/property/Prototype.java | 3 +- .../java/com/iluwatar/property/Stats.java | 3 +- .../java/com/iluwatar/property/AppTest.java | 3 +- .../com/iluwatar/property/CharacterTest.java | 3 +- .../main/java/com/iluwatar/prototype/App.java | 3 +- .../java/com/iluwatar/prototype/Beast.java | 3 +- .../java/com/iluwatar/prototype/ElfBeast.java | 3 +- .../java/com/iluwatar/prototype/ElfMage.java | 3 +- .../com/iluwatar/prototype/ElfWarlord.java | 3 +- .../com/iluwatar/prototype/HeroFactory.java | 3 +- .../iluwatar/prototype/HeroFactoryImpl.java | 3 +- .../java/com/iluwatar/prototype/Mage.java | 3 +- .../java/com/iluwatar/prototype/OrcBeast.java | 3 +- .../java/com/iluwatar/prototype/OrcMage.java | 3 +- .../com/iluwatar/prototype/OrcWarlord.java | 3 +- .../com/iluwatar/prototype/Prototype.java | 3 +- .../java/com/iluwatar/prototype/Warlord.java | 3 +- .../java/com/iluwatar/prototype/AppTest.java | 3 +- .../prototype/HeroFactoryImplTest.java | 3 +- .../com/iluwatar/prototype/PrototypeTest.java | 3 +- .../src/main/java/com/iluwatar/proxy/App.java | 3 +- .../java/com/iluwatar/proxy/IvoryTower.java | 3 +- .../main/java/com/iluwatar/proxy/Wizard.java | 3 +- .../java/com/iluwatar/proxy/WizardTower.java | 3 +- .../com/iluwatar/proxy/WizardTowerProxy.java | 3 +- .../test/java/com/iluwatar/proxy/AppTest.java | 3 +- .../com/iluwatar/proxy/IvoryTowerTest.java | 3 +- .../java/com/iluwatar/proxy/WizardTest.java | 3 +- .../iluwatar/proxy/WizardTowerProxyTest.java | 3 +- .../proxy/utils/InMemoryAppender.java | 3 +- .../com/iluwatar/queue/load/leveling/App.java | 3 +- .../iluwatar/queue/load/leveling/Message.java | 3 +- .../queue/load/leveling/MessageQueue.java | 3 +- .../queue/load/leveling/ServiceExecutor.java | 3 +- .../iluwatar/queue/load/leveling/Task.java | 3 +- .../queue/load/leveling/TaskGenerator.java | 3 +- .../iluwatar/queue/load/leveling/AppTest.java | 3 +- .../queue/load/leveling/MessageQueueTest.java | 3 +- .../queue/load/leveling/MessageTest.java | 3 +- .../load/leveling/TaskGenSrvExeTest.java | 3 +- .../java/com/iluwatar/reactor/app/App.java | 3 +- .../com/iluwatar/reactor/app/AppClient.java | 3 +- .../iluwatar/reactor/app/LoggingHandler.java | 3 +- .../reactor/framework/AbstractNioChannel.java | 3 +- .../reactor/framework/ChannelHandler.java | 3 +- .../reactor/framework/Dispatcher.java | 3 +- .../reactor/framework/NioDatagramChannel.java | 3 +- .../reactor/framework/NioReactor.java | 3 +- .../framework/NioServerSocketChannel.java | 3 +- .../framework/SameThreadDispatcher.java | 3 +- .../framework/ThreadPoolDispatcher.java | 3 +- .../com/iluwatar/reactor/app/ReactorTest.java | 3 +- .../com/iluwatar/reader/writer/lock/App.java | 3 +- .../iluwatar/reader/writer/lock/Reader.java | 3 +- .../reader/writer/lock/ReaderWriterLock.java | 3 +- .../iluwatar/reader/writer/lock/Writer.java | 3 +- .../iluwatar/reader/writer/lock/AppTest.java | 3 +- .../writer/lock/ReaderAndWriterTest.java | 3 +- .../reader/writer/lock/ReaderTest.java | 3 +- .../reader/writer/lock/WriterTest.java | 3 +- .../writer/lock/utils/InMemoryAppender.java | 3 +- .../java/com/iluwatar/repository/App.java | 3 +- .../com/iluwatar/repository/AppConfig.java | 3 +- .../java/com/iluwatar/repository/Person.java | 3 +- .../iluwatar/repository/PersonRepository.java | 3 +- .../repository/PersonSpecifications.java | 3 +- .../AnnotationBasedRepositoryTest.java | 3 +- .../iluwatar/repository/AppConfigTest.java | 3 +- .../java/com/iluwatar/repository/AppTest.java | 3 +- .../iluwatar/repository/RepositoryTest.java | 3 +- .../acquisition/is/initialization/App.java | 3 +- .../is/initialization/SlidingDoor.java | 3 +- .../is/initialization/TreasureChest.java | 3 +- .../is/initialization/AppTest.java | 3 +- .../is/initialization/ClosableTest.java | 3 +- .../src/main/java/com/iluwatar/retry/App.java | 3 +- .../com/iluwatar/retry/BusinessException.java | 3 +- .../com/iluwatar/retry/BusinessOperation.java | 3 +- .../retry/CustomerNotFoundException.java | 3 +- .../retry/DatabaseNotAvailableException.java | 3 +- .../java/com/iluwatar/retry/FindCustomer.java | 3 +- .../main/java/com/iluwatar/retry/Retry.java | 3 +- .../retry/RetryExponentialBackoff.java | 3 +- .../com/iluwatar/retry/FindCustomerTest.java | 3 +- .../retry/RetryExponentialBackoffTest.java | 3 +- .../java/com/iluwatar/retry/RetryTest.java | 3 +- .../main/java/com/iluwatar/semaphore/App.java | 3 +- .../java/com/iluwatar/semaphore/Customer.java | 3 +- .../java/com/iluwatar/semaphore/Fruit.java | 3 +- .../com/iluwatar/semaphore/FruitBowl.java | 3 +- .../com/iluwatar/semaphore/FruitShop.java | 3 +- .../java/com/iluwatar/semaphore/Lock.java | 3 +- .../com/iluwatar/semaphore/Semaphore.java | 3 +- .../java/com/iluwatar/semaphore/AppTest.java | 3 +- .../com/iluwatar/semaphore/FruitBowlTest.java | 3 +- .../com/iluwatar/semaphore/SemaphoreTest.java | 3 +- .../main/java/com/iluwatar/servant/App.java | 3 +- .../main/java/com/iluwatar/servant/King.java | 3 +- .../main/java/com/iluwatar/servant/Queen.java | 3 +- .../java/com/iluwatar/servant/Royalty.java | 3 +- .../java/com/iluwatar/servant/Servant.java | 3 +- .../java/com/iluwatar/servant/AppTest.java | 3 +- .../java/com/iluwatar/servant/KingTest.java | 3 +- .../java/com/iluwatar/servant/QueenTest.java | 3 +- .../com/iluwatar/servant/ServantTest.java | 3 +- .../baas/api/AbstractDynamoDbHandler.java | 3 +- .../baas/api/FindPersonApiHandler.java | 3 +- .../baas/api/SavePersonApiHandler.java | 3 +- .../serverless/baas/model/Address.java | 3 +- .../serverless/baas/model/Person.java | 3 +- .../serverless/faas/ApiGatewayResponse.java | 3 +- .../iluwatar/serverless/faas/LambdaInfo.java | 3 +- .../faas/api/LambdaInfoApiHandler.java | 3 +- .../baas/api/FindPersonApiHandlerTest.java | 3 +- .../baas/api/SavePersonApiHandlerTest.java | 3 +- .../faas/api/LambdaInfoApiHandlerTest.java | 3 +- .../com/iluwatar/servicelayer/app/App.java | 3 +- .../servicelayer/common/BaseEntity.java | 3 +- .../com/iluwatar/servicelayer/common/Dao.java | 3 +- .../servicelayer/common/DaoBaseImpl.java | 3 +- .../servicelayer/hibernate/HibernateUtil.java | 3 +- .../servicelayer/magic/MagicService.java | 3 +- .../servicelayer/magic/MagicServiceImpl.java | 3 +- .../iluwatar/servicelayer/spell/Spell.java | 3 +- .../iluwatar/servicelayer/spell/SpellDao.java | 3 +- .../servicelayer/spell/SpellDaoImpl.java | 3 +- .../servicelayer/spellbook/Spellbook.java | 3 +- .../servicelayer/spellbook/SpellbookDao.java | 3 +- .../spellbook/SpellbookDaoImpl.java | 3 +- .../iluwatar/servicelayer/wizard/Wizard.java | 3 +- .../servicelayer/wizard/WizardDao.java | 3 +- .../servicelayer/wizard/WizardDaoImpl.java | 3 +- .../iluwatar/servicelayer/app/AppTest.java | 3 +- .../servicelayer/common/BaseDaoTest.java | 3 +- .../magic/MagicServiceImplTest.java | 3 +- .../servicelayer/spell/SpellDaoImplTest.java | 3 +- .../spellbook/SpellbookDaoImplTest.java | 3 +- .../wizard/WizardDaoImplTest.java | 3 +- .../java/com/iluwatar/servicelocator/App.java | 3 +- .../iluwatar/servicelocator/InitContext.java | 3 +- .../com/iluwatar/servicelocator/Service.java | 3 +- .../iluwatar/servicelocator/ServiceCache.java | 3 +- .../iluwatar/servicelocator/ServiceImpl.java | 3 +- .../servicelocator/ServiceLocator.java | 3 +- .../com/iluwatar/servicelocator/AppTest.java | 3 +- .../servicelocator/ServiceLocatorTest.java | 3 +- .../main/java/com/iluwatar/singleton/App.java | 3 +- .../iluwatar/singleton/EnumIvoryTower.java | 3 +- .../InitializingOnDemandHolderIdiom.java | 3 +- .../com/iluwatar/singleton/IvoryTower.java | 3 +- .../ThreadSafeDoubleCheckLocking.java | 3 +- .../ThreadSafeLazyLoadedIvoryTower.java | 3 +- .../java/com/iluwatar/singleton/AppTest.java | 3 +- .../singleton/EnumIvoryTowerTest.java | 3 +- .../InitializingOnDemandHolderIdiomTest.java | 3 +- .../iluwatar/singleton/IvoryTowerTest.java | 3 +- .../com/iluwatar/singleton/SingletonTest.java | 3 +- .../ThreadSafeDoubleCheckLockingTest.java | 3 +- .../ThreadSafeLazyLoadedIvoryTowerTest.java | 3 +- .../com/iluwatar/spatialpartition/App.java | 3 +- .../com/iluwatar/spatialpartition/Bubble.java | 3 +- .../com/iluwatar/spatialpartition/Point.java | 3 +- .../iluwatar/spatialpartition/QuadTree.java | 3 +- .../com/iluwatar/spatialpartition/Rect.java | 3 +- .../SpatialPartitionBubbles.java | 3 +- .../SpatialPartitionGeneric.java | 3 +- .../iluwatar/spatialpartition/BubbleTest.java | 3 +- .../spatialpartition/QuadTreeTest.java | 3 +- .../iluwatar/spatialpartition/RectTest.java | 3 +- .../SpatialPartitionBubblesTest.java | 3 +- .../com/iluwatar/specification/app/App.java | 3 +- .../creature/AbstractCreature.java | 3 +- .../specification/creature/Creature.java | 3 +- .../specification/creature/Dragon.java | 3 +- .../specification/creature/Goblin.java | 3 +- .../specification/creature/KillerBee.java | 3 +- .../specification/creature/Octopus.java | 3 +- .../specification/creature/Shark.java | 3 +- .../specification/creature/Troll.java | 3 +- .../specification/property/Color.java | 3 +- .../specification/property/Movement.java | 3 +- .../iluwatar/specification/property/Size.java | 3 +- .../specification/selector/ColorSelector.java | 3 +- .../selector/MovementSelector.java | 3 +- .../specification/selector/SizeSelector.java | 3 +- .../iluwatar/specification/app/AppTest.java | 3 +- .../specification/creature/CreatureTest.java | 3 +- .../selector/ColorSelectorTest.java | 3 +- .../selector/MovementSelectorTest.java | 3 +- .../selector/SizeSelectorTest.java | 3 +- .../java/com/iluwatar/state/AngryState.java | 3 +- .../src/main/java/com/iluwatar/state/App.java | 3 +- .../main/java/com/iluwatar/state/Mammoth.java | 3 +- .../com/iluwatar/state/PeacefulState.java | 3 +- .../main/java/com/iluwatar/state/State.java | 3 +- .../test/java/com/iluwatar/state/AppTest.java | 3 +- .../java/com/iluwatar/state/MammothTest.java | 3 +- .../java/com/iluwatar/stepbuilder/App.java | 3 +- .../com/iluwatar/stepbuilder/Character.java | 3 +- .../stepbuilder/CharacterStepBuilder.java | 3 +- .../com/iluwatar/stepbuilder/AppTest.java | 3 +- .../stepbuilder/CharacterStepBuilderTest.java | 3 +- .../main/java/com/iluwatar/strategy/App.java | 3 +- .../com/iluwatar/strategy/DragonSlayer.java | 3 +- .../strategy/DragonSlayingStrategy.java | 3 +- .../com/iluwatar/strategy/MeleeStrategy.java | 3 +- .../iluwatar/strategy/ProjectileStrategy.java | 3 +- .../com/iluwatar/strategy/SpellStrategy.java | 3 +- .../java/com/iluwatar/strategy/AppTest.java | 3 +- .../iluwatar/strategy/DragonSlayerTest.java | 3 +- .../strategy/DragonSlayingStrategyTest.java | 3 +- subclass-sandbox/pom.xml | 2 +- .../com/iluwatar/subclasssandbox/App.java | 10 ++--- .../iluwatar/subclasssandbox/GroundDive.java | 10 ++--- .../iluwatar/subclasssandbox/SkyLaunch.java | 10 ++--- .../iluwatar/subclasssandbox/Superpower.java | 10 ++--- .../com/iluwatar/subclasssandbox/AppTest.java | 10 ++--- .../subclasssandbox/GroundDiveTest.java | 10 ++--- .../subclasssandbox/SkyLaunchTest.java | 10 ++--- .../java/com/iluwatar/templatemethod/App.java | 3 +- .../templatemethod/HalflingThief.java | 3 +- .../templatemethod/HitAndRunMethod.java | 3 +- .../templatemethod/StealingMethod.java | 3 +- .../iluwatar/templatemethod/SubtleMethod.java | 3 +- .../com/iluwatar/templatemethod/AppTest.java | 3 +- .../templatemethod/HalflingThiefTest.java | 3 +- .../templatemethod/HitAndRunMethodTest.java | 3 +- .../templatemethod/StealingMethodTest.java | 3 +- .../templatemethod/SubtleMethodTest.java | 3 +- .../java/com/iluwatar/threadpool/App.java | 3 +- .../iluwatar/threadpool/CoffeeMakingTask.java | 3 +- .../threadpool/PotatoPeelingTask.java | 3 +- .../java/com/iluwatar/threadpool/Task.java | 3 +- .../java/com/iluwatar/threadpool/Worker.java | 3 +- .../java/com/iluwatar/threadpool/AppTest.java | 3 +- .../threadpool/CoffeeMakingTaskTest.java | 3 +- .../threadpool/PotatoPeelingTaskTest.java | 3 +- .../com/iluwatar/threadpool/TaskTest.java | 3 +- .../com/iluwatar/threadpool/WorkerTest.java | 3 +- .../java/com/iluwatar/throttling/App.java | 3 +- .../com/iluwatar/throttling/B2BService.java | 3 +- .../com/iluwatar/throttling/CallsCount.java | 3 +- .../java/com/iluwatar/throttling/Tenant.java | 3 +- .../throttling/timer/ThrottleTimerImpl.java | 3 +- .../iluwatar/throttling/timer/Throttler.java | 3 +- .../java/com/iluwatar/throttling/AppTest.java | 3 +- .../iluwatar/throttling/B2BServiceTest.java | 3 +- .../com/iluwatar/throttling/TenantTest.java | 3 +- tls/src/main/java/com/iluwatar/tls/App.java | 3 +- .../com/iluwatar/tls/DateFormatCallable.java | 3 +- .../main/java/com/iluwatar/tls/Result.java | 3 +- .../test/java/com/iluwatar/tls/AppTest.java | 3 +- .../iluwatar/tls/DateFormatCallableTest.java | 3 +- ...FormatCallableTestIncorrectDateFormat.java | 3 +- .../DateFormatCallableTestMultiThread.java | 3 +- .../java/com/iluwatar/tolerantreader/App.java | 3 +- .../iluwatar/tolerantreader/RainbowFish.java | 3 +- .../tolerantreader/RainbowFishSerializer.java | 3 +- .../tolerantreader/RainbowFishV2.java | 3 +- .../com/iluwatar/tolerantreader/AppTest.java | 3 +- .../RainbowFishSerializerTest.java | 3 +- .../tolerantreader/RainbowFishTest.java | 3 +- .../tolerantreader/RainbowFishV2Test.java | 3 +- .../com/iluwatar/trampoline/Trampoline.java | 3 +- .../iluwatar/trampoline/TrampolineApp.java | 3 +- .../trampoline/TrampolineAppTest.java | 3 +- twin/src/main/java/com/iluwatar/twin/App.java | 3 +- .../main/java/com/iluwatar/twin/BallItem.java | 3 +- .../java/com/iluwatar/twin/BallThread.java | 3 +- .../main/java/com/iluwatar/twin/GameItem.java | 2 +- .../test/java/com/iluwatar/twin/AppTest.java | 3 +- .../java/com/iluwatar/twin/BallItemTest.java | 3 +- .../com/iluwatar/twin/BallThreadTest.java | 3 +- .../java/com/iluwatar/typeobject/App.java | 3 +- .../java/com/iluwatar/typeobject/Candy.java | 3 +- .../com/iluwatar/typeobject/CandyGame.java | 3 +- .../java/com/iluwatar/typeobject/Cell.java | 3 +- .../com/iluwatar/typeobject/CellPool.java | 3 +- .../com/iluwatar/typeobject/JsonParser.java | 3 +- .../iluwatar/typeobject/CandyGameTest.java | 3 +- .../com/iluwatar/typeobject/CellPoolTest.java | 3 +- .../com/iluwatar/typeobject/CellTest.java | 3 +- .../java/com/iluwatar/unitofwork/App.java | 3 +- .../com/iluwatar/unitofwork/IUnitOfWork.java | 3 +- .../java/com/iluwatar/unitofwork/Student.java | 3 +- .../iluwatar/unitofwork/StudentDatabase.java | 3 +- .../unitofwork/StudentRepository.java | 3 +- .../java/com/iluwatar/unitofwork/AppTest.java | 3 +- .../unitofwork/StudentRepositoryTest.java | 3 +- .../java/com/iluwatar/value/object/App.java | 3 +- .../com/iluwatar/value/object/HeroStat.java | 3 +- .../com/iluwatar/value/object/AppTest.java | 3 +- .../iluwatar/value/object/HeroStatTest.java | 3 +- .../main/java/com/iluwatar/visitor/App.java | 3 +- .../java/com/iluwatar/visitor/Commander.java | 3 +- .../iluwatar/visitor/CommanderVisitor.java | 3 +- .../java/com/iluwatar/visitor/Sergeant.java | 3 +- .../com/iluwatar/visitor/SergeantVisitor.java | 3 +- .../java/com/iluwatar/visitor/Soldier.java | 3 +- .../com/iluwatar/visitor/SoldierVisitor.java | 3 +- .../main/java/com/iluwatar/visitor/Unit.java | 3 +- .../com/iluwatar/visitor/UnitVisitor.java | 3 +- .../java/com/iluwatar/visitor/AppTest.java | 3 +- .../com/iluwatar/visitor/CommanderTest.java | 3 +- .../visitor/CommanderVisitorTest.java | 3 +- .../com/iluwatar/visitor/SergeantTest.java | 3 +- .../iluwatar/visitor/SergeantVisitorTest.java | 3 +- .../com/iluwatar/visitor/SoldierTest.java | 3 +- .../iluwatar/visitor/SoldierVisitorTest.java | 3 +- .../java/com/iluwatar/visitor/UnitTest.java | 3 +- .../com/iluwatar/visitor/VisitorTest.java | 3 +- 1246 files changed, 2578 insertions(+), 1312 deletions(-) create mode 100644 license-plugin-header-style.xml diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java index dee8302c1539..649bdbcc9499 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/AbstractDocument.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument; import java.util.List; diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java index e8b2410a8bb6..a0d9d13c8a79 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument; import java.util.Arrays; diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/Document.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/Document.java index 767002eb7f6b..e1254c1f9400 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/Document.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/Document.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument; import java.util.Map; diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/Car.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/Car.java index f0db8399387d..738aaab26df0 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/Car.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/Car.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument.domain; import java.util.Map; diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasModel.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasModel.java index 9c7ce855f5d5..d5178ecaddff 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasModel.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasModel.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument.domain; import java.util.Optional; diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasParts.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasParts.java index 84f55989f9f6..ff021a2eab9a 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasParts.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasParts.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument.domain; import java.util.stream.Stream; diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasPrice.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasPrice.java index 31f333bded5a..97683c344faf 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasPrice.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasPrice.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument.domain; import java.util.Optional; diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasType.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasType.java index 89dce0e3bf49..8ec1a9fe4cf2 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasType.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/HasType.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument.domain; import java.util.Optional; diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/Part.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/Part.java index 68c3e1aae31c..21e0c7070977 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/Part.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/Part.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument.domain; import java.util.Map; diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java index 07ca62de5a23..b9957dd0c939 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/domain/enums/Property.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument.domain.enums; /** diff --git a/abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java b/abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java index 78088ab49446..7f3e1eada124 100644 --- a/abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java +++ b/abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument; import org.junit.jupiter.api.Test; diff --git a/abstract-document/src/test/java/com/iluwatar/abstractdocument/AppTest.java b/abstract-document/src/test/java/com/iluwatar/abstractdocument/AppTest.java index 4dffbdf88cf4..aed63f303181 100644 --- a/abstract-document/src/test/java/com/iluwatar/abstractdocument/AppTest.java +++ b/abstract-document/src/test/java/com/iluwatar/abstractdocument/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument; import org.junit.jupiter.api.Test; diff --git a/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java b/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java index 6d67be392c77..2dde49a1ea2a 100644 --- a/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java +++ b/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractdocument; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/App.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/App.java index 9d77b245084e..a2b4867b0d2a 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/App.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; import org.slf4j.Logger; diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Army.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Army.java index 03ada4ba0339..158ad9fa8c41 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Army.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Army.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; /** diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Castle.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Castle.java index e349e6160fd3..faf2cb4cc58c 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Castle.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Castle.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; /** diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfArmy.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfArmy.java index 2eaaf722c642..f4196072c1c8 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfArmy.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfArmy.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; /** diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfCastle.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfCastle.java index 0562ffaaa49f..29f16907e665 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfCastle.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfCastle.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; /** diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKing.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKing.java index faa78d401515..8d4c6d7f0701 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKing.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKing.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; /** diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKingdomFactory.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKingdomFactory.java index 887ba058c477..61d744cfcb1e 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKingdomFactory.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKingdomFactory.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; /** diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/King.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/King.java index f11d5c685e7d..cbb27cec2820 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/King.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/King.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; /** diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/KingdomFactory.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/KingdomFactory.java index a117598edd1a..c3e3d0f2579b 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/KingdomFactory.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/KingdomFactory.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; /** diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcArmy.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcArmy.java index 66ac688edc38..55842f2a93f2 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcArmy.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcArmy.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; /** diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcCastle.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcCastle.java index ac6840276907..1316cf6d4aae 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcCastle.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcCastle.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; /** diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKing.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKing.java index cc5bd158b92f..a4ffc1d28ae4 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKing.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKing.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; /** diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKingdomFactory.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKingdomFactory.java index 731d52eecc4d..6792174f2f9b 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKingdomFactory.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKingdomFactory.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; /** diff --git a/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AbstractFactoryTest.java b/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AbstractFactoryTest.java index 244ec0015904..eab501e9b191 100644 --- a/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AbstractFactoryTest.java +++ b/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AbstractFactoryTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AppTest.java b/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AppTest.java index 28224d12360a..892af73920ae 100644 --- a/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AppTest.java +++ b/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.abstractfactory; import org.junit.jupiter.api.Test; diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/AllModemVisitor.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/AllModemVisitor.java index 97c9b19462c5..b5842cdf576e 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/AllModemVisitor.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/AllModemVisitor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; /** diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/App.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/App.java index be96f3a60d31..3875d7a2a289 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/App.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; /** diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitor.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitor.java index 1f03065505bb..8b64db8a7ab7 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitor.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; import org.slf4j.Logger; diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitor.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitor.java index d77118ccc355..fb5a657d78ea 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitor.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; import org.slf4j.Logger; diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/Hayes.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/Hayes.java index 1c650ce0c053..586d72876871 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/Hayes.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/Hayes.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; import org.slf4j.Logger; diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/HayesVisitor.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/HayesVisitor.java index 130fdf250e3b..80dfc2320384 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/HayesVisitor.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/HayesVisitor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; /** diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/Modem.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/Modem.java index c8ddfd3d907b..9c1eb117eea6 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/Modem.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/Modem.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; /** diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ModemVisitor.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ModemVisitor.java index 57ccc3105016..a5baa7169b8b 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ModemVisitor.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ModemVisitor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; /** diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/Zoom.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/Zoom.java index 39bd8c38f7ca..c624f9f5f46c 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/Zoom.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/Zoom.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; import org.slf4j.Logger; diff --git a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ZoomVisitor.java b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ZoomVisitor.java index eebc5111b000..707943884eeb 100644 --- a/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ZoomVisitor.java +++ b/acyclic-visitor/src/main/java/com/iluwatar/acyclicvisitor/ZoomVisitor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; /** diff --git a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/AppTest.java b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/AppTest.java index 813a380b8790..1f555ee9932e 100644 --- a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/AppTest.java +++ b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; import org.junit.jupiter.api.Test; diff --git a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitorTest.java b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitorTest.java index b90bafb0f5e6..d49ba591cfec 100644 --- a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitorTest.java +++ b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForDosVisitorTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; import static org.assertj.core.api.Assertions.assertThat; diff --git a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitorTest.java b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitorTest.java index ef6fd4d8ede3..e1765c81b770 100644 --- a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitorTest.java +++ b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitorTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; import static org.assertj.core.api.Assertions.assertThat; diff --git a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/HayesTest.java b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/HayesTest.java index 477354b1347f..308dd5879329 100644 --- a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/HayesTest.java +++ b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/HayesTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; import static org.mockito.Matchers.eq; diff --git a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ZoomTest.java b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ZoomTest.java index ff24d526d227..2dcfcfbbbf80 100644 --- a/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ZoomTest.java +++ b/acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ZoomTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.acyclicvisitor; diff --git a/adapter/src/main/java/com/iluwatar/adapter/App.java b/adapter/src/main/java/com/iluwatar/adapter/App.java index 4f31af795f6b..a3bf5b14b35c 100644 --- a/adapter/src/main/java/com/iluwatar/adapter/App.java +++ b/adapter/src/main/java/com/iluwatar/adapter/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.adapter; /** diff --git a/adapter/src/main/java/com/iluwatar/adapter/Captain.java b/adapter/src/main/java/com/iluwatar/adapter/Captain.java index dd9397b2236b..fbf0be6ca628 100644 --- a/adapter/src/main/java/com/iluwatar/adapter/Captain.java +++ b/adapter/src/main/java/com/iluwatar/adapter/Captain.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.adapter; /** diff --git a/adapter/src/main/java/com/iluwatar/adapter/FishingBoat.java b/adapter/src/main/java/com/iluwatar/adapter/FishingBoat.java index 381e4de97a58..6c2daae3d2df 100644 --- a/adapter/src/main/java/com/iluwatar/adapter/FishingBoat.java +++ b/adapter/src/main/java/com/iluwatar/adapter/FishingBoat.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.adapter; import org.slf4j.Logger; diff --git a/adapter/src/main/java/com/iluwatar/adapter/FishingBoatAdapter.java b/adapter/src/main/java/com/iluwatar/adapter/FishingBoatAdapter.java index df0ba4792b17..7dda379c9271 100644 --- a/adapter/src/main/java/com/iluwatar/adapter/FishingBoatAdapter.java +++ b/adapter/src/main/java/com/iluwatar/adapter/FishingBoatAdapter.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.adapter; /** diff --git a/adapter/src/main/java/com/iluwatar/adapter/RowingBoat.java b/adapter/src/main/java/com/iluwatar/adapter/RowingBoat.java index 672511770bc7..3b43da732bd3 100644 --- a/adapter/src/main/java/com/iluwatar/adapter/RowingBoat.java +++ b/adapter/src/main/java/com/iluwatar/adapter/RowingBoat.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.adapter; /** diff --git a/adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java b/adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java index b5164c68de2f..d4cca004f599 100644 --- a/adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java +++ b/adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.adapter; import org.junit.jupiter.api.BeforeEach; diff --git a/adapter/src/test/java/com/iluwatar/adapter/AppTest.java b/adapter/src/test/java/com/iluwatar/adapter/AppTest.java index 5c7303353496..7e94241b635f 100644 --- a/adapter/src/test/java/com/iluwatar/adapter/AppTest.java +++ b/adapter/src/test/java/com/iluwatar/adapter/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.adapter; import org.junit.jupiter.api.Test; diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java index 593d83e1378e..e96ac9d43c2c 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.aggregator.microservices; import javax.annotation.Resource; diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/App.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/App.java index 5221ddd8abcf..ab4b11dcf619 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/App.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.aggregator.microservices; import org.springframework.boot.SpringApplication; diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Product.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Product.java index f47a035a91f5..3c214a58a9f5 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Product.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Product.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.aggregator.microservices; /** diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClient.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClient.java index 72684668b0fe..47d786ec6aeb 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClient.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClient.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.aggregator.microservices; /** diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java index f04906b476d2..0fe68da17325 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInformationClientImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.aggregator.microservices; import java.io.IOException; diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClient.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClient.java index e7780257e338..ed325be0070f 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClient.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClient.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.aggregator.microservices; /** diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java index c92eb678c152..c43fe84c61ca 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.aggregator.microservices; import java.io.IOException; diff --git a/aggregator-microservices/aggregator-service/src/test/java/com/iluwatar/aggregator/microservices/AggregatorTest.java b/aggregator-microservices/aggregator-service/src/test/java/com/iluwatar/aggregator/microservices/AggregatorTest.java index 8aeab6d8dda5..59d790de27ce 100644 --- a/aggregator-microservices/aggregator-service/src/test/java/com/iluwatar/aggregator/microservices/AggregatorTest.java +++ b/aggregator-microservices/aggregator-service/src/test/java/com/iluwatar/aggregator/microservices/AggregatorTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.aggregator.microservices; import org.junit.jupiter.api.BeforeEach; diff --git a/aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationApplication.java b/aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationApplication.java index c027f14993ec..3815fffc4cc7 100644 --- a/aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationApplication.java +++ b/aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationApplication.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.information.microservice; import org.springframework.boot.SpringApplication; diff --git a/aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationController.java b/aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationController.java index f22d17eab4c1..8306fd7855a5 100644 --- a/aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationController.java +++ b/aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationController.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.information.microservice; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/aggregator-microservices/information-microservice/src/test/java/com/iluwatar/information/microservice/InformationControllerTest.java b/aggregator-microservices/information-microservice/src/test/java/com/iluwatar/information/microservice/InformationControllerTest.java index 4f880d375a45..3f3f1b511452 100644 --- a/aggregator-microservices/information-microservice/src/test/java/com/iluwatar/information/microservice/InformationControllerTest.java +++ b/aggregator-microservices/information-microservice/src/test/java/com/iluwatar/information/microservice/InformationControllerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.information.microservice; import org.junit.jupiter.api.Test; diff --git a/aggregator-microservices/inventory-microservice/src/main/java/com/iluwatar/inventory/microservice/InventoryApplication.java b/aggregator-microservices/inventory-microservice/src/main/java/com/iluwatar/inventory/microservice/InventoryApplication.java index 8fed4d4d7448..9a49518b536e 100644 --- a/aggregator-microservices/inventory-microservice/src/main/java/com/iluwatar/inventory/microservice/InventoryApplication.java +++ b/aggregator-microservices/inventory-microservice/src/main/java/com/iluwatar/inventory/microservice/InventoryApplication.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.inventory.microservice; import org.springframework.boot.SpringApplication; diff --git a/aggregator-microservices/inventory-microservice/src/main/java/com/iluwatar/inventory/microservice/InventoryController.java b/aggregator-microservices/inventory-microservice/src/main/java/com/iluwatar/inventory/microservice/InventoryController.java index 5117107b3efa..85eea4e9cef1 100644 --- a/aggregator-microservices/inventory-microservice/src/main/java/com/iluwatar/inventory/microservice/InventoryController.java +++ b/aggregator-microservices/inventory-microservice/src/main/java/com/iluwatar/inventory/microservice/InventoryController.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.inventory.microservice; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/aggregator-microservices/inventory-microservice/src/test/java/com/iluwatar/inventory/microservice/InventoryControllerTest.java b/aggregator-microservices/inventory-microservice/src/test/java/com/iluwatar/inventory/microservice/InventoryControllerTest.java index 063cb9d9d73d..8933053d417a 100644 --- a/aggregator-microservices/inventory-microservice/src/test/java/com/iluwatar/inventory/microservice/InventoryControllerTest.java +++ b/aggregator-microservices/inventory-microservice/src/test/java/com/iluwatar/inventory/microservice/InventoryControllerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.inventory.microservice; import org.junit.jupiter.api.Test; diff --git a/ambassador/src/main/java/com/iluwatar/ambassador/App.java b/ambassador/src/main/java/com/iluwatar/ambassador/App.java index 465981d41958..6b0b048c8b97 100644 --- a/ambassador/src/main/java/com/iluwatar/ambassador/App.java +++ b/ambassador/src/main/java/com/iluwatar/ambassador/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.ambassador; /** diff --git a/ambassador/src/main/java/com/iluwatar/ambassador/Client.java b/ambassador/src/main/java/com/iluwatar/ambassador/Client.java index 3637c05bed0f..fdadd71d26dd 100644 --- a/ambassador/src/main/java/com/iluwatar/ambassador/Client.java +++ b/ambassador/src/main/java/com/iluwatar/ambassador/Client.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.ambassador; import org.slf4j.LoggerFactory; diff --git a/ambassador/src/main/java/com/iluwatar/ambassador/RemoteService.java b/ambassador/src/main/java/com/iluwatar/ambassador/RemoteService.java index ad26951fd30b..10da79d0b937 100644 --- a/ambassador/src/main/java/com/iluwatar/ambassador/RemoteService.java +++ b/ambassador/src/main/java/com/iluwatar/ambassador/RemoteService.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.ambassador; import com.iluwatar.ambassador.util.RandomProvider; diff --git a/ambassador/src/main/java/com/iluwatar/ambassador/RemoteServiceInterface.java b/ambassador/src/main/java/com/iluwatar/ambassador/RemoteServiceInterface.java index 394839f2acad..013015936957 100644 --- a/ambassador/src/main/java/com/iluwatar/ambassador/RemoteServiceInterface.java +++ b/ambassador/src/main/java/com/iluwatar/ambassador/RemoteServiceInterface.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.ambassador; /** diff --git a/ambassador/src/main/java/com/iluwatar/ambassador/ServiceAmbassador.java b/ambassador/src/main/java/com/iluwatar/ambassador/ServiceAmbassador.java index 00a39e01b75e..37b6970b451d 100644 --- a/ambassador/src/main/java/com/iluwatar/ambassador/ServiceAmbassador.java +++ b/ambassador/src/main/java/com/iluwatar/ambassador/ServiceAmbassador.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.ambassador; import org.slf4j.Logger; diff --git a/ambassador/src/main/java/com/iluwatar/ambassador/util/RandomProvider.java b/ambassador/src/main/java/com/iluwatar/ambassador/util/RandomProvider.java index 9b46e096fbef..5948472c0062 100644 --- a/ambassador/src/main/java/com/iluwatar/ambassador/util/RandomProvider.java +++ b/ambassador/src/main/java/com/iluwatar/ambassador/util/RandomProvider.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.ambassador.util; /** diff --git a/ambassador/src/test/java/com/iluwatar/ambassador/AppTest.java b/ambassador/src/test/java/com/iluwatar/ambassador/AppTest.java index e5a28addb054..ff868b13b81d 100644 --- a/ambassador/src/test/java/com/iluwatar/ambassador/AppTest.java +++ b/ambassador/src/test/java/com/iluwatar/ambassador/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.ambassador; import org.junit.jupiter.api.Test; diff --git a/ambassador/src/test/java/com/iluwatar/ambassador/ClientTest.java b/ambassador/src/test/java/com/iluwatar/ambassador/ClientTest.java index aadb4b137a09..c3cbd66cb1aa 100644 --- a/ambassador/src/test/java/com/iluwatar/ambassador/ClientTest.java +++ b/ambassador/src/test/java/com/iluwatar/ambassador/ClientTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.ambassador; import org.junit.jupiter.api.Test; diff --git a/ambassador/src/test/java/com/iluwatar/ambassador/RemoteServiceTest.java b/ambassador/src/test/java/com/iluwatar/ambassador/RemoteServiceTest.java index a8e5822930ef..5f1ff4db759f 100644 --- a/ambassador/src/test/java/com/iluwatar/ambassador/RemoteServiceTest.java +++ b/ambassador/src/test/java/com/iluwatar/ambassador/RemoteServiceTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.ambassador; import com.iluwatar.ambassador.util.RandomProvider; diff --git a/ambassador/src/test/java/com/iluwatar/ambassador/ServiceAmbassadorTest.java b/ambassador/src/test/java/com/iluwatar/ambassador/ServiceAmbassadorTest.java index 3b1fe51d09a2..2737c957e315 100644 --- a/ambassador/src/test/java/com/iluwatar/ambassador/ServiceAmbassadorTest.java +++ b/ambassador/src/test/java/com/iluwatar/ambassador/ServiceAmbassadorTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.ambassador; import org.junit.jupiter.api.Test; diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ApiGateway.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ApiGateway.java index dc4249c6eb3d..25c201521578 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ApiGateway.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ApiGateway.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.api.gateway; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/App.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/App.java index ba4b67c39c89..b92e3a7d0d36 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/App.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.api.gateway; import org.springframework.boot.SpringApplication; diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/DesktopProduct.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/DesktopProduct.java index 89de62b1b730..06b9e949533d 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/DesktopProduct.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/DesktopProduct.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.api.gateway; /** diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClient.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClient.java index bc166c4c89f4..9c8c341ccd84 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClient.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClient.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.api.gateway; /** diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClientImpl.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClientImpl.java index dddd0dc20f60..d2f80858cc49 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClientImpl.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClientImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.api.gateway; import java.io.IOException; diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/MobileProduct.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/MobileProduct.java index 41644fb32a28..b7edb1047275 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/MobileProduct.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/MobileProduct.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.api.gateway; /** diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClient.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClient.java index fca5fe32c573..74c564132939 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClient.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClient.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.api.gateway; /** diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClientImpl.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClientImpl.java index 25d7f0b1169c..0a43c4b1fcfe 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClientImpl.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClientImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.api.gateway; import java.io.IOException; diff --git a/api-gateway/api-gateway-service/src/test/java/com/iluwatar/api/gateway/ApiGatewayTest.java b/api-gateway/api-gateway-service/src/test/java/com/iluwatar/api/gateway/ApiGatewayTest.java index ec579ead69a8..27068b52beb4 100644 --- a/api-gateway/api-gateway-service/src/test/java/com/iluwatar/api/gateway/ApiGatewayTest.java +++ b/api-gateway/api-gateway-service/src/test/java/com/iluwatar/api/gateway/ApiGatewayTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.api.gateway; import org.junit.jupiter.api.BeforeEach; diff --git a/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageApplication.java b/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageApplication.java index 86580ad8563e..bb551ac31ecb 100644 --- a/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageApplication.java +++ b/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageApplication.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.image.microservice; import org.springframework.boot.SpringApplication; diff --git a/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageController.java b/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageController.java index 5a84e700898b..9781dbc011aa 100644 --- a/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageController.java +++ b/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageController.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.image.microservice; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/api-gateway/image-microservice/src/test/java/com/iluwatar/image/microservice/ImageControllerTest.java b/api-gateway/image-microservice/src/test/java/com/iluwatar/image/microservice/ImageControllerTest.java index 71044b56d496..d0c44ff0fa97 100644 --- a/api-gateway/image-microservice/src/test/java/com/iluwatar/image/microservice/ImageControllerTest.java +++ b/api-gateway/image-microservice/src/test/java/com/iluwatar/image/microservice/ImageControllerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.image.microservice; import org.junit.jupiter.api.Test; diff --git a/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceApplication.java b/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceApplication.java index 1edaf4c32b9a..1a29e53c9e98 100644 --- a/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceApplication.java +++ b/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceApplication.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.price.microservice; import org.springframework.boot.SpringApplication; diff --git a/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceController.java b/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceController.java index 8af122648e27..efb982253417 100644 --- a/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceController.java +++ b/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceController.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.price.microservice; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/api-gateway/price-microservice/src/test/java/com/iluwatar/price/microservice/PriceControllerTest.java b/api-gateway/price-microservice/src/test/java/com/iluwatar/price/microservice/PriceControllerTest.java index a2c5c81616e5..54a4413a96ad 100644 --- a/api-gateway/price-microservice/src/test/java/com/iluwatar/price/microservice/PriceControllerTest.java +++ b/api-gateway/price-microservice/src/test/java/com/iluwatar/price/microservice/PriceControllerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.price.microservice; import org.junit.jupiter.api.Test; diff --git a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/App.java b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/App.java index 0e0471c94029..bc33494f73f5 100644 --- a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/App.java +++ b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.async.method.invocation; import org.slf4j.Logger; diff --git a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncCallback.java b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncCallback.java index ffa162dbe475..950444fe7a17 100644 --- a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncCallback.java +++ b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncCallback.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.async.method.invocation; import java.util.Optional; diff --git a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncExecutor.java b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncExecutor.java index 8fa58d3f914d..14e30cbebdc2 100644 --- a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncExecutor.java +++ b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncExecutor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.async.method.invocation; import java.util.concurrent.Callable; diff --git a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncResult.java b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncResult.java index 7001521444e9..c3b8467f1c8a 100644 --- a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncResult.java +++ b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncResult.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.async.method.invocation; import java.util.concurrent.ExecutionException; diff --git a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutor.java b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutor.java index c5f01b662023..f05b83b4f21a 100644 --- a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutor.java +++ b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.async.method.invocation; import java.util.Optional; diff --git a/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/AppTest.java b/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/AppTest.java index dd0cfd9ffaed..769cd66c4f90 100644 --- a/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/AppTest.java +++ b/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.async.method.invocation; import org.junit.jupiter.api.Test; diff --git a/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutorTest.java b/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutorTest.java index 3f43e67af762..d240f3c2eca1 100644 --- a/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutorTest.java +++ b/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutorTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.async.method.invocation; import org.junit.jupiter.api.Test; diff --git a/balking/src/main/java/com/iluwatar/balking/App.java b/balking/src/main/java/com/iluwatar/balking/App.java index 97fdda1854da..bb3fb085c077 100644 --- a/balking/src/main/java/com/iluwatar/balking/App.java +++ b/balking/src/main/java/com/iluwatar/balking/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.balking; import org.slf4j.Logger; diff --git a/balking/src/main/java/com/iluwatar/balking/DelayProvider.java b/balking/src/main/java/com/iluwatar/balking/DelayProvider.java index bce94699739e..ed05cd292f6f 100644 --- a/balking/src/main/java/com/iluwatar/balking/DelayProvider.java +++ b/balking/src/main/java/com/iluwatar/balking/DelayProvider.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.balking; import java.util.concurrent.TimeUnit; diff --git a/balking/src/main/java/com/iluwatar/balking/WashingMachine.java b/balking/src/main/java/com/iluwatar/balking/WashingMachine.java index 5fe32a1065df..044b1b6e9f36 100644 --- a/balking/src/main/java/com/iluwatar/balking/WashingMachine.java +++ b/balking/src/main/java/com/iluwatar/balking/WashingMachine.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.balking; import org.slf4j.Logger; diff --git a/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java b/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java index d6b7f7249b5e..0799d3fd8edb 100644 --- a/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java +++ b/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.balking; /** diff --git a/balking/src/test/java/com/iluwatar/balking/AppTest.java b/balking/src/test/java/com/iluwatar/balking/AppTest.java index ca9af5262e00..440427f9f030 100644 --- a/balking/src/test/java/com/iluwatar/balking/AppTest.java +++ b/balking/src/test/java/com/iluwatar/balking/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.balking; import org.junit.jupiter.api.Test; diff --git a/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java b/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java index 4140e74aac33..8348f9256dee 100644 --- a/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java +++ b/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.balking; import org.junit.jupiter.api.Test; diff --git a/bridge/src/main/java/com/iluwatar/bridge/App.java b/bridge/src/main/java/com/iluwatar/bridge/App.java index 89584cc922f7..195f463cf40d 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/App.java +++ b/bridge/src/main/java/com/iluwatar/bridge/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bridge; import org.slf4j.Logger; diff --git a/bridge/src/main/java/com/iluwatar/bridge/Enchantment.java b/bridge/src/main/java/com/iluwatar/bridge/Enchantment.java index 3e14a00b2767..22acac8f9a1d 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/Enchantment.java +++ b/bridge/src/main/java/com/iluwatar/bridge/Enchantment.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bridge; /** diff --git a/bridge/src/main/java/com/iluwatar/bridge/FlyingEnchantment.java b/bridge/src/main/java/com/iluwatar/bridge/FlyingEnchantment.java index 2aeb8e6389ca..14abe4c635cd 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/FlyingEnchantment.java +++ b/bridge/src/main/java/com/iluwatar/bridge/FlyingEnchantment.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bridge; import org.slf4j.Logger; diff --git a/bridge/src/main/java/com/iluwatar/bridge/Hammer.java b/bridge/src/main/java/com/iluwatar/bridge/Hammer.java index 6943ddd4902d..47f60613d239 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/Hammer.java +++ b/bridge/src/main/java/com/iluwatar/bridge/Hammer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bridge; import org.slf4j.Logger; diff --git a/bridge/src/main/java/com/iluwatar/bridge/SoulEatingEnchantment.java b/bridge/src/main/java/com/iluwatar/bridge/SoulEatingEnchantment.java index a9ebbf251db6..3655c7e97722 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/SoulEatingEnchantment.java +++ b/bridge/src/main/java/com/iluwatar/bridge/SoulEatingEnchantment.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bridge; import org.slf4j.Logger; diff --git a/bridge/src/main/java/com/iluwatar/bridge/Sword.java b/bridge/src/main/java/com/iluwatar/bridge/Sword.java index 19650999da6c..ab6f4ab7feff 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/Sword.java +++ b/bridge/src/main/java/com/iluwatar/bridge/Sword.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bridge; import org.slf4j.Logger; diff --git a/bridge/src/main/java/com/iluwatar/bridge/Weapon.java b/bridge/src/main/java/com/iluwatar/bridge/Weapon.java index 6c65ac8e8b2c..b264dddca794 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/Weapon.java +++ b/bridge/src/main/java/com/iluwatar/bridge/Weapon.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bridge; /** diff --git a/bridge/src/test/java/com/iluwatar/bridge/AppTest.java b/bridge/src/test/java/com/iluwatar/bridge/AppTest.java index ba9ecf21184e..55a848818b04 100644 --- a/bridge/src/test/java/com/iluwatar/bridge/AppTest.java +++ b/bridge/src/test/java/com/iluwatar/bridge/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bridge; import org.junit.jupiter.api.Test; diff --git a/bridge/src/test/java/com/iluwatar/bridge/HammerTest.java b/bridge/src/test/java/com/iluwatar/bridge/HammerTest.java index 4d17a0ddd50b..8e140862c4ab 100644 --- a/bridge/src/test/java/com/iluwatar/bridge/HammerTest.java +++ b/bridge/src/test/java/com/iluwatar/bridge/HammerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bridge; import org.junit.jupiter.api.Test; diff --git a/bridge/src/test/java/com/iluwatar/bridge/SwordTest.java b/bridge/src/test/java/com/iluwatar/bridge/SwordTest.java index 168f4d92942f..a88ba9fa19f2 100644 --- a/bridge/src/test/java/com/iluwatar/bridge/SwordTest.java +++ b/bridge/src/test/java/com/iluwatar/bridge/SwordTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bridge; import org.junit.jupiter.api.Test; diff --git a/bridge/src/test/java/com/iluwatar/bridge/WeaponTest.java b/bridge/src/test/java/com/iluwatar/bridge/WeaponTest.java index 39b30d80b6de..4ca9d9ef059a 100644 --- a/bridge/src/test/java/com/iluwatar/bridge/WeaponTest.java +++ b/bridge/src/test/java/com/iluwatar/bridge/WeaponTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bridge; import org.junit.jupiter.api.Disabled; diff --git a/builder/src/main/java/com/iluwatar/builder/App.java b/builder/src/main/java/com/iluwatar/builder/App.java index 0b524e9adf79..f57e4d42f26f 100644 --- a/builder/src/main/java/com/iluwatar/builder/App.java +++ b/builder/src/main/java/com/iluwatar/builder/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.builder; import com.iluwatar.builder.Hero.Builder; diff --git a/builder/src/main/java/com/iluwatar/builder/Armor.java b/builder/src/main/java/com/iluwatar/builder/Armor.java index 13cf0a758119..8cf57a361a9e 100644 --- a/builder/src/main/java/com/iluwatar/builder/Armor.java +++ b/builder/src/main/java/com/iluwatar/builder/Armor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.builder; /** diff --git a/builder/src/main/java/com/iluwatar/builder/HairColor.java b/builder/src/main/java/com/iluwatar/builder/HairColor.java index 310c82c77e2e..f94de35564a4 100644 --- a/builder/src/main/java/com/iluwatar/builder/HairColor.java +++ b/builder/src/main/java/com/iluwatar/builder/HairColor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.builder; /** diff --git a/builder/src/main/java/com/iluwatar/builder/HairType.java b/builder/src/main/java/com/iluwatar/builder/HairType.java index 91416a4792e8..6eece1e373dd 100644 --- a/builder/src/main/java/com/iluwatar/builder/HairType.java +++ b/builder/src/main/java/com/iluwatar/builder/HairType.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.builder; /** diff --git a/builder/src/main/java/com/iluwatar/builder/Hero.java b/builder/src/main/java/com/iluwatar/builder/Hero.java index fff0075652a0..a8f285b66eda 100644 --- a/builder/src/main/java/com/iluwatar/builder/Hero.java +++ b/builder/src/main/java/com/iluwatar/builder/Hero.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.builder; /** diff --git a/builder/src/main/java/com/iluwatar/builder/Profession.java b/builder/src/main/java/com/iluwatar/builder/Profession.java index 2647946a25d3..1e22a1c67d85 100644 --- a/builder/src/main/java/com/iluwatar/builder/Profession.java +++ b/builder/src/main/java/com/iluwatar/builder/Profession.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.builder; /** diff --git a/builder/src/main/java/com/iluwatar/builder/Weapon.java b/builder/src/main/java/com/iluwatar/builder/Weapon.java index 1bab8ca2d386..51ddeafbce29 100644 --- a/builder/src/main/java/com/iluwatar/builder/Weapon.java +++ b/builder/src/main/java/com/iluwatar/builder/Weapon.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.builder; /** diff --git a/builder/src/test/java/com/iluwatar/builder/AppTest.java b/builder/src/test/java/com/iluwatar/builder/AppTest.java index ffee67444495..9511d3f9c48f 100644 --- a/builder/src/test/java/com/iluwatar/builder/AppTest.java +++ b/builder/src/test/java/com/iluwatar/builder/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.builder; import org.junit.jupiter.api.Test; diff --git a/builder/src/test/java/com/iluwatar/builder/HeroTest.java b/builder/src/test/java/com/iluwatar/builder/HeroTest.java index 8fa6fdd6b036..411087d9b077 100644 --- a/builder/src/test/java/com/iluwatar/builder/HeroTest.java +++ b/builder/src/test/java/com/iluwatar/builder/HeroTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.builder; import org.junit.jupiter.api.Test; diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/App.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/App.java index 00d9ab569a8b..68e382c0f051 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/App.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.business.delegate; /** diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessDelegate.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessDelegate.java index 38b90c7dfe79..cf2b251295ad 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessDelegate.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessDelegate.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.business.delegate; /** diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessLookup.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessLookup.java index 776694c93ee0..e7d8400d3249 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessLookup.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessLookup.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.business.delegate; /** diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessService.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessService.java index eaca9b202d10..6e08aca1f939 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessService.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessService.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.business.delegate; /** diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/Client.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/Client.java index 2d4e91561880..c9c8950db3a4 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/Client.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/Client.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.business.delegate; /** diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/EjbService.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/EjbService.java index b5eac51518b7..aa9457abfada 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/EjbService.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/EjbService.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.business.delegate; import org.slf4j.Logger; diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/JmsService.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/JmsService.java index 20b22a1a4527..83abd9762301 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/JmsService.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/JmsService.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.business.delegate; import org.slf4j.Logger; diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/ServiceType.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/ServiceType.java index 8f918a4e241f..a09dde59c661 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/ServiceType.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/ServiceType.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.business.delegate; /** diff --git a/business-delegate/src/test/java/com/iluwatar/business/delegate/AppTest.java b/business-delegate/src/test/java/com/iluwatar/business/delegate/AppTest.java index d31d6f7a354b..48e756acb816 100644 --- a/business-delegate/src/test/java/com/iluwatar/business/delegate/AppTest.java +++ b/business-delegate/src/test/java/com/iluwatar/business/delegate/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.business.delegate; import org.junit.jupiter.api.Test; diff --git a/business-delegate/src/test/java/com/iluwatar/business/delegate/BusinessDelegateTest.java b/business-delegate/src/test/java/com/iluwatar/business/delegate/BusinessDelegateTest.java index 296fdaeef359..dfc6dfa9d4da 100644 --- a/business-delegate/src/test/java/com/iluwatar/business/delegate/BusinessDelegateTest.java +++ b/business-delegate/src/test/java/com/iluwatar/business/delegate/BusinessDelegateTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.business.delegate; import org.junit.jupiter.api.BeforeEach; diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/App.java b/bytecode/src/main/java/com/iluwatar/bytecode/App.java index 09c8f90f3148..9a5f66d886fe 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/App.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bytecode; import com.iluwatar.bytecode.util.InstructionConverterUtil; diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java b/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java index 82ade960623a..99b632ed853e 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bytecode; /** diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java b/bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java index 324085d81ffa..c6b120963284 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bytecode; import java.util.Stack; diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/Wizard.java b/bytecode/src/main/java/com/iluwatar/bytecode/Wizard.java index 6e0a9ee41106..434a1bddd1e8 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/Wizard.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/Wizard.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bytecode; import org.slf4j.Logger; diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/util/InstructionConverterUtil.java b/bytecode/src/main/java/com/iluwatar/bytecode/util/InstructionConverterUtil.java index 3905d692fa22..bdc0782dd593 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/util/InstructionConverterUtil.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/util/InstructionConverterUtil.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bytecode.util; import com.iluwatar.bytecode.Instruction; diff --git a/bytecode/src/test/java/com/iluwatar/bytecode/AppTest.java b/bytecode/src/test/java/com/iluwatar/bytecode/AppTest.java index ae212b71c5d3..6ab29c95c884 100644 --- a/bytecode/src/test/java/com/iluwatar/bytecode/AppTest.java +++ b/bytecode/src/test/java/com/iluwatar/bytecode/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bytecode; import org.junit.jupiter.api.Test; diff --git a/bytecode/src/test/java/com/iluwatar/bytecode/VirtualMachineTest.java b/bytecode/src/test/java/com/iluwatar/bytecode/VirtualMachineTest.java index fbb3064b22b5..837c40582b1d 100644 --- a/bytecode/src/test/java/com/iluwatar/bytecode/VirtualMachineTest.java +++ b/bytecode/src/test/java/com/iluwatar/bytecode/VirtualMachineTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bytecode; import org.junit.jupiter.api.Test; diff --git a/bytecode/src/test/java/com/iluwatar/bytecode/util/InstructionConverterUtilTest.java b/bytecode/src/test/java/com/iluwatar/bytecode/util/InstructionConverterUtilTest.java index ff52ae4518ac..8c0437629b2e 100644 --- a/bytecode/src/test/java/com/iluwatar/bytecode/util/InstructionConverterUtilTest.java +++ b/bytecode/src/test/java/com/iluwatar/bytecode/util/InstructionConverterUtilTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.bytecode.util; import com.iluwatar.bytecode.Instruction; diff --git a/caching/src/main/java/com/iluwatar/caching/App.java b/caching/src/main/java/com/iluwatar/caching/App.java index 699ee983267c..4ef12b7de784 100644 --- a/caching/src/main/java/com/iluwatar/caching/App.java +++ b/caching/src/main/java/com/iluwatar/caching/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.caching; import org.slf4j.Logger; diff --git a/caching/src/main/java/com/iluwatar/caching/AppManager.java b/caching/src/main/java/com/iluwatar/caching/AppManager.java index 2545110e2146..6939c6b80b79 100644 --- a/caching/src/main/java/com/iluwatar/caching/AppManager.java +++ b/caching/src/main/java/com/iluwatar/caching/AppManager.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.caching; import java.text.ParseException; diff --git a/caching/src/main/java/com/iluwatar/caching/CacheStore.java b/caching/src/main/java/com/iluwatar/caching/CacheStore.java index 8871f8648605..e221f16e7878 100644 --- a/caching/src/main/java/com/iluwatar/caching/CacheStore.java +++ b/caching/src/main/java/com/iluwatar/caching/CacheStore.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.caching; import org.slf4j.Logger; diff --git a/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java b/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java index fe5829919507..23be7d7e2b2d 100644 --- a/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java +++ b/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.caching; /** diff --git a/caching/src/main/java/com/iluwatar/caching/DbManager.java b/caching/src/main/java/com/iluwatar/caching/DbManager.java index 434d9281b340..01b727fa540e 100644 --- a/caching/src/main/java/com/iluwatar/caching/DbManager.java +++ b/caching/src/main/java/com/iluwatar/caching/DbManager.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.caching; import java.text.ParseException; diff --git a/caching/src/main/java/com/iluwatar/caching/LruCache.java b/caching/src/main/java/com/iluwatar/caching/LruCache.java index 346a5ad448cf..0f2e53823a0a 100644 --- a/caching/src/main/java/com/iluwatar/caching/LruCache.java +++ b/caching/src/main/java/com/iluwatar/caching/LruCache.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.caching; import org.slf4j.Logger; diff --git a/caching/src/main/java/com/iluwatar/caching/UserAccount.java b/caching/src/main/java/com/iluwatar/caching/UserAccount.java index f64b5952c056..fc6b8cb4c5eb 100644 --- a/caching/src/main/java/com/iluwatar/caching/UserAccount.java +++ b/caching/src/main/java/com/iluwatar/caching/UserAccount.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.caching; /** diff --git a/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java b/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java index 514a1e7f7bbd..7e53f61f0cf6 100644 --- a/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java +++ b/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.caching.constants; /** diff --git a/caching/src/test/java/com/iluwatar/caching/AppTest.java b/caching/src/test/java/com/iluwatar/caching/AppTest.java index 61b65544cf98..cb696f804606 100644 --- a/caching/src/test/java/com/iluwatar/caching/AppTest.java +++ b/caching/src/test/java/com/iluwatar/caching/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.caching; import org.junit.jupiter.api.Test; diff --git a/caching/src/test/java/com/iluwatar/caching/CachingTest.java b/caching/src/test/java/com/iluwatar/caching/CachingTest.java index e978d31a2a2c..ed6004429df8 100644 --- a/caching/src/test/java/com/iluwatar/caching/CachingTest.java +++ b/caching/src/test/java/com/iluwatar/caching/CachingTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.caching; import org.junit.jupiter.api.BeforeEach; diff --git a/callback/src/main/java/com/iluwatar/callback/App.java b/callback/src/main/java/com/iluwatar/callback/App.java index 4fa546fe693a..3a9cd00cb185 100644 --- a/callback/src/main/java/com/iluwatar/callback/App.java +++ b/callback/src/main/java/com/iluwatar/callback/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.callback; import org.slf4j.Logger; diff --git a/callback/src/main/java/com/iluwatar/callback/Callback.java b/callback/src/main/java/com/iluwatar/callback/Callback.java index d871e3345861..15f08366275d 100644 --- a/callback/src/main/java/com/iluwatar/callback/Callback.java +++ b/callback/src/main/java/com/iluwatar/callback/Callback.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.callback; /** diff --git a/callback/src/main/java/com/iluwatar/callback/LambdasApp.java b/callback/src/main/java/com/iluwatar/callback/LambdasApp.java index d6cd5d22c148..2b445d9ca440 100644 --- a/callback/src/main/java/com/iluwatar/callback/LambdasApp.java +++ b/callback/src/main/java/com/iluwatar/callback/LambdasApp.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.callback; import org.slf4j.Logger; diff --git a/callback/src/main/java/com/iluwatar/callback/SimpleTask.java b/callback/src/main/java/com/iluwatar/callback/SimpleTask.java index 9b0c16fc5cc4..155d1e96dad7 100644 --- a/callback/src/main/java/com/iluwatar/callback/SimpleTask.java +++ b/callback/src/main/java/com/iluwatar/callback/SimpleTask.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.callback; import org.slf4j.Logger; diff --git a/callback/src/main/java/com/iluwatar/callback/Task.java b/callback/src/main/java/com/iluwatar/callback/Task.java index b8257e1fcb1f..9f2abe85fa21 100644 --- a/callback/src/main/java/com/iluwatar/callback/Task.java +++ b/callback/src/main/java/com/iluwatar/callback/Task.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.callback; /** diff --git a/callback/src/test/java/com/iluwatar/callback/AppTest.java b/callback/src/test/java/com/iluwatar/callback/AppTest.java index 1d7c96f91740..e954d8f04fc2 100644 --- a/callback/src/test/java/com/iluwatar/callback/AppTest.java +++ b/callback/src/test/java/com/iluwatar/callback/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.callback; import org.junit.jupiter.api.Test; diff --git a/callback/src/test/java/com/iluwatar/callback/CallbackTest.java b/callback/src/test/java/com/iluwatar/callback/CallbackTest.java index 5f07e4690cd1..7f424f79dfc0 100644 --- a/callback/src/test/java/com/iluwatar/callback/CallbackTest.java +++ b/callback/src/test/java/com/iluwatar/callback/CallbackTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.callback; import org.junit.jupiter.api.Test; diff --git a/chain/src/main/java/com/iluwatar/chain/App.java b/chain/src/main/java/com/iluwatar/chain/App.java index b696ff6e989a..c45d682769bf 100644 --- a/chain/src/main/java/com/iluwatar/chain/App.java +++ b/chain/src/main/java/com/iluwatar/chain/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.chain; /** diff --git a/chain/src/main/java/com/iluwatar/chain/OrcCommander.java b/chain/src/main/java/com/iluwatar/chain/OrcCommander.java index 23abddfccf1d..4770eafcb624 100644 --- a/chain/src/main/java/com/iluwatar/chain/OrcCommander.java +++ b/chain/src/main/java/com/iluwatar/chain/OrcCommander.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.chain; /** diff --git a/chain/src/main/java/com/iluwatar/chain/OrcKing.java b/chain/src/main/java/com/iluwatar/chain/OrcKing.java index 143a02a9dc3a..39243d0fdc5c 100644 --- a/chain/src/main/java/com/iluwatar/chain/OrcKing.java +++ b/chain/src/main/java/com/iluwatar/chain/OrcKing.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.chain; /** diff --git a/chain/src/main/java/com/iluwatar/chain/OrcOfficer.java b/chain/src/main/java/com/iluwatar/chain/OrcOfficer.java index 363b5505499b..6cf78b11dcb7 100644 --- a/chain/src/main/java/com/iluwatar/chain/OrcOfficer.java +++ b/chain/src/main/java/com/iluwatar/chain/OrcOfficer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.chain; /** diff --git a/chain/src/main/java/com/iluwatar/chain/OrcSoldier.java b/chain/src/main/java/com/iluwatar/chain/OrcSoldier.java index dcb3b78a86c5..686840d9548f 100644 --- a/chain/src/main/java/com/iluwatar/chain/OrcSoldier.java +++ b/chain/src/main/java/com/iluwatar/chain/OrcSoldier.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.chain; /** diff --git a/chain/src/main/java/com/iluwatar/chain/Request.java b/chain/src/main/java/com/iluwatar/chain/Request.java index 0afb681e5058..c8962aafa954 100644 --- a/chain/src/main/java/com/iluwatar/chain/Request.java +++ b/chain/src/main/java/com/iluwatar/chain/Request.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.chain; import java.util.Objects; diff --git a/chain/src/main/java/com/iluwatar/chain/RequestHandler.java b/chain/src/main/java/com/iluwatar/chain/RequestHandler.java index de43e23a54a8..aed5c0611cd6 100644 --- a/chain/src/main/java/com/iluwatar/chain/RequestHandler.java +++ b/chain/src/main/java/com/iluwatar/chain/RequestHandler.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.chain; import org.slf4j.Logger; diff --git a/chain/src/main/java/com/iluwatar/chain/RequestType.java b/chain/src/main/java/com/iluwatar/chain/RequestType.java index 03391bef258e..4e377a2b6215 100644 --- a/chain/src/main/java/com/iluwatar/chain/RequestType.java +++ b/chain/src/main/java/com/iluwatar/chain/RequestType.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.chain; /** diff --git a/chain/src/test/java/com/iluwatar/chain/AppTest.java b/chain/src/test/java/com/iluwatar/chain/AppTest.java index d7964c86d2ad..da73476eaa1b 100644 --- a/chain/src/test/java/com/iluwatar/chain/AppTest.java +++ b/chain/src/test/java/com/iluwatar/chain/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.chain; import org.junit.jupiter.api.Test; diff --git a/chain/src/test/java/com/iluwatar/chain/OrcKingTest.java b/chain/src/test/java/com/iluwatar/chain/OrcKingTest.java index 7e9c2a7071b2..cf957f119900 100644 --- a/chain/src/test/java/com/iluwatar/chain/OrcKingTest.java +++ b/chain/src/test/java/com/iluwatar/chain/OrcKingTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.chain; import org.junit.jupiter.api.Test; diff --git a/circuit-breaker/pom.xml b/circuit-breaker/pom.xml index b6587b061f7a..6ef7da2236a2 100644 --- a/circuit-breaker/pom.xml +++ b/circuit-breaker/pom.xml @@ -1,7 +1,7 @@ + + + + /* + * + */EOL + (\\s|\\t)*/\\*.*$ + .*\\*/(\\s|\\t)*$ + false + true + false + + diff --git a/marker/src/main/java/App.java b/marker/src/main/java/App.java index 2958b993f7b5..93697e6ebf40 100644 --- a/marker/src/main/java/App.java +++ b/marker/src/main/java/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/marker/src/main/java/Guard.java b/marker/src/main/java/Guard.java index 9f7ba7e76090..d135d54598f4 100644 --- a/marker/src/main/java/Guard.java +++ b/marker/src/main/java/Guard.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/marker/src/main/java/Permission.java b/marker/src/main/java/Permission.java index 369173cb5266..e1b45e99f7f4 100644 --- a/marker/src/main/java/Permission.java +++ b/marker/src/main/java/Permission.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + /** * Interface without any methods * Marker interface is based on that assumption diff --git a/marker/src/main/java/Thief.java b/marker/src/main/java/Thief.java index 11be5828b7eb..155a974c19d3 100644 --- a/marker/src/main/java/Thief.java +++ b/marker/src/main/java/Thief.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/marker/src/test/java/AppTest.java b/marker/src/test/java/AppTest.java index c658caba07d5..5d63db0ad8d6 100644 --- a/marker/src/test/java/AppTest.java +++ b/marker/src/test/java/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + import org.junit.jupiter.api.Test; /** diff --git a/marker/src/test/java/GuardTest.java b/marker/src/test/java/GuardTest.java index 9ab5ac018fb3..615d4e129886 100644 --- a/marker/src/test/java/GuardTest.java +++ b/marker/src/test/java/GuardTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.instanceOf; diff --git a/marker/src/test/java/ThiefTest.java b/marker/src/test/java/ThiefTest.java index 813ebe907609..2732fc78a965 100644 --- a/marker/src/test/java/ThiefTest.java +++ b/marker/src/test/java/ThiefTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/App.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/App.java index 46c0baf8d16c..e3ffd08c4d44 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/App.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker; import com.iluwatar.masterworker.system.ArrayTransposeMasterWorker; diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayInput.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayInput.java index fcd4ab977eb7..df2d691b26eb 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayInput.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayInput.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker; import java.util.ArrayList; diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayResult.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayResult.java index 47c0d364a0f7..dbe4f7477c12 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayResult.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayResult.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker; /** diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayUtilityMethods.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayUtilityMethods.java index 576ffb6bf000..04db66492a13 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayUtilityMethods.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/ArrayUtilityMethods.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker; import org.slf4j.Logger; diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/Input.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/Input.java index 6e89e9476bf8..d0d0c2ddeac4 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/Input.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/Input.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker; import java.util.ArrayList; diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/Result.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/Result.java index 0e73e21b3f04..1bc729aa9228 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/Result.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/Result.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker; /** diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/ArrayTransposeMasterWorker.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/ArrayTransposeMasterWorker.java index aba8c92d62b9..76e9ff35ab08 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/ArrayTransposeMasterWorker.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/ArrayTransposeMasterWorker.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker.system; import com.iluwatar.masterworker.system.systemmaster.ArrayTransposeMaster; diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/MasterWorker.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/MasterWorker.java index 142b5fd7c2cc..009faf106536 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/MasterWorker.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/MasterWorker.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker.system; import com.iluwatar.masterworker.Input; diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemmaster/ArrayTransposeMaster.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemmaster/ArrayTransposeMaster.java index 81068878b984..0a3ab79b7cc1 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemmaster/ArrayTransposeMaster.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemmaster/ArrayTransposeMaster.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker.system.systemmaster; import java.util.ArrayList; diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemmaster/Master.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemmaster/Master.java index 4a2d98f34093..7e7d796eb718 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemmaster/Master.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemmaster/Master.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker.system.systemmaster; import java.util.ArrayList; diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemworkers/ArrayTransposeWorker.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemworkers/ArrayTransposeWorker.java index 9820284657d6..1d06fcc875da 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemworkers/ArrayTransposeWorker.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemworkers/ArrayTransposeWorker.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker.system.systemworkers; import com.iluwatar.masterworker.ArrayInput; diff --git a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemworkers/Worker.java b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemworkers/Worker.java index 99c769a4a087..fff38e953216 100644 --- a/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemworkers/Worker.java +++ b/master-worker-pattern/src/main/java/com/iluwatar/masterworker/system/systemworkers/Worker.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker.system.systemworkers; import com.iluwatar.masterworker.Input; diff --git a/master-worker-pattern/src/test/java/com/iluwatar/masterworker/ArrayInputTest.java b/master-worker-pattern/src/test/java/com/iluwatar/masterworker/ArrayInputTest.java index 46b2cce9d27a..b5820e2af931 100644 --- a/master-worker-pattern/src/test/java/com/iluwatar/masterworker/ArrayInputTest.java +++ b/master-worker-pattern/src/test/java/com/iluwatar/masterworker/ArrayInputTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker; import static org.junit.jupiter.api.Assertions.*; diff --git a/master-worker-pattern/src/test/java/com/iluwatar/masterworker/ArrayUtilityMethodsTest.java b/master-worker-pattern/src/test/java/com/iluwatar/masterworker/ArrayUtilityMethodsTest.java index 72282b0df825..aae784b527b5 100644 --- a/master-worker-pattern/src/test/java/com/iluwatar/masterworker/ArrayUtilityMethodsTest.java +++ b/master-worker-pattern/src/test/java/com/iluwatar/masterworker/ArrayUtilityMethodsTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker; import static org.junit.jupiter.api.Assertions.*; diff --git a/master-worker-pattern/src/test/java/com/iluwatar/masterworker/system/ArrayTransposeMasterWorkerTest.java b/master-worker-pattern/src/test/java/com/iluwatar/masterworker/system/ArrayTransposeMasterWorkerTest.java index fd97b37ad457..b80d7881f991 100644 --- a/master-worker-pattern/src/test/java/com/iluwatar/masterworker/system/ArrayTransposeMasterWorkerTest.java +++ b/master-worker-pattern/src/test/java/com/iluwatar/masterworker/system/ArrayTransposeMasterWorkerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker.system; import static org.junit.jupiter.api.Assertions.*; diff --git a/master-worker-pattern/src/test/java/com/iluwatar/masterworker/system/systemworkers/ArrayTransposeWorkerTest.java b/master-worker-pattern/src/test/java/com/iluwatar/masterworker/system/systemworkers/ArrayTransposeWorkerTest.java index e1f0433c9fa0..3e5f581b93cf 100644 --- a/master-worker-pattern/src/test/java/com/iluwatar/masterworker/system/systemworkers/ArrayTransposeWorkerTest.java +++ b/master-worker-pattern/src/test/java/com/iluwatar/masterworker/system/systemworkers/ArrayTransposeWorkerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.masterworker.system.systemworkers; import static org.junit.jupiter.api.Assertions.*; diff --git a/mediator/src/main/java/com/iluwatar/mediator/Action.java b/mediator/src/main/java/com/iluwatar/mediator/Action.java index 479f86d55fc9..dc89bcfdcd88 100644 --- a/mediator/src/main/java/com/iluwatar/mediator/Action.java +++ b/mediator/src/main/java/com/iluwatar/mediator/Action.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; /** diff --git a/mediator/src/main/java/com/iluwatar/mediator/App.java b/mediator/src/main/java/com/iluwatar/mediator/App.java index 8fd981e80493..9af600f7cc5e 100644 --- a/mediator/src/main/java/com/iluwatar/mediator/App.java +++ b/mediator/src/main/java/com/iluwatar/mediator/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; /** diff --git a/mediator/src/main/java/com/iluwatar/mediator/Hobbit.java b/mediator/src/main/java/com/iluwatar/mediator/Hobbit.java index d47cd997e5a8..1ddec27ab3a9 100644 --- a/mediator/src/main/java/com/iluwatar/mediator/Hobbit.java +++ b/mediator/src/main/java/com/iluwatar/mediator/Hobbit.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; /** diff --git a/mediator/src/main/java/com/iluwatar/mediator/Hunter.java b/mediator/src/main/java/com/iluwatar/mediator/Hunter.java index 5e7a703f5f51..ed73c1684ccb 100644 --- a/mediator/src/main/java/com/iluwatar/mediator/Hunter.java +++ b/mediator/src/main/java/com/iluwatar/mediator/Hunter.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; /** diff --git a/mediator/src/main/java/com/iluwatar/mediator/Party.java b/mediator/src/main/java/com/iluwatar/mediator/Party.java index a4e9f6348e65..c28b063f35b8 100644 --- a/mediator/src/main/java/com/iluwatar/mediator/Party.java +++ b/mediator/src/main/java/com/iluwatar/mediator/Party.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; /** diff --git a/mediator/src/main/java/com/iluwatar/mediator/PartyImpl.java b/mediator/src/main/java/com/iluwatar/mediator/PartyImpl.java index 31bdbf019c4e..a2a755408620 100644 --- a/mediator/src/main/java/com/iluwatar/mediator/PartyImpl.java +++ b/mediator/src/main/java/com/iluwatar/mediator/PartyImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; import java.util.ArrayList; diff --git a/mediator/src/main/java/com/iluwatar/mediator/PartyMember.java b/mediator/src/main/java/com/iluwatar/mediator/PartyMember.java index 815614ebbb6d..a45b37b17cd3 100644 --- a/mediator/src/main/java/com/iluwatar/mediator/PartyMember.java +++ b/mediator/src/main/java/com/iluwatar/mediator/PartyMember.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; /** diff --git a/mediator/src/main/java/com/iluwatar/mediator/PartyMemberBase.java b/mediator/src/main/java/com/iluwatar/mediator/PartyMemberBase.java index c5825e0d9eb8..7ff3535e85d4 100644 --- a/mediator/src/main/java/com/iluwatar/mediator/PartyMemberBase.java +++ b/mediator/src/main/java/com/iluwatar/mediator/PartyMemberBase.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; import org.slf4j.Logger; diff --git a/mediator/src/main/java/com/iluwatar/mediator/Rogue.java b/mediator/src/main/java/com/iluwatar/mediator/Rogue.java index 551c51037c50..226bd8f04c4f 100644 --- a/mediator/src/main/java/com/iluwatar/mediator/Rogue.java +++ b/mediator/src/main/java/com/iluwatar/mediator/Rogue.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; /** diff --git a/mediator/src/main/java/com/iluwatar/mediator/Wizard.java b/mediator/src/main/java/com/iluwatar/mediator/Wizard.java index 61e9b15401a4..33d7d6dce511 100644 --- a/mediator/src/main/java/com/iluwatar/mediator/Wizard.java +++ b/mediator/src/main/java/com/iluwatar/mediator/Wizard.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; /** diff --git a/mediator/src/test/java/com/iluwatar/mediator/AppTest.java b/mediator/src/test/java/com/iluwatar/mediator/AppTest.java index 8a24bb76d5ba..3a55d51d8e53 100644 --- a/mediator/src/test/java/com/iluwatar/mediator/AppTest.java +++ b/mediator/src/test/java/com/iluwatar/mediator/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; import org.junit.jupiter.api.Test; diff --git a/mediator/src/test/java/com/iluwatar/mediator/PartyImplTest.java b/mediator/src/test/java/com/iluwatar/mediator/PartyImplTest.java index 2090403062b1..5d2446545eac 100644 --- a/mediator/src/test/java/com/iluwatar/mediator/PartyImplTest.java +++ b/mediator/src/test/java/com/iluwatar/mediator/PartyImplTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; import org.junit.jupiter.api.Test; diff --git a/mediator/src/test/java/com/iluwatar/mediator/PartyMemberTest.java b/mediator/src/test/java/com/iluwatar/mediator/PartyMemberTest.java index b9baac60d6b1..b7092347b840 100644 --- a/mediator/src/test/java/com/iluwatar/mediator/PartyMemberTest.java +++ b/mediator/src/test/java/com/iluwatar/mediator/PartyMemberTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mediator; import ch.qos.logback.classic.Logger; diff --git a/memento/src/main/java/com/iluwatar/memento/App.java b/memento/src/main/java/com/iluwatar/memento/App.java index 64c283bdc790..fc6dffb06cb6 100644 --- a/memento/src/main/java/com/iluwatar/memento/App.java +++ b/memento/src/main/java/com/iluwatar/memento/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.memento; import org.slf4j.Logger; diff --git a/memento/src/main/java/com/iluwatar/memento/Star.java b/memento/src/main/java/com/iluwatar/memento/Star.java index 06b24448a9d9..0e235752ec4e 100644 --- a/memento/src/main/java/com/iluwatar/memento/Star.java +++ b/memento/src/main/java/com/iluwatar/memento/Star.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.memento; /** diff --git a/memento/src/main/java/com/iluwatar/memento/StarMemento.java b/memento/src/main/java/com/iluwatar/memento/StarMemento.java index fe5b26a58483..b94f5996a9db 100644 --- a/memento/src/main/java/com/iluwatar/memento/StarMemento.java +++ b/memento/src/main/java/com/iluwatar/memento/StarMemento.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.memento; /** diff --git a/memento/src/main/java/com/iluwatar/memento/StarType.java b/memento/src/main/java/com/iluwatar/memento/StarType.java index a7bea6be861b..29da625799ce 100644 --- a/memento/src/main/java/com/iluwatar/memento/StarType.java +++ b/memento/src/main/java/com/iluwatar/memento/StarType.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.memento; /** diff --git a/memento/src/test/java/com/iluwatar/memento/AppTest.java b/memento/src/test/java/com/iluwatar/memento/AppTest.java index d432c9e8e724..074de2c41606 100644 --- a/memento/src/test/java/com/iluwatar/memento/AppTest.java +++ b/memento/src/test/java/com/iluwatar/memento/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.memento; import org.junit.jupiter.api.Test; diff --git a/memento/src/test/java/com/iluwatar/memento/StarTest.java b/memento/src/test/java/com/iluwatar/memento/StarTest.java index bf9c3dacad8d..40adb99e198f 100644 --- a/memento/src/test/java/com/iluwatar/memento/StarTest.java +++ b/memento/src/test/java/com/iluwatar/memento/StarTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.memento; import org.junit.jupiter.api.Test; diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/App.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/App.java index cede84db2c7c..b4bc8f6ca4a6 100644 --- a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/App.java +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.controller; /** diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/Fatigue.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/Fatigue.java index 300c23ab4213..7f0fd293741c 100644 --- a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/Fatigue.java +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/Fatigue.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.controller; /** diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantController.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantController.java index 4efc6c8b8eea..e420ec890870 100644 --- a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantController.java +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantController.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.controller; /** diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantModel.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantModel.java index bce81cb70f57..4ae2c4c195ba 100644 --- a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantModel.java +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantModel.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.controller; /** diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantView.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantView.java index 39db87991ebe..9590d609d61f 100644 --- a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantView.java +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/GiantView.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.controller; import org.slf4j.Logger; diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/Health.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/Health.java index 84f402943d07..c8b9374bf43b 100644 --- a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/Health.java +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/Health.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.controller; /** diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/Nourishment.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/Nourishment.java index c56e22b2dcf2..9810b201565b 100644 --- a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/Nourishment.java +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/Nourishment.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.controller; /** diff --git a/model-view-controller/src/test/java/com/iluwatar/model/view/controller/AppTest.java b/model-view-controller/src/test/java/com/iluwatar/model/view/controller/AppTest.java index 0d2af602d118..e6d2d9a0b71a 100644 --- a/model-view-controller/src/test/java/com/iluwatar/model/view/controller/AppTest.java +++ b/model-view-controller/src/test/java/com/iluwatar/model/view/controller/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.controller; import org.junit.jupiter.api.Test; diff --git a/model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantControllerTest.java b/model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantControllerTest.java index 86026e441fe1..a2f42a80dfa4 100644 --- a/model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantControllerTest.java +++ b/model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantControllerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.controller; import org.junit.jupiter.api.Test; diff --git a/model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantModelTest.java b/model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantModelTest.java index ee89b71b363b..a566010cd938 100644 --- a/model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantModelTest.java +++ b/model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantModelTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.controller; import org.junit.jupiter.api.Test; diff --git a/model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantViewTest.java b/model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantViewTest.java index a492a4493f01..a3e33f9dd9d8 100644 --- a/model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantViewTest.java +++ b/model-view-controller/src/test/java/com/iluwatar/model/view/controller/GiantViewTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.controller; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/App.java b/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/App.java index 058fb5996ea4..9b6e6cde833f 100644 --- a/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/App.java +++ b/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.presenter; /** diff --git a/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileLoader.java b/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileLoader.java index eee206faefd7..980c0b56c2e9 100644 --- a/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileLoader.java +++ b/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileLoader.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.presenter; import java.io.BufferedReader; diff --git a/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorJFrame.java b/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorJFrame.java index d82ce553bee1..3d9bc035a5ad 100644 --- a/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorJFrame.java +++ b/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorJFrame.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.presenter; import java.awt.Color; diff --git a/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorPresenter.java b/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorPresenter.java index 315ac43be549..a9cf1ba80a4c 100644 --- a/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorPresenter.java +++ b/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorPresenter.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.presenter; import java.io.Serializable; diff --git a/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorStub.java b/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorStub.java index ecf724e3fb25..d034bcb04563 100644 --- a/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorStub.java +++ b/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorStub.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.presenter; /** diff --git a/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorView.java b/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorView.java index 8c03a446842f..3deec63d9692 100644 --- a/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorView.java +++ b/model-view-presenter/src/main/java/com/iluwatar/model/view/presenter/FileSelectorView.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.presenter; import java.io.Serializable; diff --git a/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/AppTest.java b/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/AppTest.java index 6d9840bac999..00e35ae1b6f8 100644 --- a/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/AppTest.java +++ b/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.presenter; import org.junit.jupiter.api.Test; diff --git a/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/FileLoaderTest.java b/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/FileLoaderTest.java index 3d57e63ebee5..a63ca5ae8e02 100644 --- a/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/FileLoaderTest.java +++ b/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/FileLoaderTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.presenter; import org.junit.jupiter.api.Test; diff --git a/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/FileSelectorPresenterTest.java b/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/FileSelectorPresenterTest.java index 351452868e9b..fdc19398d792 100644 --- a/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/FileSelectorPresenterTest.java +++ b/model-view-presenter/src/test/java/com/iluwatar/model/view/presenter/FileSelectorPresenterTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.model.view.presenter; import org.junit.jupiter.api.BeforeEach; diff --git a/module/src/main/java/com/iluwatar/module/App.java b/module/src/main/java/com/iluwatar/module/App.java index 69279d0f77d4..af0432afb9af 100644 --- a/module/src/main/java/com/iluwatar/module/App.java +++ b/module/src/main/java/com/iluwatar/module/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.module; import java.io.FileNotFoundException; diff --git a/module/src/main/java/com/iluwatar/module/ConsoleLoggerModule.java b/module/src/main/java/com/iluwatar/module/ConsoleLoggerModule.java index 12eaae1d9be4..6e6d0539d0ba 100644 --- a/module/src/main/java/com/iluwatar/module/ConsoleLoggerModule.java +++ b/module/src/main/java/com/iluwatar/module/ConsoleLoggerModule.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.module; import org.slf4j.Logger; diff --git a/module/src/main/java/com/iluwatar/module/FileLoggerModule.java b/module/src/main/java/com/iluwatar/module/FileLoggerModule.java index 65f954b6cccd..e461b31d7572 100644 --- a/module/src/main/java/com/iluwatar/module/FileLoggerModule.java +++ b/module/src/main/java/com/iluwatar/module/FileLoggerModule.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.module; import org.slf4j.Logger; diff --git a/module/src/test/java/com/iluwatar/module/AppTest.java b/module/src/test/java/com/iluwatar/module/AppTest.java index 4236e422411f..88fa4c68c3db 100644 --- a/module/src/test/java/com/iluwatar/module/AppTest.java +++ b/module/src/test/java/com/iluwatar/module/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.module; import org.junit.jupiter.api.Test; diff --git a/module/src/test/java/com/iluwatar/module/FileLoggerModuleTest.java b/module/src/test/java/com/iluwatar/module/FileLoggerModuleTest.java index 30f0baae5703..e88b466f2438 100644 --- a/module/src/test/java/com/iluwatar/module/FileLoggerModuleTest.java +++ b/module/src/test/java/com/iluwatar/module/FileLoggerModuleTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.module; import org.junit.jupiter.api.Test; diff --git a/monad/src/main/java/com/iluwatar/monad/App.java b/monad/src/main/java/com/iluwatar/monad/App.java index 7c3efe70b2d1..94e46548744c 100644 --- a/monad/src/main/java/com/iluwatar/monad/App.java +++ b/monad/src/main/java/com/iluwatar/monad/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.monad; import org.slf4j.Logger; diff --git a/monad/src/main/java/com/iluwatar/monad/Sex.java b/monad/src/main/java/com/iluwatar/monad/Sex.java index a34dbc6928a5..960711656021 100644 --- a/monad/src/main/java/com/iluwatar/monad/Sex.java +++ b/monad/src/main/java/com/iluwatar/monad/Sex.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.monad; /** diff --git a/monad/src/main/java/com/iluwatar/monad/User.java b/monad/src/main/java/com/iluwatar/monad/User.java index 7ade709de9c9..9ecaa527539c 100644 --- a/monad/src/main/java/com/iluwatar/monad/User.java +++ b/monad/src/main/java/com/iluwatar/monad/User.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.monad; /** diff --git a/monad/src/main/java/com/iluwatar/monad/Validator.java b/monad/src/main/java/com/iluwatar/monad/Validator.java index c30427e7140b..b5618f91c390 100644 --- a/monad/src/main/java/com/iluwatar/monad/Validator.java +++ b/monad/src/main/java/com/iluwatar/monad/Validator.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.monad; import java.util.ArrayList; diff --git a/monad/src/test/java/com/iluwatar/monad/AppTest.java b/monad/src/test/java/com/iluwatar/monad/AppTest.java index 2ffead426296..f4d89a7cd3dc 100644 --- a/monad/src/test/java/com/iluwatar/monad/AppTest.java +++ b/monad/src/test/java/com/iluwatar/monad/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.monad; import org.junit.jupiter.api.Test; diff --git a/monad/src/test/java/com/iluwatar/monad/MonadTest.java b/monad/src/test/java/com/iluwatar/monad/MonadTest.java index 5b8547d5acd9..d1bdd7487d9e 100644 --- a/monad/src/test/java/com/iluwatar/monad/MonadTest.java +++ b/monad/src/test/java/com/iluwatar/monad/MonadTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.monad; import org.junit.jupiter.api.Test; diff --git a/monostate/src/main/java/com/iluwatar/monostate/App.java b/monostate/src/main/java/com/iluwatar/monostate/App.java index 3e536d2b20de..4b6f8b14b64d 100644 --- a/monostate/src/main/java/com/iluwatar/monostate/App.java +++ b/monostate/src/main/java/com/iluwatar/monostate/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.monostate; diff --git a/monostate/src/main/java/com/iluwatar/monostate/LoadBalancer.java b/monostate/src/main/java/com/iluwatar/monostate/LoadBalancer.java index 23052d16b966..ae590be5ee5d 100644 --- a/monostate/src/main/java/com/iluwatar/monostate/LoadBalancer.java +++ b/monostate/src/main/java/com/iluwatar/monostate/LoadBalancer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.monostate; import java.util.ArrayList; diff --git a/monostate/src/main/java/com/iluwatar/monostate/Request.java b/monostate/src/main/java/com/iluwatar/monostate/Request.java index 96a90dc9ed4e..5a7429998ac1 100644 --- a/monostate/src/main/java/com/iluwatar/monostate/Request.java +++ b/monostate/src/main/java/com/iluwatar/monostate/Request.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.monostate; /** diff --git a/monostate/src/main/java/com/iluwatar/monostate/Server.java b/monostate/src/main/java/com/iluwatar/monostate/Server.java index 387947824a9f..fa809864cb83 100644 --- a/monostate/src/main/java/com/iluwatar/monostate/Server.java +++ b/monostate/src/main/java/com/iluwatar/monostate/Server.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.monostate; import org.slf4j.Logger; diff --git a/monostate/src/test/java/com/iluwatar/monostate/AppTest.java b/monostate/src/test/java/com/iluwatar/monostate/AppTest.java index 4ce49f03df8a..c914f136ecaa 100644 --- a/monostate/src/test/java/com/iluwatar/monostate/AppTest.java +++ b/monostate/src/test/java/com/iluwatar/monostate/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.monostate; import org.junit.jupiter.api.Test; diff --git a/monostate/src/test/java/com/iluwatar/monostate/LoadBalancerTest.java b/monostate/src/test/java/com/iluwatar/monostate/LoadBalancerTest.java index e806696e7ce1..736bf6ea68aa 100644 --- a/monostate/src/test/java/com/iluwatar/monostate/LoadBalancerTest.java +++ b/monostate/src/test/java/com/iluwatar/monostate/LoadBalancerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.monostate; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/multiton/src/main/java/com/iluwatar/multiton/App.java b/multiton/src/main/java/com/iluwatar/multiton/App.java index daf1ea4d9530..8fb226625eae 100644 --- a/multiton/src/main/java/com/iluwatar/multiton/App.java +++ b/multiton/src/main/java/com/iluwatar/multiton/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.multiton; import org.slf4j.Logger; diff --git a/multiton/src/main/java/com/iluwatar/multiton/Nazgul.java b/multiton/src/main/java/com/iluwatar/multiton/Nazgul.java index e7f8ef65b03d..52a25e00d665 100644 --- a/multiton/src/main/java/com/iluwatar/multiton/Nazgul.java +++ b/multiton/src/main/java/com/iluwatar/multiton/Nazgul.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.multiton; import java.util.Map; diff --git a/multiton/src/main/java/com/iluwatar/multiton/NazgulEnum.java b/multiton/src/main/java/com/iluwatar/multiton/NazgulEnum.java index 7d120fed0197..f119ee68fb59 100644 --- a/multiton/src/main/java/com/iluwatar/multiton/NazgulEnum.java +++ b/multiton/src/main/java/com/iluwatar/multiton/NazgulEnum.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.multiton; /** diff --git a/multiton/src/main/java/com/iluwatar/multiton/NazgulName.java b/multiton/src/main/java/com/iluwatar/multiton/NazgulName.java index 62903c9c8286..5fe2a5a0f427 100644 --- a/multiton/src/main/java/com/iluwatar/multiton/NazgulName.java +++ b/multiton/src/main/java/com/iluwatar/multiton/NazgulName.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.multiton; /** diff --git a/multiton/src/test/java/com/iluwatar/multiton/AppTest.java b/multiton/src/test/java/com/iluwatar/multiton/AppTest.java index 8672e18157fd..f577b7f07e41 100644 --- a/multiton/src/test/java/com/iluwatar/multiton/AppTest.java +++ b/multiton/src/test/java/com/iluwatar/multiton/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.multiton; import org.junit.jupiter.api.Test; diff --git a/multiton/src/test/java/com/iluwatar/multiton/NazgulEnumTest.java b/multiton/src/test/java/com/iluwatar/multiton/NazgulEnumTest.java index 6a890777e62f..6668874f4ba7 100644 --- a/multiton/src/test/java/com/iluwatar/multiton/NazgulEnumTest.java +++ b/multiton/src/test/java/com/iluwatar/multiton/NazgulEnumTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.multiton; import static org.junit.jupiter.api.Assertions.*; diff --git a/multiton/src/test/java/com/iluwatar/multiton/NazgulTest.java b/multiton/src/test/java/com/iluwatar/multiton/NazgulTest.java index b9545dfefca8..0429f8e2939e 100644 --- a/multiton/src/test/java/com/iluwatar/multiton/NazgulTest.java +++ b/multiton/src/test/java/com/iluwatar/multiton/NazgulTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.multiton; import org.junit.jupiter.api.Test; diff --git a/mute-idiom/src/main/java/com/iluwatar/mute/App.java b/mute-idiom/src/main/java/com/iluwatar/mute/App.java index f8ac25f5c42c..28649e24990a 100644 --- a/mute-idiom/src/main/java/com/iluwatar/mute/App.java +++ b/mute-idiom/src/main/java/com/iluwatar/mute/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mute; import org.slf4j.Logger; diff --git a/mute-idiom/src/main/java/com/iluwatar/mute/CheckedRunnable.java b/mute-idiom/src/main/java/com/iluwatar/mute/CheckedRunnable.java index 9a3feefc1033..d5fdaaec2b34 100644 --- a/mute-idiom/src/main/java/com/iluwatar/mute/CheckedRunnable.java +++ b/mute-idiom/src/main/java/com/iluwatar/mute/CheckedRunnable.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mute; /** diff --git a/mute-idiom/src/main/java/com/iluwatar/mute/Mute.java b/mute-idiom/src/main/java/com/iluwatar/mute/Mute.java index 6c2c417017ae..87a1f651e77f 100644 --- a/mute-idiom/src/main/java/com/iluwatar/mute/Mute.java +++ b/mute-idiom/src/main/java/com/iluwatar/mute/Mute.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mute; import java.io.ByteArrayOutputStream; diff --git a/mute-idiom/src/main/java/com/iluwatar/mute/Resource.java b/mute-idiom/src/main/java/com/iluwatar/mute/Resource.java index 366f014b4fba..a10fe4617605 100644 --- a/mute-idiom/src/main/java/com/iluwatar/mute/Resource.java +++ b/mute-idiom/src/main/java/com/iluwatar/mute/Resource.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mute; import java.io.Closeable; diff --git a/mute-idiom/src/test/java/com/iluwatar/mute/AppTest.java b/mute-idiom/src/test/java/com/iluwatar/mute/AppTest.java index 8d2299492197..5ca525a9d9f5 100644 --- a/mute-idiom/src/test/java/com/iluwatar/mute/AppTest.java +++ b/mute-idiom/src/test/java/com/iluwatar/mute/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mute; import org.junit.jupiter.api.Test; diff --git a/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java b/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java index 9d946810fee0..f2743113bea1 100644 --- a/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java +++ b/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mute; import org.junit.jupiter.api.Test; diff --git a/mutex/src/main/java/com/iluwatar/mutex/App.java b/mutex/src/main/java/com/iluwatar/mutex/App.java index 2e8f572566e9..827307d0f884 100644 --- a/mutex/src/main/java/com/iluwatar/mutex/App.java +++ b/mutex/src/main/java/com/iluwatar/mutex/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mutex; /** diff --git a/mutex/src/main/java/com/iluwatar/mutex/Jar.java b/mutex/src/main/java/com/iluwatar/mutex/Jar.java index 60236a57b728..427907f31d90 100644 --- a/mutex/src/main/java/com/iluwatar/mutex/Jar.java +++ b/mutex/src/main/java/com/iluwatar/mutex/Jar.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mutex; /** diff --git a/mutex/src/main/java/com/iluwatar/mutex/Lock.java b/mutex/src/main/java/com/iluwatar/mutex/Lock.java index aca8de4c0978..bd28c3c0884c 100644 --- a/mutex/src/main/java/com/iluwatar/mutex/Lock.java +++ b/mutex/src/main/java/com/iluwatar/mutex/Lock.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mutex; /** diff --git a/mutex/src/main/java/com/iluwatar/mutex/Mutex.java b/mutex/src/main/java/com/iluwatar/mutex/Mutex.java index 1b1bced56ad0..a2ef71f11d1f 100644 --- a/mutex/src/main/java/com/iluwatar/mutex/Mutex.java +++ b/mutex/src/main/java/com/iluwatar/mutex/Mutex.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mutex; /** diff --git a/mutex/src/main/java/com/iluwatar/mutex/Thief.java b/mutex/src/main/java/com/iluwatar/mutex/Thief.java index 1798f4673598..f88e46d96fab 100644 --- a/mutex/src/main/java/com/iluwatar/mutex/Thief.java +++ b/mutex/src/main/java/com/iluwatar/mutex/Thief.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mutex; import org.slf4j.Logger; diff --git a/mutex/src/test/java/com/iluwatar/mutex/AppTest.java b/mutex/src/test/java/com/iluwatar/mutex/AppTest.java index 4195edbc2e25..1793bf90be73 100644 --- a/mutex/src/test/java/com/iluwatar/mutex/AppTest.java +++ b/mutex/src/test/java/com/iluwatar/mutex/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mutex; import org.junit.jupiter.api.Test; diff --git a/mutex/src/test/java/com/iluwatar/mutex/JarTest.java b/mutex/src/test/java/com/iluwatar/mutex/JarTest.java index ec359aa18877..e0a316072835 100644 --- a/mutex/src/test/java/com/iluwatar/mutex/JarTest.java +++ b/mutex/src/test/java/com/iluwatar/mutex/JarTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mutex; import org.junit.jupiter.api.Test; diff --git a/mutex/src/test/java/com/iluwatar/mutex/MutexTest.java b/mutex/src/test/java/com/iluwatar/mutex/MutexTest.java index 3914e99c9994..2e3184c51be3 100644 --- a/mutex/src/test/java/com/iluwatar/mutex/MutexTest.java +++ b/mutex/src/test/java/com/iluwatar/mutex/MutexTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.mutex; import org.junit.jupiter.api.Test; diff --git a/naked-objects/dom/src/main/java/domainapp/dom/app/homepage/HomePageService.java b/naked-objects/dom/src/main/java/domainapp/dom/app/homepage/HomePageService.java index 910b492b4120..8c3618db88fe 100644 --- a/naked-objects/dom/src/main/java/domainapp/dom/app/homepage/HomePageService.java +++ b/naked-objects/dom/src/main/java/domainapp/dom/app/homepage/HomePageService.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.dom.app.homepage; import org.apache.isis.applib.DomainObjectContainer; diff --git a/naked-objects/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.java b/naked-objects/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.java index 6d8f87aeb977..9d845cbd6d71 100644 --- a/naked-objects/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.java +++ b/naked-objects/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.dom.app.homepage; import java.util.List; diff --git a/naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.java b/naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.java index b2c950e8d04f..329c4c138065 100644 --- a/naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.java +++ b/naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.dom.modules.simple; import javax.jdo.JDOHelper; diff --git a/naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java b/naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java index 9ef5e5395487..506bda597473 100644 --- a/naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java +++ b/naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.dom.modules.simple; import java.util.List; diff --git a/naked-objects/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectTest.java b/naked-objects/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectTest.java index 9affd1b4f576..03ab30f7561c 100644 --- a/naked-objects/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectTest.java +++ b/naked-objects/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.dom.modules.simple; import static org.junit.Assert.assertEquals; diff --git a/naked-objects/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectsTest.java b/naked-objects/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectsTest.java index 0b1878cc2740..a95ad5aa3b7d 100644 --- a/naked-objects/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectsTest.java +++ b/naked-objects/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectsTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.dom.modules.simple; import com.google.common.collect.Lists; diff --git a/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesProvider.java b/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesProvider.java index 4496d2e32dd2..7a7e8c4b7bac 100644 --- a/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesProvider.java +++ b/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesProvider.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.fixture; import org.apache.isis.applib.annotation.DomainService; diff --git a/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java b/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java index 89eadad31f0c..4de9bfc9cf88 100644 --- a/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java +++ b/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.fixture.modules.simple; import org.apache.isis.applib.fixturescripts.FixtureScript; diff --git a/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java b/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java index a5092c2ec70e..8fc54d0ada80 100644 --- a/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java +++ b/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.fixture.modules.simple; import org.apache.isis.applib.fixturescripts.FixtureScript; diff --git a/naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java b/naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java index 33e5570a6063..2c201ead22e6 100644 --- a/naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java +++ b/naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.fixture.scenarios; import java.util.Arrays; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java b/naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java index 930a805d5fe2..f67c268766c4 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.integtests.bootstrap; import org.apache.isis.core.commons.config.IsisConfiguration; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/BootstrappingGlue.java b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/BootstrappingGlue.java index 4b22615ecc96..b3bd973bd0e2 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/BootstrappingGlue.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/BootstrappingGlue.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.integtests.specglue; import org.apache.isis.core.specsupport.scenarios.ScenarioExecutionScope; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/CatalogOfFixturesGlue.java b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/CatalogOfFixturesGlue.java index acc1485eca51..025c6724aa32 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/CatalogOfFixturesGlue.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/CatalogOfFixturesGlue.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.integtests.specglue; import org.apache.isis.core.specsupport.specs.CukeGlueAbstract; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java index 6c98b008c462..7b508faf38cf 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.integtests.specglue.modules.simple; import static org.hamcrest.CoreMatchers.is; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/specs/RunSpecs.java b/naked-objects/integtests/src/test/java/domainapp/integtests/specs/RunSpecs.java index 8f197985d6b5..d92cfa88185c 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/specs/RunSpecs.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/specs/RunSpecs.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.integtests.specs; import org.junit.runner.RunWith; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/SimpleAppIntegTest.java b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/SimpleAppIntegTest.java index 0c19714253ba..24d8d207ce02 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/SimpleAppIntegTest.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/SimpleAppIntegTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.integtests.tests; import org.junit.BeforeClass; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java index 0fc7c8f0b0e1..11ff6a47d400 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.integtests.tests.modules.simple; import static org.junit.Assert.assertEquals; diff --git a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java index a150bdb5a726..c762dd88f9b5 100644 --- a/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java +++ b/naked-objects/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.integtests.tests.modules.simple; import static org.junit.Assert.assertEquals; diff --git a/naked-objects/webapp/src/main/java/domainapp/webapp/SimpleApplication.java b/naked-objects/webapp/src/main/java/domainapp/webapp/SimpleApplication.java index 875212963b67..649aea7fd743 100644 --- a/naked-objects/webapp/src/main/java/domainapp/webapp/SimpleApplication.java +++ b/naked-objects/webapp/src/main/java/domainapp/webapp/SimpleApplication.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package domainapp.webapp; import java.io.IOException; diff --git a/null-object/src/main/java/com/iluwatar/nullobject/App.java b/null-object/src/main/java/com/iluwatar/nullobject/App.java index 11c646d43ac4..9e5a1412b317 100644 --- a/null-object/src/main/java/com/iluwatar/nullobject/App.java +++ b/null-object/src/main/java/com/iluwatar/nullobject/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.nullobject; /** diff --git a/null-object/src/main/java/com/iluwatar/nullobject/Node.java b/null-object/src/main/java/com/iluwatar/nullobject/Node.java index 5d74ff70f737..61423778c397 100644 --- a/null-object/src/main/java/com/iluwatar/nullobject/Node.java +++ b/null-object/src/main/java/com/iluwatar/nullobject/Node.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.nullobject; /** diff --git a/null-object/src/main/java/com/iluwatar/nullobject/NodeImpl.java b/null-object/src/main/java/com/iluwatar/nullobject/NodeImpl.java index 240bea929858..c44c26fb9284 100644 --- a/null-object/src/main/java/com/iluwatar/nullobject/NodeImpl.java +++ b/null-object/src/main/java/com/iluwatar/nullobject/NodeImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.nullobject; import org.slf4j.Logger; diff --git a/null-object/src/main/java/com/iluwatar/nullobject/NullNode.java b/null-object/src/main/java/com/iluwatar/nullobject/NullNode.java index 41bf98c5c02f..c5085b03d5f8 100644 --- a/null-object/src/main/java/com/iluwatar/nullobject/NullNode.java +++ b/null-object/src/main/java/com/iluwatar/nullobject/NullNode.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.nullobject; /** diff --git a/null-object/src/test/java/com/iluwatar/nullobject/AppTest.java b/null-object/src/test/java/com/iluwatar/nullobject/AppTest.java index 57eb86748885..97d6b5eef36e 100644 --- a/null-object/src/test/java/com/iluwatar/nullobject/AppTest.java +++ b/null-object/src/test/java/com/iluwatar/nullobject/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.nullobject; import org.junit.jupiter.api.Test; diff --git a/null-object/src/test/java/com/iluwatar/nullobject/NullNodeTest.java b/null-object/src/test/java/com/iluwatar/nullobject/NullNodeTest.java index efd1a2b85e48..b4d9f72d0bb5 100644 --- a/null-object/src/test/java/com/iluwatar/nullobject/NullNodeTest.java +++ b/null-object/src/test/java/com/iluwatar/nullobject/NullNodeTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.nullobject; import org.junit.jupiter.api.Test; diff --git a/null-object/src/test/java/com/iluwatar/nullobject/TreeTest.java b/null-object/src/test/java/com/iluwatar/nullobject/TreeTest.java index ce1502d986aa..4ff30f5240cb 100644 --- a/null-object/src/test/java/com/iluwatar/nullobject/TreeTest.java +++ b/null-object/src/test/java/com/iluwatar/nullobject/TreeTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.nullobject; import ch.qos.logback.classic.Logger; diff --git a/object-mother/src/main/java/com/iluwatar/objectmother/King.java b/object-mother/src/main/java/com/iluwatar/objectmother/King.java index 7bb2ebd202b0..cfebd2590a95 100644 --- a/object-mother/src/main/java/com/iluwatar/objectmother/King.java +++ b/object-mother/src/main/java/com/iluwatar/objectmother/King.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.objectmother; /** diff --git a/object-mother/src/main/java/com/iluwatar/objectmother/Queen.java b/object-mother/src/main/java/com/iluwatar/objectmother/Queen.java index 70fe0c0d6e3a..98a41a96061d 100644 --- a/object-mother/src/main/java/com/iluwatar/objectmother/Queen.java +++ b/object-mother/src/main/java/com/iluwatar/objectmother/Queen.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.objectmother; /** diff --git a/object-mother/src/main/java/com/iluwatar/objectmother/Royalty.java b/object-mother/src/main/java/com/iluwatar/objectmother/Royalty.java index 025172e69dff..9abbbe75b76f 100644 --- a/object-mother/src/main/java/com/iluwatar/objectmother/Royalty.java +++ b/object-mother/src/main/java/com/iluwatar/objectmother/Royalty.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.objectmother; /** diff --git a/object-mother/src/main/java/com/iluwatar/objectmother/RoyaltyObjectMother.java b/object-mother/src/main/java/com/iluwatar/objectmother/RoyaltyObjectMother.java index 418fd115158a..372f1166c8c9 100644 --- a/object-mother/src/main/java/com/iluwatar/objectmother/RoyaltyObjectMother.java +++ b/object-mother/src/main/java/com/iluwatar/objectmother/RoyaltyObjectMother.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.objectmother; /** diff --git a/object-mother/src/test/java/com/iluwatar/objectmother/test/RoyaltyObjectMotherTest.java b/object-mother/src/test/java/com/iluwatar/objectmother/test/RoyaltyObjectMotherTest.java index 62cc6db80ac6..b9b211d96539 100644 --- a/object-mother/src/test/java/com/iluwatar/objectmother/test/RoyaltyObjectMotherTest.java +++ b/object-mother/src/test/java/com/iluwatar/objectmother/test/RoyaltyObjectMotherTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.objectmother.test; import com.iluwatar.objectmother.King; diff --git a/object-pool/src/main/java/com/iluwatar/object/pool/App.java b/object-pool/src/main/java/com/iluwatar/object/pool/App.java index 421ee71183da..24923c1e969e 100644 --- a/object-pool/src/main/java/com/iluwatar/object/pool/App.java +++ b/object-pool/src/main/java/com/iluwatar/object/pool/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.object.pool; import org.slf4j.Logger; diff --git a/object-pool/src/main/java/com/iluwatar/object/pool/ObjectPool.java b/object-pool/src/main/java/com/iluwatar/object/pool/ObjectPool.java index 4baf25e66fe1..e71e97f160a1 100644 --- a/object-pool/src/main/java/com/iluwatar/object/pool/ObjectPool.java +++ b/object-pool/src/main/java/com/iluwatar/object/pool/ObjectPool.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.object.pool; import java.util.HashSet; diff --git a/object-pool/src/main/java/com/iluwatar/object/pool/Oliphaunt.java b/object-pool/src/main/java/com/iluwatar/object/pool/Oliphaunt.java index 3557d3b284c6..0d9f85adc34a 100644 --- a/object-pool/src/main/java/com/iluwatar/object/pool/Oliphaunt.java +++ b/object-pool/src/main/java/com/iluwatar/object/pool/Oliphaunt.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.object.pool; import java.util.concurrent.atomic.AtomicInteger; diff --git a/object-pool/src/main/java/com/iluwatar/object/pool/OliphauntPool.java b/object-pool/src/main/java/com/iluwatar/object/pool/OliphauntPool.java index c3bc860a3dcf..b2d92936ff98 100644 --- a/object-pool/src/main/java/com/iluwatar/object/pool/OliphauntPool.java +++ b/object-pool/src/main/java/com/iluwatar/object/pool/OliphauntPool.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.object.pool; /** diff --git a/object-pool/src/test/java/com/iluwatar/object/pool/AppTest.java b/object-pool/src/test/java/com/iluwatar/object/pool/AppTest.java index e78936778573..7113f93043db 100644 --- a/object-pool/src/test/java/com/iluwatar/object/pool/AppTest.java +++ b/object-pool/src/test/java/com/iluwatar/object/pool/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.object.pool; import org.junit.jupiter.api.Test; diff --git a/object-pool/src/test/java/com/iluwatar/object/pool/OliphauntPoolTest.java b/object-pool/src/test/java/com/iluwatar/object/pool/OliphauntPoolTest.java index ad9d531a012b..b946f80981d7 100644 --- a/object-pool/src/test/java/com/iluwatar/object/pool/OliphauntPoolTest.java +++ b/object-pool/src/test/java/com/iluwatar/object/pool/OliphauntPoolTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.object.pool; import org.junit.jupiter.api.Test; diff --git a/observer/src/main/java/com/iluwatar/observer/App.java b/observer/src/main/java/com/iluwatar/observer/App.java index 1a174b7e74f9..07321ea6b459 100644 --- a/observer/src/main/java/com/iluwatar/observer/App.java +++ b/observer/src/main/java/com/iluwatar/observer/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer; import com.iluwatar.observer.generic.GHobbits; diff --git a/observer/src/main/java/com/iluwatar/observer/Hobbits.java b/observer/src/main/java/com/iluwatar/observer/Hobbits.java index 50da760ec155..b718aa5e8d6a 100644 --- a/observer/src/main/java/com/iluwatar/observer/Hobbits.java +++ b/observer/src/main/java/com/iluwatar/observer/Hobbits.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer; import org.slf4j.Logger; diff --git a/observer/src/main/java/com/iluwatar/observer/Orcs.java b/observer/src/main/java/com/iluwatar/observer/Orcs.java index 377e47ebb12d..1420c7da79a0 100644 --- a/observer/src/main/java/com/iluwatar/observer/Orcs.java +++ b/observer/src/main/java/com/iluwatar/observer/Orcs.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer; import org.slf4j.Logger; diff --git a/observer/src/main/java/com/iluwatar/observer/Weather.java b/observer/src/main/java/com/iluwatar/observer/Weather.java index bf21e51e8d4e..b5f6d2e39c72 100644 --- a/observer/src/main/java/com/iluwatar/observer/Weather.java +++ b/observer/src/main/java/com/iluwatar/observer/Weather.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer; import org.slf4j.Logger; diff --git a/observer/src/main/java/com/iluwatar/observer/WeatherObserver.java b/observer/src/main/java/com/iluwatar/observer/WeatherObserver.java index a859ac19af80..deb4c15edb2e 100644 --- a/observer/src/main/java/com/iluwatar/observer/WeatherObserver.java +++ b/observer/src/main/java/com/iluwatar/observer/WeatherObserver.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer; /** diff --git a/observer/src/main/java/com/iluwatar/observer/WeatherType.java b/observer/src/main/java/com/iluwatar/observer/WeatherType.java index e2d950798f50..384f8ac58f76 100644 --- a/observer/src/main/java/com/iluwatar/observer/WeatherType.java +++ b/observer/src/main/java/com/iluwatar/observer/WeatherType.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer; /** diff --git a/observer/src/main/java/com/iluwatar/observer/generic/GHobbits.java b/observer/src/main/java/com/iluwatar/observer/generic/GHobbits.java index 53b9b41ccba1..79669ef486b7 100644 --- a/observer/src/main/java/com/iluwatar/observer/generic/GHobbits.java +++ b/observer/src/main/java/com/iluwatar/observer/generic/GHobbits.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer.generic; import com.iluwatar.observer.WeatherType; diff --git a/observer/src/main/java/com/iluwatar/observer/generic/GOrcs.java b/observer/src/main/java/com/iluwatar/observer/generic/GOrcs.java index aca6c74405e7..5ba85b17f058 100644 --- a/observer/src/main/java/com/iluwatar/observer/generic/GOrcs.java +++ b/observer/src/main/java/com/iluwatar/observer/generic/GOrcs.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer.generic; import com.iluwatar.observer.WeatherType; diff --git a/observer/src/main/java/com/iluwatar/observer/generic/GWeather.java b/observer/src/main/java/com/iluwatar/observer/generic/GWeather.java index d28fdad4110f..3bf52f46b4c1 100644 --- a/observer/src/main/java/com/iluwatar/observer/generic/GWeather.java +++ b/observer/src/main/java/com/iluwatar/observer/generic/GWeather.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer.generic; import com.iluwatar.observer.WeatherType; diff --git a/observer/src/main/java/com/iluwatar/observer/generic/Observable.java b/observer/src/main/java/com/iluwatar/observer/generic/Observable.java index 635904de0267..722915b92db1 100644 --- a/observer/src/main/java/com/iluwatar/observer/generic/Observable.java +++ b/observer/src/main/java/com/iluwatar/observer/generic/Observable.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer.generic; import java.util.List; diff --git a/observer/src/main/java/com/iluwatar/observer/generic/Observer.java b/observer/src/main/java/com/iluwatar/observer/generic/Observer.java index 7440243ac125..819068b6e1b8 100644 --- a/observer/src/main/java/com/iluwatar/observer/generic/Observer.java +++ b/observer/src/main/java/com/iluwatar/observer/generic/Observer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer.generic; /** diff --git a/observer/src/main/java/com/iluwatar/observer/generic/Race.java b/observer/src/main/java/com/iluwatar/observer/generic/Race.java index 301636164ff0..1cd3aa4a6846 100644 --- a/observer/src/main/java/com/iluwatar/observer/generic/Race.java +++ b/observer/src/main/java/com/iluwatar/observer/generic/Race.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer.generic; import com.iluwatar.observer.WeatherType; diff --git a/observer/src/test/java/com/iluwatar/observer/AppTest.java b/observer/src/test/java/com/iluwatar/observer/AppTest.java index c2ac8b11edc4..b557fdf7eb0e 100644 --- a/observer/src/test/java/com/iluwatar/observer/AppTest.java +++ b/observer/src/test/java/com/iluwatar/observer/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer; import org.junit.jupiter.api.Test; diff --git a/observer/src/test/java/com/iluwatar/observer/HobbitsTest.java b/observer/src/test/java/com/iluwatar/observer/HobbitsTest.java index f0f5e0825a5d..c43c592da611 100644 --- a/observer/src/test/java/com/iluwatar/observer/HobbitsTest.java +++ b/observer/src/test/java/com/iluwatar/observer/HobbitsTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer; import java.util.ArrayList; diff --git a/observer/src/test/java/com/iluwatar/observer/OrcsTest.java b/observer/src/test/java/com/iluwatar/observer/OrcsTest.java index 17ccf938e06d..b2c0fcbaca10 100644 --- a/observer/src/test/java/com/iluwatar/observer/OrcsTest.java +++ b/observer/src/test/java/com/iluwatar/observer/OrcsTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer; import java.util.ArrayList; diff --git a/observer/src/test/java/com/iluwatar/observer/WeatherObserverTest.java b/observer/src/test/java/com/iluwatar/observer/WeatherObserverTest.java index ec3dfbed8f04..fbaceb02bfdf 100644 --- a/observer/src/test/java/com/iluwatar/observer/WeatherObserverTest.java +++ b/observer/src/test/java/com/iluwatar/observer/WeatherObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer; import com.iluwatar.observer.utils.InMemoryAppender; diff --git a/observer/src/test/java/com/iluwatar/observer/WeatherTest.java b/observer/src/test/java/com/iluwatar/observer/WeatherTest.java index dfb370ca29ff..c00357153ed7 100644 --- a/observer/src/test/java/com/iluwatar/observer/WeatherTest.java +++ b/observer/src/test/java/com/iluwatar/observer/WeatherTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer; import com.iluwatar.observer.utils.InMemoryAppender; diff --git a/observer/src/test/java/com/iluwatar/observer/generic/GHobbitsTest.java b/observer/src/test/java/com/iluwatar/observer/generic/GHobbitsTest.java index c9c525b9d6e8..93e68a9f1ac1 100644 --- a/observer/src/test/java/com/iluwatar/observer/generic/GHobbitsTest.java +++ b/observer/src/test/java/com/iluwatar/observer/generic/GHobbitsTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer.generic; import com.iluwatar.observer.WeatherType; diff --git a/observer/src/test/java/com/iluwatar/observer/generic/GWeatherTest.java b/observer/src/test/java/com/iluwatar/observer/generic/GWeatherTest.java index 60203ced3040..7450a00b930d 100644 --- a/observer/src/test/java/com/iluwatar/observer/generic/GWeatherTest.java +++ b/observer/src/test/java/com/iluwatar/observer/generic/GWeatherTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer.generic; import com.iluwatar.observer.WeatherObserver; diff --git a/observer/src/test/java/com/iluwatar/observer/generic/ObserverTest.java b/observer/src/test/java/com/iluwatar/observer/generic/ObserverTest.java index 940d45aba8cf..b5ef7ec0de0c 100644 --- a/observer/src/test/java/com/iluwatar/observer/generic/ObserverTest.java +++ b/observer/src/test/java/com/iluwatar/observer/generic/ObserverTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer.generic; import com.iluwatar.observer.WeatherType; diff --git a/observer/src/test/java/com/iluwatar/observer/generic/OrcsTest.java b/observer/src/test/java/com/iluwatar/observer/generic/OrcsTest.java index 136b766c3450..b73b105199cc 100644 --- a/observer/src/test/java/com/iluwatar/observer/generic/OrcsTest.java +++ b/observer/src/test/java/com/iluwatar/observer/generic/OrcsTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer.generic; import com.iluwatar.observer.WeatherType; diff --git a/observer/src/test/java/com/iluwatar/observer/utils/InMemoryAppender.java b/observer/src/test/java/com/iluwatar/observer/utils/InMemoryAppender.java index fbfe107b88c3..b3d2bf1bc7eb 100644 --- a/observer/src/test/java/com/iluwatar/observer/utils/InMemoryAppender.java +++ b/observer/src/test/java/com/iluwatar/observer/utils/InMemoryAppender.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.observer.utils; import ch.qos.logback.classic.Logger; diff --git a/page-object/sample-application/src/main/java/com/iluwatar/pageobject/App.java b/page-object/sample-application/src/main/java/com/iluwatar/pageobject/App.java index ff1f53790466..aae08c15f80e 100644 --- a/page-object/sample-application/src/main/java/com/iluwatar/pageobject/App.java +++ b/page-object/sample-application/src/main/java/com/iluwatar/pageobject/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject; import java.awt.Desktop; diff --git a/page-object/src/main/java/com/iluwatar/pageobject/App.java b/page-object/src/main/java/com/iluwatar/pageobject/App.java index a84533b478cd..c76867e89899 100644 --- a/page-object/src/main/java/com/iluwatar/pageobject/App.java +++ b/page-object/src/main/java/com/iluwatar/pageobject/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject; import java.awt.Desktop; diff --git a/page-object/src/test/java/com/iluwatar/pageobject/AlbumListPageTest.java b/page-object/src/test/java/com/iluwatar/pageobject/AlbumListPageTest.java index 1a66d99d3018..29704fe387cc 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/AlbumListPageTest.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/AlbumListPageTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject; import com.gargoylesoftware.htmlunit.WebClient; diff --git a/page-object/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java b/page-object/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java index 9f8419be1af7..488dcc0bb878 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject; import com.gargoylesoftware.htmlunit.WebClient; diff --git a/page-object/src/test/java/com/iluwatar/pageobject/LoginPageTest.java b/page-object/src/test/java/com/iluwatar/pageobject/LoginPageTest.java index 911ee5769656..70458eb643e5 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/LoginPageTest.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/LoginPageTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject; import com.gargoylesoftware.htmlunit.WebClient; diff --git a/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumListPage.java b/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumListPage.java index 20673c8779dd..f64c7cec2803 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumListPage.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumListPage.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject.pages; import com.gargoylesoftware.htmlunit.WebClient; diff --git a/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumPage.java b/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumPage.java index e33ffc4af32a..9115603147f7 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumPage.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/pages/AlbumPage.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject.pages; import com.gargoylesoftware.htmlunit.WebClient; diff --git a/page-object/src/test/java/com/iluwatar/pageobject/pages/LoginPage.java b/page-object/src/test/java/com/iluwatar/pageobject/pages/LoginPage.java index 843a5e1dc433..81debb5fb681 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/pages/LoginPage.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/pages/LoginPage.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject.pages; import com.gargoylesoftware.htmlunit.WebClient; diff --git a/page-object/src/test/java/com/iluwatar/pageobject/pages/Page.java b/page-object/src/test/java/com/iluwatar/pageobject/pages/Page.java index fbdc1b28c7be..3cebd94e94e4 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/pages/Page.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/pages/Page.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject.pages; import com.gargoylesoftware.htmlunit.WebClient; diff --git a/page-object/test-automation/src/main/java/com/iluwatar/pageobject/AlbumListPage.java b/page-object/test-automation/src/main/java/com/iluwatar/pageobject/AlbumListPage.java index d464cec69b5a..feab7838c7bd 100644 --- a/page-object/test-automation/src/main/java/com/iluwatar/pageobject/AlbumListPage.java +++ b/page-object/test-automation/src/main/java/com/iluwatar/pageobject/AlbumListPage.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject; import com.gargoylesoftware.htmlunit.WebClient; diff --git a/page-object/test-automation/src/main/java/com/iluwatar/pageobject/AlbumPage.java b/page-object/test-automation/src/main/java/com/iluwatar/pageobject/AlbumPage.java index 312f2efb33ed..cf8c50dd74a1 100644 --- a/page-object/test-automation/src/main/java/com/iluwatar/pageobject/AlbumPage.java +++ b/page-object/test-automation/src/main/java/com/iluwatar/pageobject/AlbumPage.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject; import java.io.IOException; diff --git a/page-object/test-automation/src/main/java/com/iluwatar/pageobject/LoginPage.java b/page-object/test-automation/src/main/java/com/iluwatar/pageobject/LoginPage.java index a9dcb1051338..b139253a77fa 100644 --- a/page-object/test-automation/src/main/java/com/iluwatar/pageobject/LoginPage.java +++ b/page-object/test-automation/src/main/java/com/iluwatar/pageobject/LoginPage.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject; import com.gargoylesoftware.htmlunit.WebClient; diff --git a/page-object/test-automation/src/main/java/com/iluwatar/pageobject/Page.java b/page-object/test-automation/src/main/java/com/iluwatar/pageobject/Page.java index f5c5a29f409f..78bc4618c407 100644 --- a/page-object/test-automation/src/main/java/com/iluwatar/pageobject/Page.java +++ b/page-object/test-automation/src/main/java/com/iluwatar/pageobject/Page.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject; import com.gargoylesoftware.htmlunit.WebClient; diff --git a/page-object/test-automation/src/test/java/com/iluwatar/pageobject/AlbumListPageTest.java b/page-object/test-automation/src/test/java/com/iluwatar/pageobject/AlbumListPageTest.java index e81c930b02db..8e8173c04ea5 100644 --- a/page-object/test-automation/src/test/java/com/iluwatar/pageobject/AlbumListPageTest.java +++ b/page-object/test-automation/src/test/java/com/iluwatar/pageobject/AlbumListPageTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject; import com.gargoylesoftware.htmlunit.WebClient; diff --git a/page-object/test-automation/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java b/page-object/test-automation/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java index d42611d5c3eb..f3fea0ee6b1c 100644 --- a/page-object/test-automation/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java +++ b/page-object/test-automation/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/page-object/test-automation/src/test/java/com/iluwatar/pageobject/LoginPageTest.java b/page-object/test-automation/src/test/java/com/iluwatar/pageobject/LoginPageTest.java index 312a08520c14..f6ec3978f706 100644 --- a/page-object/test-automation/src/test/java/com/iluwatar/pageobject/LoginPageTest.java +++ b/page-object/test-automation/src/test/java/com/iluwatar/pageobject/LoginPageTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pageobject; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/App.java b/partial-response/src/main/java/com/iluwatar/partialresponse/App.java index 03edfb844009..05aa660880c1 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/App.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.partialresponse; import org.slf4j.Logger; diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java b/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java index be9055501ddf..da1d22620c31 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.partialresponse; import java.lang.reflect.Field; diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java index e64718175cb6..fcfda7497f95 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.partialresponse; /** diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java index 309765c7dc20..d0d77af05151 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.partialresponse; import java.util.Map; diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/AppTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/AppTest.java index 6bfd782cce01..afd2c70e253b 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/AppTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.partialresponse; import org.junit.Test; diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/FieldJsonMapperTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/FieldJsonMapperTest.java index 696d2ef0ed19..c71cc21f4e58 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/FieldJsonMapperTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/FieldJsonMapperTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.partialresponse; import org.junit.Before; diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java index 5c4ac78fb74c..c28613f4a8c7 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.partialresponse; import org.junit.Before; diff --git a/pipeline/src/main/java/com/iluwatar/pipeline/App.java b/pipeline/src/main/java/com/iluwatar/pipeline/App.java index 581e414606bd..3298a6eb69b2 100644 --- a/pipeline/src/main/java/com/iluwatar/pipeline/App.java +++ b/pipeline/src/main/java/com/iluwatar/pipeline/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pipeline; /** diff --git a/pipeline/src/main/java/com/iluwatar/pipeline/ConvertToCharArrayHandler.java b/pipeline/src/main/java/com/iluwatar/pipeline/ConvertToCharArrayHandler.java index 6a418fef4cf1..104d81f40b88 100644 --- a/pipeline/src/main/java/com/iluwatar/pipeline/ConvertToCharArrayHandler.java +++ b/pipeline/src/main/java/com/iluwatar/pipeline/ConvertToCharArrayHandler.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pipeline; import org.slf4j.Logger; diff --git a/pipeline/src/main/java/com/iluwatar/pipeline/Handler.java b/pipeline/src/main/java/com/iluwatar/pipeline/Handler.java index b00e20a281fe..253bc22f5607 100644 --- a/pipeline/src/main/java/com/iluwatar/pipeline/Handler.java +++ b/pipeline/src/main/java/com/iluwatar/pipeline/Handler.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pipeline; /** diff --git a/pipeline/src/main/java/com/iluwatar/pipeline/Pipeline.java b/pipeline/src/main/java/com/iluwatar/pipeline/Pipeline.java index 476c9f0a5931..af5c69b1d77c 100644 --- a/pipeline/src/main/java/com/iluwatar/pipeline/Pipeline.java +++ b/pipeline/src/main/java/com/iluwatar/pipeline/Pipeline.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pipeline; /** diff --git a/pipeline/src/main/java/com/iluwatar/pipeline/RemoveAlphabetsHandler.java b/pipeline/src/main/java/com/iluwatar/pipeline/RemoveAlphabetsHandler.java index 342ed86c23c7..930332671c3d 100644 --- a/pipeline/src/main/java/com/iluwatar/pipeline/RemoveAlphabetsHandler.java +++ b/pipeline/src/main/java/com/iluwatar/pipeline/RemoveAlphabetsHandler.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pipeline; import org.slf4j.Logger; diff --git a/pipeline/src/main/java/com/iluwatar/pipeline/RemoveDigitsHandler.java b/pipeline/src/main/java/com/iluwatar/pipeline/RemoveDigitsHandler.java index a5320a0a55c4..6fd591006c55 100644 --- a/pipeline/src/main/java/com/iluwatar/pipeline/RemoveDigitsHandler.java +++ b/pipeline/src/main/java/com/iluwatar/pipeline/RemoveDigitsHandler.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pipeline; import org.slf4j.Logger; diff --git a/pipeline/src/test/java/com/iluwatar/pipeline/AppTest.java b/pipeline/src/test/java/com/iluwatar/pipeline/AppTest.java index 552cd99bd488..d5a892d91809 100644 --- a/pipeline/src/test/java/com/iluwatar/pipeline/AppTest.java +++ b/pipeline/src/test/java/com/iluwatar/pipeline/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pipeline; import org.junit.jupiter.api.Test; diff --git a/pipeline/src/test/java/com/iluwatar/pipeline/PipelineTest.java b/pipeline/src/test/java/com/iluwatar/pipeline/PipelineTest.java index 590dfc62e59a..1de692222dbe 100644 --- a/pipeline/src/test/java/com/iluwatar/pipeline/PipelineTest.java +++ b/pipeline/src/test/java/com/iluwatar/pipeline/PipelineTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.pipeline; import org.junit.jupiter.api.Test; diff --git a/poison-pill/src/main/java/com/iluwatar/poison/pill/App.java b/poison-pill/src/main/java/com/iluwatar/poison/pill/App.java index 10e7f58d70e1..6d6a41eb9970 100644 --- a/poison-pill/src/main/java/com/iluwatar/poison/pill/App.java +++ b/poison-pill/src/main/java/com/iluwatar/poison/pill/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; /** diff --git a/poison-pill/src/main/java/com/iluwatar/poison/pill/Consumer.java b/poison-pill/src/main/java/com/iluwatar/poison/pill/Consumer.java index 115915ffe161..12cc246d8d28 100644 --- a/poison-pill/src/main/java/com/iluwatar/poison/pill/Consumer.java +++ b/poison-pill/src/main/java/com/iluwatar/poison/pill/Consumer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; import com.iluwatar.poison.pill.Message.Headers; diff --git a/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java b/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java index cdbd7241d49e..9b35bf53a569 100644 --- a/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java +++ b/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; import java.util.Map; diff --git a/poison-pill/src/main/java/com/iluwatar/poison/pill/MessageQueue.java b/poison-pill/src/main/java/com/iluwatar/poison/pill/MessageQueue.java index d766f24c3cd3..ce8005fcebaf 100644 --- a/poison-pill/src/main/java/com/iluwatar/poison/pill/MessageQueue.java +++ b/poison-pill/src/main/java/com/iluwatar/poison/pill/MessageQueue.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; /** diff --git a/poison-pill/src/main/java/com/iluwatar/poison/pill/MqPublishPoint.java b/poison-pill/src/main/java/com/iluwatar/poison/pill/MqPublishPoint.java index 31b54610f034..b0e086637509 100644 --- a/poison-pill/src/main/java/com/iluwatar/poison/pill/MqPublishPoint.java +++ b/poison-pill/src/main/java/com/iluwatar/poison/pill/MqPublishPoint.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; /** diff --git a/poison-pill/src/main/java/com/iluwatar/poison/pill/MqSubscribePoint.java b/poison-pill/src/main/java/com/iluwatar/poison/pill/MqSubscribePoint.java index 55554f2705f7..bb01e6395f14 100644 --- a/poison-pill/src/main/java/com/iluwatar/poison/pill/MqSubscribePoint.java +++ b/poison-pill/src/main/java/com/iluwatar/poison/pill/MqSubscribePoint.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; /** diff --git a/poison-pill/src/main/java/com/iluwatar/poison/pill/Producer.java b/poison-pill/src/main/java/com/iluwatar/poison/pill/Producer.java index 766b84d9605b..0b746b31f3e7 100644 --- a/poison-pill/src/main/java/com/iluwatar/poison/pill/Producer.java +++ b/poison-pill/src/main/java/com/iluwatar/poison/pill/Producer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; import java.util.Date; diff --git a/poison-pill/src/main/java/com/iluwatar/poison/pill/SimpleMessage.java b/poison-pill/src/main/java/com/iluwatar/poison/pill/SimpleMessage.java index a1875433a6e0..efc45fc83bef 100644 --- a/poison-pill/src/main/java/com/iluwatar/poison/pill/SimpleMessage.java +++ b/poison-pill/src/main/java/com/iluwatar/poison/pill/SimpleMessage.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; import java.util.Collections; diff --git a/poison-pill/src/main/java/com/iluwatar/poison/pill/SimpleMessageQueue.java b/poison-pill/src/main/java/com/iluwatar/poison/pill/SimpleMessageQueue.java index 60e74db11a85..7f1b662cde71 100644 --- a/poison-pill/src/main/java/com/iluwatar/poison/pill/SimpleMessageQueue.java +++ b/poison-pill/src/main/java/com/iluwatar/poison/pill/SimpleMessageQueue.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; import java.util.concurrent.ArrayBlockingQueue; diff --git a/poison-pill/src/test/java/com/iluwatar/poison/pill/AppTest.java b/poison-pill/src/test/java/com/iluwatar/poison/pill/AppTest.java index 1093852ae168..b921f6bc7c7f 100644 --- a/poison-pill/src/test/java/com/iluwatar/poison/pill/AppTest.java +++ b/poison-pill/src/test/java/com/iluwatar/poison/pill/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; import org.junit.jupiter.api.Test; diff --git a/poison-pill/src/test/java/com/iluwatar/poison/pill/ConsumerTest.java b/poison-pill/src/test/java/com/iluwatar/poison/pill/ConsumerTest.java index af0e3d73e6bd..c874d36293fb 100644 --- a/poison-pill/src/test/java/com/iluwatar/poison/pill/ConsumerTest.java +++ b/poison-pill/src/test/java/com/iluwatar/poison/pill/ConsumerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; import ch.qos.logback.classic.Logger; diff --git a/poison-pill/src/test/java/com/iluwatar/poison/pill/PoisonMessageTest.java b/poison-pill/src/test/java/com/iluwatar/poison/pill/PoisonMessageTest.java index 0e9454508dd6..6b310d431116 100644 --- a/poison-pill/src/test/java/com/iluwatar/poison/pill/PoisonMessageTest.java +++ b/poison-pill/src/test/java/com/iluwatar/poison/pill/PoisonMessageTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; import org.junit.jupiter.api.Test; diff --git a/poison-pill/src/test/java/com/iluwatar/poison/pill/ProducerTest.java b/poison-pill/src/test/java/com/iluwatar/poison/pill/ProducerTest.java index 33c80d1f0aea..76f2373da017 100644 --- a/poison-pill/src/test/java/com/iluwatar/poison/pill/ProducerTest.java +++ b/poison-pill/src/test/java/com/iluwatar/poison/pill/ProducerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; import org.junit.jupiter.api.Test; diff --git a/poison-pill/src/test/java/com/iluwatar/poison/pill/SimpleMessageTest.java b/poison-pill/src/test/java/com/iluwatar/poison/pill/SimpleMessageTest.java index 6edaab625f20..3eebecb01845 100644 --- a/poison-pill/src/test/java/com/iluwatar/poison/pill/SimpleMessageTest.java +++ b/poison-pill/src/test/java/com/iluwatar/poison/pill/SimpleMessageTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.poison.pill; import org.junit.jupiter.api.Test; diff --git a/pom.xml b/pom.xml index 913f600e7aff..b6c1b4472a88 100644 --- a/pom.xml +++ b/pom.xml @@ -416,6 +416,12 @@ Ilkka Seppälä true + + license-plugin-header-style.xml + + + SLASHSTAR_CUSTOM_STYLE + diff --git a/priority-queue/src/main/java/com/iluwatar/priority/queue/Application.java b/priority-queue/src/main/java/com/iluwatar/priority/queue/Application.java index 5f40bc1ebfc7..1e6e44a68564 100644 --- a/priority-queue/src/main/java/com/iluwatar/priority/queue/Application.java +++ b/priority-queue/src/main/java/com/iluwatar/priority/queue/Application.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.priority.queue; /** diff --git a/priority-queue/src/main/java/com/iluwatar/priority/queue/Message.java b/priority-queue/src/main/java/com/iluwatar/priority/queue/Message.java index 1fd5e7813658..b874bd677915 100644 --- a/priority-queue/src/main/java/com/iluwatar/priority/queue/Message.java +++ b/priority-queue/src/main/java/com/iluwatar/priority/queue/Message.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.priority.queue; /** diff --git a/priority-queue/src/main/java/com/iluwatar/priority/queue/PriorityMessageQueue.java b/priority-queue/src/main/java/com/iluwatar/priority/queue/PriorityMessageQueue.java index 971c6551fa46..ff73a496ff58 100644 --- a/priority-queue/src/main/java/com/iluwatar/priority/queue/PriorityMessageQueue.java +++ b/priority-queue/src/main/java/com/iluwatar/priority/queue/PriorityMessageQueue.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.priority.queue; import org.slf4j.Logger; diff --git a/priority-queue/src/main/java/com/iluwatar/priority/queue/QueueManager.java b/priority-queue/src/main/java/com/iluwatar/priority/queue/QueueManager.java index ecf13b3d7697..ade211766c3d 100644 --- a/priority-queue/src/main/java/com/iluwatar/priority/queue/QueueManager.java +++ b/priority-queue/src/main/java/com/iluwatar/priority/queue/QueueManager.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.priority.queue; /** diff --git a/priority-queue/src/main/java/com/iluwatar/priority/queue/Worker.java b/priority-queue/src/main/java/com/iluwatar/priority/queue/Worker.java index e37feb679d3e..bbeb64b73a7e 100644 --- a/priority-queue/src/main/java/com/iluwatar/priority/queue/Worker.java +++ b/priority-queue/src/main/java/com/iluwatar/priority/queue/Worker.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.priority.queue; import org.slf4j.Logger; diff --git a/priority-queue/src/test/java/com/iluwatar/priority/queue/PriorityMessageQueueTest.java b/priority-queue/src/test/java/com/iluwatar/priority/queue/PriorityMessageQueueTest.java index 36ad1ef414d9..4fd1f06a6454 100644 --- a/priority-queue/src/test/java/com/iluwatar/priority/queue/PriorityMessageQueueTest.java +++ b/priority-queue/src/test/java/com/iluwatar/priority/queue/PriorityMessageQueueTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.priority.queue; import org.junit.jupiter.api.Test; diff --git a/priority-queue/src/test/java/com/iluwatar/priority/queue/QueueManagerTest.java b/priority-queue/src/test/java/com/iluwatar/priority/queue/QueueManagerTest.java index 03909f830e5d..17aad88b396c 100644 --- a/priority-queue/src/test/java/com/iluwatar/priority/queue/QueueManagerTest.java +++ b/priority-queue/src/test/java/com/iluwatar/priority/queue/QueueManagerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.priority.queue; import org.junit.jupiter.api.Test; diff --git a/private-class-data/src/main/java/com/iluwatar/privateclassdata/App.java b/private-class-data/src/main/java/com/iluwatar/privateclassdata/App.java index 79f3c3895283..c5b75eee4a78 100644 --- a/private-class-data/src/main/java/com/iluwatar/privateclassdata/App.java +++ b/private-class-data/src/main/java/com/iluwatar/privateclassdata/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.privateclassdata; /** diff --git a/private-class-data/src/main/java/com/iluwatar/privateclassdata/ImmutableStew.java b/private-class-data/src/main/java/com/iluwatar/privateclassdata/ImmutableStew.java index ff42f96aa4d9..627d744620bd 100644 --- a/private-class-data/src/main/java/com/iluwatar/privateclassdata/ImmutableStew.java +++ b/private-class-data/src/main/java/com/iluwatar/privateclassdata/ImmutableStew.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.privateclassdata; import org.slf4j.Logger; diff --git a/private-class-data/src/main/java/com/iluwatar/privateclassdata/Stew.java b/private-class-data/src/main/java/com/iluwatar/privateclassdata/Stew.java index d251fe65b450..6618ee5dac95 100644 --- a/private-class-data/src/main/java/com/iluwatar/privateclassdata/Stew.java +++ b/private-class-data/src/main/java/com/iluwatar/privateclassdata/Stew.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.privateclassdata; import org.slf4j.Logger; diff --git a/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java b/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java index 9b7f0009396c..c170a531ef1a 100644 --- a/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java +++ b/private-class-data/src/main/java/com/iluwatar/privateclassdata/StewData.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.privateclassdata; /** diff --git a/private-class-data/src/test/java/com/iluwatar/privateclassdata/AppTest.java b/private-class-data/src/test/java/com/iluwatar/privateclassdata/AppTest.java index d34c3f1077a2..cfdb73fd478f 100644 --- a/private-class-data/src/test/java/com/iluwatar/privateclassdata/AppTest.java +++ b/private-class-data/src/test/java/com/iluwatar/privateclassdata/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.privateclassdata; import org.junit.jupiter.api.Test; diff --git a/private-class-data/src/test/java/com/iluwatar/privateclassdata/ImmutableStewTest.java b/private-class-data/src/test/java/com/iluwatar/privateclassdata/ImmutableStewTest.java index 3083925ce950..b866b31eacd7 100644 --- a/private-class-data/src/test/java/com/iluwatar/privateclassdata/ImmutableStewTest.java +++ b/private-class-data/src/test/java/com/iluwatar/privateclassdata/ImmutableStewTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.privateclassdata; import com.iluwatar.privateclassdata.utils.InMemoryAppender; diff --git a/private-class-data/src/test/java/com/iluwatar/privateclassdata/StewTest.java b/private-class-data/src/test/java/com/iluwatar/privateclassdata/StewTest.java index 9e58c2eab15b..3c30fc02122f 100644 --- a/private-class-data/src/test/java/com/iluwatar/privateclassdata/StewTest.java +++ b/private-class-data/src/test/java/com/iluwatar/privateclassdata/StewTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.privateclassdata; import com.iluwatar.privateclassdata.utils.InMemoryAppender; diff --git a/private-class-data/src/test/java/com/iluwatar/privateclassdata/utils/InMemoryAppender.java b/private-class-data/src/test/java/com/iluwatar/privateclassdata/utils/InMemoryAppender.java index 08ada391f7aa..dceaee29b989 100644 --- a/private-class-data/src/test/java/com/iluwatar/privateclassdata/utils/InMemoryAppender.java +++ b/private-class-data/src/test/java/com/iluwatar/privateclassdata/utils/InMemoryAppender.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.privateclassdata.utils; import ch.qos.logback.classic.Logger; diff --git a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/App.java b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/App.java index 17dc8c6365b0..853c6fcfe51d 100644 --- a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/App.java +++ b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.producer.consumer; import org.slf4j.Logger; diff --git a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Consumer.java b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Consumer.java index 24cc457faba0..3e4e9aadb3d9 100644 --- a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Consumer.java +++ b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Consumer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.producer.consumer; import org.slf4j.Logger; diff --git a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Item.java b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Item.java index 1b98c1d9a7ed..6991ec4d10a4 100644 --- a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Item.java +++ b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Item.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.producer.consumer; /** diff --git a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/ItemQueue.java b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/ItemQueue.java index dfdf336fd5c1..674fb069aa62 100644 --- a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/ItemQueue.java +++ b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/ItemQueue.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.producer.consumer; import java.util.concurrent.BlockingQueue; diff --git a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Producer.java b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Producer.java index 3681c017d223..e8c79afd4836 100644 --- a/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Producer.java +++ b/producer-consumer/src/main/java/com/iluwatar/producer/consumer/Producer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.producer.consumer; import java.util.Random; diff --git a/producer-consumer/src/test/java/com/iluwatar/producer/consumer/AppTest.java b/producer-consumer/src/test/java/com/iluwatar/producer/consumer/AppTest.java index fa95d0f1b3ce..e14e963a1150 100644 --- a/producer-consumer/src/test/java/com/iluwatar/producer/consumer/AppTest.java +++ b/producer-consumer/src/test/java/com/iluwatar/producer/consumer/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.producer.consumer; import org.junit.jupiter.api.Test; diff --git a/producer-consumer/src/test/java/com/iluwatar/producer/consumer/ConsumerTest.java b/producer-consumer/src/test/java/com/iluwatar/producer/consumer/ConsumerTest.java index 22477ac92a54..c4b3a17a7a97 100644 --- a/producer-consumer/src/test/java/com/iluwatar/producer/consumer/ConsumerTest.java +++ b/producer-consumer/src/test/java/com/iluwatar/producer/consumer/ConsumerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.producer.consumer; import org.junit.jupiter.api.Test; diff --git a/producer-consumer/src/test/java/com/iluwatar/producer/consumer/ProducerTest.java b/producer-consumer/src/test/java/com/iluwatar/producer/consumer/ProducerTest.java index 268f122a569f..6e93450115cd 100644 --- a/producer-consumer/src/test/java/com/iluwatar/producer/consumer/ProducerTest.java +++ b/producer-consumer/src/test/java/com/iluwatar/producer/consumer/ProducerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.producer.consumer; import org.junit.jupiter.api.Test; diff --git a/promise/src/main/java/com/iluwatar/promise/App.java b/promise/src/main/java/com/iluwatar/promise/App.java index 54371023d080..c201d33526c2 100644 --- a/promise/src/main/java/com/iluwatar/promise/App.java +++ b/promise/src/main/java/com/iluwatar/promise/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.promise; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/promise/src/main/java/com/iluwatar/promise/Promise.java b/promise/src/main/java/com/iluwatar/promise/Promise.java index c3f0d9fc7373..eadcc5bd9a7d 100644 --- a/promise/src/main/java/com/iluwatar/promise/Promise.java +++ b/promise/src/main/java/com/iluwatar/promise/Promise.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.promise; import java.util.concurrent.Callable; diff --git a/promise/src/main/java/com/iluwatar/promise/PromiseSupport.java b/promise/src/main/java/com/iluwatar/promise/PromiseSupport.java index 5cfb86af5f4f..058e899d0b39 100644 --- a/promise/src/main/java/com/iluwatar/promise/PromiseSupport.java +++ b/promise/src/main/java/com/iluwatar/promise/PromiseSupport.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.promise; import java.util.concurrent.ExecutionException; diff --git a/promise/src/main/java/com/iluwatar/promise/Utility.java b/promise/src/main/java/com/iluwatar/promise/Utility.java index b6830f03d4c5..472f7b0a5234 100644 --- a/promise/src/main/java/com/iluwatar/promise/Utility.java +++ b/promise/src/main/java/com/iluwatar/promise/Utility.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.promise; import org.slf4j.Logger; diff --git a/promise/src/test/java/com/iluwatar/promise/AppTest.java b/promise/src/test/java/com/iluwatar/promise/AppTest.java index 17d3bc3dabe9..0913d5911ac5 100644 --- a/promise/src/test/java/com/iluwatar/promise/AppTest.java +++ b/promise/src/test/java/com/iluwatar/promise/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.promise; import org.junit.jupiter.api.Test; diff --git a/promise/src/test/java/com/iluwatar/promise/PromiseTest.java b/promise/src/test/java/com/iluwatar/promise/PromiseTest.java index 08962f2e4b12..9b02191ee007 100644 --- a/promise/src/test/java/com/iluwatar/promise/PromiseTest.java +++ b/promise/src/test/java/com/iluwatar/promise/PromiseTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.promise; import org.junit.jupiter.api.BeforeEach; diff --git a/property/src/main/java/com/iluwatar/property/App.java b/property/src/main/java/com/iluwatar/property/App.java index 0aa1ee4035ba..a7045e6df6db 100644 --- a/property/src/main/java/com/iluwatar/property/App.java +++ b/property/src/main/java/com/iluwatar/property/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.property; import com.iluwatar.property.Character.Type; diff --git a/property/src/main/java/com/iluwatar/property/Character.java b/property/src/main/java/com/iluwatar/property/Character.java index 6b8dbd1d69e9..ef19f01072e6 100644 --- a/property/src/main/java/com/iluwatar/property/Character.java +++ b/property/src/main/java/com/iluwatar/property/Character.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.property; import java.util.HashMap; diff --git a/property/src/main/java/com/iluwatar/property/Prototype.java b/property/src/main/java/com/iluwatar/property/Prototype.java index eba8976ef8ce..9570f66536d8 100644 --- a/property/src/main/java/com/iluwatar/property/Prototype.java +++ b/property/src/main/java/com/iluwatar/property/Prototype.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.property; /** diff --git a/property/src/main/java/com/iluwatar/property/Stats.java b/property/src/main/java/com/iluwatar/property/Stats.java index d4bc8aa4976b..4015e5693680 100644 --- a/property/src/main/java/com/iluwatar/property/Stats.java +++ b/property/src/main/java/com/iluwatar/property/Stats.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.property; /** diff --git a/property/src/test/java/com/iluwatar/property/AppTest.java b/property/src/test/java/com/iluwatar/property/AppTest.java index d8addd67f5f2..f8096b865c6d 100644 --- a/property/src/test/java/com/iluwatar/property/AppTest.java +++ b/property/src/test/java/com/iluwatar/property/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.property; import org.junit.jupiter.api.Test; diff --git a/property/src/test/java/com/iluwatar/property/CharacterTest.java b/property/src/test/java/com/iluwatar/property/CharacterTest.java index 6c349438edd3..6bbd693a7d13 100644 --- a/property/src/test/java/com/iluwatar/property/CharacterTest.java +++ b/property/src/test/java/com/iluwatar/property/CharacterTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.property; import org.junit.jupiter.api.Test; diff --git a/prototype/src/main/java/com/iluwatar/prototype/App.java b/prototype/src/main/java/com/iluwatar/prototype/App.java index 1972979d83dc..457f4f2a0f5a 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/App.java +++ b/prototype/src/main/java/com/iluwatar/prototype/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; import org.slf4j.Logger; diff --git a/prototype/src/main/java/com/iluwatar/prototype/Beast.java b/prototype/src/main/java/com/iluwatar/prototype/Beast.java index 8c2f0f31af95..3b82cdd9dde1 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/Beast.java +++ b/prototype/src/main/java/com/iluwatar/prototype/Beast.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; /** diff --git a/prototype/src/main/java/com/iluwatar/prototype/ElfBeast.java b/prototype/src/main/java/com/iluwatar/prototype/ElfBeast.java index 128a8ec373b7..9ef44b164391 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/ElfBeast.java +++ b/prototype/src/main/java/com/iluwatar/prototype/ElfBeast.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; /** diff --git a/prototype/src/main/java/com/iluwatar/prototype/ElfMage.java b/prototype/src/main/java/com/iluwatar/prototype/ElfMage.java index 4abcc8d849d7..14b6e6261ba6 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/ElfMage.java +++ b/prototype/src/main/java/com/iluwatar/prototype/ElfMage.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; /** diff --git a/prototype/src/main/java/com/iluwatar/prototype/ElfWarlord.java b/prototype/src/main/java/com/iluwatar/prototype/ElfWarlord.java index efba5fde08ab..6c5a4a4ffc0a 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/ElfWarlord.java +++ b/prototype/src/main/java/com/iluwatar/prototype/ElfWarlord.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; /** diff --git a/prototype/src/main/java/com/iluwatar/prototype/HeroFactory.java b/prototype/src/main/java/com/iluwatar/prototype/HeroFactory.java index 17ae47031928..791671289b4c 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/HeroFactory.java +++ b/prototype/src/main/java/com/iluwatar/prototype/HeroFactory.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; /** diff --git a/prototype/src/main/java/com/iluwatar/prototype/HeroFactoryImpl.java b/prototype/src/main/java/com/iluwatar/prototype/HeroFactoryImpl.java index f890b3b69376..5803ee8efcc6 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/HeroFactoryImpl.java +++ b/prototype/src/main/java/com/iluwatar/prototype/HeroFactoryImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; /** diff --git a/prototype/src/main/java/com/iluwatar/prototype/Mage.java b/prototype/src/main/java/com/iluwatar/prototype/Mage.java index 03ed7b69b7eb..9da5e45baada 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/Mage.java +++ b/prototype/src/main/java/com/iluwatar/prototype/Mage.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; /** diff --git a/prototype/src/main/java/com/iluwatar/prototype/OrcBeast.java b/prototype/src/main/java/com/iluwatar/prototype/OrcBeast.java index 37704c1a58ff..2b5fb51599d0 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/OrcBeast.java +++ b/prototype/src/main/java/com/iluwatar/prototype/OrcBeast.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; /** diff --git a/prototype/src/main/java/com/iluwatar/prototype/OrcMage.java b/prototype/src/main/java/com/iluwatar/prototype/OrcMage.java index 01189c8f863d..de15b5e10d91 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/OrcMage.java +++ b/prototype/src/main/java/com/iluwatar/prototype/OrcMage.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; /** diff --git a/prototype/src/main/java/com/iluwatar/prototype/OrcWarlord.java b/prototype/src/main/java/com/iluwatar/prototype/OrcWarlord.java index ee2136bc86ea..0b117357fd82 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/OrcWarlord.java +++ b/prototype/src/main/java/com/iluwatar/prototype/OrcWarlord.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; /** diff --git a/prototype/src/main/java/com/iluwatar/prototype/Prototype.java b/prototype/src/main/java/com/iluwatar/prototype/Prototype.java index 4c9fcbd2acbe..bae58b026d3e 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/Prototype.java +++ b/prototype/src/main/java/com/iluwatar/prototype/Prototype.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; /** diff --git a/prototype/src/main/java/com/iluwatar/prototype/Warlord.java b/prototype/src/main/java/com/iluwatar/prototype/Warlord.java index 096a5b195319..7ce8922e909c 100644 --- a/prototype/src/main/java/com/iluwatar/prototype/Warlord.java +++ b/prototype/src/main/java/com/iluwatar/prototype/Warlord.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; /** diff --git a/prototype/src/test/java/com/iluwatar/prototype/AppTest.java b/prototype/src/test/java/com/iluwatar/prototype/AppTest.java index 5e93fcf95040..4943339e8c5c 100644 --- a/prototype/src/test/java/com/iluwatar/prototype/AppTest.java +++ b/prototype/src/test/java/com/iluwatar/prototype/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; import org.junit.jupiter.api.Test; diff --git a/prototype/src/test/java/com/iluwatar/prototype/HeroFactoryImplTest.java b/prototype/src/test/java/com/iluwatar/prototype/HeroFactoryImplTest.java index d90de6a6a40f..0d33b67c3796 100644 --- a/prototype/src/test/java/com/iluwatar/prototype/HeroFactoryImplTest.java +++ b/prototype/src/test/java/com/iluwatar/prototype/HeroFactoryImplTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; import org.junit.jupiter.api.Test; diff --git a/prototype/src/test/java/com/iluwatar/prototype/PrototypeTest.java b/prototype/src/test/java/com/iluwatar/prototype/PrototypeTest.java index 5345ac43cdc6..8fbd80294b4c 100644 --- a/prototype/src/test/java/com/iluwatar/prototype/PrototypeTest.java +++ b/prototype/src/test/java/com/iluwatar/prototype/PrototypeTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.prototype; import org.junit.jupiter.params.ParameterizedTest; diff --git a/proxy/src/main/java/com/iluwatar/proxy/App.java b/proxy/src/main/java/com/iluwatar/proxy/App.java index fb6a6f2b7c53..4c9d0efaa3f4 100644 --- a/proxy/src/main/java/com/iluwatar/proxy/App.java +++ b/proxy/src/main/java/com/iluwatar/proxy/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.proxy; /** diff --git a/proxy/src/main/java/com/iluwatar/proxy/IvoryTower.java b/proxy/src/main/java/com/iluwatar/proxy/IvoryTower.java index 304f316a29a7..3adb96d86b6c 100644 --- a/proxy/src/main/java/com/iluwatar/proxy/IvoryTower.java +++ b/proxy/src/main/java/com/iluwatar/proxy/IvoryTower.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.proxy; import org.slf4j.Logger; diff --git a/proxy/src/main/java/com/iluwatar/proxy/Wizard.java b/proxy/src/main/java/com/iluwatar/proxy/Wizard.java index f1043f672ff9..031ab8dfd2da 100644 --- a/proxy/src/main/java/com/iluwatar/proxy/Wizard.java +++ b/proxy/src/main/java/com/iluwatar/proxy/Wizard.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.proxy; /** diff --git a/proxy/src/main/java/com/iluwatar/proxy/WizardTower.java b/proxy/src/main/java/com/iluwatar/proxy/WizardTower.java index 6efb920b8663..ac83aa6ea54a 100644 --- a/proxy/src/main/java/com/iluwatar/proxy/WizardTower.java +++ b/proxy/src/main/java/com/iluwatar/proxy/WizardTower.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.proxy; /** diff --git a/proxy/src/main/java/com/iluwatar/proxy/WizardTowerProxy.java b/proxy/src/main/java/com/iluwatar/proxy/WizardTowerProxy.java index 90c45352940e..7e6b2acf06d9 100644 --- a/proxy/src/main/java/com/iluwatar/proxy/WizardTowerProxy.java +++ b/proxy/src/main/java/com/iluwatar/proxy/WizardTowerProxy.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.proxy; import org.slf4j.Logger; diff --git a/proxy/src/test/java/com/iluwatar/proxy/AppTest.java b/proxy/src/test/java/com/iluwatar/proxy/AppTest.java index 92b09c63df69..7fcae7530aa4 100644 --- a/proxy/src/test/java/com/iluwatar/proxy/AppTest.java +++ b/proxy/src/test/java/com/iluwatar/proxy/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.proxy; import org.junit.jupiter.api.Test; diff --git a/proxy/src/test/java/com/iluwatar/proxy/IvoryTowerTest.java b/proxy/src/test/java/com/iluwatar/proxy/IvoryTowerTest.java index 0d068e1e18ca..ed3d6416c608 100644 --- a/proxy/src/test/java/com/iluwatar/proxy/IvoryTowerTest.java +++ b/proxy/src/test/java/com/iluwatar/proxy/IvoryTowerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.proxy; import com.iluwatar.proxy.utils.InMemoryAppender; diff --git a/proxy/src/test/java/com/iluwatar/proxy/WizardTest.java b/proxy/src/test/java/com/iluwatar/proxy/WizardTest.java index 62d35f4ea3d7..db6ae5c33921 100644 --- a/proxy/src/test/java/com/iluwatar/proxy/WizardTest.java +++ b/proxy/src/test/java/com/iluwatar/proxy/WizardTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.proxy; import org.junit.jupiter.api.Test; diff --git a/proxy/src/test/java/com/iluwatar/proxy/WizardTowerProxyTest.java b/proxy/src/test/java/com/iluwatar/proxy/WizardTowerProxyTest.java index ba2f66f6d3b4..6a51e4cbbda1 100644 --- a/proxy/src/test/java/com/iluwatar/proxy/WizardTowerProxyTest.java +++ b/proxy/src/test/java/com/iluwatar/proxy/WizardTowerProxyTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.proxy; import com.iluwatar.proxy.utils.InMemoryAppender; diff --git a/proxy/src/test/java/com/iluwatar/proxy/utils/InMemoryAppender.java b/proxy/src/test/java/com/iluwatar/proxy/utils/InMemoryAppender.java index a18f11887562..ebe841f2b26c 100644 --- a/proxy/src/test/java/com/iluwatar/proxy/utils/InMemoryAppender.java +++ b/proxy/src/test/java/com/iluwatar/proxy/utils/InMemoryAppender.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.proxy.utils; import ch.qos.logback.classic.Logger; diff --git a/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/App.java b/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/App.java index aa3c04efe995..80fdc9462f07 100644 --- a/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/App.java +++ b/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.queue.load.leveling; import java.util.concurrent.ExecutorService; diff --git a/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/Message.java b/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/Message.java index 561618891dbf..432d1fe4038f 100644 --- a/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/Message.java +++ b/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/Message.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.queue.load.leveling; /** diff --git a/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/MessageQueue.java b/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/MessageQueue.java index 177d6df9fa3c..b6059471f5d6 100644 --- a/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/MessageQueue.java +++ b/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/MessageQueue.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.queue.load.leveling; import java.util.concurrent.ArrayBlockingQueue; diff --git a/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/ServiceExecutor.java b/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/ServiceExecutor.java index 5c788011ce07..1ef27ff28972 100644 --- a/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/ServiceExecutor.java +++ b/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/ServiceExecutor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.queue.load.leveling; import org.slf4j.Logger; diff --git a/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/Task.java b/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/Task.java index cae188933305..fcdc3866f46b 100644 --- a/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/Task.java +++ b/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/Task.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.queue.load.leveling; /** * Task Interface. diff --git a/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/TaskGenerator.java b/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/TaskGenerator.java index 4f3380252e7f..cef9311fb29a 100644 --- a/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/TaskGenerator.java +++ b/queue-load-leveling/src/main/java/com/iluwatar/queue/load/leveling/TaskGenerator.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.queue.load.leveling; import org.slf4j.Logger; diff --git a/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/AppTest.java b/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/AppTest.java index b6b85096d558..b8d772f3929e 100644 --- a/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/AppTest.java +++ b/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.queue.load.leveling; import org.junit.jupiter.api.Test; diff --git a/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/MessageQueueTest.java b/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/MessageQueueTest.java index ac260f623c40..0333a666df87 100644 --- a/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/MessageQueueTest.java +++ b/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/MessageQueueTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.queue.load.leveling; import org.junit.jupiter.api.Test; diff --git a/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/MessageTest.java b/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/MessageTest.java index 9a6f27b93d43..4dad771628c3 100644 --- a/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/MessageTest.java +++ b/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/MessageTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.queue.load.leveling; import org.junit.jupiter.api.Test; diff --git a/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/TaskGenSrvExeTest.java b/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/TaskGenSrvExeTest.java index c8626f84144f..a6cd3d36c2eb 100644 --- a/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/TaskGenSrvExeTest.java +++ b/queue-load-leveling/src/test/java/com/iluwatar/queue/load/leveling/TaskGenSrvExeTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.queue.load.leveling; import org.junit.jupiter.api.Test; diff --git a/reactor/src/main/java/com/iluwatar/reactor/app/App.java b/reactor/src/main/java/com/iluwatar/reactor/app/App.java index 5f2ea96a3cee..8ccbe314579d 100644 --- a/reactor/src/main/java/com/iluwatar/reactor/app/App.java +++ b/reactor/src/main/java/com/iluwatar/reactor/app/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reactor.app; import java.io.IOException; diff --git a/reactor/src/main/java/com/iluwatar/reactor/app/AppClient.java b/reactor/src/main/java/com/iluwatar/reactor/app/AppClient.java index 6d28b795d0a5..75db3079bf47 100644 --- a/reactor/src/main/java/com/iluwatar/reactor/app/AppClient.java +++ b/reactor/src/main/java/com/iluwatar/reactor/app/AppClient.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reactor.app; import org.slf4j.Logger; diff --git a/reactor/src/main/java/com/iluwatar/reactor/app/LoggingHandler.java b/reactor/src/main/java/com/iluwatar/reactor/app/LoggingHandler.java index 9a8b102a969c..f0de033be8df 100644 --- a/reactor/src/main/java/com/iluwatar/reactor/app/LoggingHandler.java +++ b/reactor/src/main/java/com/iluwatar/reactor/app/LoggingHandler.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reactor.app; import java.nio.ByteBuffer; diff --git a/reactor/src/main/java/com/iluwatar/reactor/framework/AbstractNioChannel.java b/reactor/src/main/java/com/iluwatar/reactor/framework/AbstractNioChannel.java index b3dd1cedd229..dd0572aefc29 100644 --- a/reactor/src/main/java/com/iluwatar/reactor/framework/AbstractNioChannel.java +++ b/reactor/src/main/java/com/iluwatar/reactor/framework/AbstractNioChannel.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reactor.framework; import java.io.IOException; diff --git a/reactor/src/main/java/com/iluwatar/reactor/framework/ChannelHandler.java b/reactor/src/main/java/com/iluwatar/reactor/framework/ChannelHandler.java index cb491b88a519..e7204a550f27 100644 --- a/reactor/src/main/java/com/iluwatar/reactor/framework/ChannelHandler.java +++ b/reactor/src/main/java/com/iluwatar/reactor/framework/ChannelHandler.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reactor.framework; import java.nio.channels.SelectionKey; diff --git a/reactor/src/main/java/com/iluwatar/reactor/framework/Dispatcher.java b/reactor/src/main/java/com/iluwatar/reactor/framework/Dispatcher.java index 3bfc94b7900b..17ccb2ef85d5 100644 --- a/reactor/src/main/java/com/iluwatar/reactor/framework/Dispatcher.java +++ b/reactor/src/main/java/com/iluwatar/reactor/framework/Dispatcher.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reactor.framework; import java.nio.channels.SelectionKey; diff --git a/reactor/src/main/java/com/iluwatar/reactor/framework/NioDatagramChannel.java b/reactor/src/main/java/com/iluwatar/reactor/framework/NioDatagramChannel.java index 3ea4828b5254..f62e46e72049 100644 --- a/reactor/src/main/java/com/iluwatar/reactor/framework/NioDatagramChannel.java +++ b/reactor/src/main/java/com/iluwatar/reactor/framework/NioDatagramChannel.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reactor.framework; import org.slf4j.Logger; diff --git a/reactor/src/main/java/com/iluwatar/reactor/framework/NioReactor.java b/reactor/src/main/java/com/iluwatar/reactor/framework/NioReactor.java index e4f13d065f3b..9c71ed80e57e 100644 --- a/reactor/src/main/java/com/iluwatar/reactor/framework/NioReactor.java +++ b/reactor/src/main/java/com/iluwatar/reactor/framework/NioReactor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reactor.framework; import org.slf4j.Logger; diff --git a/reactor/src/main/java/com/iluwatar/reactor/framework/NioServerSocketChannel.java b/reactor/src/main/java/com/iluwatar/reactor/framework/NioServerSocketChannel.java index 3fa6cfbe7c65..a56b5dfe9a58 100644 --- a/reactor/src/main/java/com/iluwatar/reactor/framework/NioServerSocketChannel.java +++ b/reactor/src/main/java/com/iluwatar/reactor/framework/NioServerSocketChannel.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reactor.framework; import org.slf4j.Logger; diff --git a/reactor/src/main/java/com/iluwatar/reactor/framework/SameThreadDispatcher.java b/reactor/src/main/java/com/iluwatar/reactor/framework/SameThreadDispatcher.java index d672757c4772..a64acc069a97 100644 --- a/reactor/src/main/java/com/iluwatar/reactor/framework/SameThreadDispatcher.java +++ b/reactor/src/main/java/com/iluwatar/reactor/framework/SameThreadDispatcher.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reactor.framework; import java.nio.channels.SelectionKey; diff --git a/reactor/src/main/java/com/iluwatar/reactor/framework/ThreadPoolDispatcher.java b/reactor/src/main/java/com/iluwatar/reactor/framework/ThreadPoolDispatcher.java index 4283a50aced0..e4bd20cfd340 100644 --- a/reactor/src/main/java/com/iluwatar/reactor/framework/ThreadPoolDispatcher.java +++ b/reactor/src/main/java/com/iluwatar/reactor/framework/ThreadPoolDispatcher.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reactor.framework; import java.nio.channels.SelectionKey; diff --git a/reactor/src/test/java/com/iluwatar/reactor/app/ReactorTest.java b/reactor/src/test/java/com/iluwatar/reactor/app/ReactorTest.java index 2a0af14113cb..4b2f0348abfe 100644 --- a/reactor/src/test/java/com/iluwatar/reactor/app/ReactorTest.java +++ b/reactor/src/test/java/com/iluwatar/reactor/app/ReactorTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reactor.app; import com.iluwatar.reactor.framework.SameThreadDispatcher; diff --git a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/App.java b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/App.java index 2ee3fa948845..1232a73f73bc 100644 --- a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/App.java +++ b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reader.writer.lock; import java.util.concurrent.ExecutorService; diff --git a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Reader.java b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Reader.java index 3bc46c4524f7..a4c7d07448fc 100644 --- a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Reader.java +++ b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Reader.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reader.writer.lock; import java.util.concurrent.locks.Lock; diff --git a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/ReaderWriterLock.java b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/ReaderWriterLock.java index d35703801c67..282503ea63bc 100644 --- a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/ReaderWriterLock.java +++ b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/ReaderWriterLock.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reader.writer.lock; import java.util.HashSet; diff --git a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Writer.java b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Writer.java index 4aa5ab5a9571..afe93efd7ef2 100644 --- a/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Writer.java +++ b/reader-writer-lock/src/main/java/com/iluwatar/reader/writer/lock/Writer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reader.writer.lock; import java.util.concurrent.locks.Lock; diff --git a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/AppTest.java b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/AppTest.java index 8815e6c8e451..0c323724e471 100644 --- a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/AppTest.java +++ b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reader.writer.lock; import org.junit.jupiter.api.Test; diff --git a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderAndWriterTest.java b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderAndWriterTest.java index d190dfb9ef4c..1f6edfa3cf3f 100644 --- a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderAndWriterTest.java +++ b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderAndWriterTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reader.writer.lock; import com.iluwatar.reader.writer.lock.utils.InMemoryAppender; diff --git a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderTest.java b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderTest.java index d49a472e05a8..849cf32ba802 100644 --- a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderTest.java +++ b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/ReaderTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reader.writer.lock; import com.iluwatar.reader.writer.lock.utils.InMemoryAppender; diff --git a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/WriterTest.java b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/WriterTest.java index 55a8b7f95685..60c78e57313a 100644 --- a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/WriterTest.java +++ b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/WriterTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reader.writer.lock; import com.iluwatar.reader.writer.lock.utils.InMemoryAppender; diff --git a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/utils/InMemoryAppender.java b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/utils/InMemoryAppender.java index c6b8319d2a5d..98f14a82bcc0 100644 --- a/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/utils/InMemoryAppender.java +++ b/reader-writer-lock/src/test/java/com/iluwatar/reader/writer/lock/utils/InMemoryAppender.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.reader.writer.lock.utils; import ch.qos.logback.classic.Logger; diff --git a/repository/src/main/java/com/iluwatar/repository/App.java b/repository/src/main/java/com/iluwatar/repository/App.java index 171369497f5b..0ecafd030e73 100644 --- a/repository/src/main/java/com/iluwatar/repository/App.java +++ b/repository/src/main/java/com/iluwatar/repository/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.repository; import java.util.List; diff --git a/repository/src/main/java/com/iluwatar/repository/AppConfig.java b/repository/src/main/java/com/iluwatar/repository/AppConfig.java index 23de85b1ece5..f4f46be88f60 100644 --- a/repository/src/main/java/com/iluwatar/repository/AppConfig.java +++ b/repository/src/main/java/com/iluwatar/repository/AppConfig.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.repository; import java.sql.SQLException; diff --git a/repository/src/main/java/com/iluwatar/repository/Person.java b/repository/src/main/java/com/iluwatar/repository/Person.java index 1f68108bab8b..ded5b8cfa855 100644 --- a/repository/src/main/java/com/iluwatar/repository/Person.java +++ b/repository/src/main/java/com/iluwatar/repository/Person.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.repository; import javax.persistence.Entity; diff --git a/repository/src/main/java/com/iluwatar/repository/PersonRepository.java b/repository/src/main/java/com/iluwatar/repository/PersonRepository.java index e6e559942b67..e181d19b5aba 100644 --- a/repository/src/main/java/com/iluwatar/repository/PersonRepository.java +++ b/repository/src/main/java/com/iluwatar/repository/PersonRepository.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.repository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; diff --git a/repository/src/main/java/com/iluwatar/repository/PersonSpecifications.java b/repository/src/main/java/com/iluwatar/repository/PersonSpecifications.java index 4e6ced00a961..5a14985c9b65 100644 --- a/repository/src/main/java/com/iluwatar/repository/PersonSpecifications.java +++ b/repository/src/main/java/com/iluwatar/repository/PersonSpecifications.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.repository; import javax.persistence.criteria.CriteriaBuilder; diff --git a/repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java b/repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java index 519febf68dd0..6e53713233a1 100644 --- a/repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java +++ b/repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.repository; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/repository/src/test/java/com/iluwatar/repository/AppConfigTest.java b/repository/src/test/java/com/iluwatar/repository/AppConfigTest.java index d73027c5b4b3..c9f292029b63 100644 --- a/repository/src/test/java/com/iluwatar/repository/AppConfigTest.java +++ b/repository/src/test/java/com/iluwatar/repository/AppConfigTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.repository; import org.junit.jupiter.api.Test; diff --git a/repository/src/test/java/com/iluwatar/repository/AppTest.java b/repository/src/test/java/com/iluwatar/repository/AppTest.java index f33e83c91894..8889833f6bfa 100644 --- a/repository/src/test/java/com/iluwatar/repository/AppTest.java +++ b/repository/src/test/java/com/iluwatar/repository/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.repository; import org.junit.jupiter.api.Test; diff --git a/repository/src/test/java/com/iluwatar/repository/RepositoryTest.java b/repository/src/test/java/com/iluwatar/repository/RepositoryTest.java index d0f7fe9ae7d8..9f7615aa57de 100644 --- a/repository/src/test/java/com/iluwatar/repository/RepositoryTest.java +++ b/repository/src/test/java/com/iluwatar/repository/RepositoryTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.repository; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization/App.java b/resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization/App.java index ea8f3e0448d5..fc67465a7e24 100644 --- a/resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization/App.java +++ b/resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.resource.acquisition.is.initialization; import org.slf4j.Logger; diff --git a/resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization/SlidingDoor.java b/resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization/SlidingDoor.java index 615a87fc9941..47c36a77ff26 100644 --- a/resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization/SlidingDoor.java +++ b/resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization/SlidingDoor.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.resource.acquisition.is.initialization; import org.slf4j.Logger; diff --git a/resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization/TreasureChest.java b/resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization/TreasureChest.java index ccca9015afe5..d8adf2ed48ec 100644 --- a/resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization/TreasureChest.java +++ b/resource-acquisition-is-initialization/src/main/java/com/iluwatar/resource/acquisition/is/initialization/TreasureChest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.resource.acquisition.is.initialization; import org.slf4j.Logger; diff --git a/resource-acquisition-is-initialization/src/test/java/com/iluwatar/resource/acquisition/is/initialization/AppTest.java b/resource-acquisition-is-initialization/src/test/java/com/iluwatar/resource/acquisition/is/initialization/AppTest.java index 97a160eda68b..0e58779aff08 100644 --- a/resource-acquisition-is-initialization/src/test/java/com/iluwatar/resource/acquisition/is/initialization/AppTest.java +++ b/resource-acquisition-is-initialization/src/test/java/com/iluwatar/resource/acquisition/is/initialization/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.resource.acquisition.is.initialization; import org.junit.jupiter.api.Test; diff --git a/resource-acquisition-is-initialization/src/test/java/com/iluwatar/resource/acquisition/is/initialization/ClosableTest.java b/resource-acquisition-is-initialization/src/test/java/com/iluwatar/resource/acquisition/is/initialization/ClosableTest.java index 030848b9d90f..10a85c6efdbc 100644 --- a/resource-acquisition-is-initialization/src/test/java/com/iluwatar/resource/acquisition/is/initialization/ClosableTest.java +++ b/resource-acquisition-is-initialization/src/test/java/com/iluwatar/resource/acquisition/is/initialization/ClosableTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.resource.acquisition.is.initialization; import ch.qos.logback.classic.Logger; diff --git a/retry/src/main/java/com/iluwatar/retry/App.java b/retry/src/main/java/com/iluwatar/retry/App.java index 76ec43363525..5eb78125cc8b 100644 --- a/retry/src/main/java/com/iluwatar/retry/App.java +++ b/retry/src/main/java/com/iluwatar/retry/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.retry; import org.slf4j.Logger; diff --git a/retry/src/main/java/com/iluwatar/retry/BusinessException.java b/retry/src/main/java/com/iluwatar/retry/BusinessException.java index d88aa8a105b7..2da1cca8ab7b 100644 --- a/retry/src/main/java/com/iluwatar/retry/BusinessException.java +++ b/retry/src/main/java/com/iluwatar/retry/BusinessException.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.retry; /** diff --git a/retry/src/main/java/com/iluwatar/retry/BusinessOperation.java b/retry/src/main/java/com/iluwatar/retry/BusinessOperation.java index 37846f54d751..a829ff541f35 100644 --- a/retry/src/main/java/com/iluwatar/retry/BusinessOperation.java +++ b/retry/src/main/java/com/iluwatar/retry/BusinessOperation.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.retry; /** diff --git a/retry/src/main/java/com/iluwatar/retry/CustomerNotFoundException.java b/retry/src/main/java/com/iluwatar/retry/CustomerNotFoundException.java index 990229ebed04..c0a9ca434c93 100644 --- a/retry/src/main/java/com/iluwatar/retry/CustomerNotFoundException.java +++ b/retry/src/main/java/com/iluwatar/retry/CustomerNotFoundException.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.retry; /** diff --git a/retry/src/main/java/com/iluwatar/retry/DatabaseNotAvailableException.java b/retry/src/main/java/com/iluwatar/retry/DatabaseNotAvailableException.java index be78a9e6fd8b..02cbc6521ab9 100644 --- a/retry/src/main/java/com/iluwatar/retry/DatabaseNotAvailableException.java +++ b/retry/src/main/java/com/iluwatar/retry/DatabaseNotAvailableException.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.retry; /** diff --git a/retry/src/main/java/com/iluwatar/retry/FindCustomer.java b/retry/src/main/java/com/iluwatar/retry/FindCustomer.java index 83ab9a25c3f4..11c2b40d6e03 100644 --- a/retry/src/main/java/com/iluwatar/retry/FindCustomer.java +++ b/retry/src/main/java/com/iluwatar/retry/FindCustomer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.retry; import java.util.ArrayDeque; diff --git a/retry/src/main/java/com/iluwatar/retry/Retry.java b/retry/src/main/java/com/iluwatar/retry/Retry.java index d5d16bf30e62..7f188cb8f181 100644 --- a/retry/src/main/java/com/iluwatar/retry/Retry.java +++ b/retry/src/main/java/com/iluwatar/retry/Retry.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.retry; import java.util.ArrayList; diff --git a/retry/src/main/java/com/iluwatar/retry/RetryExponentialBackoff.java b/retry/src/main/java/com/iluwatar/retry/RetryExponentialBackoff.java index b7024c9184d0..91dc0d6b2369 100644 --- a/retry/src/main/java/com/iluwatar/retry/RetryExponentialBackoff.java +++ b/retry/src/main/java/com/iluwatar/retry/RetryExponentialBackoff.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.retry; import java.util.ArrayList; diff --git a/retry/src/test/java/com/iluwatar/retry/FindCustomerTest.java b/retry/src/test/java/com/iluwatar/retry/FindCustomerTest.java index d1cd87b21772..b52763099bd4 100644 --- a/retry/src/test/java/com/iluwatar/retry/FindCustomerTest.java +++ b/retry/src/test/java/com/iluwatar/retry/FindCustomerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.retry; import org.junit.jupiter.api.Test; diff --git a/retry/src/test/java/com/iluwatar/retry/RetryExponentialBackoffTest.java b/retry/src/test/java/com/iluwatar/retry/RetryExponentialBackoffTest.java index 23fd8add732c..f07d665af6a3 100644 --- a/retry/src/test/java/com/iluwatar/retry/RetryExponentialBackoffTest.java +++ b/retry/src/test/java/com/iluwatar/retry/RetryExponentialBackoffTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.retry; import org.junit.jupiter.api.Test; diff --git a/retry/src/test/java/com/iluwatar/retry/RetryTest.java b/retry/src/test/java/com/iluwatar/retry/RetryTest.java index 5366b525bc1e..64df9d14d8f9 100644 --- a/retry/src/test/java/com/iluwatar/retry/RetryTest.java +++ b/retry/src/test/java/com/iluwatar/retry/RetryTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.retry; import org.junit.jupiter.api.Test; diff --git a/semaphore/src/main/java/com/iluwatar/semaphore/App.java b/semaphore/src/main/java/com/iluwatar/semaphore/App.java index 36a792f2379b..e1f43cf97386 100644 --- a/semaphore/src/main/java/com/iluwatar/semaphore/App.java +++ b/semaphore/src/main/java/com/iluwatar/semaphore/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.semaphore; /** diff --git a/semaphore/src/main/java/com/iluwatar/semaphore/Customer.java b/semaphore/src/main/java/com/iluwatar/semaphore/Customer.java index 432cbb52ff7b..4e380f92a20b 100644 --- a/semaphore/src/main/java/com/iluwatar/semaphore/Customer.java +++ b/semaphore/src/main/java/com/iluwatar/semaphore/Customer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.semaphore; import org.slf4j.Logger; diff --git a/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java b/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java index 52e8d8f0416c..05872be9d7ca 100644 --- a/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java +++ b/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.semaphore; /** diff --git a/semaphore/src/main/java/com/iluwatar/semaphore/FruitBowl.java b/semaphore/src/main/java/com/iluwatar/semaphore/FruitBowl.java index a187c5a57acf..8696709a045e 100644 --- a/semaphore/src/main/java/com/iluwatar/semaphore/FruitBowl.java +++ b/semaphore/src/main/java/com/iluwatar/semaphore/FruitBowl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.semaphore; import java.util.List; diff --git a/semaphore/src/main/java/com/iluwatar/semaphore/FruitShop.java b/semaphore/src/main/java/com/iluwatar/semaphore/FruitShop.java index 7881a79b9437..cd71955fb3bb 100644 --- a/semaphore/src/main/java/com/iluwatar/semaphore/FruitShop.java +++ b/semaphore/src/main/java/com/iluwatar/semaphore/FruitShop.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.semaphore; /** diff --git a/semaphore/src/main/java/com/iluwatar/semaphore/Lock.java b/semaphore/src/main/java/com/iluwatar/semaphore/Lock.java index 4813c5e22104..df7df2cf064d 100644 --- a/semaphore/src/main/java/com/iluwatar/semaphore/Lock.java +++ b/semaphore/src/main/java/com/iluwatar/semaphore/Lock.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.semaphore; /** diff --git a/semaphore/src/main/java/com/iluwatar/semaphore/Semaphore.java b/semaphore/src/main/java/com/iluwatar/semaphore/Semaphore.java index 9bd67380762e..9dfe79316e3a 100644 --- a/semaphore/src/main/java/com/iluwatar/semaphore/Semaphore.java +++ b/semaphore/src/main/java/com/iluwatar/semaphore/Semaphore.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.semaphore; /** diff --git a/semaphore/src/test/java/com/iluwatar/semaphore/AppTest.java b/semaphore/src/test/java/com/iluwatar/semaphore/AppTest.java index 55a8f0936713..087ab78758b2 100644 --- a/semaphore/src/test/java/com/iluwatar/semaphore/AppTest.java +++ b/semaphore/src/test/java/com/iluwatar/semaphore/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.semaphore; import org.junit.jupiter.api.Test; diff --git a/semaphore/src/test/java/com/iluwatar/semaphore/FruitBowlTest.java b/semaphore/src/test/java/com/iluwatar/semaphore/FruitBowlTest.java index b2ce4beb7b98..5cab7d64d9a1 100644 --- a/semaphore/src/test/java/com/iluwatar/semaphore/FruitBowlTest.java +++ b/semaphore/src/test/java/com/iluwatar/semaphore/FruitBowlTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.semaphore; import org.junit.jupiter.api.Test; diff --git a/semaphore/src/test/java/com/iluwatar/semaphore/SemaphoreTest.java b/semaphore/src/test/java/com/iluwatar/semaphore/SemaphoreTest.java index 393db51f384d..76f68af1537e 100644 --- a/semaphore/src/test/java/com/iluwatar/semaphore/SemaphoreTest.java +++ b/semaphore/src/test/java/com/iluwatar/semaphore/SemaphoreTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.semaphore; import org.junit.jupiter.api.Test; diff --git a/servant/src/main/java/com/iluwatar/servant/App.java b/servant/src/main/java/com/iluwatar/servant/App.java index 3b982dfb8a86..a629856d5173 100644 --- a/servant/src/main/java/com/iluwatar/servant/App.java +++ b/servant/src/main/java/com/iluwatar/servant/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servant; import org.slf4j.Logger; diff --git a/servant/src/main/java/com/iluwatar/servant/King.java b/servant/src/main/java/com/iluwatar/servant/King.java index 18c5bf3f8906..19db41201b54 100644 --- a/servant/src/main/java/com/iluwatar/servant/King.java +++ b/servant/src/main/java/com/iluwatar/servant/King.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servant; /** diff --git a/servant/src/main/java/com/iluwatar/servant/Queen.java b/servant/src/main/java/com/iluwatar/servant/Queen.java index 8e7a89bed69b..3e4fa486f422 100644 --- a/servant/src/main/java/com/iluwatar/servant/Queen.java +++ b/servant/src/main/java/com/iluwatar/servant/Queen.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servant; /** diff --git a/servant/src/main/java/com/iluwatar/servant/Royalty.java b/servant/src/main/java/com/iluwatar/servant/Royalty.java index 7a755cbd8e17..88c301ffe9fa 100644 --- a/servant/src/main/java/com/iluwatar/servant/Royalty.java +++ b/servant/src/main/java/com/iluwatar/servant/Royalty.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servant; /** diff --git a/servant/src/main/java/com/iluwatar/servant/Servant.java b/servant/src/main/java/com/iluwatar/servant/Servant.java index 11b78734ba58..97d6107c4838 100644 --- a/servant/src/main/java/com/iluwatar/servant/Servant.java +++ b/servant/src/main/java/com/iluwatar/servant/Servant.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servant; import java.util.List; diff --git a/servant/src/test/java/com/iluwatar/servant/AppTest.java b/servant/src/test/java/com/iluwatar/servant/AppTest.java index a41faa57dbd1..ef37ff010477 100644 --- a/servant/src/test/java/com/iluwatar/servant/AppTest.java +++ b/servant/src/test/java/com/iluwatar/servant/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servant; import org.junit.jupiter.api.Test; diff --git a/servant/src/test/java/com/iluwatar/servant/KingTest.java b/servant/src/test/java/com/iluwatar/servant/KingTest.java index 2206673899c1..ed97ae7cfa00 100644 --- a/servant/src/test/java/com/iluwatar/servant/KingTest.java +++ b/servant/src/test/java/com/iluwatar/servant/KingTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servant; import org.junit.jupiter.api.Test; diff --git a/servant/src/test/java/com/iluwatar/servant/QueenTest.java b/servant/src/test/java/com/iluwatar/servant/QueenTest.java index 1dfe07716007..a82eec7767f4 100644 --- a/servant/src/test/java/com/iluwatar/servant/QueenTest.java +++ b/servant/src/test/java/com/iluwatar/servant/QueenTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servant; diff --git a/servant/src/test/java/com/iluwatar/servant/ServantTest.java b/servant/src/test/java/com/iluwatar/servant/ServantTest.java index 624ee32c3525..4431f6d60837 100644 --- a/servant/src/test/java/com/iluwatar/servant/ServantTest.java +++ b/servant/src/test/java/com/iluwatar/servant/ServantTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servant; import org.junit.jupiter.api.Test; diff --git a/serverless/src/main/java/com/iluwatar/serverless/baas/api/AbstractDynamoDbHandler.java b/serverless/src/main/java/com/iluwatar/serverless/baas/api/AbstractDynamoDbHandler.java index 0295f03a6694..eff21f879cdc 100644 --- a/serverless/src/main/java/com/iluwatar/serverless/baas/api/AbstractDynamoDbHandler.java +++ b/serverless/src/main/java/com/iluwatar/serverless/baas/api/AbstractDynamoDbHandler.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.serverless.baas.api; import com.amazonaws.regions.Regions; diff --git a/serverless/src/main/java/com/iluwatar/serverless/baas/api/FindPersonApiHandler.java b/serverless/src/main/java/com/iluwatar/serverless/baas/api/FindPersonApiHandler.java index 14f2b25a5153..3e0bde023761 100644 --- a/serverless/src/main/java/com/iluwatar/serverless/baas/api/FindPersonApiHandler.java +++ b/serverless/src/main/java/com/iluwatar/serverless/baas/api/FindPersonApiHandler.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.serverless.baas.api; import com.amazonaws.services.lambda.runtime.Context; diff --git a/serverless/src/main/java/com/iluwatar/serverless/baas/api/SavePersonApiHandler.java b/serverless/src/main/java/com/iluwatar/serverless/baas/api/SavePersonApiHandler.java index 8ef4b839ec63..502f12258d94 100644 --- a/serverless/src/main/java/com/iluwatar/serverless/baas/api/SavePersonApiHandler.java +++ b/serverless/src/main/java/com/iluwatar/serverless/baas/api/SavePersonApiHandler.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.serverless.baas.api; import com.amazonaws.services.lambda.runtime.Context; diff --git a/serverless/src/main/java/com/iluwatar/serverless/baas/model/Address.java b/serverless/src/main/java/com/iluwatar/serverless/baas/model/Address.java index 8c6232c4efd1..c2e8fdac609e 100644 --- a/serverless/src/main/java/com/iluwatar/serverless/baas/model/Address.java +++ b/serverless/src/main/java/com/iluwatar/serverless/baas/model/Address.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.serverless.baas.model; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute; diff --git a/serverless/src/main/java/com/iluwatar/serverless/baas/model/Person.java b/serverless/src/main/java/com/iluwatar/serverless/baas/model/Person.java index 2a83448501bd..3328b837032e 100644 --- a/serverless/src/main/java/com/iluwatar/serverless/baas/model/Person.java +++ b/serverless/src/main/java/com/iluwatar/serverless/baas/model/Person.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.serverless.baas.model; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute; diff --git a/serverless/src/main/java/com/iluwatar/serverless/faas/ApiGatewayResponse.java b/serverless/src/main/java/com/iluwatar/serverless/faas/ApiGatewayResponse.java index 665c3dec659d..8de0421612c8 100644 --- a/serverless/src/main/java/com/iluwatar/serverless/faas/ApiGatewayResponse.java +++ b/serverless/src/main/java/com/iluwatar/serverless/faas/ApiGatewayResponse.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.serverless.faas; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/serverless/src/main/java/com/iluwatar/serverless/faas/LambdaInfo.java b/serverless/src/main/java/com/iluwatar/serverless/faas/LambdaInfo.java index bae73281bc60..4186cfef8b7a 100644 --- a/serverless/src/main/java/com/iluwatar/serverless/faas/LambdaInfo.java +++ b/serverless/src/main/java/com/iluwatar/serverless/faas/LambdaInfo.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.serverless.faas; import java.io.Serializable; diff --git a/serverless/src/main/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandler.java b/serverless/src/main/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandler.java index 174e409c35c6..b88c24612453 100644 --- a/serverless/src/main/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandler.java +++ b/serverless/src/main/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandler.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.serverless.faas.api; import com.iluwatar.serverless.faas.ApiGatewayResponse; diff --git a/serverless/src/test/java/com/iluwatar/serverless/baas/api/FindPersonApiHandlerTest.java b/serverless/src/test/java/com/iluwatar/serverless/baas/api/FindPersonApiHandlerTest.java index 193346ab8ead..a688bdf9d0ac 100644 --- a/serverless/src/test/java/com/iluwatar/serverless/baas/api/FindPersonApiHandlerTest.java +++ b/serverless/src/test/java/com/iluwatar/serverless/baas/api/FindPersonApiHandlerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.serverless.baas.api; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper; diff --git a/serverless/src/test/java/com/iluwatar/serverless/baas/api/SavePersonApiHandlerTest.java b/serverless/src/test/java/com/iluwatar/serverless/baas/api/SavePersonApiHandlerTest.java index da31f8ac4fd6..66636c011458 100644 --- a/serverless/src/test/java/com/iluwatar/serverless/baas/api/SavePersonApiHandlerTest.java +++ b/serverless/src/test/java/com/iluwatar/serverless/baas/api/SavePersonApiHandlerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.serverless.baas.api; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper; diff --git a/serverless/src/test/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandlerTest.java b/serverless/src/test/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandlerTest.java index 9922c1a5c55e..ec6872973449 100644 --- a/serverless/src/test/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandlerTest.java +++ b/serverless/src/test/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandlerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.serverless.faas.api; import com.amazonaws.services.lambda.runtime.Context; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/app/App.java b/service-layer/src/main/java/com/iluwatar/servicelayer/app/App.java index 4d6ba0399bc1..1da25e4cb51f 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/app/App.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/app/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.app; import java.util.List; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java b/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java index a3c084109887..d58ffd2c90e0 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.common; import javax.persistence.Inheritance; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/common/Dao.java b/service-layer/src/main/java/com/iluwatar/servicelayer/common/Dao.java index 8e72e3225580..1fb41d0c8a98 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/common/Dao.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/common/Dao.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.common; import java.util.List; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/common/DaoBaseImpl.java b/service-layer/src/main/java/com/iluwatar/servicelayer/common/DaoBaseImpl.java index 290b9d148cb6..9accede55349 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/common/DaoBaseImpl.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/common/DaoBaseImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.common; import java.lang.reflect.ParameterizedType; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/hibernate/HibernateUtil.java b/service-layer/src/main/java/com/iluwatar/servicelayer/hibernate/HibernateUtil.java index a6e3bd39bd86..673918711a57 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/hibernate/HibernateUtil.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/hibernate/HibernateUtil.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.hibernate; import com.iluwatar.servicelayer.spell.Spell; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/magic/MagicService.java b/service-layer/src/main/java/com/iluwatar/servicelayer/magic/MagicService.java index ede38ec856c4..f0780b3382a3 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/magic/MagicService.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/magic/MagicService.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.magic; import java.util.List; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/magic/MagicServiceImpl.java b/service-layer/src/main/java/com/iluwatar/servicelayer/magic/MagicServiceImpl.java index d2319bc0dbe4..78bf3c0d00ce 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/magic/MagicServiceImpl.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/magic/MagicServiceImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.magic; import java.util.ArrayList; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/spell/Spell.java b/service-layer/src/main/java/com/iluwatar/servicelayer/spell/Spell.java index 242dc9e16c61..cc456c12432b 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/spell/Spell.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/spell/Spell.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.spell; import javax.persistence.Column; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/spell/SpellDao.java b/service-layer/src/main/java/com/iluwatar/servicelayer/spell/SpellDao.java index 50f008670381..cb7989176e83 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/spell/SpellDao.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/spell/SpellDao.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.spell; import com.iluwatar.servicelayer.common.Dao; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/spell/SpellDaoImpl.java b/service-layer/src/main/java/com/iluwatar/servicelayer/spell/SpellDaoImpl.java index fb061bb967f0..f4be0ae902ab 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/spell/SpellDaoImpl.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/spell/SpellDaoImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.spell; import com.iluwatar.servicelayer.common.DaoBaseImpl; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/Spellbook.java b/service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/Spellbook.java index 07893f53a654..481fa20db76a 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/Spellbook.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/Spellbook.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.spellbook; import java.util.HashSet; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/SpellbookDao.java b/service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/SpellbookDao.java index 69cb03fc8676..11cb667890ac 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/SpellbookDao.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/SpellbookDao.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.spellbook; import com.iluwatar.servicelayer.common.Dao; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/SpellbookDaoImpl.java b/service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/SpellbookDaoImpl.java index 980dfdc7649c..3ca708fde8f6 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/SpellbookDaoImpl.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/spellbook/SpellbookDaoImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.spellbook; import org.hibernate.Criteria; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/wizard/Wizard.java b/service-layer/src/main/java/com/iluwatar/servicelayer/wizard/Wizard.java index c970d88df4cc..05e65faf3f6f 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/wizard/Wizard.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/wizard/Wizard.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.wizard; import java.util.HashSet; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/wizard/WizardDao.java b/service-layer/src/main/java/com/iluwatar/servicelayer/wizard/WizardDao.java index d42656704523..945509dc526c 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/wizard/WizardDao.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/wizard/WizardDao.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.wizard; import com.iluwatar.servicelayer.common.Dao; diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/wizard/WizardDaoImpl.java b/service-layer/src/main/java/com/iluwatar/servicelayer/wizard/WizardDaoImpl.java index ccbd49f50ee5..e16f150d0c2e 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/wizard/WizardDaoImpl.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/wizard/WizardDaoImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.wizard; import org.hibernate.Criteria; diff --git a/service-layer/src/test/java/com/iluwatar/servicelayer/app/AppTest.java b/service-layer/src/test/java/com/iluwatar/servicelayer/app/AppTest.java index fc7a4910d127..f144e026633e 100644 --- a/service-layer/src/test/java/com/iluwatar/servicelayer/app/AppTest.java +++ b/service-layer/src/test/java/com/iluwatar/servicelayer/app/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.app; import com.iluwatar.servicelayer.hibernate.HibernateUtil; diff --git a/service-layer/src/test/java/com/iluwatar/servicelayer/common/BaseDaoTest.java b/service-layer/src/test/java/com/iluwatar/servicelayer/common/BaseDaoTest.java index b46584cc9271..e70cf0625ac7 100644 --- a/service-layer/src/test/java/com/iluwatar/servicelayer/common/BaseDaoTest.java +++ b/service-layer/src/test/java/com/iluwatar/servicelayer/common/BaseDaoTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.common; import com.iluwatar.servicelayer.hibernate.HibernateUtil; diff --git a/service-layer/src/test/java/com/iluwatar/servicelayer/magic/MagicServiceImplTest.java b/service-layer/src/test/java/com/iluwatar/servicelayer/magic/MagicServiceImplTest.java index c92b15e103ce..03284ab6ddd8 100644 --- a/service-layer/src/test/java/com/iluwatar/servicelayer/magic/MagicServiceImplTest.java +++ b/service-layer/src/test/java/com/iluwatar/servicelayer/magic/MagicServiceImplTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.magic; import com.iluwatar.servicelayer.spell.Spell; diff --git a/service-layer/src/test/java/com/iluwatar/servicelayer/spell/SpellDaoImplTest.java b/service-layer/src/test/java/com/iluwatar/servicelayer/spell/SpellDaoImplTest.java index f6f61505b4e3..bd6afaedc187 100644 --- a/service-layer/src/test/java/com/iluwatar/servicelayer/spell/SpellDaoImplTest.java +++ b/service-layer/src/test/java/com/iluwatar/servicelayer/spell/SpellDaoImplTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.spell; import com.iluwatar.servicelayer.common.BaseDaoTest; diff --git a/service-layer/src/test/java/com/iluwatar/servicelayer/spellbook/SpellbookDaoImplTest.java b/service-layer/src/test/java/com/iluwatar/servicelayer/spellbook/SpellbookDaoImplTest.java index e24b126023aa..01fed1bcb79a 100644 --- a/service-layer/src/test/java/com/iluwatar/servicelayer/spellbook/SpellbookDaoImplTest.java +++ b/service-layer/src/test/java/com/iluwatar/servicelayer/spellbook/SpellbookDaoImplTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.spellbook; import com.iluwatar.servicelayer.common.BaseDaoTest; diff --git a/service-layer/src/test/java/com/iluwatar/servicelayer/wizard/WizardDaoImplTest.java b/service-layer/src/test/java/com/iluwatar/servicelayer/wizard/WizardDaoImplTest.java index b3fa3dec0cc9..ca2b679c9e2e 100644 --- a/service-layer/src/test/java/com/iluwatar/servicelayer/wizard/WizardDaoImplTest.java +++ b/service-layer/src/test/java/com/iluwatar/servicelayer/wizard/WizardDaoImplTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelayer.wizard; import com.iluwatar.servicelayer.common.BaseDaoTest; diff --git a/service-locator/src/main/java/com/iluwatar/servicelocator/App.java b/service-locator/src/main/java/com/iluwatar/servicelocator/App.java index 72f7ed6a9a48..f5704c54f237 100644 --- a/service-locator/src/main/java/com/iluwatar/servicelocator/App.java +++ b/service-locator/src/main/java/com/iluwatar/servicelocator/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelocator; /** diff --git a/service-locator/src/main/java/com/iluwatar/servicelocator/InitContext.java b/service-locator/src/main/java/com/iluwatar/servicelocator/InitContext.java index 1366f5102183..93c6e3c7d8f8 100644 --- a/service-locator/src/main/java/com/iluwatar/servicelocator/InitContext.java +++ b/service-locator/src/main/java/com/iluwatar/servicelocator/InitContext.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelocator; import org.slf4j.Logger; diff --git a/service-locator/src/main/java/com/iluwatar/servicelocator/Service.java b/service-locator/src/main/java/com/iluwatar/servicelocator/Service.java index 271bd60c279b..805b3e92c40d 100644 --- a/service-locator/src/main/java/com/iluwatar/servicelocator/Service.java +++ b/service-locator/src/main/java/com/iluwatar/servicelocator/Service.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelocator; /** diff --git a/service-locator/src/main/java/com/iluwatar/servicelocator/ServiceCache.java b/service-locator/src/main/java/com/iluwatar/servicelocator/ServiceCache.java index 9009c336086c..e32585b6b489 100644 --- a/service-locator/src/main/java/com/iluwatar/servicelocator/ServiceCache.java +++ b/service-locator/src/main/java/com/iluwatar/servicelocator/ServiceCache.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelocator; import org.slf4j.Logger; diff --git a/service-locator/src/main/java/com/iluwatar/servicelocator/ServiceImpl.java b/service-locator/src/main/java/com/iluwatar/servicelocator/ServiceImpl.java index f26c221411c3..b2440c838310 100644 --- a/service-locator/src/main/java/com/iluwatar/servicelocator/ServiceImpl.java +++ b/service-locator/src/main/java/com/iluwatar/servicelocator/ServiceImpl.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelocator; import org.slf4j.Logger; diff --git a/service-locator/src/main/java/com/iluwatar/servicelocator/ServiceLocator.java b/service-locator/src/main/java/com/iluwatar/servicelocator/ServiceLocator.java index cd2b94b7f24e..a94d8289e39b 100644 --- a/service-locator/src/main/java/com/iluwatar/servicelocator/ServiceLocator.java +++ b/service-locator/src/main/java/com/iluwatar/servicelocator/ServiceLocator.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelocator; /** diff --git a/service-locator/src/test/java/com/iluwatar/servicelocator/AppTest.java b/service-locator/src/test/java/com/iluwatar/servicelocator/AppTest.java index 9d337263781e..f77f1c612edf 100644 --- a/service-locator/src/test/java/com/iluwatar/servicelocator/AppTest.java +++ b/service-locator/src/test/java/com/iluwatar/servicelocator/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelocator; import org.junit.jupiter.api.Test; diff --git a/service-locator/src/test/java/com/iluwatar/servicelocator/ServiceLocatorTest.java b/service-locator/src/test/java/com/iluwatar/servicelocator/ServiceLocatorTest.java index c50b44a4bc09..16bc934eb017 100644 --- a/service-locator/src/test/java/com/iluwatar/servicelocator/ServiceLocatorTest.java +++ b/service-locator/src/test/java/com/iluwatar/servicelocator/ServiceLocatorTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.servicelocator; import org.junit.jupiter.api.Test; diff --git a/singleton/src/main/java/com/iluwatar/singleton/App.java b/singleton/src/main/java/com/iluwatar/singleton/App.java index 54d0da981dc7..668e7658b65e 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/App.java +++ b/singleton/src/main/java/com/iluwatar/singleton/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; import org.slf4j.Logger; diff --git a/singleton/src/main/java/com/iluwatar/singleton/EnumIvoryTower.java b/singleton/src/main/java/com/iluwatar/singleton/EnumIvoryTower.java index b9dc1b3b146a..2028b7d76bd4 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/EnumIvoryTower.java +++ b/singleton/src/main/java/com/iluwatar/singleton/EnumIvoryTower.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; /** diff --git a/singleton/src/main/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiom.java b/singleton/src/main/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiom.java index c3492ac6cdb0..dfd4951f7726 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiom.java +++ b/singleton/src/main/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiom.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; /** diff --git a/singleton/src/main/java/com/iluwatar/singleton/IvoryTower.java b/singleton/src/main/java/com/iluwatar/singleton/IvoryTower.java index d6cf3a3fb3ab..c8d551404c8b 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/IvoryTower.java +++ b/singleton/src/main/java/com/iluwatar/singleton/IvoryTower.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; /** diff --git a/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLocking.java b/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLocking.java index 3a811b5521a7..db285ce2f427 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLocking.java +++ b/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLocking.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; /** diff --git a/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTower.java b/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTower.java index 3001b7691a26..82580acf6896 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTower.java +++ b/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTower.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; /** diff --git a/singleton/src/test/java/com/iluwatar/singleton/AppTest.java b/singleton/src/test/java/com/iluwatar/singleton/AppTest.java index 5c418b1036c7..66974e47271a 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/AppTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; import org.junit.jupiter.api.Test; diff --git a/singleton/src/test/java/com/iluwatar/singleton/EnumIvoryTowerTest.java b/singleton/src/test/java/com/iluwatar/singleton/EnumIvoryTowerTest.java index fb10c9d54b49..49dfae6b0d1b 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/EnumIvoryTowerTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/EnumIvoryTowerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; /** diff --git a/singleton/src/test/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiomTest.java b/singleton/src/test/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiomTest.java index 4f5eb715606a..d7021dac7bdd 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiomTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiomTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; /** diff --git a/singleton/src/test/java/com/iluwatar/singleton/IvoryTowerTest.java b/singleton/src/test/java/com/iluwatar/singleton/IvoryTowerTest.java index 9f367bd2b6bd..ac5a145cbedc 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/IvoryTowerTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/IvoryTowerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; /** diff --git a/singleton/src/test/java/com/iluwatar/singleton/SingletonTest.java b/singleton/src/test/java/com/iluwatar/singleton/SingletonTest.java index 19814c3a5372..e98796aefa5b 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/SingletonTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/SingletonTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; import org.junit.jupiter.api.Disabled; diff --git a/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLockingTest.java b/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLockingTest.java index 0255bd74a7bc..fff516ad3a2e 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLockingTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLockingTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; import org.junit.Test; diff --git a/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTowerTest.java b/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTowerTest.java index a1cf61cd91e2..7ca1caf3d695 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTowerTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTowerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.singleton; /** diff --git a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/App.java b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/App.java index f6a07de62f6a..3e7a64b6ca34 100644 --- a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/App.java +++ b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.spatialpartition; import org.slf4j.Logger; diff --git a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Bubble.java b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Bubble.java index 8147c4ea3f5d..8a11c4f88895 100644 --- a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Bubble.java +++ b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Bubble.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.spatialpartition; import org.slf4j.Logger; diff --git a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Point.java b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Point.java index b1d58d7a8e01..3b5fb963f20c 100644 --- a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Point.java +++ b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Point.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.spatialpartition; import java.util.ArrayList; diff --git a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/QuadTree.java b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/QuadTree.java index ea49020b8629..7c2a93bda901 100644 --- a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/QuadTree.java +++ b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/QuadTree.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.spatialpartition; import java.util.ArrayList; diff --git a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Rect.java b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Rect.java index 71d4eda5bfa7..6142c99d896e 100644 --- a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Rect.java +++ b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/Rect.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.spatialpartition; /** diff --git a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/SpatialPartitionBubbles.java b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/SpatialPartitionBubbles.java index e1ed341452df..48714aa0a9cc 100644 --- a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/SpatialPartitionBubbles.java +++ b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/SpatialPartitionBubbles.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.spatialpartition; import java.util.ArrayList; diff --git a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/SpatialPartitionGeneric.java b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/SpatialPartitionGeneric.java index 82c3d87e7e74..d5f1818ed3c5 100644 --- a/spatial-partition/src/main/java/com/iluwatar/spatialpartition/SpatialPartitionGeneric.java +++ b/spatial-partition/src/main/java/com/iluwatar/spatialpartition/SpatialPartitionGeneric.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.spatialpartition; import java.util.Hashtable; diff --git a/spatial-partition/src/test/java/com/iluwatar/spatialpartition/BubbleTest.java b/spatial-partition/src/test/java/com/iluwatar/spatialpartition/BubbleTest.java index a8fc236474c2..e26de5b696c4 100644 --- a/spatial-partition/src/test/java/com/iluwatar/spatialpartition/BubbleTest.java +++ b/spatial-partition/src/test/java/com/iluwatar/spatialpartition/BubbleTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.spatialpartition; import static org.junit.jupiter.api.Assertions.*; diff --git a/spatial-partition/src/test/java/com/iluwatar/spatialpartition/QuadTreeTest.java b/spatial-partition/src/test/java/com/iluwatar/spatialpartition/QuadTreeTest.java index 15f1022fdae9..9335cd9c9641 100644 --- a/spatial-partition/src/test/java/com/iluwatar/spatialpartition/QuadTreeTest.java +++ b/spatial-partition/src/test/java/com/iluwatar/spatialpartition/QuadTreeTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.spatialpartition; import static org.junit.jupiter.api.Assertions.*; diff --git a/spatial-partition/src/test/java/com/iluwatar/spatialpartition/RectTest.java b/spatial-partition/src/test/java/com/iluwatar/spatialpartition/RectTest.java index 7a88d43bc103..599b0d9f48ae 100644 --- a/spatial-partition/src/test/java/com/iluwatar/spatialpartition/RectTest.java +++ b/spatial-partition/src/test/java/com/iluwatar/spatialpartition/RectTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.spatialpartition; import static org.junit.jupiter.api.Assertions.*; diff --git a/spatial-partition/src/test/java/com/iluwatar/spatialpartition/SpatialPartitionBubblesTest.java b/spatial-partition/src/test/java/com/iluwatar/spatialpartition/SpatialPartitionBubblesTest.java index 3b7a7d18dc87..aac2e0d69992 100644 --- a/spatial-partition/src/test/java/com/iluwatar/spatialpartition/SpatialPartitionBubblesTest.java +++ b/spatial-partition/src/test/java/com/iluwatar/spatialpartition/SpatialPartitionBubblesTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.spatialpartition; import static org.junit.jupiter.api.Assertions.*; diff --git a/specification/src/main/java/com/iluwatar/specification/app/App.java b/specification/src/main/java/com/iluwatar/specification/app/App.java index 0be1c109aa7b..df80f855f1f5 100644 --- a/specification/src/main/java/com/iluwatar/specification/app/App.java +++ b/specification/src/main/java/com/iluwatar/specification/app/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.app; import java.util.Arrays; diff --git a/specification/src/main/java/com/iluwatar/specification/creature/AbstractCreature.java b/specification/src/main/java/com/iluwatar/specification/creature/AbstractCreature.java index 033589f02265..566885560c7e 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/AbstractCreature.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/AbstractCreature.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.creature; import com.iluwatar.specification.property.Color; diff --git a/specification/src/main/java/com/iluwatar/specification/creature/Creature.java b/specification/src/main/java/com/iluwatar/specification/creature/Creature.java index 9c1705a9defd..c999f546d928 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/Creature.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/Creature.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.creature; import com.iluwatar.specification.property.Color; diff --git a/specification/src/main/java/com/iluwatar/specification/creature/Dragon.java b/specification/src/main/java/com/iluwatar/specification/creature/Dragon.java index 458c8e806fbb..833b8522b866 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/Dragon.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/Dragon.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.creature; import com.iluwatar.specification.property.Color; diff --git a/specification/src/main/java/com/iluwatar/specification/creature/Goblin.java b/specification/src/main/java/com/iluwatar/specification/creature/Goblin.java index 3835d6f713a7..0153e21fe7e0 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/Goblin.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/Goblin.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.creature; import com.iluwatar.specification.property.Color; diff --git a/specification/src/main/java/com/iluwatar/specification/creature/KillerBee.java b/specification/src/main/java/com/iluwatar/specification/creature/KillerBee.java index f4ad3d2c7679..04c416b7abe2 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/KillerBee.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/KillerBee.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.creature; import com.iluwatar.specification.property.Color; diff --git a/specification/src/main/java/com/iluwatar/specification/creature/Octopus.java b/specification/src/main/java/com/iluwatar/specification/creature/Octopus.java index ef99f5e4036e..bb2c5718b8de 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/Octopus.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/Octopus.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.creature; import com.iluwatar.specification.property.Color; diff --git a/specification/src/main/java/com/iluwatar/specification/creature/Shark.java b/specification/src/main/java/com/iluwatar/specification/creature/Shark.java index ef68b96bcd58..56ec1651aa4b 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/Shark.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/Shark.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.creature; import com.iluwatar.specification.property.Color; diff --git a/specification/src/main/java/com/iluwatar/specification/creature/Troll.java b/specification/src/main/java/com/iluwatar/specification/creature/Troll.java index a6a74e17ee39..1d6a79bb8296 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/Troll.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/Troll.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.creature; import com.iluwatar.specification.property.Color; diff --git a/specification/src/main/java/com/iluwatar/specification/property/Color.java b/specification/src/main/java/com/iluwatar/specification/property/Color.java index 8af07d6c967d..9f64e1b77b2e 100644 --- a/specification/src/main/java/com/iluwatar/specification/property/Color.java +++ b/specification/src/main/java/com/iluwatar/specification/property/Color.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.property; /** diff --git a/specification/src/main/java/com/iluwatar/specification/property/Movement.java b/specification/src/main/java/com/iluwatar/specification/property/Movement.java index 7869fe63dfa4..5bf0863e4ed2 100644 --- a/specification/src/main/java/com/iluwatar/specification/property/Movement.java +++ b/specification/src/main/java/com/iluwatar/specification/property/Movement.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.property; /** diff --git a/specification/src/main/java/com/iluwatar/specification/property/Size.java b/specification/src/main/java/com/iluwatar/specification/property/Size.java index c82b53ca69b0..a4a09e96c798 100644 --- a/specification/src/main/java/com/iluwatar/specification/property/Size.java +++ b/specification/src/main/java/com/iluwatar/specification/property/Size.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.property; /** diff --git a/specification/src/main/java/com/iluwatar/specification/selector/ColorSelector.java b/specification/src/main/java/com/iluwatar/specification/selector/ColorSelector.java index 9fb150b46ebd..75e922bff0ab 100644 --- a/specification/src/main/java/com/iluwatar/specification/selector/ColorSelector.java +++ b/specification/src/main/java/com/iluwatar/specification/selector/ColorSelector.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.selector; import java.util.function.Predicate; diff --git a/specification/src/main/java/com/iluwatar/specification/selector/MovementSelector.java b/specification/src/main/java/com/iluwatar/specification/selector/MovementSelector.java index c0987218f431..19613dfeddb7 100644 --- a/specification/src/main/java/com/iluwatar/specification/selector/MovementSelector.java +++ b/specification/src/main/java/com/iluwatar/specification/selector/MovementSelector.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.selector; import java.util.function.Predicate; diff --git a/specification/src/main/java/com/iluwatar/specification/selector/SizeSelector.java b/specification/src/main/java/com/iluwatar/specification/selector/SizeSelector.java index 39594cef0f1d..1d561e95cff1 100644 --- a/specification/src/main/java/com/iluwatar/specification/selector/SizeSelector.java +++ b/specification/src/main/java/com/iluwatar/specification/selector/SizeSelector.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.selector; import java.util.function.Predicate; diff --git a/specification/src/test/java/com/iluwatar/specification/app/AppTest.java b/specification/src/test/java/com/iluwatar/specification/app/AppTest.java index 64df2b286e5c..5f6d950fe6f4 100644 --- a/specification/src/test/java/com/iluwatar/specification/app/AppTest.java +++ b/specification/src/test/java/com/iluwatar/specification/app/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.app; import org.junit.jupiter.api.Test; diff --git a/specification/src/test/java/com/iluwatar/specification/creature/CreatureTest.java b/specification/src/test/java/com/iluwatar/specification/creature/CreatureTest.java index 29d4bbd651eb..022475c24238 100644 --- a/specification/src/test/java/com/iluwatar/specification/creature/CreatureTest.java +++ b/specification/src/test/java/com/iluwatar/specification/creature/CreatureTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.creature; import com.iluwatar.specification.property.Color; diff --git a/specification/src/test/java/com/iluwatar/specification/selector/ColorSelectorTest.java b/specification/src/test/java/com/iluwatar/specification/selector/ColorSelectorTest.java index 2c8572c54268..cc47ba5955e2 100644 --- a/specification/src/test/java/com/iluwatar/specification/selector/ColorSelectorTest.java +++ b/specification/src/test/java/com/iluwatar/specification/selector/ColorSelectorTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.selector; import com.iluwatar.specification.creature.Creature; diff --git a/specification/src/test/java/com/iluwatar/specification/selector/MovementSelectorTest.java b/specification/src/test/java/com/iluwatar/specification/selector/MovementSelectorTest.java index 2797ef92d9b7..e194790fbc2c 100644 --- a/specification/src/test/java/com/iluwatar/specification/selector/MovementSelectorTest.java +++ b/specification/src/test/java/com/iluwatar/specification/selector/MovementSelectorTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.selector; import com.iluwatar.specification.creature.Creature; diff --git a/specification/src/test/java/com/iluwatar/specification/selector/SizeSelectorTest.java b/specification/src/test/java/com/iluwatar/specification/selector/SizeSelectorTest.java index 66891927b075..9145f9b810c6 100644 --- a/specification/src/test/java/com/iluwatar/specification/selector/SizeSelectorTest.java +++ b/specification/src/test/java/com/iluwatar/specification/selector/SizeSelectorTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.specification.selector; import com.iluwatar.specification.creature.Creature; diff --git a/state/src/main/java/com/iluwatar/state/AngryState.java b/state/src/main/java/com/iluwatar/state/AngryState.java index b792202882b1..0ce9f868c364 100644 --- a/state/src/main/java/com/iluwatar/state/AngryState.java +++ b/state/src/main/java/com/iluwatar/state/AngryState.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.state; import org.slf4j.Logger; diff --git a/state/src/main/java/com/iluwatar/state/App.java b/state/src/main/java/com/iluwatar/state/App.java index 31d8baf76a82..d930e048bdda 100644 --- a/state/src/main/java/com/iluwatar/state/App.java +++ b/state/src/main/java/com/iluwatar/state/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.state; /** diff --git a/state/src/main/java/com/iluwatar/state/Mammoth.java b/state/src/main/java/com/iluwatar/state/Mammoth.java index df0a23deaf26..0791815f00c5 100644 --- a/state/src/main/java/com/iluwatar/state/Mammoth.java +++ b/state/src/main/java/com/iluwatar/state/Mammoth.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.state; /** diff --git a/state/src/main/java/com/iluwatar/state/PeacefulState.java b/state/src/main/java/com/iluwatar/state/PeacefulState.java index 37c6f643963b..49586f87729e 100644 --- a/state/src/main/java/com/iluwatar/state/PeacefulState.java +++ b/state/src/main/java/com/iluwatar/state/PeacefulState.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.state; import org.slf4j.Logger; diff --git a/state/src/main/java/com/iluwatar/state/State.java b/state/src/main/java/com/iluwatar/state/State.java index f4dbbce1ed25..c2ae69780aa9 100644 --- a/state/src/main/java/com/iluwatar/state/State.java +++ b/state/src/main/java/com/iluwatar/state/State.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.state; /** diff --git a/state/src/test/java/com/iluwatar/state/AppTest.java b/state/src/test/java/com/iluwatar/state/AppTest.java index b5089e7ab412..b61fdcb10371 100644 --- a/state/src/test/java/com/iluwatar/state/AppTest.java +++ b/state/src/test/java/com/iluwatar/state/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.state; import org.junit.jupiter.api.Test; diff --git a/state/src/test/java/com/iluwatar/state/MammothTest.java b/state/src/test/java/com/iluwatar/state/MammothTest.java index af943d78ba9f..1286d74266d7 100644 --- a/state/src/test/java/com/iluwatar/state/MammothTest.java +++ b/state/src/test/java/com/iluwatar/state/MammothTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.state; import ch.qos.logback.classic.Logger; diff --git a/step-builder/src/main/java/com/iluwatar/stepbuilder/App.java b/step-builder/src/main/java/com/iluwatar/stepbuilder/App.java index 1dd03306d637..dda5dd2258de 100644 --- a/step-builder/src/main/java/com/iluwatar/stepbuilder/App.java +++ b/step-builder/src/main/java/com/iluwatar/stepbuilder/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.stepbuilder; import org.slf4j.Logger; diff --git a/step-builder/src/main/java/com/iluwatar/stepbuilder/Character.java b/step-builder/src/main/java/com/iluwatar/stepbuilder/Character.java index aa94e36837fc..5036bd3366b7 100644 --- a/step-builder/src/main/java/com/iluwatar/stepbuilder/Character.java +++ b/step-builder/src/main/java/com/iluwatar/stepbuilder/Character.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.stepbuilder; import java.util.List; diff --git a/step-builder/src/main/java/com/iluwatar/stepbuilder/CharacterStepBuilder.java b/step-builder/src/main/java/com/iluwatar/stepbuilder/CharacterStepBuilder.java index b07897ab56fd..e11698b2acf6 100644 --- a/step-builder/src/main/java/com/iluwatar/stepbuilder/CharacterStepBuilder.java +++ b/step-builder/src/main/java/com/iluwatar/stepbuilder/CharacterStepBuilder.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.stepbuilder; import java.util.ArrayList; diff --git a/step-builder/src/test/java/com/iluwatar/stepbuilder/AppTest.java b/step-builder/src/test/java/com/iluwatar/stepbuilder/AppTest.java index 7b4079a1f329..d4e99bc9ea1e 100644 --- a/step-builder/src/test/java/com/iluwatar/stepbuilder/AppTest.java +++ b/step-builder/src/test/java/com/iluwatar/stepbuilder/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.stepbuilder; import org.junit.jupiter.api.Test; diff --git a/step-builder/src/test/java/com/iluwatar/stepbuilder/CharacterStepBuilderTest.java b/step-builder/src/test/java/com/iluwatar/stepbuilder/CharacterStepBuilderTest.java index 46d4a8cf3f64..4c8ebbd3975a 100644 --- a/step-builder/src/test/java/com/iluwatar/stepbuilder/CharacterStepBuilderTest.java +++ b/step-builder/src/test/java/com/iluwatar/stepbuilder/CharacterStepBuilderTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.stepbuilder; import org.junit.jupiter.api.Test; diff --git a/strategy/src/main/java/com/iluwatar/strategy/App.java b/strategy/src/main/java/com/iluwatar/strategy/App.java index d44ec5784d76..746afc0419dc 100644 --- a/strategy/src/main/java/com/iluwatar/strategy/App.java +++ b/strategy/src/main/java/com/iluwatar/strategy/App.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.strategy; import org.slf4j.Logger; diff --git a/strategy/src/main/java/com/iluwatar/strategy/DragonSlayer.java b/strategy/src/main/java/com/iluwatar/strategy/DragonSlayer.java index f04060c8d4ab..0455edaca98b 100644 --- a/strategy/src/main/java/com/iluwatar/strategy/DragonSlayer.java +++ b/strategy/src/main/java/com/iluwatar/strategy/DragonSlayer.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.strategy; /** diff --git a/strategy/src/main/java/com/iluwatar/strategy/DragonSlayingStrategy.java b/strategy/src/main/java/com/iluwatar/strategy/DragonSlayingStrategy.java index 933a3d51e8fe..eb89523ad402 100644 --- a/strategy/src/main/java/com/iluwatar/strategy/DragonSlayingStrategy.java +++ b/strategy/src/main/java/com/iluwatar/strategy/DragonSlayingStrategy.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.strategy; /** diff --git a/strategy/src/main/java/com/iluwatar/strategy/MeleeStrategy.java b/strategy/src/main/java/com/iluwatar/strategy/MeleeStrategy.java index 68c556baa754..8cb2f24c12be 100644 --- a/strategy/src/main/java/com/iluwatar/strategy/MeleeStrategy.java +++ b/strategy/src/main/java/com/iluwatar/strategy/MeleeStrategy.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.strategy; import org.slf4j.Logger; diff --git a/strategy/src/main/java/com/iluwatar/strategy/ProjectileStrategy.java b/strategy/src/main/java/com/iluwatar/strategy/ProjectileStrategy.java index 1da72fb09ebf..4b6031ddfa21 100644 --- a/strategy/src/main/java/com/iluwatar/strategy/ProjectileStrategy.java +++ b/strategy/src/main/java/com/iluwatar/strategy/ProjectileStrategy.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.strategy; import org.slf4j.Logger; diff --git a/strategy/src/main/java/com/iluwatar/strategy/SpellStrategy.java b/strategy/src/main/java/com/iluwatar/strategy/SpellStrategy.java index ca3faa827e65..ffe85c7a21f8 100644 --- a/strategy/src/main/java/com/iluwatar/strategy/SpellStrategy.java +++ b/strategy/src/main/java/com/iluwatar/strategy/SpellStrategy.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.strategy; import org.slf4j.Logger; diff --git a/strategy/src/test/java/com/iluwatar/strategy/AppTest.java b/strategy/src/test/java/com/iluwatar/strategy/AppTest.java index 44487654f1da..598085ce4e03 100644 --- a/strategy/src/test/java/com/iluwatar/strategy/AppTest.java +++ b/strategy/src/test/java/com/iluwatar/strategy/AppTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.strategy; import org.junit.jupiter.api.Test; diff --git a/strategy/src/test/java/com/iluwatar/strategy/DragonSlayerTest.java b/strategy/src/test/java/com/iluwatar/strategy/DragonSlayerTest.java index 2c1347d2e0df..52dfb3ff19e9 100644 --- a/strategy/src/test/java/com/iluwatar/strategy/DragonSlayerTest.java +++ b/strategy/src/test/java/com/iluwatar/strategy/DragonSlayerTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.strategy; import org.junit.jupiter.api.Test; diff --git a/strategy/src/test/java/com/iluwatar/strategy/DragonSlayingStrategyTest.java b/strategy/src/test/java/com/iluwatar/strategy/DragonSlayingStrategyTest.java index c9d5170ffc40..b97cf499fbf8 100644 --- a/strategy/src/test/java/com/iluwatar/strategy/DragonSlayingStrategyTest.java +++ b/strategy/src/test/java/com/iluwatar/strategy/DragonSlayingStrategyTest.java @@ -1,4 +1,4 @@ -/** +/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.strategy; import ch.qos.logback.classic.Logger; diff --git a/subclass-sandbox/pom.xml b/subclass-sandbox/pom.xml index 8016ba471ed0..eb493b28cc3b 100644 --- a/subclass-sandbox/pom.xml +++ b/subclass-sandbox/pom.xml @@ -2,7 +2,7 @@ + + org.commonjava.maven.plugins + directory-maven-plugin + 0.3.1 + + + directories + + directory-of + + initialize + + projectRoot + + com.iluwatar + java-design-patterns + + + + + + com.mycila license-maven-plugin @@ -417,7 +442,7 @@ true - license-plugin-header-style.xml + ${projectRoot}${file.separator}license-plugin-header-style.xml SLASHSTAR_CUSTOM_STYLE From d1767bbb51aa6895032f12bb58b62f6958e43f98 Mon Sep 17 00:00:00 2001 From: Boris Date: Sat, 26 Oct 2019 18:58:40 +0100 Subject: [PATCH 099/197] The pattern Role object (#1031) * init repo for role object * add to init * add to init * add first impl * add pattern * add license * add changes --- role-object/README.md | 31 ++++++ role-object/pom.xml | 44 ++++++++ .../roleobject/ApplicationRoleObject.java | 93 ++++++++++++++++ .../com/iluwatar/roleobject/BorrowerRole.java | 40 +++++++ .../com/iluwatar/roleobject/Customer.java | 79 ++++++++++++++ .../com/iluwatar/roleobject/CustomerCore.java | 75 +++++++++++++ .../com/iluwatar/roleobject/CustomerRole.java | 28 +++++ .../com/iluwatar/roleobject/InvestorRole.java | 48 ++++++++ .../java/com/iluwatar/roleobject/Role.java | 55 ++++++++++ .../roleobject/ApplicationRoleObjectTest.java | 33 ++++++ .../iluwatar/roleobject/BorrowerRoleTest.java | 40 +++++++ .../iluwatar/roleobject/CustomerCoreTest.java | 103 ++++++++++++++++++ .../iluwatar/roleobject/InvestorRoleTest.java | 38 +++++++ .../com/iluwatar/roleobject/RoleTest.java | 40 +++++++ 14 files changed, 747 insertions(+) create mode 100644 role-object/README.md create mode 100644 role-object/pom.xml create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/ApplicationRoleObject.java create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/BorrowerRole.java create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/Customer.java create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/CustomerCore.java create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/CustomerRole.java create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/InvestorRole.java create mode 100644 role-object/src/main/java/com/iluwatar/roleobject/Role.java create mode 100644 role-object/src/test/java/com/iluwatar/roleobject/ApplicationRoleObjectTest.java create mode 100644 role-object/src/test/java/com/iluwatar/roleobject/BorrowerRoleTest.java create mode 100644 role-object/src/test/java/com/iluwatar/roleobject/CustomerCoreTest.java create mode 100644 role-object/src/test/java/com/iluwatar/roleobject/InvestorRoleTest.java create mode 100644 role-object/src/test/java/com/iluwatar/roleobject/RoleTest.java diff --git a/role-object/README.md b/role-object/README.md new file mode 100644 index 000000000000..c97177d7b1d5 --- /dev/null +++ b/role-object/README.md @@ -0,0 +1,31 @@ +--- +layout: pattern +title: Role object +folder: Migration +permalink: /patterns/role-object/ +categories: Structural +tags: + - Java + - Difficulty-Medium + - Handle Body Pattern +--- + +## Also known as +Post pattern, Extension Object pattern + +## Intent +Adapt an object to different client’s needs through transparently attached role objects, each one representing a role +the object has to play in that client’s context. The object manages its role set dynamically. By representing roles as +individual objects, different contexts are kept separate and system configuration is simplified. + +## Applicability +Use the Role Object pattern, if: +- you want to handle a key abstraction in different contexts and you do not want to put the resulting context specific interfaces into the same class interface. +- you want to handle the available roles dynamically so that they can be attached and removed on demand, that is at runtime, rather than fixing them statically at compile-time. +- you want to treat the extensions transparently and need to preserve the logical object identity of the resultingobject conglomerate. +- you want to keep role/client pairs independent from each other so that changes to a role do not affect clients that are not interested in that role. + +## Credits +- [Hillside - Role object pattern](https://hillside.net/plop/plop97/Proceedings/riehle.pdf) +- [Role object](http://wiki.c2.com/?RoleObject) +- [Fowler - Dealing with roles](https://martinfowler.com/apsupp/roles.pdf) \ No newline at end of file diff --git a/role-object/pom.xml b/role-object/pom.xml new file mode 100644 index 000000000000..c9feb1419afd --- /dev/null +++ b/role-object/pom.xml @@ -0,0 +1,44 @@ + + + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.22.0-SNAPSHOT + + + role-object + + + junit + junit + test + + + + diff --git a/role-object/src/main/java/com/iluwatar/roleobject/ApplicationRoleObject.java b/role-object/src/main/java/com/iluwatar/roleobject/ApplicationRoleObject.java new file mode 100644 index 000000000000..b8296dabacc6 --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/ApplicationRoleObject.java @@ -0,0 +1,93 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.roleobject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static com.iluwatar.roleobject.Role.*; + +/** + * The Role Object pattern suggests to model context-specific views + * of an object as separate role objects which are + * dynamically attached to and removed from the core object. + * We call the resulting composite object structure, + * consisting of the core and its role objects, a subject. + * A subject often plays several roles and the same role is likely to + * be played by different subjects. + * As an example consider two different customers playing the role of borrower and + * investor, respectively. Both roles could as well be played by a single {@link Customer} object. + * The common superclass for customer-specific roles is provided by {@link CustomerRole}, + * which also supports the {@link Customer} interface. + *

    + * The {@link CustomerRole} class is abstract and not meant to be instantiated. + * Concrete subclasses of {@link CustomerRole}, for example {@link BorrowerRole} or {@link InvestorRole}, + * define and implement the interface for specific roles. It is only + * these subclasses which are instantiated at runtime. + * The {@link BorrowerRole} class defines the context-specific view of {@link Customer} objects as needed by the loan department. + * It defines additional operations to manage the customer’s + * credits and securities. Similarly, the {@link InvestorRole} class adds operations specific + * to the investment department’s view of customers. + * A client like the loan application may either work with objects of the {@link CustomerRole} class, using the interface class + * {@link Customer}, or with objects of concrete {@link CustomerRole} subclasses. Suppose the loan application knows a particular + * {@link Customer} instance through its {@link Customer} interface. The loan application may want to check whether the {@link Customer} + * object plays the role of Borrower. + * To this end it calls {@link Customer#hasRole(Role)} with a suitable role specification. For the purpose of + * our example, let’s assume we can name roles with enum. + * If the {@link Customer} object can play the role named “Borrower,” the loan application will ask it + * to return a reference to the corresponding object. + * The loan application may now use this reference to call Borrower-specific operations. + */ +public class ApplicationRoleObject { + + private static final Logger logger = LoggerFactory.getLogger(Role.class); + + public static void main(String[] args) { + Customer customer = Customer.newCustomer(Borrower, Investor); + + logger.info(" the new customer created : {}", customer); + + boolean hasBorrowerRole = customer.hasRole(Borrower); + logger.info(" customer has a borrowed role - {}", hasBorrowerRole); + boolean hasInvestorRole = customer.hasRole(Investor); + logger.info(" customer has an investor role - {}", hasInvestorRole); + + customer.getRole(Investor, InvestorRole.class) + .ifPresent(inv -> { + inv.setAmountToInvest(1000); + inv.setName("Billy"); + }); + customer.getRole(Borrower, BorrowerRole.class) + .ifPresent(inv -> inv.setName("Johny")); + + customer.getRole(Investor, InvestorRole.class) + .map(InvestorRole::invest) + .ifPresent(logger::info); + + customer.getRole(Borrower, BorrowerRole.class) + .map(BorrowerRole::borrow) + .ifPresent(logger::info); + } + + +} diff --git a/role-object/src/main/java/com/iluwatar/roleobject/BorrowerRole.java b/role-object/src/main/java/com/iluwatar/roleobject/BorrowerRole.java new file mode 100644 index 000000000000..425d9511d083 --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/BorrowerRole.java @@ -0,0 +1,40 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.roleobject; + +public class BorrowerRole extends CustomerRole{ + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String borrow(){ + return String.format("Borrower %s wants to get some money.",name); + } + +} diff --git a/role-object/src/main/java/com/iluwatar/roleobject/Customer.java b/role-object/src/main/java/com/iluwatar/roleobject/Customer.java new file mode 100644 index 000000000000..ebcddff4b154 --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/Customer.java @@ -0,0 +1,79 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.roleobject; + +import java.util.Optional; + +/** + * The main abstraction to work with Customer. + */ +public abstract class Customer { + + /** + * Add specific role @see {@link Role} + * + * @param role to add + * @return true if the operation has been successful otherwise false + */ + public abstract boolean addRole(Role role); + + /** + * Check specific role @see {@link Role} + * + * @param role to check + * @return true if the role exists otherwise false + */ + + public abstract boolean hasRole(Role role); + + /** + * Remove specific role @see {@link Role} + * + * @param role to remove + * @return true if the operation has been successful otherwise false + */ + public abstract boolean remRole(Role role); + + /** + * Get specific instance associated with this role @see {@link Role} + * + * @param role to get + * @param expectedRole instance class expected to get + * @return optional with value if the instance exists and corresponds expected class + */ + public abstract Optional getRole(Role role, Class expectedRole); + + + public static Customer newCustomer() { + return new CustomerCore(); + } + + public static Customer newCustomer(Role... role) { + Customer customer = newCustomer(); + for (Role r : role) { + customer.addRole(r); + } + return customer; + } + +} diff --git a/role-object/src/main/java/com/iluwatar/roleobject/CustomerCore.java b/role-object/src/main/java/com/iluwatar/roleobject/CustomerCore.java new file mode 100644 index 000000000000..5de27aa9295d --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/CustomerCore.java @@ -0,0 +1,75 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.roleobject; + +import java.util.*; + +/** + * Core class to store different customer roles + * + * @see CustomerRole + * Note: not thread safe + */ +public class CustomerCore extends Customer { + + private Map roles; + + public CustomerCore() { + roles = new HashMap<>(); + } + + @Override + public boolean addRole(Role role) { + return role + .instance() + .map(inst -> { + roles.put(role, inst); + return true; + }) + .orElse(false); + } + + @Override + public boolean hasRole(Role role) { + return roles.containsKey(role); + } + + @Override + public boolean remRole(Role role) { + return Objects.nonNull(roles.remove(role)); + } + + @Override + public Optional getRole(Role role, Class expectedRole) { + return Optional + .ofNullable(roles.get(role)) + .filter(expectedRole::isInstance) + .map(expectedRole::cast); + } + + @Override + public String toString() { + String roles = Arrays.toString(this.roles.keySet().toArray()); + return "Customer{roles=" + roles + "}"; + } +} diff --git a/role-object/src/main/java/com/iluwatar/roleobject/CustomerRole.java b/role-object/src/main/java/com/iluwatar/roleobject/CustomerRole.java new file mode 100644 index 000000000000..40fe2341b3a9 --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/CustomerRole.java @@ -0,0 +1,28 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.roleobject; + +/** + * Key abstraction for segregated roles + */ +public abstract class CustomerRole extends CustomerCore{} diff --git a/role-object/src/main/java/com/iluwatar/roleobject/InvestorRole.java b/role-object/src/main/java/com/iluwatar/roleobject/InvestorRole.java new file mode 100644 index 000000000000..6d5c17c904f7 --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/InvestorRole.java @@ -0,0 +1,48 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.roleobject; + +public class InvestorRole extends CustomerRole { + private String name; + private long amountToInvest; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public long getAmountToInvest() { + return amountToInvest; + } + + public void setAmountToInvest(long amountToInvest) { + this.amountToInvest = amountToInvest; + } + + public String invest() { + return String.format("Investor %s has invested %d dollars", name, amountToInvest); + } +} diff --git a/role-object/src/main/java/com/iluwatar/roleobject/Role.java b/role-object/src/main/java/com/iluwatar/roleobject/Role.java new file mode 100644 index 000000000000..f6c739891566 --- /dev/null +++ b/role-object/src/main/java/com/iluwatar/roleobject/Role.java @@ -0,0 +1,55 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.roleobject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Optional; + +/** + * Possible roles + */ +public enum Role { + Borrower(BorrowerRole.class), Investor(InvestorRole.class); + + private Class typeCst; + + Role(Class typeCst) { + this.typeCst = typeCst; + } + + private static final Logger logger = LoggerFactory.getLogger(Role.class); + + @SuppressWarnings("unchecked") + public Optional instance() { + Class typeCst = this.typeCst; + try { + return (Optional) Optional.of(typeCst.newInstance()); + } catch (InstantiationException | IllegalAccessException e) { + logger.error("error creating an object", e); + } + return Optional.empty(); + } + +} diff --git a/role-object/src/test/java/com/iluwatar/roleobject/ApplicationRoleObjectTest.java b/role-object/src/test/java/com/iluwatar/roleobject/ApplicationRoleObjectTest.java new file mode 100644 index 000000000000..831781d7103b --- /dev/null +++ b/role-object/src/test/java/com/iluwatar/roleobject/ApplicationRoleObjectTest.java @@ -0,0 +1,33 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.roleobject; + +import org.junit.Test; + +public class ApplicationRoleObjectTest { + + @Test + public void mainTest() { + ApplicationRoleObject.main(new String[]{}); + } +} \ No newline at end of file diff --git a/role-object/src/test/java/com/iluwatar/roleobject/BorrowerRoleTest.java b/role-object/src/test/java/com/iluwatar/roleobject/BorrowerRoleTest.java new file mode 100644 index 000000000000..0c0f92fc2322 --- /dev/null +++ b/role-object/src/test/java/com/iluwatar/roleobject/BorrowerRoleTest.java @@ -0,0 +1,40 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.roleobject; + +import org.junit.Assert; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class BorrowerRoleTest { + + @Test + public void borrowTest() { + BorrowerRole borrowerRole = new BorrowerRole(); + borrowerRole.setName("test"); + String res = "Borrower test wants to get some money."; + + Assert.assertEquals(borrowerRole.borrow(),res); + } +} \ No newline at end of file diff --git a/role-object/src/test/java/com/iluwatar/roleobject/CustomerCoreTest.java b/role-object/src/test/java/com/iluwatar/roleobject/CustomerCoreTest.java new file mode 100644 index 000000000000..1b2987400d05 --- /dev/null +++ b/role-object/src/test/java/com/iluwatar/roleobject/CustomerCoreTest.java @@ -0,0 +1,103 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.roleobject; + +import org.junit.Test; + +import java.util.Optional; + +import static org.junit.Assert.*; + +public class CustomerCoreTest { + + @Test + public void addRole() { + CustomerCore core = new CustomerCore(); + boolean add = core.addRole(Role.Borrower); + assertTrue(add); + + } + + @Test + public void hasRole() { + CustomerCore core = new CustomerCore(); + core.addRole(Role.Borrower); + + boolean has = core.hasRole(Role.Borrower); + assertTrue(has); + + boolean notHas = core.hasRole(Role.Investor); + assertFalse(notHas); + } + + @Test + public void remRole() { + CustomerCore core = new CustomerCore(); + core.addRole(Role.Borrower); + + Optional bRole = core.getRole(Role.Borrower, BorrowerRole.class); + assertTrue(bRole.isPresent()); + + boolean res = core.remRole(Role.Borrower); + assertTrue(res); + + Optional empt = core.getRole(Role.Borrower, BorrowerRole.class); + assertFalse(empt.isPresent()); + + } + + @Test + public void getRole() { + CustomerCore core = new CustomerCore(); + core.addRole(Role.Borrower); + + Optional bRole = core.getRole(Role.Borrower, BorrowerRole.class); + assertTrue(bRole.isPresent()); + + Optional nonRole = core.getRole(Role.Borrower, InvestorRole.class); + assertFalse(nonRole.isPresent()); + + Optional invRole = core.getRole(Role.Investor, InvestorRole.class); + assertFalse(invRole.isPresent()); + + + } + + + @Test + public void toStringTest() { + CustomerCore core = new CustomerCore(); + core.addRole(Role.Borrower); + assertEquals(core.toString(), "Customer{roles=[Borrower]}"); + + core = new CustomerCore(); + core.addRole(Role.Investor); + assertEquals(core.toString(), "Customer{roles=[Investor]}"); + + core = new CustomerCore(); + assertEquals(core.toString(), "Customer{roles=[]}"); + + + } + +} \ No newline at end of file diff --git a/role-object/src/test/java/com/iluwatar/roleobject/InvestorRoleTest.java b/role-object/src/test/java/com/iluwatar/roleobject/InvestorRoleTest.java new file mode 100644 index 000000000000..06afa1016275 --- /dev/null +++ b/role-object/src/test/java/com/iluwatar/roleobject/InvestorRoleTest.java @@ -0,0 +1,38 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.roleobject; + +import org.junit.Assert; +import org.junit.Test; + +public class InvestorRoleTest { + + @Test + public void investTest() { + InvestorRole investorRole = new InvestorRole(); + investorRole.setName("test"); + investorRole.setAmountToInvest(10); + String res = "Investor test has invested 10 dollars"; + Assert.assertEquals(investorRole.invest(), res); + } +} \ No newline at end of file diff --git a/role-object/src/test/java/com/iluwatar/roleobject/RoleTest.java b/role-object/src/test/java/com/iluwatar/roleobject/RoleTest.java new file mode 100644 index 000000000000..6ae5b0cd8857 --- /dev/null +++ b/role-object/src/test/java/com/iluwatar/roleobject/RoleTest.java @@ -0,0 +1,40 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.roleobject; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.Optional; + +import static org.junit.Assert.*; + +public class RoleTest { + + @Test + public void instanceTest() { + Optional instance = Role.Borrower.instance(); + Assert.assertTrue(instance.isPresent()); + Assert.assertEquals(instance.get().getClass(),BorrowerRole.class); + } +} \ No newline at end of file From 9f7e3fe55216d88e14d49e403a6149765d5e4d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 26 Oct 2019 21:09:19 +0300 Subject: [PATCH 100/197] Update license headers --- .../com/iluwatar/adapter/package-info.java | 23 +++++++++++++++++++ pom.xml | 3 +++ 2 files changed, 26 insertions(+) diff --git a/adapter/src/main/java/com/iluwatar/adapter/package-info.java b/adapter/src/main/java/com/iluwatar/adapter/package-info.java index eb7e442f9f20..d036d86ddb47 100644 --- a/adapter/src/main/java/com/iluwatar/adapter/package-info.java +++ b/adapter/src/main/java/com/iluwatar/adapter/package-info.java @@ -1 +1,24 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + package com.iluwatar.adapter; diff --git a/pom.xml b/pom.xml index 1bcf73b8b4d5..8b8139f790e3 100644 --- a/pom.xml +++ b/pom.xml @@ -447,6 +447,9 @@ SLASHSTAR_CUSTOM_STYLE + + .github/FUNDING.yml + From b50189e283b8e90023cc2b61b3ca0993f1618c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 26 Oct 2019 21:26:42 +0300 Subject: [PATCH 101/197] Fix Role Object front matter --- role-object/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/role-object/README.md b/role-object/README.md index c97177d7b1d5..0e960140c987 100644 --- a/role-object/README.md +++ b/role-object/README.md @@ -1,7 +1,7 @@ --- layout: pattern -title: Role object -folder: Migration +title: Role Object +folder: role-object permalink: /patterns/role-object/ categories: Structural tags: From 63fb8dc31824ff81dc977de3e8e506e3041039af Mon Sep 17 00:00:00 2001 From: Leon Mak Date: Mon, 28 Oct 2019 04:05:10 +0800 Subject: [PATCH 102/197] Add java 11 (#1048) --- .../com/iluwatar/abstractdocument/App.java | 34 ++++++------ .../AbstractDocumentTest.java | 11 ++-- .../iluwatar/abstractdocument/DomainTest.java | 29 +++++----- .../iluwatar/collectionpipeline/AppTest.java | 44 ++++++++------- .../java/com/iluwatar/commander/Service.java | 8 ++- .../commander/queue/QueueDatabase.java | 9 ++-- .../com/iluwatar/commander/RetryTest.java | 24 ++++----- composite/README.md | 34 ++++++------ .../com/iluwatar/composite/Messenger.java | 54 ++++++++----------- .../main/java/com/iluwatar/converter/App.java | 6 +-- .../com/iluwatar/converter/ConverterTest.java | 7 ++- 11 files changed, 117 insertions(+), 143 deletions(-) diff --git a/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java b/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java index a0d9d13c8a79..99be4ee12719 100644 --- a/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java +++ b/abstract-document/src/main/java/com/iluwatar/abstractdocument/App.java @@ -23,14 +23,13 @@ package com.iluwatar.abstractdocument; -import java.util.Arrays; -import java.util.HashMap; - +import com.iluwatar.abstractdocument.domain.Car; +import com.iluwatar.abstractdocument.domain.enums.Property; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.iluwatar.abstractdocument.domain.Car; -import com.iluwatar.abstractdocument.domain.enums.Property; +import java.util.List; +import java.util.Map; /** * The Abstract Document pattern enables handling additional, non-static @@ -52,21 +51,20 @@ public class App { public App() { LOGGER.info("Constructing parts and car"); - var carProperties = new HashMap(); - carProperties.put(Property.MODEL.toString(), "300SL"); - carProperties.put(Property.PRICE.toString(), 10000L); - - var wheelProperties = new HashMap(); - wheelProperties.put(Property.TYPE.toString(), "wheel"); - wheelProperties.put(Property.MODEL.toString(), "15C"); - wheelProperties.put(Property.PRICE.toString(), 100L); + var wheelProperties = Map.of( + Property.TYPE.toString(), "wheel", + Property.MODEL.toString(), "15C", + Property.PRICE.toString(), 100L); - var doorProperties = new HashMap(); - doorProperties.put(Property.TYPE.toString(), "door"); - doorProperties.put(Property.MODEL.toString(), "Lambo"); - doorProperties.put(Property.PRICE.toString(), 300L); + var doorProperties = Map.of( + Property.TYPE.toString(), "door", + Property.MODEL.toString(), "Lambo", + Property.PRICE.toString(), 300L); - carProperties.put(Property.PARTS.toString(), Arrays.asList(wheelProperties, doorProperties)); + var carProperties = Map.of( + Property.MODEL.toString(), "300SL", + Property.PRICE.toString(), 10000L, + Property.PARTS.toString(), List.of(wheelProperties, doorProperties)); var car = new Car(carProperties); diff --git a/abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java b/abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java index 7f3e1eada124..0514c750aa77 100644 --- a/abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java +++ b/abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java @@ -31,9 +31,7 @@ import java.util.Map; import java.util.stream.Stream; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * AbstractDocument test class @@ -60,9 +58,7 @@ public void shouldPutAndGetValue() { @Test public void shouldRetrieveChildren() { - Map child1 = new HashMap<>(); - Map child2 = new HashMap<>(); - List> children = Arrays.asList(child1, child2); + var children = List.of(Map.of(), Map.of()); document.put(KEY, children); @@ -80,8 +76,7 @@ public void shouldRetrieveEmptyStreamForNonExistingChildren() { @Test public void shouldIncludePropsInToString() { - Map props = new HashMap<>(); - props.put(KEY, VALUE); + Map props = Map.of(KEY, VALUE); DocumentImplementation document = new DocumentImplementation(props); assertTrue(document.toString().contains(KEY)); assertTrue(document.toString().contains(VALUE)); diff --git a/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java b/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java index 2dde49a1ea2a..663071f6a0a7 100644 --- a/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java +++ b/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java @@ -23,17 +23,16 @@ package com.iluwatar.abstractdocument; -import static org.junit.jupiter.api.Assertions.assertEquals; +import com.iluwatar.abstractdocument.domain.Car; +import com.iluwatar.abstractdocument.domain.Part; +import com.iluwatar.abstractdocument.domain.enums.Property; +import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; -import org.junit.jupiter.api.Test; - -import com.iluwatar.abstractdocument.domain.Car; -import com.iluwatar.abstractdocument.domain.Part; -import com.iluwatar.abstractdocument.domain.enums.Property; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test for Part and Car @@ -49,10 +48,10 @@ public class DomainTest { @Test public void shouldConstructPart() { - Map partProperties = new HashMap<>(); - partProperties.put(Property.TYPE.toString(), TEST_PART_TYPE); - partProperties.put(Property.MODEL.toString(), TEST_PART_MODEL); - partProperties.put(Property.PRICE.toString(), TEST_PART_PRICE); + Map partProperties = Map.of( + Property.TYPE.toString(), TEST_PART_TYPE, + Property.MODEL.toString(), TEST_PART_MODEL, + Property.PRICE.toString(), TEST_PART_PRICE); Part part = new Part(partProperties); assertEquals(TEST_PART_TYPE, part.getType().get()); @@ -62,10 +61,10 @@ public void shouldConstructPart() { @Test public void shouldConstructCar() { - Map carProperties = new HashMap<>(); - carProperties.put(Property.MODEL.toString(), TEST_CAR_MODEL); - carProperties.put(Property.PRICE.toString(), TEST_CAR_PRICE); - carProperties.put(Property.PARTS.toString(), Arrays.asList(new HashMap<>(), new HashMap<>())); + Map carProperties = Map.of( + Property.MODEL.toString(), TEST_CAR_MODEL, + Property.PRICE.toString(), TEST_CAR_PRICE, + Property.PARTS.toString(), List.of(new HashMap<>(), new HashMap<>())); Car car = new Car(carProperties); assertEquals(TEST_CAR_MODEL, car.getModel().get()); diff --git a/collection-pipeline/src/test/java/com/iluwatar/collectionpipeline/AppTest.java b/collection-pipeline/src/test/java/com/iluwatar/collectionpipeline/AppTest.java index 5cec263cdead..6bc035920d88 100644 --- a/collection-pipeline/src/test/java/com/iluwatar/collectionpipeline/AppTest.java +++ b/collection-pipeline/src/test/java/com/iluwatar/collectionpipeline/AppTest.java @@ -23,16 +23,14 @@ package com.iluwatar.collectionpipeline; -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import java.util.Arrays; -import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Tests that Collection Pipeline methods work as expected. @@ -44,27 +42,27 @@ public class AppTest { @Test public void testGetModelsAfter2000UsingFor() { - List models = ImperativeProgramming.getModelsAfter2000(cars); - assertEquals(Arrays.asList("Avenger", "Wrangler", "Focus", "Cascada"), models); + var models = ImperativeProgramming.getModelsAfter2000(cars); + assertEquals(List.of("Avenger", "Wrangler", "Focus", "Cascada"), models); } @Test public void testGetModelsAfter2000UsingPipeline() { - List models = FunctionalProgramming.getModelsAfter2000(cars); - assertEquals(Arrays.asList("Avenger", "Wrangler", "Focus", "Cascada"), models); + var models = FunctionalProgramming.getModelsAfter2000(cars); + assertEquals(List.of("Avenger", "Wrangler", "Focus", "Cascada"), models); } @Test public void testGetGroupingOfCarsByCategory() { - Map> modelsExpected = new HashMap<>(); - modelsExpected.put(Category.CONVERTIBLE, Arrays.asList(new Car("Buick", "Cascada", 2016, Category.CONVERTIBLE), - new Car("Chevrolet", "Geo Metro", 1992, Category.CONVERTIBLE))); - modelsExpected.put(Category.SEDAN, Arrays.asList(new Car("Dodge", "Avenger", 2010, Category.SEDAN), - new Car("Ford", "Focus", 2012, Category.SEDAN))); - modelsExpected.put(Category.JEEP, Arrays.asList(new Car("Jeep", "Wrangler", 2011, Category.JEEP), - new Car("Jeep", "Comanche", 1990, Category.JEEP))); - Map> modelsFunctional = FunctionalProgramming.getGroupingOfCarsByCategory(cars); - Map> modelsImperative = ImperativeProgramming.getGroupingOfCarsByCategory(cars); + var modelsExpected = Map.of( + Category.CONVERTIBLE, List.of(new Car("Buick", "Cascada", 2016, Category.CONVERTIBLE), + new Car("Chevrolet", "Geo Metro", 1992, Category.CONVERTIBLE)), + Category.SEDAN, List.of(new Car("Dodge", "Avenger", 2010, Category.SEDAN), + new Car("Ford", "Focus", 2012, Category.SEDAN)), + Category.JEEP, List.of(new Car("Jeep", "Wrangler", 2011, Category.JEEP), + new Car("Jeep", "Comanche", 1990, Category.JEEP))); + var modelsFunctional = FunctionalProgramming.getGroupingOfCarsByCategory(cars); + var modelsImperative = ImperativeProgramming.getGroupingOfCarsByCategory(cars); LOGGER.info("Category " + modelsFunctional); assertEquals(modelsExpected, modelsFunctional); assertEquals(modelsExpected, modelsImperative); @@ -72,11 +70,11 @@ public void testGetGroupingOfCarsByCategory() { @Test public void testGetSedanCarsOwnedSortedByDate() { - Person john = new Person(cars); - List modelsExpected = Arrays.asList(new Car("Dodge", "Avenger", 2010, Category.SEDAN), + var john = new Person(cars); + var modelsExpected = List.of(new Car("Dodge", "Avenger", 2010, Category.SEDAN), new Car("Ford", "Focus", 2012, Category.SEDAN)); - List modelsFunctional = FunctionalProgramming.getSedanCarsOwnedSortedByDate(Arrays.asList(john)); - List modelsImperative = ImperativeProgramming.getSedanCarsOwnedSortedByDate(Arrays.asList(john)); + var modelsFunctional = FunctionalProgramming.getSedanCarsOwnedSortedByDate(List.of(john)); + var modelsImperative = ImperativeProgramming.getSedanCarsOwnedSortedByDate(List.of(john)); assertEquals(modelsExpected, modelsFunctional); assertEquals(modelsExpected, modelsImperative); } diff --git a/commander/src/main/java/com/iluwatar/commander/Service.java b/commander/src/main/java/com/iluwatar/commander/Service.java index f3b1940c7093..2e293520b87b 100644 --- a/commander/src/main/java/com/iluwatar/commander/Service.java +++ b/commander/src/main/java/com/iluwatar/commander/Service.java @@ -23,10 +23,8 @@ package com.iluwatar.commander; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Random; +import java.util.*; + import com.iluwatar.commander.exceptions.DatabaseUnavailableException; /** @@ -49,7 +47,7 @@ public abstract class Service { protected Service(Database db, Exception...exc) { this.database = db; - this.exceptionsList = new ArrayList(Arrays.asList(exc)); + this.exceptionsList = new ArrayList<>(List.of(exc)); } public abstract String receiveRequest(Object...parameters) throws DatabaseUnavailableException; diff --git a/commander/src/main/java/com/iluwatar/commander/queue/QueueDatabase.java b/commander/src/main/java/com/iluwatar/commander/queue/QueueDatabase.java index 0010ce1f4d3e..6b9007b9fd36 100644 --- a/commander/src/main/java/com/iluwatar/commander/queue/QueueDatabase.java +++ b/commander/src/main/java/com/iluwatar/commander/queue/QueueDatabase.java @@ -23,12 +23,13 @@ package com.iluwatar.commander.queue; -import java.util.ArrayList; -import java.util.Arrays; import com.iluwatar.commander.Database; import com.iluwatar.commander.exceptions.DatabaseUnavailableException; import com.iluwatar.commander.exceptions.IsEmptyException; +import java.util.ArrayList; +import java.util.List; + /** * QueueDatabase id where the instructions to be implemented are queued. */ @@ -39,8 +40,8 @@ public class QueueDatabase extends Database { public ArrayList exceptionsList; public QueueDatabase(Exception...exc) { - this.data = new Queue(); - this.exceptionsList = new ArrayList(Arrays.asList(exc)); + this.data = new Queue<>(); + this.exceptionsList = new ArrayList<>(List.of(exc)); } @Override diff --git a/commander/src/test/java/com/iluwatar/commander/RetryTest.java b/commander/src/test/java/com/iluwatar/commander/RetryTest.java index 7dd142b9c83a..c4ee5caf7964 100644 --- a/commander/src/test/java/com/iluwatar/commander/RetryTest.java +++ b/commander/src/test/java/com/iluwatar/commander/RetryTest.java @@ -23,18 +23,14 @@ package com.iluwatar.commander; -import static org.junit.jupiter.api.Assertions.*; -import java.util.ArrayList; -import java.util.Arrays; -import org.junit.jupiter.api.Test; - -import com.iluwatar.commander.Order; -import com.iluwatar.commander.Retry; -import com.iluwatar.commander.User; -import com.iluwatar.commander.Retry.HandleErrorIssue; -import com.iluwatar.commander.Retry.Operation; import com.iluwatar.commander.exceptions.DatabaseUnavailableException; import com.iluwatar.commander.exceptions.ItemUnavailableException; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertTrue; class RetryTest { @@ -55,15 +51,15 @@ void performTest() { e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); - ArrayList arr1 = new ArrayList(Arrays.asList(new Exception[] - {new ItemUnavailableException(), new DatabaseUnavailableException()})); + ArrayList arr1 = new ArrayList<>(List.of( + new ItemUnavailableException(), new DatabaseUnavailableException())); try { r1.perform(arr1, order); } catch (Exception e1) { e1.printStackTrace(); } - ArrayList arr2 = new ArrayList(Arrays.asList(new Exception[] - {new DatabaseUnavailableException(), new ItemUnavailableException()})); + ArrayList arr2 = new ArrayList<>(List.of( + new DatabaseUnavailableException(), new ItemUnavailableException())); try { r2.perform(arr2, order); } catch (Exception e1) { diff --git a/composite/README.md b/composite/README.md index 05ee70cbb9b9..68d5339fb016 100644 --- a/composite/README.md +++ b/composite/README.md @@ -94,27 +94,27 @@ Then we have a messenger to carry messages ```java public class Messenger { LetterComposite messageFromOrcs() { - List words = new ArrayList<>(); - words.add(new Word(Arrays.asList(new Letter('W'), new Letter('h'), new Letter('e'), new Letter('r'), new Letter('e')))); - words.add(new Word(Arrays.asList(new Letter('t'), new Letter('h'), new Letter('e'), new Letter('r'), new Letter('e')))); - words.add(new Word(Arrays.asList(new Letter('i'), new Letter('s')))); - words.add(new Word(Arrays.asList(new Letter('a')))); - words.add(new Word(Arrays.asList(new Letter('w'), new Letter('h'), new Letter('i'), new Letter('p')))); - words.add(new Word(Arrays.asList(new Letter('t'), new Letter('h'), new Letter('e'), new Letter('r'), new Letter('e')))); - words.add(new Word(Arrays.asList(new Letter('i'), new Letter('s')))); - words.add(new Word(Arrays.asList(new Letter('a')))); - words.add(new Word(Arrays.asList(new Letter('w'), new Letter('a'), new Letter('y')))); + List words = List.of( + new Word(List.of(new Letter('W'), new Letter('h'), new Letter('e'), new Letter('r'), new Letter('e'))), + new Word(List.of(new Letter('t'), new Letter('h'), new Letter('e'), new Letter('r'), new Letter('e'))), + new Word(List.of(new Letter('i'), new Letter('s'))), + new Word(List.of(new Letter('a'))), + new Word(List.of(new Letter('w'), new Letter('h'), new Letter('i'), new Letter('p'))), + new Word(List.of(new Letter('t'), new Letter('h'), new Letter('e'), new Letter('r'), new Letter('e'))), + new Word(List.of(new Letter('i'), new Letter('s'))), + new Word(List.of(new Letter('a'))), + new Word(List.of(new Letter('w'), new Letter('a'), new Letter('y')))); return new Sentence(words); } LetterComposite messageFromElves() { - List words = new ArrayList<>(); - words.add(new Word(Arrays.asList(new Letter('M'), new Letter('u'), new Letter('c'), new Letter('h')))); - words.add(new Word(Arrays.asList(new Letter('w'), new Letter('i'), new Letter('n'), new Letter('d')))); - words.add(new Word(Arrays.asList(new Letter('p'), new Letter('o'), new Letter('u'), new Letter('r'), new Letter('s')))); - words.add(new Word(Arrays.asList(new Letter('f'), new Letter('r'), new Letter('o'), new Letter('m')))); - words.add(new Word(Arrays.asList(new Letter('y'), new Letter('o'), new Letter('u'), new Letter('r')))); - words.add(new Word(Arrays.asList(new Letter('m'), new Letter('o'), new Letter('u'), new Letter('t'), new Letter('h')))); + List words = List.of( + new Word(List.of(new Letter('M'), new Letter('u'), new Letter('c'), new Letter('h'))), + new Word(List.of(new Letter('w'), new Letter('i'), new Letter('n'), new Letter('d'))), + new Word(List.of(new Letter('p'), new Letter('o'), new Letter('u'), new Letter('r'), new Letter('s'))), + new Word(List.of(new Letter('f'), new Letter('r'), new Letter('o'), new Letter('m'))), + new Word(List.of(new Letter('y'), new Letter('o'), new Letter('u'), new Letter('r'))), + new Word(List.of(new Letter('m'), new Letter('o'), new Letter('u'), new Letter('t'), new Letter('h')))); return new Sentence(words); } } diff --git a/composite/src/main/java/com/iluwatar/composite/Messenger.java b/composite/src/main/java/com/iluwatar/composite/Messenger.java index c4d99faf61fa..ba6a08161456 100644 --- a/composite/src/main/java/com/iluwatar/composite/Messenger.java +++ b/composite/src/main/java/com/iluwatar/composite/Messenger.java @@ -23,8 +23,6 @@ package com.iluwatar.composite; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** @@ -36,21 +34,20 @@ public class Messenger { LetterComposite messageFromOrcs() { - List words = new ArrayList<>(); - - words.add(new Word(Arrays.asList(new Letter('W'), new Letter('h'), new Letter('e'), new Letter( - 'r'), new Letter('e')))); - words.add(new Word(Arrays.asList(new Letter('t'), new Letter('h'), new Letter('e'), new Letter( - 'r'), new Letter('e')))); - words.add(new Word(Arrays.asList(new Letter('i'), new Letter('s')))); - words.add(new Word(Arrays.asList(new Letter('a')))); - words.add(new Word(Arrays.asList(new Letter('w'), new Letter('h'), new Letter('i'), new Letter( - 'p')))); - words.add(new Word(Arrays.asList(new Letter('t'), new Letter('h'), new Letter('e'), new Letter( - 'r'), new Letter('e')))); - words.add(new Word(Arrays.asList(new Letter('i'), new Letter('s')))); - words.add(new Word(Arrays.asList(new Letter('a')))); - words.add(new Word(Arrays.asList(new Letter('w'), new Letter('a'), new Letter('y')))); + List words = List.of( + new Word(List.of(new Letter('W'), new Letter('h'), new Letter('e'), new Letter( + 'r'), new Letter('e'))), + new Word(List.of(new Letter('t'), new Letter('h'), new Letter('e'), new Letter( + 'r'), new Letter('e'))), + new Word(List.of(new Letter('i'), new Letter('s'))), + new Word(List.of(new Letter('a'))), + new Word(List.of(new Letter('w'), new Letter('h'), new Letter('i'), new Letter( + 'p'))), + new Word(List.of(new Letter('t'), new Letter('h'), new Letter('e'), new Letter( + 'r'), new Letter('e'))), + new Word(List.of(new Letter('i'), new Letter('s'))), + new Word(List.of(new Letter('a'))), + new Word(List.of(new Letter('w'), new Letter('a'), new Letter('y')))); return new Sentence(words); @@ -58,20 +55,15 @@ LetterComposite messageFromOrcs() { LetterComposite messageFromElves() { - List words = new ArrayList<>(); - - words.add(new Word(Arrays.asList(new Letter('M'), new Letter('u'), new Letter('c'), new Letter( - 'h')))); - words.add(new Word(Arrays.asList(new Letter('w'), new Letter('i'), new Letter('n'), new Letter( - 'd')))); - words.add(new Word(Arrays.asList(new Letter('p'), new Letter('o'), new Letter('u'), new Letter( - 'r'), new Letter('s')))); - words.add(new Word(Arrays.asList(new Letter('f'), new Letter('r'), new Letter('o'), new Letter( - 'm')))); - words.add(new Word(Arrays.asList(new Letter('y'), new Letter('o'), new Letter('u'), new Letter( - 'r')))); - words.add(new Word(Arrays.asList(new Letter('m'), new Letter('o'), new Letter('u'), new Letter( - 't'), new Letter('h')))); + List words = List.of( + new Word(List.of(new Letter('M'), new Letter('u'), new Letter('c'), new Letter('h'))), + new Word(List.of(new Letter('w'), new Letter('i'), new Letter('n'), new Letter('d'))), + new Word(List.of(new Letter('p'), new Letter('o'), new Letter('u'), new Letter('r'), + new Letter('s'))), + new Word(List.of(new Letter('f'), new Letter('r'), new Letter('o'), new Letter('m'))), + new Word(List.of(new Letter('y'), new Letter('o'), new Letter('u'), new Letter('r'))), + new Word(List.of(new Letter('m'), new Letter('o'), new Letter('u'), new Letter('t'), + new Letter('h')))); return new Sentence(words); diff --git a/converter/src/main/java/com/iluwatar/converter/App.java b/converter/src/main/java/com/iluwatar/converter/App.java index 0d4666ae6cb2..fab472328afd 100644 --- a/converter/src/main/java/com/iluwatar/converter/App.java +++ b/converter/src/main/java/com/iluwatar/converter/App.java @@ -24,11 +24,9 @@ package com.iluwatar.converter; -import com.google.common.collect.Lists; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; import java.util.List; /** @@ -38,7 +36,7 @@ * objects between types. */ public class App { - + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** * Program entry point @@ -52,7 +50,7 @@ public static void main(String[] args) { User user = userConverter.convertFromDto(dtoUser); LOGGER.info("Entity converted from DTO:" + user); - ArrayList users = Lists.newArrayList(new User("Camile", "Tough", false, "124sad"), + var users = List.of(new User("Camile", "Tough", false, "124sad"), new User("Marti", "Luther", true, "42309fd"), new User("Kate", "Smith", true, "if0243")); LOGGER.info("Domain entities:"); users.stream().map(User::toString).forEach(LOGGER::info); diff --git a/converter/src/test/java/com/iluwatar/converter/ConverterTest.java b/converter/src/test/java/com/iluwatar/converter/ConverterTest.java index 90160c4678df..92d47bb41087 100644 --- a/converter/src/test/java/com/iluwatar/converter/ConverterTest.java +++ b/converter/src/test/java/com/iluwatar/converter/ConverterTest.java @@ -23,10 +23,8 @@ package com.iluwatar.converter; -import com.google.common.collect.Lists; import org.junit.jupiter.api.Test; -import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -81,8 +79,9 @@ public void testCustomConverter() { */ @Test public void testCollectionConversion() { - ArrayList users = Lists.newArrayList(new User("Camile", "Tough", false, "124sad"), - new User("Marti", "Luther", true, "42309fd"), new User("Kate", "Smith", true, "if0243")); + List users = List.of(new User("Camile", "Tough", false, "124sad"), + new User("Marti", "Luther", true, "42309fd"), + new User("Kate", "Smith", true, "if0243")); List fromDtos = userConverter.createFromDtos(userConverter.createFromEntities(users)); assertEquals(users, fromDtos); } From 6bb343896539bdce4a87e219f32362101e5088ac Mon Sep 17 00:00:00 2001 From: Leon Mak Date: Mon, 28 Oct 2019 04:08:09 +0800 Subject: [PATCH 103/197] Add java 11 (#1049) --- dao/src/main/java/com/iluwatar/dao/App.java | 6 +-- .../java/com/iluwatar/doubledispatch/App.java | 11 +++-- facade/README.md | 8 ++-- .../facade/DwarvenGoldmineFacade.java | 9 ++--- .../com/iluwatar/flyweight/AlchemistShop.java | 40 ++++++++----------- 5 files changed, 31 insertions(+), 43 deletions(-) diff --git a/dao/src/main/java/com/iluwatar/dao/App.java b/dao/src/main/java/com/iluwatar/dao/App.java index c8dd5629db7a..78406208a77e 100644 --- a/dao/src/main/java/com/iluwatar/dao/App.java +++ b/dao/src/main/java/com/iluwatar/dao/App.java @@ -128,10 +128,6 @@ public static List generateSampleCustomers() { final Customer customer1 = new Customer(1, "Adam", "Adamson"); final Customer customer2 = new Customer(2, "Bob", "Bobson"); final Customer customer3 = new Customer(3, "Carl", "Carlson"); - final List customers = new ArrayList<>(); - customers.add(customer1); - customers.add(customer2); - customers.add(customer3); - return customers; + return List.of(customer1, customer2, customer3); } } diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/App.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/App.java index 08d5440b9bc3..e6b670a6d524 100644 --- a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/App.java +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/App.java @@ -26,7 +26,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; import java.util.List; /** @@ -59,11 +58,11 @@ public class App { */ public static void main(String[] args) { // initialize game objects and print their status - List objects = new ArrayList<>(); - objects.add(new FlamingAsteroid(0, 0, 5, 5)); - objects.add(new SpaceStationMir(1, 1, 2, 2)); - objects.add(new Meteoroid(10, 10, 15, 15)); - objects.add(new SpaceStationIss(12, 12, 14, 14)); + List objects = List.of( + new FlamingAsteroid(0, 0, 5, 5), + new SpaceStationMir(1, 1, 2, 2), + new Meteoroid(10, 10, 15, 15), + new SpaceStationIss(12, 12, 14, 14)); objects.stream().forEach(o -> LOGGER.info(o.toString())); LOGGER.info(""); diff --git a/facade/README.md b/facade/README.md index 505ceee394bb..d6c64500c3f8 100644 --- a/facade/README.md +++ b/facade/README.md @@ -146,10 +146,10 @@ public class DwarvenGoldmineFacade { private final List workers; public DwarvenGoldmineFacade() { - workers = new ArrayList<>(); - workers.add(new DwarvenGoldDigger()); - workers.add(new DwarvenCartOperator()); - workers.add(new DwarvenTunnelDigger()); + workers = List.of( + new DwarvenGoldDigger(), + new DwarvenCartOperator(), + new DwarvenTunnelDigger()); } public void startNewDay() { diff --git a/facade/src/main/java/com/iluwatar/facade/DwarvenGoldmineFacade.java b/facade/src/main/java/com/iluwatar/facade/DwarvenGoldmineFacade.java index e7062f334617..b49d46e93b53 100644 --- a/facade/src/main/java/com/iluwatar/facade/DwarvenGoldmineFacade.java +++ b/facade/src/main/java/com/iluwatar/facade/DwarvenGoldmineFacade.java @@ -23,7 +23,6 @@ package com.iluwatar.facade; -import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -43,10 +42,10 @@ public class DwarvenGoldmineFacade { * Constructor */ public DwarvenGoldmineFacade() { - workers = new ArrayList<>(); - workers.add(new DwarvenGoldDigger()); - workers.add(new DwarvenCartOperator()); - workers.add(new DwarvenTunnelDigger()); + workers = List.of( + new DwarvenGoldDigger(), + new DwarvenCartOperator(), + new DwarvenTunnelDigger()); } public void startNewDay() { diff --git a/flyweight/src/main/java/com/iluwatar/flyweight/AlchemistShop.java b/flyweight/src/main/java/com/iluwatar/flyweight/AlchemistShop.java index c139e25b47b9..78f01474ff8c 100644 --- a/flyweight/src/main/java/com/iluwatar/flyweight/AlchemistShop.java +++ b/flyweight/src/main/java/com/iluwatar/flyweight/AlchemistShop.java @@ -26,7 +26,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -46,29 +45,24 @@ public class AlchemistShop { * Constructor */ public AlchemistShop() { - topShelf = new ArrayList<>(); - bottomShelf = new ArrayList<>(); - fillShelves(); - } - - private void fillShelves() { - PotionFactory factory = new PotionFactory(); - - topShelf.add(factory.createPotion(PotionType.INVISIBILITY)); - topShelf.add(factory.createPotion(PotionType.INVISIBILITY)); - topShelf.add(factory.createPotion(PotionType.STRENGTH)); - topShelf.add(factory.createPotion(PotionType.HEALING)); - topShelf.add(factory.createPotion(PotionType.INVISIBILITY)); - topShelf.add(factory.createPotion(PotionType.STRENGTH)); - topShelf.add(factory.createPotion(PotionType.HEALING)); - topShelf.add(factory.createPotion(PotionType.HEALING)); - - bottomShelf.add(factory.createPotion(PotionType.POISON)); - bottomShelf.add(factory.createPotion(PotionType.POISON)); - bottomShelf.add(factory.createPotion(PotionType.POISON)); - bottomShelf.add(factory.createPotion(PotionType.HOLY_WATER)); - bottomShelf.add(factory.createPotion(PotionType.HOLY_WATER)); + topShelf = List.of( + factory.createPotion(PotionType.INVISIBILITY), + factory.createPotion(PotionType.INVISIBILITY), + factory.createPotion(PotionType.STRENGTH), + factory.createPotion(PotionType.HEALING), + factory.createPotion(PotionType.INVISIBILITY), + factory.createPotion(PotionType.STRENGTH), + factory.createPotion(PotionType.HEALING), + factory.createPotion(PotionType.HEALING) + ); + bottomShelf = List.of( + factory.createPotion(PotionType.POISON), + factory.createPotion(PotionType.POISON), + factory.createPotion(PotionType.POISON), + factory.createPotion(PotionType.HOLY_WATER), + factory.createPotion(PotionType.HOLY_WATER) + ); } /** From dd971d8c19bcf3ae8b25956ea6daed0362488cef Mon Sep 17 00:00:00 2001 From: Leon Mak Date: Mon, 28 Oct 2019 23:02:17 +0800 Subject: [PATCH 104/197] Use java 11 (#1050) --- .../hexagonal/sampledata/SampleData.java | 82 +++++++++---------- .../service/LotteryConsoleServiceImpl.java | 12 +-- .../hexagonal/domain/LotteryNumbersTest.java | 11 +-- .../hexagonal/domain/LotteryTest.java | 11 +-- .../hexagonal/domain/LotteryTicketTest.java | 7 +- .../hexagonal/test/LotteryTestUtils.java | 2 +- .../iluwatar/iterator/list/TreasureChest.java | 22 ++--- .../iterator/list/TreasureChestTest.java | 25 +++--- .../java/com/iluwatar/layers/CakeTest.java | 11 ++- .../com/iluwatar/layers/CakeViewImplTest.java | 12 ++- .../bully/BullyMessageManagerTest.java | 29 ++----- .../ring/RingMessageManagerTest.java | 19 +---- 12 files changed, 102 insertions(+), 141 deletions(-) diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java index 90dfd1fbdc18..8189303eb04a 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java @@ -31,7 +31,6 @@ import com.iluwatar.hexagonal.domain.LotteryTicketId; import com.iluwatar.hexagonal.domain.PlayerDetails; -import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -44,46 +43,47 @@ public class SampleData { private static final Random RANDOM = new Random(); static { - PLAYERS = new ArrayList<>(); - PLAYERS.add(new PlayerDetails("john@google.com", "312-342", "+3242434242")); - PLAYERS.add(new PlayerDetails("mary@google.com", "234-987", "+23452346")); - PLAYERS.add(new PlayerDetails("steve@google.com", "833-836", "+63457543")); - PLAYERS.add(new PlayerDetails("wayne@google.com", "319-826", "+24626")); - PLAYERS.add(new PlayerDetails("johnie@google.com", "983-322", "+3635635")); - PLAYERS.add(new PlayerDetails("andy@google.com", "934-734", "+0898245")); - PLAYERS.add(new PlayerDetails("richard@google.com", "536-738", "+09845325")); - PLAYERS.add(new PlayerDetails("kevin@google.com", "453-936", "+2423532")); - PLAYERS.add(new PlayerDetails("arnold@google.com", "114-988", "+5646346524")); - PLAYERS.add(new PlayerDetails("ian@google.com", "663-765", "+928394235")); - PLAYERS.add(new PlayerDetails("robin@google.com", "334-763", "+35448")); - PLAYERS.add(new PlayerDetails("ted@google.com", "735-964", "+98752345")); - PLAYERS.add(new PlayerDetails("larry@google.com", "734-853", "+043842423")); - PLAYERS.add(new PlayerDetails("calvin@google.com", "334-746", "+73294135")); - PLAYERS.add(new PlayerDetails("jacob@google.com", "444-766", "+358042354")); - PLAYERS.add(new PlayerDetails("edwin@google.com", "895-345", "+9752435")); - PLAYERS.add(new PlayerDetails("mary@google.com", "760-009", "+34203542")); - PLAYERS.add(new PlayerDetails("lolita@google.com", "425-907", "+9872342")); - PLAYERS.add(new PlayerDetails("bruno@google.com", "023-638", "+673824122")); - PLAYERS.add(new PlayerDetails("peter@google.com", "335-886", "+5432503945")); - PLAYERS.add(new PlayerDetails("warren@google.com", "225-946", "+9872341324")); - PLAYERS.add(new PlayerDetails("monica@google.com", "265-748", "+134124")); - PLAYERS.add(new PlayerDetails("ollie@google.com", "190-045", "+34453452")); - PLAYERS.add(new PlayerDetails("yngwie@google.com", "241-465", "+9897641231")); - PLAYERS.add(new PlayerDetails("lars@google.com", "746-936", "+42345298345")); - PLAYERS.add(new PlayerDetails("bobbie@google.com", "946-384", "+79831742")); - PLAYERS.add(new PlayerDetails("tyron@google.com", "310-992", "+0498837412")); - PLAYERS.add(new PlayerDetails("tyrell@google.com", "032-045", "+67834134")); - PLAYERS.add(new PlayerDetails("nadja@google.com", "000-346", "+498723")); - PLAYERS.add(new PlayerDetails("wendy@google.com", "994-989", "+987324454")); - PLAYERS.add(new PlayerDetails("luke@google.com", "546-634", "+987642435")); - PLAYERS.add(new PlayerDetails("bjorn@google.com", "342-874", "+7834325")); - PLAYERS.add(new PlayerDetails("lisa@google.com", "024-653", "+980742154")); - PLAYERS.add(new PlayerDetails("anton@google.com", "834-935", "+876423145")); - PLAYERS.add(new PlayerDetails("bruce@google.com", "284-936", "+09843212345")); - PLAYERS.add(new PlayerDetails("ray@google.com", "843-073", "+678324123")); - PLAYERS.add(new PlayerDetails("ron@google.com", "637-738", "+09842354")); - PLAYERS.add(new PlayerDetails("xavier@google.com", "143-947", "+375245")); - PLAYERS.add(new PlayerDetails("harriet@google.com", "842-404", "+131243252")); + PLAYERS = List.of( + new PlayerDetails("john@google.com", "312-342", "+3242434242"), + new PlayerDetails("mary@google.com", "234-987", "+23452346"), + new PlayerDetails("steve@google.com", "833-836", "+63457543"), + new PlayerDetails("wayne@google.com", "319-826", "+24626"), + new PlayerDetails("johnie@google.com", "983-322", "+3635635"), + new PlayerDetails("andy@google.com", "934-734", "+0898245"), + new PlayerDetails("richard@google.com", "536-738", "+09845325"), + new PlayerDetails("kevin@google.com", "453-936", "+2423532"), + new PlayerDetails("arnold@google.com", "114-988", "+5646346524"), + new PlayerDetails("ian@google.com", "663-765", "+928394235"), + new PlayerDetails("robin@google.com", "334-763", "+35448"), + new PlayerDetails("ted@google.com", "735-964", "+98752345"), + new PlayerDetails("larry@google.com", "734-853", "+043842423"), + new PlayerDetails("calvin@google.com", "334-746", "+73294135"), + new PlayerDetails("jacob@google.com", "444-766", "+358042354"), + new PlayerDetails("edwin@google.com", "895-345", "+9752435"), + new PlayerDetails("mary@google.com", "760-009", "+34203542"), + new PlayerDetails("lolita@google.com", "425-907", "+9872342"), + new PlayerDetails("bruno@google.com", "023-638", "+673824122"), + new PlayerDetails("peter@google.com", "335-886", "+5432503945"), + new PlayerDetails("warren@google.com", "225-946", "+9872341324"), + new PlayerDetails("monica@google.com", "265-748", "+134124"), + new PlayerDetails("ollie@google.com", "190-045", "+34453452"), + new PlayerDetails("yngwie@google.com", "241-465", "+9897641231"), + new PlayerDetails("lars@google.com", "746-936", "+42345298345"), + new PlayerDetails("bobbie@google.com", "946-384", "+79831742"), + new PlayerDetails("tyron@google.com", "310-992", "+0498837412"), + new PlayerDetails("tyrell@google.com", "032-045", "+67834134"), + new PlayerDetails("nadja@google.com", "000-346", "+498723"), + new PlayerDetails("wendy@google.com", "994-989", "+987324454"), + new PlayerDetails("luke@google.com", "546-634", "+987642435"), + new PlayerDetails("bjorn@google.com", "342-874", "+7834325"), + new PlayerDetails("lisa@google.com", "024-653", "+980742154"), + new PlayerDetails("anton@google.com", "834-935", "+876423145"), + new PlayerDetails("bruce@google.com", "284-936", "+09843212345"), + new PlayerDetails("ray@google.com", "843-073", "+678324123"), + new PlayerDetails("ron@google.com", "637-738", "+09842354"), + new PlayerDetails("xavier@google.com", "143-947", "+375245"), + new PlayerDetails("harriet@google.com", "842-404", "+131243252") + ); InMemoryBank wireTransfers = new InMemoryBank(); for (PlayerDetails player : PLAYERS) { wireTransfers.setFunds(player.getBankAccount(), diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleServiceImpl.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleServiceImpl.java index c2a164353c08..3641b9a5c50c 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleServiceImpl.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleServiceImpl.java @@ -27,10 +27,9 @@ import com.iluwatar.hexagonal.domain.*; import org.slf4j.Logger; -import java.util.HashSet; -import java.util.Optional; -import java.util.Scanner; -import java.util.Set; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.IntStream; /** * Console implementation for lottery console service @@ -88,10 +87,7 @@ public void submitTicket(LotteryService service, Scanner scanner) { String numbers = readString( scanner ); try { String[] parts = numbers.split( "," ); - Set chosen = new HashSet<>(); - for (int i = 0; i < 4; i++) { - chosen.add( Integer.parseInt( parts[i] ) ); - } + Set chosen = Arrays.stream(parts).map(Integer::parseInt).collect(Collectors.toSet()); LotteryNumbers lotteryNumbers = LotteryNumbers.create( chosen ); LotteryTicket lotteryTicket = new LotteryTicket( new LotteryTicketId(), details, lotteryNumbers ); Optional id = service.submitTicket( lotteryTicket ); diff --git a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryNumbersTest.java b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryNumbersTest.java index 83699d6d413b..1812263899b7 100644 --- a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryNumbersTest.java +++ b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryNumbersTest.java @@ -27,6 +27,7 @@ import java.util.Arrays; import java.util.HashSet; +import java.util.Set; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; @@ -43,7 +44,7 @@ class LotteryNumbersTest { @Test void testGivenNumbers() { LotteryNumbers numbers = LotteryNumbers.create( - new HashSet<>(Arrays.asList(1, 2, 3, 4))); + Set.of(1, 2, 3, 4)); assertEquals(numbers.getNumbers().size(), 4); assertTrue(numbers.getNumbers().contains(1)); assertTrue(numbers.getNumbers().contains(2)); @@ -54,7 +55,7 @@ void testGivenNumbers() { @Test void testNumbersCantBeModified() { LotteryNumbers numbers = LotteryNumbers.create( - new HashSet<>(Arrays.asList(1, 2, 3, 4))); + Set.of(1, 2, 3, 4)); assertThrows(UnsupportedOperationException.class, () -> numbers.getNumbers().add(5)); } @@ -67,12 +68,12 @@ void testRandomNumbers() { @Test void testEquals() { LotteryNumbers numbers1 = LotteryNumbers.create( - new HashSet<>(Arrays.asList(1, 2, 3, 4))); + Set.of(1, 2, 3, 4)); LotteryNumbers numbers2 = LotteryNumbers.create( - new HashSet<>(Arrays.asList(1, 2, 3, 4))); + Set.of(1, 2, 3, 4)); assertEquals(numbers1, numbers2); LotteryNumbers numbers3 = LotteryNumbers.create( - new HashSet<>(Arrays.asList(11, 12, 13, 14))); + Set.of(11, 12, 13, 14)); assertNotEquals(numbers1, numbers3); } } diff --git a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTest.java b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTest.java index 4d06463d0c0f..a62adaff870a 100644 --- a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTest.java +++ b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTest.java @@ -33,10 +33,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Map; -import java.util.Optional; +import java.util.*; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; @@ -76,13 +73,13 @@ void testLottery() { // players submit the lottery tickets Optional ticket1 = service.submitTicket(LotteryTestUtils.createLotteryTicket("cvt@bbb.com", - "123-12312", "+32425255", new HashSet<>(Arrays.asList(1, 2, 3, 4)))); + "123-12312", "+32425255", Set.of(1, 2, 3, 4))); assertTrue(ticket1.isPresent()); Optional ticket2 = service.submitTicket(LotteryTestUtils.createLotteryTicket("ant@bac.com", - "123-12312", "+32423455", new HashSet<>(Arrays.asList(11, 12, 13, 14)))); + "123-12312", "+32423455", Set.of(11, 12, 13, 14))); assertTrue(ticket2.isPresent()); Optional ticket3 = service.submitTicket(LotteryTestUtils.createLotteryTicket("arg@boo.com", - "123-12312", "+32421255", new HashSet<>(Arrays.asList(6, 8, 13, 19)))); + "123-12312", "+32421255", Set.of(6, 8, 13, 19))); assertTrue(ticket3.isPresent()); assertEquals(3, administration.getAllSubmittedTickets().size()); diff --git a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTicketTest.java b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTicketTest.java index 5b9441a913cd..0e81a163b844 100644 --- a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTicketTest.java +++ b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTicketTest.java @@ -27,6 +27,7 @@ import java.util.Arrays; import java.util.HashSet; +import java.util.Set; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; @@ -39,14 +40,14 @@ class LotteryTicketTest { @Test void testEquals() { PlayerDetails details1 = new PlayerDetails("bob@foo.bar", "1212-121212", "+34332322"); - LotteryNumbers numbers1 = LotteryNumbers.create(new HashSet<>(Arrays.asList(1, 2, 3, 4))); + LotteryNumbers numbers1 = LotteryNumbers.create(Set.of(1, 2, 3, 4)); LotteryTicket ticket1 = new LotteryTicket(new LotteryTicketId(), details1, numbers1); PlayerDetails details2 = new PlayerDetails("bob@foo.bar", "1212-121212", "+34332322"); - LotteryNumbers numbers2 = LotteryNumbers.create(new HashSet<>(Arrays.asList(1, 2, 3, 4))); + LotteryNumbers numbers2 = LotteryNumbers.create(Set.of(1, 2, 3, 4)); LotteryTicket ticket2 = new LotteryTicket(new LotteryTicketId(), details2, numbers2); assertEquals(ticket1, ticket2); PlayerDetails details3 = new PlayerDetails("elsa@foo.bar", "1223-121212", "+49332322"); - LotteryNumbers numbers3 = LotteryNumbers.create(new HashSet<>(Arrays.asList(1, 2, 3, 8))); + LotteryNumbers numbers3 = LotteryNumbers.create(Set.of(1, 2, 3, 8)); LotteryTicket ticket3 = new LotteryTicket(new LotteryTicketId(), details3, numbers3); assertNotEquals(ticket1, ticket3); } diff --git a/hexagonal/src/test/java/com/iluwatar/hexagonal/test/LotteryTestUtils.java b/hexagonal/src/test/java/com/iluwatar/hexagonal/test/LotteryTestUtils.java index 2e67d2536a7e..4646aa2ff69d 100644 --- a/hexagonal/src/test/java/com/iluwatar/hexagonal/test/LotteryTestUtils.java +++ b/hexagonal/src/test/java/com/iluwatar/hexagonal/test/LotteryTestUtils.java @@ -43,7 +43,7 @@ public class LotteryTestUtils { * @return lottery ticket */ public static LotteryTicket createLotteryTicket() { - return createLotteryTicket("foo@bar.com", "12231-213132", "+99324554", new HashSet<>(Arrays.asList(1, 2, 3, 4))); + return createLotteryTicket("foo@bar.com", "12231-213132", "+99324554", Set.of(1, 2, 3, 4)); } /** diff --git a/iterator/src/main/java/com/iluwatar/iterator/list/TreasureChest.java b/iterator/src/main/java/com/iluwatar/iterator/list/TreasureChest.java index 9c6dbc64feb5..3fb93f5af804 100644 --- a/iterator/src/main/java/com/iluwatar/iterator/list/TreasureChest.java +++ b/iterator/src/main/java/com/iluwatar/iterator/list/TreasureChest.java @@ -40,17 +40,17 @@ public class TreasureChest { * Constructor */ public TreasureChest() { - items = new ArrayList<>(); - items.add(new Item(ItemType.POTION, "Potion of courage")); - items.add(new Item(ItemType.RING, "Ring of shadows")); - items.add(new Item(ItemType.POTION, "Potion of wisdom")); - items.add(new Item(ItemType.POTION, "Potion of blood")); - items.add(new Item(ItemType.WEAPON, "Sword of silver +1")); - items.add(new Item(ItemType.POTION, "Potion of rust")); - items.add(new Item(ItemType.POTION, "Potion of healing")); - items.add(new Item(ItemType.RING, "Ring of armor")); - items.add(new Item(ItemType.WEAPON, "Steel halberd")); - items.add(new Item(ItemType.WEAPON, "Dagger of poison")); + items = List.of( + new Item(ItemType.POTION, "Potion of courage"), + new Item(ItemType.RING, "Ring of shadows"), + new Item(ItemType.POTION, "Potion of wisdom"), + new Item(ItemType.POTION, "Potion of blood"), + new Item(ItemType.WEAPON, "Sword of silver +1"), + new Item(ItemType.POTION, "Potion of rust"), + new Item(ItemType.POTION, "Potion of healing"), + new Item(ItemType.RING, "Ring of armor"), + new Item(ItemType.WEAPON, "Steel halberd"), + new Item(ItemType.WEAPON, "Dagger of poison")); } public Iterator iterator(ItemType itemType) { diff --git a/iterator/src/test/java/com/iluwatar/iterator/list/TreasureChestTest.java b/iterator/src/test/java/com/iluwatar/iterator/list/TreasureChestTest.java index cac45c851c8f..350934590e51 100644 --- a/iterator/src/test/java/com/iluwatar/iterator/list/TreasureChestTest.java +++ b/iterator/src/test/java/com/iluwatar/iterator/list/TreasureChestTest.java @@ -28,7 +28,6 @@ import static org.junit.jupiter.api.Assertions.fail; import com.iluwatar.iterator.Iterator; -import java.util.ArrayList; import java.util.List; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -46,18 +45,18 @@ public class TreasureChestTest { * @return The set of all expected items in the chest */ public static List dataProvider() { - final List parameters = new ArrayList<>(); - parameters.add(new Object[]{new Item(ItemType.POTION, "Potion of courage")}); - parameters.add(new Object[]{new Item(ItemType.RING, "Ring of shadows")}); - parameters.add(new Object[]{new Item(ItemType.POTION, "Potion of wisdom")}); - parameters.add(new Object[]{new Item(ItemType.POTION, "Potion of blood")}); - parameters.add(new Object[]{new Item(ItemType.WEAPON, "Sword of silver +1")}); - parameters.add(new Object[]{new Item(ItemType.POTION, "Potion of rust")}); - parameters.add(new Object[]{new Item(ItemType.POTION, "Potion of healing")}); - parameters.add(new Object[]{new Item(ItemType.RING, "Ring of armor")}); - parameters.add(new Object[]{new Item(ItemType.WEAPON, "Steel halberd")}); - parameters.add(new Object[]{new Item(ItemType.WEAPON, "Dagger of poison")}); - return parameters; + return List.of( + new Object[]{new Item(ItemType.POTION, "Potion of courage")}, + new Object[]{new Item(ItemType.RING, "Ring of shadows")}, + new Object[]{new Item(ItemType.POTION, "Potion of wisdom")}, + new Object[]{new Item(ItemType.POTION, "Potion of blood")}, + new Object[]{new Item(ItemType.WEAPON, "Sword of silver +1")}, + new Object[]{new Item(ItemType.POTION, "Potion of rust")}, + new Object[]{new Item(ItemType.POTION, "Potion of healing")}, + new Object[]{new Item(ItemType.RING, "Ring of armor")}, + new Object[]{new Item(ItemType.WEAPON, "Steel halberd")}, + new Object[]{new Item(ItemType.WEAPON, "Dagger of poison")} + ); } /** diff --git a/layers/src/test/java/com/iluwatar/layers/CakeTest.java b/layers/src/test/java/com/iluwatar/layers/CakeTest.java index 28bbf02601c8..81bb6d1deec9 100644 --- a/layers/src/test/java/com/iluwatar/layers/CakeTest.java +++ b/layers/src/test/java/com/iluwatar/layers/CakeTest.java @@ -66,11 +66,10 @@ public void testSetLayers() { assertNotNull(cake.getLayers()); assertTrue(cake.getLayers().isEmpty()); - final Set expectedLayers = new HashSet<>(); - expectedLayers.add(new CakeLayer("layer1", 1000)); - expectedLayers.add(new CakeLayer("layer2", 2000)); - expectedLayers.add(new CakeLayer("layer3", 3000)); - + final Set expectedLayers = Set.of( + new CakeLayer("layer1", 1000), + new CakeLayer("layer2", 2000), + new CakeLayer("layer3", 3000)); cake.setLayers(expectedLayers); assertEquals(expectedLayers, cake.getLayers()); } @@ -111,7 +110,7 @@ public void testToString() { cake.setTopping(topping); cake.addLayer(layer); - final String expected = "id=1234 topping=id=2345 name=topping calories=20 " + final String expected = "id=1234 topping=id=2345 name=topping calories=20 " + "layers=[id=3456 name=layer calories=100]"; assertEquals(expected, cake.toString()); diff --git a/layers/src/test/java/com/iluwatar/layers/CakeViewImplTest.java b/layers/src/test/java/com/iluwatar/layers/CakeViewImplTest.java index 56feae2e092f..ec19b115ce45 100644 --- a/layers/src/test/java/com/iluwatar/layers/CakeViewImplTest.java +++ b/layers/src/test/java/com/iluwatar/layers/CakeViewImplTest.java @@ -31,7 +31,6 @@ import org.junit.jupiter.api.Test; import org.slf4j.LoggerFactory; -import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -64,14 +63,13 @@ public void tearDown() { @Test public void testRender() { - final List layers = new ArrayList<>(); - layers.add(new CakeLayerInfo("layer1", 1000)); - layers.add(new CakeLayerInfo("layer2", 2000)); - layers.add(new CakeLayerInfo("layer3", 3000)); + final List layers = List.of( + new CakeLayerInfo("layer1", 1000), + new CakeLayerInfo("layer2", 2000), + new CakeLayerInfo("layer3", 3000)); - final List cakes = new ArrayList<>(); final CakeInfo cake = new CakeInfo(new CakeToppingInfo("topping", 1000), layers); - cakes.add(cake); + final List cakes = List.of(cake); final CakeBakingService bakingService = mock(CakeBakingService.class); when(bakingService.getAllCakes()).thenReturn(cakes); diff --git a/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyMessageManagerTest.java b/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyMessageManagerTest.java index f099ed9466a0..524cf32170dc 100644 --- a/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyMessageManagerTest.java +++ b/leader-election/src/test/java/com/iluwatar/leaderelection/bully/BullyMessageManagerTest.java @@ -24,12 +24,9 @@ package com.iluwatar.leaderelection.bully; import com.iluwatar.leaderelection.*; -import com.iluwatar.leaderelection.ring.RingInstance; -import com.iluwatar.leaderelection.ring.RingMessageManager; import org.junit.jupiter.api.Test; import java.lang.reflect.Field; -import java.util.HashMap; import java.util.Map; import java.util.Queue; @@ -43,8 +40,7 @@ public class BullyMessageManagerTest { @Test public void testSendHeartbeatMessage() { Instance instance1 = new BullyInstance(null, 1, 1); - Map instanceMap = new HashMap<>(); - instanceMap.put(1, instance1); + Map instanceMap = Map.of(1, instance1); MessageManager messageManager = new BullyMessageManager(instanceMap); assertTrue(messageManager.sendHeartbeatMessage(1)); } @@ -56,11 +52,7 @@ public void testSendElectionMessageNotAccepted() { Instance instance2 = new BullyInstance(null, 1, 2); Instance instance3 = new BullyInstance(null, 1, 3); Instance instance4 = new BullyInstance(null, 1, 4); - Map instanceMap = new HashMap<>(); - instanceMap.put(1, instance1); - instanceMap.put(2, instance2); - instanceMap.put(3, instance3); - instanceMap.put(4, instance4); + Map instanceMap = Map.of(1, instance1, 2, instance2, 3, instance3, 4, instance4); instance1.setAlive(false); MessageManager messageManager = new BullyMessageManager(instanceMap); boolean result = messageManager.sendElectionMessage(3, "3"); @@ -84,11 +76,7 @@ public void testElectionMessageAccepted() { Instance instance2 = new BullyInstance(null, 1, 2); Instance instance3 = new BullyInstance(null, 1, 3); Instance instance4 = new BullyInstance(null, 1, 4); - Map instanceMap = new HashMap<>(); - instanceMap.put(1, instance1); - instanceMap.put(2, instance2); - instanceMap.put(3, instance3); - instanceMap.put(4, instance4); + Map instanceMap = Map.of(1, instance1, 2, instance2, 3, instance3, 4, instance4); instance1.setAlive(false); MessageManager messageManager = new BullyMessageManager(instanceMap); boolean result = messageManager.sendElectionMessage(2, "2"); @@ -102,11 +90,7 @@ public void testSendLeaderMessage() { Instance instance2 = new BullyInstance(null, 1, 2); Instance instance3 = new BullyInstance(null, 1, 3); Instance instance4 = new BullyInstance(null, 1, 4); - Map instanceMap = new HashMap<>(); - instanceMap.put(1, instance1); - instanceMap.put(2, instance2); - instanceMap.put(3, instance3); - instanceMap.put(4, instance4); + Map instanceMap = Map.of(1, instance1, 2, instance2, 3, instance3, 4, instance4); instance1.setAlive(false); MessageManager messageManager = new BullyMessageManager(instanceMap); messageManager.sendLeaderMessage(2, 2); @@ -129,10 +113,7 @@ public void testSendHeartbeatInvokeMessage() { Instance instance1 = new BullyInstance(null, 1, 1); Instance instance2 = new BullyInstance(null, 1, 2); Instance instance3 = new BullyInstance(null, 1, 3); - Map instanceMap = new HashMap<>(); - instanceMap.put(1, instance1); - instanceMap.put(2, instance2); - instanceMap.put(3, instance3); + Map instanceMap = Map.of(1, instance1, 2, instance2, 3, instance3); MessageManager messageManager = new BullyMessageManager(instanceMap); messageManager.sendHeartbeatInvokeMessage(2); Message message = new Message(MessageType.HEARTBEAT_INVOKE, ""); diff --git a/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingMessageManagerTest.java b/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingMessageManagerTest.java index 82a5a5936f59..d8429f02b05f 100644 --- a/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingMessageManagerTest.java +++ b/leader-election/src/test/java/com/iluwatar/leaderelection/ring/RingMessageManagerTest.java @@ -27,7 +27,6 @@ import org.junit.jupiter.api.Test; import java.lang.reflect.Field; -import java.util.HashMap; import java.util.Map; import java.util.Queue; @@ -41,8 +40,7 @@ public class RingMessageManagerTest { @Test public void testSendHeartbeatMessage() { Instance instance1 = new RingInstance(null, 1, 1); - Map instanceMap = new HashMap<>(); - instanceMap.put(1, instance1); + Map instanceMap = Map.of(1, instance1); MessageManager messageManager = new RingMessageManager(instanceMap); assertTrue(messageManager.sendHeartbeatMessage(1)); } @@ -53,10 +51,7 @@ public void testSendElectionMessage() { Instance instance1 = new RingInstance(null, 1, 1); Instance instance2 = new RingInstance(null, 1, 2); Instance instance3 = new RingInstance(null, 1, 3); - Map instanceMap = new HashMap<>(); - instanceMap.put(1, instance1); - instanceMap.put(2, instance2); - instanceMap.put(3, instance3); + Map instanceMap = Map.of(1, instance1, 2, instance2, 3, instance3); MessageManager messageManager = new RingMessageManager(instanceMap); String messageContent = "2"; messageManager.sendElectionMessage(2, messageContent); @@ -78,10 +73,7 @@ public void testSendLeaderMessage() { Instance instance1 = new RingInstance(null, 1, 1); Instance instance2 = new RingInstance(null, 1, 2); Instance instance3 = new RingInstance(null, 1, 3); - Map instanceMap = new HashMap<>(); - instanceMap.put(1, instance1); - instanceMap.put(2, instance2); - instanceMap.put(3, instance3); + Map instanceMap = Map.of(1, instance1, 2, instance2, 3, instance3); MessageManager messageManager = new RingMessageManager(instanceMap); String messageContent = "3"; messageManager.sendLeaderMessage(2, 3); @@ -102,10 +94,7 @@ public void testSendHeartbeatInvokeMessage() { Instance instance1 = new RingInstance(null, 1, 1); Instance instance2 = new RingInstance(null, 1, 2); Instance instance3 = new RingInstance(null, 1, 3); - Map instanceMap = new HashMap<>(); - instanceMap.put(1, instance1); - instanceMap.put(2, instance2); - instanceMap.put(3, instance3); + Map instanceMap = Map.of(1, instance1, 2, instance2, 3, instance3); MessageManager messageManager = new RingMessageManager(instanceMap); messageManager.sendHeartbeatInvokeMessage(2); Message ringMessage = new Message(MessageType.HEARTBEAT_INVOKE, ""); From c8a481bb77ddfb725ae138110ad6e5cd301a5291 Mon Sep 17 00:00:00 2001 From: Leon Mak Date: Tue, 29 Oct 2019 14:37:40 +0800 Subject: [PATCH 105/197] Add java 11 support for #987 (o-t) (#1051) * Use java 11 * Use .of - Replace Arrays.asList with List.of - Replace HashSet<>(List.of()) with Set.of * Formatting --- .../AbstractDocumentTest.java | 1 - .../iluwatar/abstractdocument/DomainTest.java | 3 +- .../com/iluwatar/collectionpipeline/App.java | 13 ++++---- .../collectionpipeline/CarFactory.java | 3 +- .../java/com/iluwatar/commander/Service.java | 2 +- .../com/iluwatar/commander/RetryTest.java | 4 +-- .../com/iluwatar/fluentinterface/app/App.java | 15 ++++----- .../fluentiterable/FluentIterableTest.java | 31 +++++++----------- .../hexagonal/domain/LotteryNumbersTest.java | 22 ++++--------- .../hexagonal/domain/LotteryTest.java | 4 +-- .../hexagonal/domain/LotteryTicketTest.java | 2 -- .../hexagonal/test/LotteryTestUtils.java | 6 ++-- .../main/java/com/iluwatar/layers/App.java | 12 ++++--- .../layers/CakeBakingServiceImplTest.java | 15 +++------ .../iluwatar/mediator/PartyMemberTest.java | 3 +- .../scenarios/RecreateSimpleObjects.java | 15 ++++----- .../object/pool/OliphauntPoolTest.java | 9 ++---- .../com/iluwatar/observer/HobbitsTest.java | 12 +++---- .../java/com/iluwatar/observer/OrcsTest.java | 12 +++---- .../observer/generic/GHobbitsTest.java | 13 ++++---- .../iluwatar/observer/generic/OrcsTest.java | 13 ++++---- .../com/iluwatar/partialresponse/App.java | 12 ++++--- .../partialresponse/VideoResourceTest.java | 12 ++++--- .../com/iluwatar/prototype/PrototypeTest.java | 9 ++---- .../AnnotationBasedRepositoryTest.java | 19 ++++------- .../iluwatar/repository/RepositoryTest.java | 19 ++++------- .../java/com/iluwatar/retry/FindCustomer.java | 4 +-- .../main/java/com/iluwatar/servant/App.java | 5 +-- .../com/iluwatar/servant/ServantTest.java | 11 ++----- .../magic/MagicServiceImplTest.java | 18 +++++------ .../com/iluwatar/specification/app/App.java | 18 +++-------- .../specification/creature/CreatureTest.java | 10 +++--- .../strategy/DragonSlayingStrategyTest.java | 27 ++++++++-------- .../java/com/iluwatar/threadpool/App.java | 32 +++++++++---------- .../iluwatar/tls/DateFormatCallableTest.java | 9 +++--- ...FormatCallableTestIncorrectDateFormat.java | 9 +++--- .../DateFormatCallableTestMultiThread.java | 9 +++--- 37 files changed, 176 insertions(+), 257 deletions(-) diff --git a/abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java b/abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java index 0514c750aa77..da576539102a 100644 --- a/abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java +++ b/abstract-document/src/test/java/com/iluwatar/abstractdocument/AbstractDocumentTest.java @@ -25,7 +25,6 @@ import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java b/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java index 663071f6a0a7..eed4ad9bb94e 100644 --- a/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java +++ b/abstract-document/src/test/java/com/iluwatar/abstractdocument/DomainTest.java @@ -28,7 +28,6 @@ import com.iluwatar.abstractdocument.domain.enums.Property; import org.junit.jupiter.api.Test; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -64,7 +63,7 @@ public void shouldConstructCar() { Map carProperties = Map.of( Property.MODEL.toString(), TEST_CAR_MODEL, Property.PRICE.toString(), TEST_CAR_PRICE, - Property.PARTS.toString(), List.of(new HashMap<>(), new HashMap<>())); + Property.PARTS.toString(), List.of(Map.of(), Map.of())); Car car = new Car(carProperties); assertEquals(TEST_CAR_MODEL, car.getModel().get()); diff --git a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/App.java b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/App.java index 3a811f0e0806..de19a3b15508 100644 --- a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/App.java +++ b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/App.java @@ -23,13 +23,12 @@ package com.iluwatar.collectionpipeline; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.List; +import java.util.Map; + /** * In imperative-style programming, it is common to use for and while loops for * most kinds of data processing. Function composition is a simple technique @@ -67,11 +66,11 @@ public static void main(String[] args) { LOGGER.info(groupingByCategoryFunctional.toString()); Person john = new Person(cars); - - List sedansOwnedImperative = ImperativeProgramming.getSedanCarsOwnedSortedByDate(Arrays.asList(john)); + + List sedansOwnedImperative = ImperativeProgramming.getSedanCarsOwnedSortedByDate(List.of(john)); LOGGER.info(sedansOwnedImperative.toString()); - List sedansOwnedFunctional = FunctionalProgramming.getSedanCarsOwnedSortedByDate(Arrays.asList(john)); + List sedansOwnedFunctional = FunctionalProgramming.getSedanCarsOwnedSortedByDate(List.of(john)); LOGGER.info(sedansOwnedFunctional.toString()); } } diff --git a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/CarFactory.java b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/CarFactory.java index 6e4531f5fb0a..aee1e21932df 100644 --- a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/CarFactory.java +++ b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/CarFactory.java @@ -23,7 +23,6 @@ package com.iluwatar.collectionpipeline; -import java.util.Arrays; import java.util.List; /** @@ -38,7 +37,7 @@ private CarFactory() { * @return {@link List} of {@link Car} */ public static List createCars() { - return Arrays.asList(new Car("Jeep", "Wrangler", 2011, Category.JEEP), + return List.of(new Car("Jeep", "Wrangler", 2011, Category.JEEP), new Car("Jeep", "Comanche", 1990, Category.JEEP), new Car("Dodge", "Avenger", 2010, Category.SEDAN), new Car("Buick", "Cascada", 2016, Category.CONVERTIBLE), diff --git a/commander/src/main/java/com/iluwatar/commander/Service.java b/commander/src/main/java/com/iluwatar/commander/Service.java index 2e293520b87b..64af79053459 100644 --- a/commander/src/main/java/com/iluwatar/commander/Service.java +++ b/commander/src/main/java/com/iluwatar/commander/Service.java @@ -43,7 +43,7 @@ public abstract class Service { public ArrayList exceptionsList; private static final Random RANDOM = new Random(); private static final String ALL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; - private static final Hashtable USED_IDS = new Hashtable(); + private static final Hashtable USED_IDS = new Hashtable<>(); protected Service(Database db, Exception...exc) { this.database = db; diff --git a/commander/src/test/java/com/iluwatar/commander/RetryTest.java b/commander/src/test/java/com/iluwatar/commander/RetryTest.java index c4ee5caf7964..749b2619cbac 100644 --- a/commander/src/test/java/com/iluwatar/commander/RetryTest.java +++ b/commander/src/test/java/com/iluwatar/commander/RetryTest.java @@ -45,9 +45,9 @@ void performTest() { Retry.HandleErrorIssue handleError = (o,e) -> { return; }; - Retry r1 = new Retry(op, handleError, 3, 30000, + Retry r1 = new Retry<>(op, handleError, 3, 30000, e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); - Retry r2 = new Retry(op, handleError, 3, 30000, + Retry r2 = new Retry<>(op, handleError, 3, 30000, e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); diff --git a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/app/App.java b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/app/App.java index 597f9d928f75..36766a568003 100644 --- a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/app/App.java +++ b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/app/App.java @@ -23,21 +23,20 @@ package com.iluwatar.fluentinterface.app; -import static java.lang.String.valueOf; +import com.iluwatar.fluentinterface.fluentiterable.FluentIterable; +import com.iluwatar.fluentinterface.fluentiterable.lazy.LazyFluentIterable; +import com.iluwatar.fluentinterface.fluentiterable.simple.SimpleFluentIterable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.StringJoiner; import java.util.function.Function; import java.util.function.Predicate; -import com.iluwatar.fluentinterface.fluentiterable.FluentIterable; -import com.iluwatar.fluentinterface.fluentiterable.lazy.LazyFluentIterable; -import com.iluwatar.fluentinterface.fluentiterable.simple.SimpleFluentIterable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import static java.lang.String.valueOf; /** * The Fluent Interface pattern is useful when you want to provide an easy readable, flowing API. @@ -61,7 +60,7 @@ public class App { public static void main(String[] args) { List integerList = new ArrayList<>(); - integerList.addAll(Arrays.asList(1, -61, 14, -22, 18, -87, 6, 64, -82, 26, -98, 97, 45, 23, 2, + integerList.addAll(List.of(1, -61, 14, -22, 18, -87, 6, 64, -82, 26, -98, 97, 45, 23, 2, -68, 45)); prettyPrint("The initial list contains: ", integerList); diff --git a/fluentinterface/src/test/java/com/iluwatar/fluentinterface/fluentiterable/FluentIterableTest.java b/fluentinterface/src/test/java/com/iluwatar/fluentinterface/fluentiterable/FluentIterableTest.java index cfe52be7f1e5..4ee30d3e5734 100644 --- a/fluentinterface/src/test/java/com/iluwatar/fluentinterface/fluentiterable/FluentIterableTest.java +++ b/fluentinterface/src/test/java/com/iluwatar/fluentinterface/fluentiterable/FluentIterableTest.java @@ -25,21 +25,14 @@ import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.Spliterator; import java.util.function.Consumer; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; /** * Date: 12/12/15 - 7:00 PM @@ -58,7 +51,7 @@ public abstract class FluentIterableTest { @Test public void testFirst() throws Exception { - final List integers = Arrays.asList(1, 2, 3, 10, 9, 8); + final List integers = List.of(1, 2, 3, 10, 9, 8); final Optional first = createFluentIterable(integers).first(); assertNotNull(first); assertTrue(first.isPresent()); @@ -75,7 +68,7 @@ public void testFirstEmptyCollection() throws Exception { @Test public void testFirstCount() throws Exception { - final List integers = Arrays.asList(1, 2, 3, 10, 9, 8); + final List integers = List.of(1, 2, 3, 10, 9, 8); final List first4 = createFluentIterable(integers) .first(4) .asList(); @@ -91,7 +84,7 @@ public void testFirstCount() throws Exception { @Test public void testFirstCountLessItems() throws Exception { - final List integers = Arrays.asList(1, 2, 3); + final List integers = List.of(1, 2, 3); final List first4 = createFluentIterable(integers) .first(4) .asList(); @@ -106,7 +99,7 @@ public void testFirstCountLessItems() throws Exception { @Test public void testLast() throws Exception { - final List integers = Arrays.asList(1, 2, 3, 10, 9, 8); + final List integers = List.of(1, 2, 3, 10, 9, 8); final Optional last = createFluentIterable(integers).last(); assertNotNull(last); assertTrue(last.isPresent()); @@ -123,7 +116,7 @@ public void testLastEmptyCollection() throws Exception { @Test public void testLastCount() throws Exception { - final List integers = Arrays.asList(1, 2, 3, 10, 9, 8); + final List integers = List.of(1, 2, 3, 10, 9, 8); final List last4 = createFluentIterable(integers) .last(4) .asList(); @@ -138,7 +131,7 @@ public void testLastCount() throws Exception { @Test public void testLastCountLessItems() throws Exception { - final List integers = Arrays.asList(1, 2, 3); + final List integers = List.of(1, 2, 3); final List last4 = createFluentIterable(integers) .last(4) .asList(); @@ -153,7 +146,7 @@ public void testLastCountLessItems() throws Exception { @Test public void testFilter() throws Exception { - final List integers = Arrays.asList(1, 2, 3, 10, 9, 8); + final List integers = List.of(1, 2, 3, 10, 9, 8); final List evenItems = createFluentIterable(integers) .filter(i -> i % 2 == 0) .asList(); @@ -167,7 +160,7 @@ public void testFilter() throws Exception { @Test public void testMap() throws Exception { - final List integers = Arrays.asList(1, 2, 3); + final List integers = List.of(1, 2, 3); final List longs = createFluentIterable(integers) .map(Integer::longValue) .asList(); @@ -181,7 +174,7 @@ public void testMap() throws Exception { @Test public void testForEach() { - final List integers = Arrays.asList(1, 2, 3); + final List integers = List.of(1, 2, 3); final Consumer consumer = mock(Consumer.class); createFluentIterable(integers).forEach(consumer); @@ -195,7 +188,7 @@ public void testForEach() { @Test public void testSpliterator() throws Exception { - final List integers = Arrays.asList(1, 2, 3); + final List integers = List.of(1, 2, 3); final Spliterator split = createFluentIterable(integers).spliterator(); assertNotNull(split); } diff --git a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryNumbersTest.java b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryNumbersTest.java index 1812263899b7..c17c5c1fdc39 100644 --- a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryNumbersTest.java +++ b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryNumbersTest.java @@ -25,14 +25,9 @@ import org.junit.jupiter.api.Test; -import java.util.Arrays; -import java.util.HashSet; import java.util.Set; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * @@ -43,8 +38,7 @@ class LotteryNumbersTest { @Test void testGivenNumbers() { - LotteryNumbers numbers = LotteryNumbers.create( - Set.of(1, 2, 3, 4)); + LotteryNumbers numbers = LotteryNumbers.create(Set.of(1, 2, 3, 4)); assertEquals(numbers.getNumbers().size(), 4); assertTrue(numbers.getNumbers().contains(1)); assertTrue(numbers.getNumbers().contains(2)); @@ -54,8 +48,7 @@ void testGivenNumbers() { @Test void testNumbersCantBeModified() { - LotteryNumbers numbers = LotteryNumbers.create( - Set.of(1, 2, 3, 4)); + LotteryNumbers numbers = LotteryNumbers.create(Set.of(1, 2, 3, 4)); assertThrows(UnsupportedOperationException.class, () -> numbers.getNumbers().add(5)); } @@ -67,13 +60,10 @@ void testRandomNumbers() { @Test void testEquals() { - LotteryNumbers numbers1 = LotteryNumbers.create( - Set.of(1, 2, 3, 4)); - LotteryNumbers numbers2 = LotteryNumbers.create( - Set.of(1, 2, 3, 4)); + LotteryNumbers numbers1 = LotteryNumbers.create(Set.of(1, 2, 3, 4)); + LotteryNumbers numbers2 = LotteryNumbers.create(Set.of(1, 2, 3, 4)); assertEquals(numbers1, numbers2); - LotteryNumbers numbers3 = LotteryNumbers.create( - Set.of(11, 12, 13, 14)); + LotteryNumbers numbers3 = LotteryNumbers.create(Set.of(11, 12, 13, 14)); assertNotEquals(numbers1, numbers3); } } diff --git a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTest.java b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTest.java index a62adaff870a..927e2fcd19a9 100644 --- a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTest.java +++ b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTest.java @@ -35,9 +35,7 @@ import java.util.*; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * diff --git a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTicketTest.java b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTicketTest.java index 0e81a163b844..6d2e371c4bd0 100644 --- a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTicketTest.java +++ b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTicketTest.java @@ -25,8 +25,6 @@ import org.junit.jupiter.api.Test; -import java.util.Arrays; -import java.util.HashSet; import java.util.Set; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hexagonal/src/test/java/com/iluwatar/hexagonal/test/LotteryTestUtils.java b/hexagonal/src/test/java/com/iluwatar/hexagonal/test/LotteryTestUtils.java index 4646aa2ff69d..2f02ca34e9f2 100644 --- a/hexagonal/src/test/java/com/iluwatar/hexagonal/test/LotteryTestUtils.java +++ b/hexagonal/src/test/java/com/iluwatar/hexagonal/test/LotteryTestUtils.java @@ -23,15 +23,13 @@ package com.iluwatar.hexagonal.test; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - import com.iluwatar.hexagonal.domain.LotteryNumbers; import com.iluwatar.hexagonal.domain.LotteryTicket; import com.iluwatar.hexagonal.domain.LotteryTicketId; import com.iluwatar.hexagonal.domain.PlayerDetails; +import java.util.Set; + /** * * Utilities for lottery tests diff --git a/layers/src/main/java/com/iluwatar/layers/App.java b/layers/src/main/java/com/iluwatar/layers/App.java index 744c82768212..a4e0a4ab20fe 100644 --- a/layers/src/main/java/com/iluwatar/layers/App.java +++ b/layers/src/main/java/com/iluwatar/layers/App.java @@ -23,7 +23,7 @@ package com.iluwatar.layers; -import java.util.Arrays; +import java.util.List; /** * @@ -99,16 +99,18 @@ private static void initializeData(CakeBakingService cakeBakingService) { cakeBakingService.saveNewTopping(new CakeToppingInfo("cherry", 350)); CakeInfo cake1 = - new CakeInfo(new CakeToppingInfo("candies", 0), Arrays.asList(new CakeLayerInfo( - "chocolate", 0), new CakeLayerInfo("banana", 0), new CakeLayerInfo("strawberry", 0))); + new CakeInfo(new CakeToppingInfo("candies", 0), List.of( + new CakeLayerInfo("chocolate", 0), + new CakeLayerInfo("banana", 0), + new CakeLayerInfo("strawberry", 0))); try { cakeBakingService.bakeNewCake(cake1); } catch (CakeBakingException e) { e.printStackTrace(); } CakeInfo cake2 = - new CakeInfo(new CakeToppingInfo("cherry", 0), Arrays.asList( - new CakeLayerInfo("vanilla", 0), new CakeLayerInfo("lemon", 0), new CakeLayerInfo( + new CakeInfo(new CakeToppingInfo("cherry", 0), List.of( + new CakeLayerInfo("vanilla", 0), new CakeLayerInfo("lemon", 0), new CakeLayerInfo( "strawberry", 0))); try { cakeBakingService.bakeNewCake(cake2); diff --git a/layers/src/test/java/com/iluwatar/layers/CakeBakingServiceImplTest.java b/layers/src/test/java/com/iluwatar/layers/CakeBakingServiceImplTest.java index 681b37e05870..21f3623298fb 100644 --- a/layers/src/test/java/com/iluwatar/layers/CakeBakingServiceImplTest.java +++ b/layers/src/test/java/com/iluwatar/layers/CakeBakingServiceImplTest.java @@ -25,15 +25,10 @@ import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.Collections; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * Date: 12/15/15 - 9:55 PM @@ -108,7 +103,7 @@ public void testBakeCakes() throws CakeBakingException { service.saveNewLayer(layer2); service.saveNewLayer(layer3); - service.bakeNewCake(new CakeInfo(topping1, Arrays.asList(layer1, layer2))); + service.bakeNewCake(new CakeInfo(topping1, List.of(layer1, layer2))); service.bakeNewCake(new CakeInfo(topping2, Collections.singletonList(layer3))); final List allCakes = service.getAllCakes(); @@ -136,7 +131,7 @@ public void testBakeCakeMissingTopping() { final CakeToppingInfo missingTopping = new CakeToppingInfo("Topping1", 1000); assertThrows(CakeBakingException.class, () -> { - service.bakeNewCake(new CakeInfo(missingTopping, Arrays.asList(layer1, layer2))); + service.bakeNewCake(new CakeInfo(missingTopping, List.of(layer1, layer2))); }); } @@ -156,7 +151,7 @@ public void testBakeCakeMissingLayer() { final CakeLayerInfo missingLayer = new CakeLayerInfo("Layer2", 2000); assertThrows(CakeBakingException.class, () -> { - service.bakeNewCake(new CakeInfo(topping1, Arrays.asList(layer1, missingLayer))); + service.bakeNewCake(new CakeInfo(topping1, List.of(layer1, missingLayer))); }); } @@ -178,7 +173,7 @@ public void testBakeCakesUsedLayer() throws CakeBakingException { service.saveNewLayer(layer1); service.saveNewLayer(layer2); - service.bakeNewCake(new CakeInfo(topping1, Arrays.asList(layer1, layer2))); + service.bakeNewCake(new CakeInfo(topping1, List.of(layer1, layer2))); assertThrows(CakeBakingException.class, () -> { service.bakeNewCake(new CakeInfo(topping2, Collections.singletonList(layer2))); }); diff --git a/mediator/src/test/java/com/iluwatar/mediator/PartyMemberTest.java b/mediator/src/test/java/com/iluwatar/mediator/PartyMemberTest.java index b7092347b840..951f8e166c89 100644 --- a/mediator/src/test/java/com/iluwatar/mediator/PartyMemberTest.java +++ b/mediator/src/test/java/com/iluwatar/mediator/PartyMemberTest.java @@ -32,7 +32,6 @@ import org.junit.jupiter.params.provider.MethodSource; import org.slf4j.LoggerFactory; -import java.util.Arrays; import java.util.Collection; import java.util.LinkedList; import java.util.List; @@ -50,7 +49,7 @@ public class PartyMemberTest { static Collection[]> dataProvider() { - return Arrays.asList( + return List.of( new Supplier[]{Hobbit::new}, new Supplier[]{Hunter::new}, new Supplier[]{Rogue::new}, diff --git a/naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java b/naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java index 2c201ead22e6..303dfda4fa13 100644 --- a/naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java +++ b/naked-objects/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java @@ -23,17 +23,14 @@ package domainapp.fixture.scenarios; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - import com.google.common.collect.Lists; - -import org.apache.isis.applib.fixturescripts.FixtureScript; - import domainapp.dom.modules.simple.SimpleObject; import domainapp.fixture.modules.simple.SimpleObjectCreate; import domainapp.fixture.modules.simple.SimpleObjectsTearDown; +import org.apache.isis.applib.fixturescripts.FixtureScript; + +import java.util.Collections; +import java.util.List; /** @@ -41,8 +38,8 @@ */ public class RecreateSimpleObjects extends FixtureScript { - public final List names = Collections.unmodifiableList(Arrays.asList("Foo", "Bar", "Baz", - "Frodo", "Froyo", "Fizz", "Bip", "Bop", "Bang", "Boo")); + public final List names = Collections.unmodifiableList(List.of("Foo", "Bar", "Baz", + "Frodo", "Froyo", "Fizz", "Bip", "Bop", "Bang", "Boo")); // region > number (optional input) private Integer number; diff --git a/object-pool/src/test/java/com/iluwatar/object/pool/OliphauntPoolTest.java b/object-pool/src/test/java/com/iluwatar/object/pool/OliphauntPoolTest.java index b946f80981d7..d4ca42948b81 100644 --- a/object-pool/src/test/java/com/iluwatar/object/pool/OliphauntPoolTest.java +++ b/object-pool/src/test/java/com/iluwatar/object/pool/OliphauntPoolTest.java @@ -25,15 +25,10 @@ import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.List; import static java.time.Duration.ofMillis; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTimeout; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * Date: 12/27/15 - 1:05 AM @@ -115,7 +110,7 @@ public void testConcurrentCheckinCheckout() { // The order of the returned instances is not determined, so just put them in a list // and verify if both expected instances are in there. - final List oliphaunts = Arrays.asList(pool.checkOut(), pool.checkOut()); + final List oliphaunts = List.of(pool.checkOut(), pool.checkOut()); assertEquals(pool.toString(), "Pool available=0 inUse=2"); assertTrue(oliphaunts.contains(firstOliphaunt)); assertTrue(oliphaunts.contains(secondOliphaunt)); diff --git a/observer/src/test/java/com/iluwatar/observer/HobbitsTest.java b/observer/src/test/java/com/iluwatar/observer/HobbitsTest.java index c43c592da611..66ec45fdb62e 100644 --- a/observer/src/test/java/com/iluwatar/observer/HobbitsTest.java +++ b/observer/src/test/java/com/iluwatar/observer/HobbitsTest.java @@ -23,7 +23,6 @@ package com.iluwatar.observer; -import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -36,12 +35,11 @@ public class HobbitsTest extends WeatherObserverTest { @Override public Collection dataProvider() { - final List testData = new ArrayList<>(); - testData.add(new Object[]{WeatherType.SUNNY, "The happy hobbits bade in the warm sun."}); - testData.add(new Object[]{WeatherType.RAINY, "The hobbits look for cover from the rain."}); - testData.add(new Object[]{WeatherType.WINDY, "The hobbits hold their hats tightly in the windy weather."}); - testData.add(new Object[]{WeatherType.COLD, "The hobbits are shivering in the cold weather."}); - return testData; + return List.of( + new Object[]{WeatherType.SUNNY, "The happy hobbits bade in the warm sun."}, + new Object[]{WeatherType.RAINY, "The hobbits look for cover from the rain."}, + new Object[]{WeatherType.WINDY, "The hobbits hold their hats tightly in the windy weather."}, + new Object[]{WeatherType.COLD, "The hobbits are shivering in the cold weather."}); } /** diff --git a/observer/src/test/java/com/iluwatar/observer/OrcsTest.java b/observer/src/test/java/com/iluwatar/observer/OrcsTest.java index b2c0fcbaca10..ff615df3c94e 100644 --- a/observer/src/test/java/com/iluwatar/observer/OrcsTest.java +++ b/observer/src/test/java/com/iluwatar/observer/OrcsTest.java @@ -23,7 +23,6 @@ package com.iluwatar.observer; -import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -36,12 +35,11 @@ public class OrcsTest extends WeatherObserverTest { @Override public Collection dataProvider() { - final List testData = new ArrayList<>(); - testData.add(new Object[]{WeatherType.SUNNY, "The sun hurts the orcs' eyes."}); - testData.add(new Object[]{WeatherType.RAINY, "The orcs are dripping wet."}); - testData.add(new Object[]{WeatherType.WINDY, "The orc smell almost vanishes in the wind."}); - testData.add(new Object[]{WeatherType.COLD, "The orcs are freezing cold."}); - return testData; + return List.of( + new Object[]{WeatherType.SUNNY, "The sun hurts the orcs' eyes."}, + new Object[]{WeatherType.RAINY, "The orcs are dripping wet."}, + new Object[]{WeatherType.WINDY, "The orc smell almost vanishes in the wind."}, + new Object[]{WeatherType.COLD, "The orcs are freezing cold."}); } /** diff --git a/observer/src/test/java/com/iluwatar/observer/generic/GHobbitsTest.java b/observer/src/test/java/com/iluwatar/observer/generic/GHobbitsTest.java index 93e68a9f1ac1..dd0e6d6bf5f4 100644 --- a/observer/src/test/java/com/iluwatar/observer/generic/GHobbitsTest.java +++ b/observer/src/test/java/com/iluwatar/observer/generic/GHobbitsTest.java @@ -25,7 +25,6 @@ import com.iluwatar.observer.WeatherType; -import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -38,12 +37,12 @@ public class GHobbitsTest extends ObserverTest { @Override public Collection dataProvider() { - final List testData = new ArrayList<>(); - testData.add(new Object[]{WeatherType.SUNNY, "The happy hobbits bade in the warm sun."}); - testData.add(new Object[]{WeatherType.RAINY, "The hobbits look for cover from the rain."}); - testData.add(new Object[]{WeatherType.WINDY, "The hobbits hold their hats tightly in the windy weather."}); - testData.add(new Object[]{WeatherType.COLD, "The hobbits are shivering in the cold weather."}); - return testData; + return List.of( + new Object[]{WeatherType.SUNNY, "The happy hobbits bade in the warm sun."}, + new Object[]{WeatherType.RAINY, "The hobbits look for cover from the rain."}, + new Object[]{WeatherType.WINDY, "The hobbits hold their hats tightly in the windy weather."}, + new Object[]{WeatherType.COLD, "The hobbits are shivering in the cold weather."} + ); } /** diff --git a/observer/src/test/java/com/iluwatar/observer/generic/OrcsTest.java b/observer/src/test/java/com/iluwatar/observer/generic/OrcsTest.java index b73b105199cc..396de445669f 100644 --- a/observer/src/test/java/com/iluwatar/observer/generic/OrcsTest.java +++ b/observer/src/test/java/com/iluwatar/observer/generic/OrcsTest.java @@ -25,7 +25,6 @@ import com.iluwatar.observer.WeatherType; -import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -38,12 +37,12 @@ public class OrcsTest extends ObserverTest { @Override public Collection dataProvider() { - final List testData = new ArrayList<>(); - testData.add(new Object[]{WeatherType.SUNNY, "The sun hurts the orcs' eyes."}); - testData.add(new Object[]{WeatherType.RAINY, "The orcs are dripping wet."}); - testData.add(new Object[]{WeatherType.WINDY, "The orc smell almost vanishes in the wind."}); - testData.add(new Object[]{WeatherType.COLD, "The orcs are freezing cold."}); - return testData; + return List.of( + new Object[]{WeatherType.SUNNY, "The sun hurts the orcs' eyes."}, + new Object[]{WeatherType.RAINY, "The orcs are dripping wet."}, + new Object[]{WeatherType.WINDY, "The orc smell almost vanishes in the wind."}, + new Object[]{WeatherType.COLD, "The orcs are freezing cold."} + ); } /** diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/App.java b/partial-response/src/main/java/com/iluwatar/partialresponse/App.java index 05aa660880c1..314846a3dbe5 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/App.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/App.java @@ -26,7 +26,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.HashMap; import java.util.Map; /** @@ -47,10 +46,13 @@ public class App { * @param args program argument. */ public static void main(String[] args) throws Exception { - Map videos = new HashMap<>(); - videos.put(1, new Video(1, "Avatar", 178, "epic science fiction film", "James Cameron", "English")); - videos.put(2, new Video(2, "Godzilla Resurgence", 120, "Action & drama movie|", "Hideaki Anno", "Japanese")); - videos.put(3, new Video(3, "Interstellar", 169, "Adventure & Sci-Fi", "Christopher Nolan", "English")); + Map videos = Map.of( + 1, new Video(1, "Avatar", 178, "epic science fiction film", + "James Cameron", "English"), + 2, new Video(2, "Godzilla Resurgence", 120, "Action & drama movie|", + "Hideaki Anno", "Japanese"), + 3, new Video(3, "Interstellar", 169, "Adventure & Sci-Fi", + "Christopher Nolan", "English")); VideoResource videoResource = new VideoResource(new FieldJsonMapper(), videos); diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java index c28613f4a8c7..85f240fa03db 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java @@ -29,7 +29,6 @@ import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import java.util.HashMap; import java.util.Map; import static org.junit.Assert.assertEquals; @@ -49,10 +48,13 @@ public class VideoResourceTest { @Before public void setUp() { - Map videos = new HashMap<>(); - videos.put(1, new Video(1, "Avatar", 178, "epic science fiction film", "James Cameron", "English")); - videos.put(2, new Video(2, "Godzilla Resurgence", 120, "Action & drama movie|", "Hideaki Anno", "Japanese")); - videos.put(3, new Video(3, "Interstellar", 169, "Adventure & Sci-Fi", "Christopher Nolan", "English")); + Map videos = Map.of( + 1, new Video(1, "Avatar", 178, "epic science fiction film", + "James Cameron", "English"), + 2, new Video(2, "Godzilla Resurgence", 120, "Action & drama movie|", + "Hideaki Anno", "Japanese"), + 3, new Video(3, "Interstellar", 169, "Adventure & Sci-Fi", + "Christopher Nolan", "English")); resource = new VideoResource(fieldJsonMapper, videos); } diff --git a/prototype/src/test/java/com/iluwatar/prototype/PrototypeTest.java b/prototype/src/test/java/com/iluwatar/prototype/PrototypeTest.java index 8fbd80294b4c..e4dd0658a0d8 100644 --- a/prototype/src/test/java/com/iluwatar/prototype/PrototypeTest.java +++ b/prototype/src/test/java/com/iluwatar/prototype/PrototypeTest.java @@ -26,13 +26,10 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import java.util.Arrays; import java.util.Collection; +import java.util.List; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.*; /** * Date: 12/28/15 - 8:45 PM @@ -41,7 +38,7 @@ */ public class PrototypeTest

    { static Collection dataProvider() { - return Arrays.asList( + return List.of( new Object[]{new OrcBeast("axe"), "Orcish wolf attacks with axe"}, new Object[]{new OrcMage("sword"), "Orcish mage attacks with sword"}, new Object[]{new OrcWarlord("laser"), "Orcish warlord attacks with laser"}, diff --git a/repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java b/repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java index 6e53713233a1..3b0bff608327 100644 --- a/repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java +++ b/repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java @@ -23,16 +23,7 @@ package com.iluwatar.repository; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.util.Arrays; -import java.util.List; -import java.util.Optional; - -import javax.annotation.Resource; - +import com.google.common.collect.Lists; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -40,7 +31,11 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; -import com.google.common.collect.Lists; +import javax.annotation.Resource; +import java.util.List; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.*; /** * Test case to test the functions of {@link PersonRepository}, beside the CRUD functions, the query @@ -59,7 +54,7 @@ public class AnnotationBasedRepositoryTest { Person john = new Person("John", "lawrence", 35); Person terry = new Person("Terry", "Law", 36); - List persons = Arrays.asList(peter, nasta, john, terry); + List persons = List.of(peter, nasta, john, terry); /** * Prepare data for test diff --git a/repository/src/test/java/com/iluwatar/repository/RepositoryTest.java b/repository/src/test/java/com/iluwatar/repository/RepositoryTest.java index 9f7615aa57de..614f18dba1af 100644 --- a/repository/src/test/java/com/iluwatar/repository/RepositoryTest.java +++ b/repository/src/test/java/com/iluwatar/repository/RepositoryTest.java @@ -23,16 +23,7 @@ package com.iluwatar.repository; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.util.Arrays; -import java.util.List; -import java.util.Optional; - -import javax.annotation.Resource; - +import com.google.common.collect.Lists; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -40,7 +31,11 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; -import com.google.common.collect.Lists; +import javax.annotation.Resource; +import java.util.List; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.*; /** * Test case to test the functions of {@link PersonRepository}, beside the CRUD functions, the query @@ -58,7 +53,7 @@ public class RepositoryTest { Person john = new Person("John", "lawrence", 35); Person terry = new Person("Terry", "Law", 36); - List persons = Arrays.asList(peter, nasta, john, terry); + List persons = List.of(peter, nasta, john, terry); /** * Prepare data for test diff --git a/retry/src/main/java/com/iluwatar/retry/FindCustomer.java b/retry/src/main/java/com/iluwatar/retry/FindCustomer.java index 11c2b40d6e03..e5013f50e925 100644 --- a/retry/src/main/java/com/iluwatar/retry/FindCustomer.java +++ b/retry/src/main/java/com/iluwatar/retry/FindCustomer.java @@ -24,8 +24,8 @@ package com.iluwatar.retry; import java.util.ArrayDeque; -import java.util.Arrays; import java.util.Deque; +import java.util.List; /** * Finds a customer, returning its ID from our records. @@ -48,7 +48,7 @@ public final class FindCustomer implements BusinessOperation { */ public FindCustomer(String customerId, BusinessException... errors) { this.customerId = customerId; - this.errors = new ArrayDeque<>(Arrays.asList(errors)); + this.errors = new ArrayDeque<>(List.of(errors)); } @Override diff --git a/servant/src/main/java/com/iluwatar/servant/App.java b/servant/src/main/java/com/iluwatar/servant/App.java index a629856d5173..35a26dbcc955 100644 --- a/servant/src/main/java/com/iluwatar/servant/App.java +++ b/servant/src/main/java/com/iluwatar/servant/App.java @@ -26,7 +26,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; import java.util.List; @@ -60,9 +59,7 @@ public static void scenario(Servant servant, int compliment) { King k = new King(); Queen q = new Queen(); - List guests = new ArrayList<>(); - guests.add(k); - guests.add(q); + List guests = List.of(k, q); // feed servant.feed(k); diff --git a/servant/src/test/java/com/iluwatar/servant/ServantTest.java b/servant/src/test/java/com/iluwatar/servant/ServantTest.java index 4431f6d60837..02b69559e624 100644 --- a/servant/src/test/java/com/iluwatar/servant/ServantTest.java +++ b/servant/src/test/java/com/iluwatar/servant/ServantTest.java @@ -25,7 +25,6 @@ import org.junit.jupiter.api.Test; -import java.util.ArrayList; import java.util.List; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -76,15 +75,9 @@ public void testCheckIfYouWillBeHanged() { final Royalty badMoodRoyalty = mock(Royalty.class); when(badMoodRoyalty.getMood()).thenReturn(true); - final List goodCompany = new ArrayList<>(); - goodCompany.add(goodMoodRoyalty); - goodCompany.add(goodMoodRoyalty); - goodCompany.add(goodMoodRoyalty); + final List goodCompany = List.of(goodMoodRoyalty, goodMoodRoyalty, goodMoodRoyalty); - final List badCompany = new ArrayList<>(); - goodCompany.add(goodMoodRoyalty); - goodCompany.add(goodMoodRoyalty); - goodCompany.add(badMoodRoyalty); + final List badCompany = List.of(goodMoodRoyalty, goodMoodRoyalty, badMoodRoyalty); assertTrue(new Servant("test").checkIfYouWillBeHanged(goodCompany)); assertTrue(new Servant("test").checkIfYouWillBeHanged(badCompany)); diff --git a/service-layer/src/test/java/com/iluwatar/servicelayer/magic/MagicServiceImplTest.java b/service-layer/src/test/java/com/iluwatar/servicelayer/magic/MagicServiceImplTest.java index 03284ab6ddd8..b4b3c5714ca3 100644 --- a/service-layer/src/test/java/com/iluwatar/servicelayer/magic/MagicServiceImplTest.java +++ b/service-layer/src/test/java/com/iluwatar/servicelayer/magic/MagicServiceImplTest.java @@ -97,11 +97,10 @@ public void testFindAllSpells() throws Exception { public void testFindWizardsWithSpellbook() throws Exception { final String bookname = "bookname"; final Spellbook spellbook = mock(Spellbook.class); - final Set wizards = new HashSet<>(); - wizards.add(mock(Wizard.class)); - wizards.add(mock(Wizard.class)); - wizards.add(mock(Wizard.class)); - + final Set wizards = Set.of( + mock(Wizard.class), + mock(Wizard.class), + mock(Wizard.class)); when(spellbook.getWizards()).thenReturn(wizards); final SpellbookDao spellbookDao = mock(SpellbookDao.class); @@ -126,11 +125,10 @@ public void testFindWizardsWithSpellbook() throws Exception { @Test public void testFindWizardsWithSpell() throws Exception { - final Set wizards = new HashSet<>(); - wizards.add(mock(Wizard.class)); - wizards.add(mock(Wizard.class)); - wizards.add(mock(Wizard.class)); - + final Set wizards = Set.of( + mock(Wizard.class), + mock(Wizard.class), + mock(Wizard.class)); final Spellbook spellbook = mock(Spellbook.class); when(spellbook.getWizards()).thenReturn(wizards); diff --git a/specification/src/main/java/com/iluwatar/specification/app/App.java b/specification/src/main/java/com/iluwatar/specification/app/App.java index df80f855f1f5..00b37181438c 100644 --- a/specification/src/main/java/com/iluwatar/specification/app/App.java +++ b/specification/src/main/java/com/iluwatar/specification/app/App.java @@ -23,17 +23,7 @@ package com.iluwatar.specification.app; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import com.iluwatar.specification.creature.Creature; -import com.iluwatar.specification.creature.Dragon; -import com.iluwatar.specification.creature.Goblin; -import com.iluwatar.specification.creature.KillerBee; -import com.iluwatar.specification.creature.Octopus; -import com.iluwatar.specification.creature.Shark; -import com.iluwatar.specification.creature.Troll; +import com.iluwatar.specification.creature.*; import com.iluwatar.specification.property.Color; import com.iluwatar.specification.property.Movement; import com.iluwatar.specification.selector.ColorSelector; @@ -41,6 +31,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.List; +import java.util.stream.Collectors; + /** * * The central idea of the Specification pattern is to separate the statement of how to match a @@ -64,8 +57,7 @@ public class App { public static void main(String[] args) { // initialize creatures list List creatures = - Arrays.asList(new Goblin(), new Octopus(), new Dragon(), new Shark(), new Troll(), - new KillerBee()); + List.of(new Goblin(), new Octopus(), new Dragon(), new Shark(), new Troll(), new KillerBee()); // find all walking creatures LOGGER.info("Find all walking creatures"); List walkingCreatures = diff --git a/specification/src/test/java/com/iluwatar/specification/creature/CreatureTest.java b/specification/src/test/java/com/iluwatar/specification/creature/CreatureTest.java index 022475c24238..26ff4c1ab877 100644 --- a/specification/src/test/java/com/iluwatar/specification/creature/CreatureTest.java +++ b/specification/src/test/java/com/iluwatar/specification/creature/CreatureTest.java @@ -29,8 +29,8 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import java.util.Arrays; import java.util.Collection; +import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -46,7 +46,7 @@ public class CreatureTest { * @return The tested {@link Creature} instance and its expected specs */ public static Collection dataProvider() { - return Arrays.asList( + return List.of( new Object[]{new Dragon(), "Dragon", Size.LARGE, Movement.FLYING, Color.RED}, new Object[]{new Goblin(), "Goblin", Size.SMALL, Movement.WALKING, Color.GREEN}, new Object[]{new KillerBee(), "KillerBee", Size.SMALL, Movement.FLYING, Color.LIGHT}, @@ -76,15 +76,13 @@ public void testGetMovement(Creature testedCreature, String name, Size size, Mov @ParameterizedTest @MethodSource("dataProvider") - public void testGetColor(Creature testedCreature, String name, Size size, Movement movement, - Color color) { + public void testGetColor(Creature testedCreature, String name, Size size, Movement movement, Color color) { assertEquals(color, testedCreature.getColor()); } @ParameterizedTest @MethodSource("dataProvider") - public void testToString(Creature testedCreature, String name, Size size, Movement movement, - Color color) { + public void testToString(Creature testedCreature, String name, Size size, Movement movement, Color color) { final String toString = testedCreature.toString(); assertNotNull(toString); assertEquals( diff --git a/strategy/src/test/java/com/iluwatar/strategy/DragonSlayingStrategyTest.java b/strategy/src/test/java/com/iluwatar/strategy/DragonSlayingStrategyTest.java index b97cf499fbf8..67e4b92cc643 100644 --- a/strategy/src/test/java/com/iluwatar/strategy/DragonSlayingStrategyTest.java +++ b/strategy/src/test/java/com/iluwatar/strategy/DragonSlayingStrategyTest.java @@ -32,7 +32,6 @@ import org.junit.jupiter.params.provider.MethodSource; import org.slf4j.LoggerFactory; -import java.util.Arrays; import java.util.Collection; import java.util.LinkedList; import java.util.List; @@ -50,19 +49,19 @@ public class DragonSlayingStrategyTest { * @return The test parameters for each cycle */ static Collection dataProvider() { - return Arrays.asList( - new Object[]{ - new MeleeStrategy(), - "With your Excalibur you sever the dragon's head!" - }, - new Object[]{ - new ProjectileStrategy(), - "You shoot the dragon with the magical crossbow and it falls dead on the ground!" - }, - new Object[]{ - new SpellStrategy(), - "You cast the spell of disintegration and the dragon vaporizes in a pile of dust!" - } + return List.of( + new Object[]{ + new MeleeStrategy(), + "With your Excalibur you sever the dragon's head!" + }, + new Object[]{ + new ProjectileStrategy(), + "You shoot the dragon with the magical crossbow and it falls dead on the ground!" + }, + new Object[]{ + new SpellStrategy(), + "You cast the spell of disintegration and the dragon vaporizes in a pile of dust!" + } ); } diff --git a/thread-pool/src/main/java/com/iluwatar/threadpool/App.java b/thread-pool/src/main/java/com/iluwatar/threadpool/App.java index 9fe16d36ac2a..b21f8cc4a1d3 100644 --- a/thread-pool/src/main/java/com/iluwatar/threadpool/App.java +++ b/thread-pool/src/main/java/com/iluwatar/threadpool/App.java @@ -60,22 +60,22 @@ public static void main(String[] args) { LOGGER.info("Program started"); // Create a list of tasks to be executed - List tasks = new ArrayList<>(); - tasks.add(new PotatoPeelingTask(3)); - tasks.add(new PotatoPeelingTask(6)); - tasks.add(new CoffeeMakingTask(2)); - tasks.add(new CoffeeMakingTask(6)); - tasks.add(new PotatoPeelingTask(4)); - tasks.add(new CoffeeMakingTask(2)); - tasks.add(new PotatoPeelingTask(4)); - tasks.add(new CoffeeMakingTask(9)); - tasks.add(new PotatoPeelingTask(3)); - tasks.add(new CoffeeMakingTask(2)); - tasks.add(new PotatoPeelingTask(4)); - tasks.add(new CoffeeMakingTask(2)); - tasks.add(new CoffeeMakingTask(7)); - tasks.add(new PotatoPeelingTask(4)); - tasks.add(new PotatoPeelingTask(5)); + List tasks = List.of( + new PotatoPeelingTask(3), + new PotatoPeelingTask(6), + new CoffeeMakingTask(2), + new CoffeeMakingTask(6), + new PotatoPeelingTask(4), + new CoffeeMakingTask(2), + new PotatoPeelingTask(4), + new CoffeeMakingTask(9), + new PotatoPeelingTask(3), + new CoffeeMakingTask(2), + new PotatoPeelingTask(4), + new CoffeeMakingTask(2), + new CoffeeMakingTask(7), + new PotatoPeelingTask(4), + new PotatoPeelingTask(5)); // Creates a thread pool that reuses a fixed number of threads operating off a shared // unbounded queue. At any point, at most nThreads threads will be active processing diff --git a/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTest.java b/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTest.java index 04ca5ffcce4f..2e69e2c7f2e9 100644 --- a/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTest.java +++ b/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTest.java @@ -23,8 +23,10 @@ package com.iluwatar.tls; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import java.util.ArrayList; -import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.List; @@ -32,9 +34,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; @@ -82,7 +81,7 @@ public class DateFormatCallableTest { /** * Expected content of the list containing the date values created by the run of DateFormatRunnalbe */ - List expectedDateValues = Arrays.asList("15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015"); + List expectedDateValues = List.of("15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015"); /** * Run Callable and prepare results for usage in the test methods diff --git a/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestIncorrectDateFormat.java b/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestIncorrectDateFormat.java index 2c88fc13d9e0..df2ab2a93419 100644 --- a/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestIncorrectDateFormat.java +++ b/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestIncorrectDateFormat.java @@ -23,16 +23,15 @@ package com.iluwatar.tls; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; @@ -76,7 +75,7 @@ public class DateFormatCallableTestIncorrectDateFormat { /** * Expected content of the list containing the exceptions created by the run of DateFormatRunnalbe */ - List expectedExceptions = Arrays.asList("class java.text.ParseException: Unparseable date: \"15.12.2015\"", + List expectedExceptions = List.of("class java.text.ParseException: Unparseable date: \"15.12.2015\"", "class java.text.ParseException: Unparseable date: \"15.12.2015\"", "class java.text.ParseException: Unparseable date: \"15.12.2015\"", "class java.text.ParseException: Unparseable date: \"15.12.2015\"", diff --git a/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestMultiThread.java b/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestMultiThread.java index 11e8eef5bc2a..1001e1bdf59b 100644 --- a/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestMultiThread.java +++ b/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestMultiThread.java @@ -23,8 +23,10 @@ package com.iluwatar.tls; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import java.util.ArrayList; -import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.List; @@ -32,9 +34,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; @@ -86,7 +85,7 @@ static class StringArrayList extends ArrayList { /** * Expected content of the list containing the date values created by each thread */ - List expectedDateValues = Arrays.asList("15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015"); + List expectedDateValues = List.of("15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015"); /** * Run Callable and prepare results for usage in the test methods From a65a60183575c35c16c16aeba2338675eb8bbe6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Tue, 29 Oct 2019 22:11:09 +0200 Subject: [PATCH 106/197] Update web site logic --- .travis.yml | 3 +-- update-ghpages.sh => update-website.sh | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) rename update-ghpages.sh => update-website.sh (87%) diff --git a/.travis.yml b/.travis.yml index f9bfeaa8568a..0a5ac7709f2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ sudo: required env: global: - - GH_REF: github.com/iluwatar/java-design-patterns.git - secure: "DCpazS3nkLnter3sguXEAS2fC/1ZWNfM+XLyif9MfNFxlZdpni2vCD/jA0Rdpga8puQWHNVLyAec+RPFH/2qSmJ1c1UTV5MaLv8tPqwUX0VFA+1I6XoSv6oX4ldHTBWHEWqQHkRFOLoil0h0edc0tTOWQwXF8U+DLAB+HkRb4gw=" services: @@ -24,7 +23,7 @@ script: - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then mvn clean verify sonar:sonar -Dsonar.projectKey=iluwatar_java-design-patterns -Dsonar.host.url=https://sonarcloud.io; fi' after_success: -- bash update-ghpages.sh +- bash update-website.sh notifications: email: diff --git a/update-ghpages.sh b/update-website.sh similarity index 87% rename from update-ghpages.sh rename to update-website.sh index 25ea680cc906..5b9fe5515f7d 100644 --- a/update-ghpages.sh +++ b/update-website.sh @@ -24,8 +24,8 @@ # Clone gh-pages -git clone -b gh-pages "https://${GH_REF}" ghpagesclone -cd ghpagesclone +git clone https://github.com/iluwatar/java-design-patterns-web.git +cd java-design-patterns-web # Init and update submodule to latest git submodule update --init --recursive @@ -41,5 +41,5 @@ then # it should be committed git add . git commit -m ":sparkles: :up: Automagic Update via Travis-CI" - git push --quiet "https://${GH_TOKEN}:x-oauth-basic@${GH_REF}" gh-pages > /dev/null 2>&1 + git push --quiet "https://${GH_TOKEN}:x-oauth-basic@github.com/iluwatar/java-design-patterns-web.git" gh-pages > /dev/null 2>&1 fi From ccc1a6340b6b74e337d431d2aff3a067dd078070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Tue, 29 Oct 2019 23:02:24 +0200 Subject: [PATCH 107/197] Update script --- update-website.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/update-website.sh b/update-website.sh index 5b9fe5515f7d..cdff97392b60 100644 --- a/update-website.sh +++ b/update-website.sh @@ -29,7 +29,6 @@ cd java-design-patterns-web # Init and update submodule to latest git submodule update --init --recursive -git submodule update --remote # Setup Git git config user.name "Travis-CI" From ff5284848188afaedb4463796df1e0c002603685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Tue, 29 Oct 2019 23:28:05 +0200 Subject: [PATCH 108/197] Update script --- update-website.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/update-website.sh b/update-website.sh index cdff97392b60..7dd96a144d3a 100644 --- a/update-website.sh +++ b/update-website.sh @@ -34,11 +34,6 @@ git submodule update --init --recursive git config user.name "Travis-CI" git config user.email "travis@no.reply" -# If there is a new version of the master branch -if git status | grep patterns > /dev/null 2>&1 -then - # it should be committed - git add . - git commit -m ":sparkles: :up: Automagic Update via Travis-CI" - git push --quiet "https://${GH_TOKEN}:x-oauth-basic@github.com/iluwatar/java-design-patterns-web.git" gh-pages > /dev/null 2>&1 -fi +git add . +git commit -m ":sparkles: :up: Automagic Update via Travis-CI" +git push --quiet "https://${GH_TOKEN}:x-oauth-basic@github.com/iluwatar/java-design-patterns-web.git" master > /dev/null 2>&1 From 91a085d3d18905f845c0328d5ebef36c630bf36b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Wed, 30 Oct 2019 08:15:43 +0200 Subject: [PATCH 109/197] Update script --- update-website.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/update-website.sh b/update-website.sh index 7dd96a144d3a..66192f15f82a 100644 --- a/update-website.sh +++ b/update-website.sh @@ -29,6 +29,13 @@ cd java-design-patterns-web # Init and update submodule to latest git submodule update --init --recursive +cd 30-seconds-of-java +git pull origin master +cd ../patterns +git pull origin master +cd ../programming-principles +git pull origin gh-pages +cd .. # Setup Git git config user.name "Travis-CI" From fca7e9c8c7e9b0ffd579624b7c137db46eeeb6ca Mon Sep 17 00:00:00 2001 From: "adamski.pro" Date: Wed, 30 Oct 2019 07:19:33 +0100 Subject: [PATCH 110/197] https://github.com/iluwatar/java-design-patterns/issues/1021 - decrease number of checkstyle errors in callback pattern (#1053) --- .../main/java/com/iluwatar/callback/App.java | 22 +++++++++++-------- .../java/com/iluwatar/callback/Callback.java | 4 ++-- .../com/iluwatar/callback/LambdasApp.java | 15 ++++++++----- .../com/iluwatar/callback/SimpleTask.java | 14 +++++++----- .../main/java/com/iluwatar/callback/Task.java | 6 ++--- .../com/iluwatar/callback/package-info.java | 1 + 6 files changed, 36 insertions(+), 26 deletions(-) create mode 100644 callback/src/main/java/com/iluwatar/callback/package-info.java diff --git a/callback/src/main/java/com/iluwatar/callback/App.java b/callback/src/main/java/com/iluwatar/callback/App.java index 3a9cd00cb185..842f01dcdf3d 100644 --- a/callback/src/main/java/com/iluwatar/callback/App.java +++ b/callback/src/main/java/com/iluwatar/callback/App.java @@ -24,23 +24,27 @@ package com.iluwatar.callback; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import static org.slf4j.LoggerFactory.getLogger; /** - * - * Callback pattern is more native for functional languages where functions are treated as - * first-class citizens. Prior to Java 8 callbacks can be simulated using simple (alike command) - * interfaces. - * + * + * Callback pattern is more native for functional languages where functions are + * treated as first-class citizens. Prior to Java 8 callbacks can be simulated + * using simple (alike command) interfaces. + * */ -public class App { +public final class App { - private static final Logger LOGGER = LoggerFactory.getLogger(App.class); + private static final Logger LOGGER = getLogger(App.class); + + private App() { + } /** * Program entry point */ - public static void main(String[] args) { + public static void main(final String[] args) { Task task = new SimpleTask(); Callback callback = () -> LOGGER.info("I'm done now."); task.executeWith(callback); diff --git a/callback/src/main/java/com/iluwatar/callback/Callback.java b/callback/src/main/java/com/iluwatar/callback/Callback.java index 15f08366275d..0158dcda0fe6 100644 --- a/callback/src/main/java/com/iluwatar/callback/Callback.java +++ b/callback/src/main/java/com/iluwatar/callback/Callback.java @@ -24,9 +24,9 @@ package com.iluwatar.callback; /** - * + * * Callback interface - * + * */ public interface Callback { diff --git a/callback/src/main/java/com/iluwatar/callback/LambdasApp.java b/callback/src/main/java/com/iluwatar/callback/LambdasApp.java index 2b445d9ca440..18715e3b79ca 100644 --- a/callback/src/main/java/com/iluwatar/callback/LambdasApp.java +++ b/callback/src/main/java/com/iluwatar/callback/LambdasApp.java @@ -24,22 +24,25 @@ package com.iluwatar.callback; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import static org.slf4j.LoggerFactory.getLogger; /** * - * This example generates the exact same output as {@link App} however the callback has been - * defined as a Lambdas expression. + * This example generates the exact same output as {@link App} however the + * callback has been defined as a Lambdas expression. * */ -public class LambdasApp { +public final class LambdasApp { + + private static final Logger LOGGER = getLogger(LambdasApp.class); - private static final Logger LOGGER = LoggerFactory.getLogger(LambdasApp.class); + private LambdasApp() { } /** * Program entry point */ - public static void main(String[] args) { + public static void main(final String[] args) { Task task = new SimpleTask(); Callback c = () -> LOGGER.info("I'm done now."); task.executeWith(c); diff --git a/callback/src/main/java/com/iluwatar/callback/SimpleTask.java b/callback/src/main/java/com/iluwatar/callback/SimpleTask.java index 155d1e96dad7..21162833a72c 100644 --- a/callback/src/main/java/com/iluwatar/callback/SimpleTask.java +++ b/callback/src/main/java/com/iluwatar/callback/SimpleTask.java @@ -24,19 +24,21 @@ package com.iluwatar.callback; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import static org.slf4j.LoggerFactory.getLogger; /** - * + * * Implementation of task that need to be executed - * + * */ -public class SimpleTask extends Task { +public final class SimpleTask extends Task { - private static final Logger LOGGER = LoggerFactory.getLogger(SimpleTask.class); + private static final Logger LOGGER = getLogger(SimpleTask.class); @Override public void execute() { - LOGGER.info("Perform some important activity and after call the callback method."); + LOGGER.info("Perform some important activity and after call the" + + " callback method."); } } diff --git a/callback/src/main/java/com/iluwatar/callback/Task.java b/callback/src/main/java/com/iluwatar/callback/Task.java index 9f2abe85fa21..15cd99e9ae70 100644 --- a/callback/src/main/java/com/iluwatar/callback/Task.java +++ b/callback/src/main/java/com/iluwatar/callback/Task.java @@ -24,16 +24,16 @@ package com.iluwatar.callback; /** - * + * * Template-method class for callback hook execution - * + * */ public abstract class Task { /** * Execute with callback */ - public final void executeWith(Callback callback) { + final void executeWith(final Callback callback) { execute(); if (callback != null) { callback.call(); diff --git a/callback/src/main/java/com/iluwatar/callback/package-info.java b/callback/src/main/java/com/iluwatar/callback/package-info.java new file mode 100644 index 000000000000..a72bbb50d6cd --- /dev/null +++ b/callback/src/main/java/com/iluwatar/callback/package-info.java @@ -0,0 +1 @@ +package com.iluwatar.callback; From a9dfd7e8091cfe6ba8312f518827c71af1352bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Wed, 30 Oct 2019 08:23:45 +0200 Subject: [PATCH 111/197] Update license header --- .../com/iluwatar/callback/package-info.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/callback/src/main/java/com/iluwatar/callback/package-info.java b/callback/src/main/java/com/iluwatar/callback/package-info.java index a72bbb50d6cd..0b86125fd678 100644 --- a/callback/src/main/java/com/iluwatar/callback/package-info.java +++ b/callback/src/main/java/com/iluwatar/callback/package-info.java @@ -1 +1,24 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + package com.iluwatar.callback; From cdb80b8ddd09ec487278a6c9b89cc07b58de8559 Mon Sep 17 00:00:00 2001 From: Hemant Bothra Date: Wed, 30 Oct 2019 11:57:24 +0530 Subject: [PATCH 112/197] Issue 893 (#1014) * Using static object to reduce memory foot prints * Updating README along with name of static fields * Updating code as per review comments * Updating code as per review comments * Updating doc as per new code --- factory-method/README.md | 4 ++-- .../iluwatar/factory/method/ElfBlacksmith.java | 15 +++++++++++++-- .../iluwatar/factory/method/OrcBlacksmith.java | 13 ++++++++++++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/factory-method/README.md b/factory-method/README.md index 087221fb9dfe..31e2ab98b744 100644 --- a/factory-method/README.md +++ b/factory-method/README.md @@ -42,13 +42,13 @@ public interface Blacksmith { public class ElfBlacksmith implements Blacksmith { public Weapon manufactureWeapon(WeaponType weaponType) { - return new ElfWeapon(weaponType); + return ELFARSENAL.get(weaponType); } } public class OrcBlacksmith implements Blacksmith { public Weapon manufactureWeapon(WeaponType weaponType) { - return new OrcWeapon(weaponType); + return ORCARSENAL.get(weaponType); } } ``` diff --git a/factory-method/src/main/java/com/iluwatar/factory/method/ElfBlacksmith.java b/factory-method/src/main/java/com/iluwatar/factory/method/ElfBlacksmith.java index adae5bd50b9a..eccff10d924c 100644 --- a/factory-method/src/main/java/com/iluwatar/factory/method/ElfBlacksmith.java +++ b/factory-method/src/main/java/com/iluwatar/factory/method/ElfBlacksmith.java @@ -23,6 +23,9 @@ package com.iluwatar.factory.method; +import java.util.HashMap; +import java.util.Map; + /** * * Concrete subclass for creating new objects. @@ -30,9 +33,17 @@ */ public class ElfBlacksmith implements Blacksmith { + private static Map ELFARSENAL; + static { + ELFARSENAL= new HashMap<>(WeaponType.values().length); + for (WeaponType type : WeaponType.values()) { + ELFARSENAL.put(type, new ElfWeapon(type)); + } + } + @Override public Weapon manufactureWeapon(WeaponType weaponType) { - return new ElfWeapon(weaponType); + return ELFARSENAL.get(weaponType); } - + } diff --git a/factory-method/src/main/java/com/iluwatar/factory/method/OrcBlacksmith.java b/factory-method/src/main/java/com/iluwatar/factory/method/OrcBlacksmith.java index a2a86fe4455f..6736630492c6 100644 --- a/factory-method/src/main/java/com/iluwatar/factory/method/OrcBlacksmith.java +++ b/factory-method/src/main/java/com/iluwatar/factory/method/OrcBlacksmith.java @@ -23,6 +23,9 @@ package com.iluwatar.factory.method; +import java.util.HashMap; +import java.util.Map; + /** * * Concrete subclass for creating new objects. @@ -30,8 +33,16 @@ */ public class OrcBlacksmith implements Blacksmith { + private static Map ORCARSENAL; + static { + ORCARSENAL= new HashMap<>(WeaponType.values().length); + for (WeaponType type : WeaponType.values()) { + ORCARSENAL.put(type, new OrcWeapon(type)); + } + } + @Override public Weapon manufactureWeapon(WeaponType weaponType) { - return new OrcWeapon(weaponType); + return ORCARSENAL.get(weaponType); } } From cc85c73fbc6a43dd564d2858a0a00671dd042493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Wed, 30 Oct 2019 19:52:03 +0200 Subject: [PATCH 113/197] Move faq.md to java-design-patterns-web repository --- faq.md | 88 ---------------------------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 faq.md diff --git a/faq.md b/faq.md deleted file mode 100644 index 107ee1e684e2..000000000000 --- a/faq.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -layout: page -link-title: FAQ -title: FAQ - Java Design Patterns -description: Java Design Pattern FAQ answers the most commonly asked design patterns questions. -permalink: /faq/ -icon: fa-question -page-index: 5 ---- - -### Q1: What is the difference between State and Strategy patterns? {#Q1} - -While the implementation is similar they solve different problems. The State -pattern deals with what state an object is in - it encapsulates state-dependent -behavior. -The Strategy pattern deals with how an object performs a certain task - it -encapsulates an algorithm. - -### Q2: What is the difference between Strategy and Template Method patterns? {#Q2} - -In Template Method the algorithm is chosen at compile time via inheritance. -With Strategy pattern the algorithm is chosen at runtime via composition. - -### Q3: What is the difference between Proxy and Decorator patterns? {#Q3} - -The difference is the intent of the patterns. While Proxy controls access to -the object Decorator is used to add responsibilities to the object. - -### Q4: What is the difference between Chain of Responsibility and Intercepting Filter patterns? {#Q4} - -While the implementations look similar there are differences. The Chain of -Responsibility forms a chain of request processors and the processors are then -executed one by one until the correct processor is found. In Intercepting -Filter the chain is constructed from filters and the whole chain is always -executed. - -### Q5: What is the difference between Visitor and Double Dispatch patterns? {#Q5} - -The Visitor pattern is a means of adding a new operation to existing classes. -Double dispatch is a means of dispatching function calls with respect to two -polymorphic types, rather than a single polymorphic type, which is what -languages like C++ and Java _do not_ support directly. - -### Q6: What are the differences between Flyweight and Object Pool patterns? {#Q6} - -They differ in the way they are used. - -Pooled objects can simultaneously be used by a single "client" only. For that, -a pooled object must be checked out from the pool, then it can be used by a -client, and then the client must return the object back to the pool. Multiple -instances of identical objects may exist, up to the maximal capacity of the -pool. - -In contrast, a Flyweight object is singleton, and it can be used simultaneously -by multiple clients. - -As for concurrent access, pooled objects can be mutable and they usually don't -need to be thread safe, as typically, only one thread is going to use a -specific instance at the same time. Flyweight must either be immutable (the -best option), or implement thread safety. - -As for performance and scalability, pools can become bottlenecks, if all the -pooled objects are in use and more clients need them, threads will become -blocked waiting for available object from the pool. This is not the case with -Flyweight. - -### Q7: What are the differences between FluentInterface and Builder patterns? {#Q7} - -Fluent interfaces are sometimes confused with the Builder pattern, because they share method chaining and a fluent usage. However, fluent interfaces are not primarily used to create shared (mutable) objects, but to configure complex objects without having to respecify the target object on every property change. - -### Q8: What is the difference between java.io.Serialization and Memento pattern? {#Q8} - -Memento is typically used to implement rollback/save-point support. Example we might want to mark the state of an object at a point in time, do some work and then decide to rollback to the previous state. - -On the other hand serialization may be used as a tool to save the state of an object into byte[] and preserving the contents in memory or disk. When someone invokes the memento to revert object's previous state then we can deserialize the information stored and recreate previous state. - -So Memento is a pattern and serialization is a tool that can be used to implement this pattern. Other ways to implement the pattern can be to clone the contents of the object and keep track of those clones. - - -### Q9: What's the difference between “API Gateway” and “Aggregator Microservices”? Isn't it the same? {#Q9} - -The API Gateway : Aggregate calls to microservices in a single location. The user makes a single call to the API Gateway, and the API Gateway then calls each relevant microservice. -Use the API Gateway pattern when you're also using the Microservices pattern and need a single point of aggregation for your microservice calls. - -Aggregator Microservices : The user makes a single call to the Aggregator, and the aggregator then calls each relevant microservice and collects the data, apply business logic to it, and further publish is as a REST Endpoint.Use the Aggregator Microservices pattern when you need a unified API for various microservices, regardless the client device. - - - From 1eb1961f1b38c8360ac7a99204224087dadad46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Wed, 30 Oct 2019 21:12:10 +0200 Subject: [PATCH 114/197] Remove presentations --- abstract-factory/README.md | 4 - abstract-factory/etc/diagram1.png | Bin 58018 -> 0 bytes abstract-factory/etc/diagram2.png | Bin 26347 -> 0 bytes abstract-factory/etc/presentation.html | 190 ------------------- command/README.md | 4 - command/etc/diagram.png | Bin 57571 -> 0 bytes command/etc/presentation.html | 243 ------------------------- factory-method/README.md | 4 - factory-method/etc/diagram1.png | Bin 59865 -> 0 bytes factory-method/etc/presentation.html | 185 ------------------- hexagonal/README.md | 3 - hexagonal/etc/layers.png | Bin 15887 -> 0 bytes hexagonal/etc/ports_and_adapters.png | Bin 34860 -> 0 bytes hexagonal/etc/ports_and_adapters.xml | 25 --- hexagonal/etc/presentation.html | 127 ------------- proxy/README.md | 3 - proxy/etc/presentation.html | 92 ---------- proxy/etc/proxy-concept.png | Bin 24957 -> 0 bytes proxy/etc/proxy-concept.xml | 25 --- 19 files changed, 905 deletions(-) delete mode 100644 abstract-factory/etc/diagram1.png delete mode 100644 abstract-factory/etc/diagram2.png delete mode 100644 abstract-factory/etc/presentation.html delete mode 100644 command/etc/diagram.png delete mode 100644 command/etc/presentation.html delete mode 100644 factory-method/etc/diagram1.png delete mode 100644 factory-method/etc/presentation.html delete mode 100644 hexagonal/etc/layers.png delete mode 100644 hexagonal/etc/ports_and_adapters.png delete mode 100644 hexagonal/etc/ports_and_adapters.xml delete mode 100644 hexagonal/etc/presentation.html delete mode 100644 proxy/etc/presentation.html delete mode 100644 proxy/etc/proxy-concept.png delete mode 100644 proxy/etc/proxy-concept.xml diff --git a/abstract-factory/README.md b/abstract-factory/README.md index 0084030b645e..aefedb07f7f4 100644 --- a/abstract-factory/README.md +++ b/abstract-factory/README.md @@ -188,10 +188,6 @@ Use the Abstract Factory pattern when ## Tutorial * [Abstract Factory Pattern Tutorial](https://www.journaldev.com/1418/abstract-factory-design-pattern-in-java) -## Presentations - -* [Abstract Factory Pattern](etc/presentation.html) - ## Real world examples diff --git a/abstract-factory/etc/diagram1.png b/abstract-factory/etc/diagram1.png deleted file mode 100644 index e9c3c84c212d84c26f73ea24a2668dc7a3b7bf21..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 58018 zcmeFZcR-Wb)-N0jGB&UwA_hc6q$>zWXf{B)^bQVHx+a7YB&diD44u$X>4Y+LLmgD4 zgd#Q4r9%Rt6I$Tg0X=8tyyv^;eeeC}{&9I8Nyuc9r|iAf`jxd`-_uY!dg$yS2n2Fe z`R*NU2!uf&0@-`}w*%mnAO4z!;9(C!Tj>@gr}^9z_+!7_P4$})NM6w4&EFZo-v=Mw zH9|ljOke2#_CyFUu|puklFD~(>Ux?_(+Wtss_C+ZM2lOe1v;9dpGkfcr`GErr z5qG${AK!ldPSmqIOY0Ya!`b4URQYhD!hBgCX)ykPanRN{J!_|it~lh&@zu%b2hQ@bN2S#d^SezBV@Q+ah8U6 zSumNK$RFO9>q{fUY0E@Loe%c110HqAx}v%wm8&Iqyiv2%#PkpIy&GHsrUDlD?bRTQ z5E1lzz<6<25;Tl{Z*a(!hVOY+*0mV@0bid{W3%Xu<=jCL$-akXS9oN5^7QWF^Ri=Q za|;;HpyT)K>q*JZR+HHd8esD|0k7{bD^YKTrD?lUoQ|eKDh4Gh=hIE)H^zUMqsnIu zM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XP$05wc*Oys82U^r&xBX$4hTL}YJ3hJbz*GppSYvK7 zKVLn6gq>F;D@_R?VoOWBOi(CD=b26m%~E|G#%j_|7p9n@m~EuH^y;IX!&|7&O#^-I zovk((m^D1C$dI?KBrv6%{meGSpBTQSGxVXMCD^Wv8=z(BLpy!vLNO6qg_!++vif({ z?wd50pKhV~^LAa>Opj#VXTEe^^@cf7M`mDavrYOdK7u>%1R(qDeaw;@71OB@XWzuy z8shA$#E}ydVG!@valuh(c6X3K*pT;|0sGFTXUj^niPX-%qX|?$#U5~;kl*RS4|CGb z-SH33J0cLl@#0w^WrDg#6C{8>wGA%PzX!lY_r5ae{>1OJN5_8#g zjWZ^)=y|GG`}vqTOg8kw-LU)L^uC?WUvmGObh!&fPR;LbU)Ks6bs~kX>QXZXaGsl9p@qOcRfGIW;Yi~`xytcO^vl;`0LU3S| z9pjqaNk{OG^ux)dRu0TCB16cTiXRfCoApo8gnif^nRHJ^2D(L1gUvuy z{+4io2EVSAFUtB8Q4e_VWEMZuYFqVT0n{foFeI3-2gI;Co(?DgmI0tHnG`Sx83okDO2m1N+zUWuZVC`>ww>Fn_G0?MrneQvbKZF=RQyYeC(6 ze>74f_KG%y@DkRZHVS*vs2 z^rHq`tZTSGH}^JBGK&ueqZ!#_c>?*XhSc=UzZk{O2co z{2$c+@Ul+;OI&-~!O7T-H>~mA`WPzj+f-a{vGU diff --git a/abstract-factory/etc/presentation.html b/abstract-factory/etc/presentation.html deleted file mode 100644 index 823245870569..000000000000 --- a/abstract-factory/etc/presentation.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - Design Patterns - Abstract Factory Presentation - - - - - - - - - \ No newline at end of file diff --git a/command/README.md b/command/README.md index cb9bd48a9608..41e8b78e1aaa 100644 --- a/command/README.md +++ b/command/README.md @@ -36,10 +36,6 @@ Use the Command pattern when you want to * implement callback functionality * implement the undo functionality -## Presentations - -* [Command Pattern](etc/presentation.html) - ## Real world examples * [java.lang.Runnable](http://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html) diff --git a/command/etc/diagram.png b/command/etc/diagram.png deleted file mode 100644 index 1d3494292b82a5c7cbde7d5dc26c238ab5661bdb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 57571 zcmd43c|6qZ`!}qO7ByFwEQOg?DqAQ^hN)C4MZ0|zLYJLlY%`T4gru^Qq>YRvTb4;0 zlNeL7hQVMaS;iPn3@8#ROUlVueI~5B`3{EoVJS0V9#{FiD$3MUb&4t59*_F zUZ3u@@k-xLGz^_^@jPP=pJ{#7b?K}W`|>7~bk%a?66`gL+T8v#liUCHajrjIFR&#^ zZ*)|-I7ZnlP1Pg1xW=<->W-$H+hrEsE$l~Mnt#Uov(sitGL~7rS<5R)E!mG5LmWlv zerePahY$G;|qQ~sjC*Zq7x}u3x71I=-YC#8hGO+|Mp6n>f~j?Cfm=J*JO~XgbBxR zH@A^-pZ{3kzkPJyMZaEs;=O}$`76)+iNALLY8A3M6tnGbJMy$cRR{M ztG(S!sf<&&@`kh_^HNZ-!oP3oX+xYAM#$)aKtPHJ*!qd@SZS;Rvissx z0YcMY+!J7}+uyo!FZubY!#QtD_shTz z_u2oz*=ao_OVBaz)6jE%#J6u3Z*W>Xg~QNe8XOJZ$q^HzSS=B!-4hB+{k1BHaUMJJ zz9c{S)IInQXF0h&`->r(w~g6DdyXm>%#9M2jTp=Jz59iFKqKgczkMuuU-42BKid59jU?e>auqoHLQ}5xZ7YNKXR*4yOB{6S3bU$hG2u*0;&DA zVFy;hjMC_=bk)Y+qCAwey`|=v0Y^$*y)~U?B&k~450hRei#G4g0QNy7d^8l zS88PJ$TiCKnxoH9HxUa5s=Am>Nz~%~!&l@@GVbT>rS^F`!`^u*M@CEZdd@WtZY|}| zjdwhr)GzK(q}zYEbaKxn@t+xBop`6yK>yNciF9w-xMfEc3Zt%z=Xj7KL!UjGbS-*rLo1!mh2D6Lj6+s!`SWh%z(`gCXF?jXVf&tIlv)kBx zd7iF6-k9lQrBoIHi+-2y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q5&u)f=l*%JIz2qSHk~4jORer>@89ZlPRdJUECa52!sUe7}Dn~Up);1=+E*9aD7L|Y?tJA2t{n)uO%#qz!*J| zp-=!~w`z2ips!_Q4D%IGM{~qI+}`?IKsJBh7-@jVkKQ72y6y~l3I1zY`B{}KRiFZP z1}Ik>&iW~SsEyWMPXYsX)ku=ZzCr)!#Q@HKo7myjBc_4VM=y!fT^rG19uTgmeI}n# zcyqDGvM4++@K2p+5a^J|b&EWhMW5?n^5Th-(V15gaXT_z(uG3CBPXtU^XS5tjShbF zTA0_x0&x1g31*85>@y(_rl4>~htfL2@7k6GBdGkFfaf}=a}*SSM&g;P6x zz~9SN z%ogJt@R-0dK!&_K0H8qguYitOM!UG|-8?;-uc;k7S=85(+^NnGof`r&ihvOh-}x{* z5c!$j5YA|2*{6|6fa8-c$oj3c8j9k7#@2-?ZuS-y+z1CuOP8`OpInfoN@2|QJbx%q z^Ly&uQ`a8rIOKE6%eVutUcxEA*7x^6I3oy}TZ;vkdC}W*3iPk(gE= - - - - Design Patterns - Command Presentation - - - - - - - - - \ No newline at end of file diff --git a/factory-method/README.md b/factory-method/README.md index 31e2ab98b744..be5ead3e7329 100644 --- a/factory-method/README.md +++ b/factory-method/README.md @@ -69,10 +69,6 @@ Use the Factory Method pattern when * a class wants its subclasses to specify the objects it creates * classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate -## Presentations - -* [Factory Method Pattern](etc/presentation.html) - ## Real world examples * [java.util.Calendar](http://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html#getInstance--) diff --git a/factory-method/etc/diagram1.png b/factory-method/etc/diagram1.png deleted file mode 100644 index fa325edf002a702f3c94e46f488c293df80d1ceb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 59865 zcmZ^L1yGw^*DWnYin|kBic4`TP@qLiaW7Wf-QBG~vEowPCAdqlV!<7P2Y2VD?|Z-b z{<-ttnPiejPtG~}?7j9{`$@zXMHzGy5)?Q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08nRQ|kS1dRi-!RZ zXoj)?N!V1SKO};qOr#YOVy2ZA+IiZHKELTGK)=F?-Bq%<@F1WzJ8inxem;%_%TAup zLXPyV(l}~;3;`y(?3gqZ%0_PtfSW$o8_&jIap0=+$pQ1jFSo->I1f#kO5ImRn)2ap z_C@3vobf~Rg)Kbt5u?eq{c$PbcX&0C>?Bme;6(c4wAy}h9=3m#J*PMS`6-g?gzCss zPgX7t5!%0*+q1C;ITj3uctu+Z;UHe5!IY^2qAuyb=`PE2lUfCB&2#3`@ihym&(Mq; z29wDg9UZ-T=AoZh`y(f==##Fnh`VG-Ny%0HGMpWpC(o>7n_+3a=m^r+zj7H+R6{=U zkxT0oZ*1uv&W6J;CzJf6Q^J3H35J6`{GtkE6%{XP@api9%x;(wqm~Z<8lG?8p4sU9 z<};*e8Xeeloy7(du4i17B*W}l*1@T@zU~SC=fFuL7hR?Q_je6|`M;h!LYMk)v7D$N g{h!JiL~unkW_kMsCxgc^0sf_>22!nl^gQ(c0U0dF2><{9 diff --git a/factory-method/etc/presentation.html b/factory-method/etc/presentation.html deleted file mode 100644 index df520605ad53..000000000000 --- a/factory-method/etc/presentation.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - Design Patterns - Factory Method Presentation - - - - - - - - - \ No newline at end of file diff --git a/hexagonal/README.md b/hexagonal/README.md index 7d27f4b622b8..1e6f897d0297 100644 --- a/hexagonal/README.md +++ b/hexagonal/README.md @@ -29,9 +29,6 @@ Use Hexagonal Architecture pattern when ## Tutorials * [Build Maintainable Systems With Hexagonal Architecture](http://java-design-patterns.com/blog/build-maintainable-systems-with-hexagonal-architecture/) -## Presentations -* [Hexagonal Architecture](https://github.com/iluwatar/java-design-patterns/tree/master/hexagonal/etc/presentation.html) - ## Real world examples * [Apache Isis](https://isis.apache.org/) builds generic UI and REST API directly from the underlying domain objects diff --git a/hexagonal/etc/layers.png b/hexagonal/etc/layers.png deleted file mode 100644 index cb5a9c90bbe953ff87197bfb1834c34fac450f3c..0000000000000000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xLV@t#e*^ z#ubCT8#Q(VDEUtb>IU3>yPqbmLYfKWhHj#hGhg*RFX_w@joWo=9?-O$C)4xHdb8?Z8 z>Z$@C!T6+0-rAJIBuzZ4f;GxQMCm?qb+-Ji^m`3W%n&o|o;P&PY;7#4=SIfhSaoO) zeWFq@&r0S*cZG5kVA?gt1E$p~yjJC!Wj-?=bKWOQK^ifllnza(Z?*P^ir>dbKl6_7 z$~(QXz9>}AnJwb6DH`n0>T3CTMcfgY>eMu{y`nkmg2jCd*jk*3xx4-%|3xi*xfCi* zo22hmboI1yL==k}b~O^d`v-Kgu6hxths zvIGWJjZG#CpTVR!wdnS_|NbC=w^Oom$)BS6cO23sk(s`lCmg8->VAmZPr0G&Pm12- zF!Rc49VpMD*x_fy(7Uz$6>3$lWSVNFQ-JbAVbi@VB2$39kYOXe12yY9AD$r#?Lf0Wy_ zUNOH$z0r;Hv0b!`c0mp9%$BqCGWm9dE`|=xCY71pv)*f~<nMAz z`FLSh(Us0&S};vmi8)QDCrj0L!9J96^A9%+j-ib!TDB5B2_e&$3FnisD}WAq1HMWq Kh}Vc32LC_vUU`lH diff --git a/hexagonal/etc/ports_and_adapters.png b/hexagonal/etc/ports_and_adapters.png deleted file mode 100644 index d285045dea68721c586bbfae5d303265f738eea0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 34860 zcmagFbyQSgxHk$T!XO|F-QC?tcXyW{-5tu%NVl|fcXvw&N+{jZ4Bbde+|4=PiSMqv z*8R)1aAx*?>v?|lMyjdEqP-z}0|y6(CNC$Y0S5FlfqF0m2rn`YbcaVK<&(qmJylY8+mtlrF2i4A zBK>rWJ>pK87dQ|MK~X-}@RZye+dt)d&55=@l;ab_kW$K|yM!j#UePDiU(Lc-t48UH zsdcpPT3pMC_Q%3iSXkHp?Caj1Jtm`&Ut4eVyN5AS=_E!UGl#)>vby8$__af8?m24- z**`v+ac1wr>{OiOzqQ0MDDhWo-`t>SGd4=m6SU9u=y_o-6d_;%@5Y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a2n2^d>pQw%xwv${WTPoUAof@St9YNy&d}vP8I-WX`k(w&^aMhkk(pYZyYs-HNza1 zT=;~L!P%l9DX8;Y0b?J^Qk_*+ed&sCb<;C01mVE}orusCJTTS#R ziDElRsrU}YLoSYeND6U#?_27mvA=P3bpnt35jEJ&Cga_?Jt1!`s^tsv)i)e8+V|>#IZfUSQ0_g*WWJ< zB5p}*4O+_z$?7Bq^5YdS8hiXu?NdwJ6M)b>j*Z336=G?t#BkeZaD)Fzv-IAHM0gLJ z`)^*kb}4519=g>8q4&#!?T9ikS7um{MUNu!t_qXXo#-7d4y#3S=$twrhnufE5V4T( z?Ln2M03Dqq?rd-I2Pm$UEPepIP08YHkYZ-84tGw(AcwkL3{|;%t)2B?yF!A+xhMhhnJaUf>BmS!m|-<w-?L;fq2(jaHg}^1OJh$9goe3<^qQS+Pa5DM!w=ZUjqm5!X;Rk zn*=a#^#qsqc>cgn*1vQOcK$iE^V<1;U(<{+)(>%^xY6ikqr_EJFM*B5J+LE{18Jq* z{ry&ObGF`F)+EA_9)_;p!%oLC2QKi!6;%BHkzid&y6N?|ufe*TZq_5G(3}Cwqt5OA zlmG!YIVyR5@;3{x`yJrdD3fG(wC)`pfh=$8)6d;{st5R6!=d;Mpe38(k$rz0o)zIQUCw| diff --git a/hexagonal/etc/ports_and_adapters.xml b/hexagonal/etc/ports_and_adapters.xml deleted file mode 100644 index 83edb95e02ef..000000000000 --- a/hexagonal/etc/ports_and_adapters.xml +++ /dev/null @@ -1,25 +0,0 @@ - -7Zpdk6I4FIZ/jbdbJAHEyx7nY/diqrqqd2tnLiOJSDUSK6ZHe3/9BkmUfFiDDqBM2TcNBwLxOe85nBOYoPl6/4XjzeorI7SYwIDsJ+jjBEKA4kj+qyzvtWUag9qQ8Zyok06Gl/w/qoyBsr7lhG6NEwVjhcg3pjFlZUlTYdgw52xnnrZkhXnXDc6oY3hJceFa/82JWNXWJApO9j9pnq30nUGgjixw+ppx9laq+00gWh7+6sNrrK+lzt+uMGG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J6Mr20XgF059dcuoD5axWEEoOsRQwDThwAuFECbfvE+Ox5dlxkCSB4CuFAAXbW8vpcRvldRHT4CfAK46WrhKAXQ5quzOxUAdAWAbrpkOEoBuE35E8Eb2Y//XuseVh+CPP1ZR+secvf0dXftkdMn9OjT/w== \ No newline at end of file diff --git a/hexagonal/etc/presentation.html b/hexagonal/etc/presentation.html deleted file mode 100644 index 35aca2bd3edc..000000000000 --- a/hexagonal/etc/presentation.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Title - - - - - - - - - - diff --git a/proxy/README.md b/proxy/README.md index e0628344a931..71eba2280bf4 100644 --- a/proxy/README.md +++ b/proxy/README.md @@ -129,9 +129,6 @@ are several common situations in which the Proxy pattern is applicable ## Tutorials * [Controlling Access With Proxy Pattern](http://java-design-patterns.com/blog/controlling-access-with-proxy-pattern/) -## Presentations -* [Proxy](https://github.com/iluwatar/java-design-patterns/tree/master/proxy/etc/presentation.html) - ## Real world examples * [java.lang.reflect.Proxy](http://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Proxy.html) diff --git a/proxy/etc/presentation.html b/proxy/etc/presentation.html deleted file mode 100644 index 20061c2c7bee..000000000000 --- a/proxy/etc/presentation.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - Title - - - - - - - - - diff --git a/proxy/etc/proxy-concept.png b/proxy/etc/proxy-concept.png deleted file mode 100644 index dac5d954bc58e9c59ded9f3963618d75a95d1b73..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24957 zcmdSBbyU>R*Eb4CiZs$4(%lFG(kV)JgLFyD0HTC+Hz*=VcStxOT_W8n4H84c0QZc) z=ehTNpLPFv?|*l#QP-O9eD^tfpIv9~&o)w1LlNg8#X}?{BphWWxmQR?C{QFMWDHDn z@J-QcZbu{})Fgjx{Ws3OiXIkjuhm_xZJdyh)U~I_YL##UDfEVo_x0A@l!ZH(l3W|w z1%I!b^B$dsZrwCGRN{*lG1nJ76EWUCM`>6Iqu)cZtw6o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zoQ$96lqh(){0@(dGL2d*zZdNAHH5^t6TuDR{tJqgQWIt(dUAMqi(= z-%^YhI(>3D^y5|Xl^`X&c`+RWCkPn{U-wox@E9{Nb+1`%`)`l>{`=9_+nKo-p8qrK z=4t&rQLMi1uUDT}(JXesYp_6Q6__Bkf_Nwz%)=aUyT4p;%^984zd(1XJ5WasCjw1EM6@PT@ZvJ*FI>G~}a|=+EYY20|kOx0$+%@8Uu52`Sj1 ffgSV&XLu(AHP3dMgn(iBl`G0HjmPDW;KBa`X#Lar diff --git a/proxy/etc/proxy-concept.xml b/proxy/etc/proxy-concept.xml deleted file mode 100644 index 14ade9c090eb..000000000000 --- a/proxy/etc/proxy-concept.xml +++ /dev/null @@ -1,25 +0,0 @@ - -7Vhtb5swEP41kbYPnQJuaPexeVv3YVK1aur60YEL8WowM05K+utnYxswkC6p2rSbmkoNfnx3vpfnLsAATZLiC8fZ6huLgA78YVQM0HTg+x4KPPmlkK1GziwQcxIZoRq4Jg9gwKFB1ySC3BEUjFFBMhcMWZpCKBwMc87uXbElo+6pGY6hA1yHmHbRGxKJlUbPR8MavwQSr+zJ3tDsLHB4F3O2Ts15Ax8ty4/eTrC1ZeTzFY7YfQNCswGacMaEvkqKCVCVW5s2rTffsVv5zSEV+yica4UNpmuwHgdUqo4z5Z3YmowEv9fKpXGCeUzSAbqQu8OskP8lWAam8BPBMr132tgTUIgTTEls9ELpG/DapryKzXd5MmkAOJEGx7S7+qpsLHEIFeyqOBZl/KR9yoJ3EAtcrxe/FKtq7UVbVmJZG1txlTLLZRudtzvQJ6WYwlI0crzLdje8PpdfxgMlW9b4ww15wDz6qKU3TLJuT/d8xzF/A1wQ2Z4XmkXTkmdjw6mpdmjMpNSSlt20JJLlaLxkqTDDxfPNeo4TQtVYugS6AWVVlU4kVAkpGak6YZTx8mTbvWicC87uoLEzLD+KahxHRMbb2Juezrz5qIpEuQ/Fzhb1qsaXAxVYAoJvpYhR8M/NrDCz1A6h+3owVeNk5Q4lMxDNMIwr0/VAkBdmJvTPB+vumxoQVTd+B0yP1awR2fQGbFOuHPcf68g8w+lBPSLddnUquPTl9VvlhYmPfJf4fcz3TnuYHzwH8f23TPwrzortO+X/O8oHnkv5s9ERGY/eIuN336VNqCrE/k3wj99SzAL19zw0G70iy7pPHLNCQBrlnQpJ8EI9y8nVgrLwTsYuIZv8QC/nZVmmQzfjMg98+1Phn0Z2eWv3CiIaW3J1awxoDyDqPBu28iq9ZGsegnuLJCTtQTQeq7rpbybYJpMDxYJs3CP7MmzMXTGiWL+jlAi1aqQ9NUrNB8GWHd/7iyEdXsdQWe8qxP0o8PmoFPCaBKiL/tOoVAQodw5v1SeSxn8nzUGkQd37sR85PEYYlkHq8kXN6wjnK4gMLZp0MZTwOpSoZ0mXSE8sPnov/mHF77s12V35lKVQ9izmomd8NOZFKWLWbULs8RPSJcvz/YToEI/CiKD1hqF643AsSsgi4W1DLFMC+eEO1wzTFvfkm1zWb1y1eP1aG83+AA== \ No newline at end of file From 3b1a28149bba38e25de8f2df1a4ffa949865cf12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=C3=B3ra=20D=C3=A9r?= <6597652+leonorader@users.noreply.github.com> Date: Thu, 31 Oct 2019 18:54:13 +0100 Subject: [PATCH 115/197] decrease number of checkstyle errors in singleton, strategy and visitor patterns #1021 (#1054) * fix checkstlye errors - visitor pattern * fix checkstlye errors - strategy pattern * fix checkstlye errors - singleton pattern --- .../main/java/com/iluwatar/singleton/App.java | 52 +++++++++---------- .../iluwatar/singleton/EnumIvoryTower.java | 6 +-- .../InitializingOnDemandHolderIdiom.java | 22 ++++---- .../ThreadSafeDoubleCheckLocking.java | 28 +++++----- .../ThreadSafeLazyLoadedIvoryTower.java | 8 +-- .../java/com/iluwatar/singleton/AppTest.java | 4 +- .../singleton/EnumIvoryTowerTest.java | 4 +- .../InitializingOnDemandHolderIdiomTest.java | 7 +-- .../iluwatar/singleton/IvoryTowerTest.java | 4 +- .../com/iluwatar/singleton/SingletonTest.java | 30 +++++------ .../ThreadSafeDoubleCheckLockingTest.java | 13 ++--- .../ThreadSafeLazyLoadedIvoryTowerTest.java | 7 +-- .../main/java/com/iluwatar/strategy/App.java | 18 +++---- .../com/iluwatar/strategy/DragonSlayer.java | 2 - .../strategy/DragonSlayingStrategy.java | 2 - .../com/iluwatar/strategy/MeleeStrategy.java | 2 - .../iluwatar/strategy/ProjectileStrategy.java | 2 - .../com/iluwatar/strategy/SpellStrategy.java | 2 - .../java/com/iluwatar/strategy/AppTest.java | 4 +- .../iluwatar/strategy/DragonSlayerTest.java | 10 ++-- .../strategy/DragonSlayingStrategyTest.java | 45 ++++++++-------- .../main/java/com/iluwatar/visitor/App.java | 13 +++-- .../java/com/iluwatar/visitor/Commander.java | 4 +- .../iluwatar/visitor/CommanderVisitor.java | 4 +- .../java/com/iluwatar/visitor/Sergeant.java | 4 +- .../com/iluwatar/visitor/SergeantVisitor.java | 4 +- .../java/com/iluwatar/visitor/Soldier.java | 4 +- .../com/iluwatar/visitor/SoldierVisitor.java | 4 +- .../main/java/com/iluwatar/visitor/Unit.java | 4 +- .../com/iluwatar/visitor/UnitVisitor.java | 2 - .../java/com/iluwatar/visitor/AppTest.java | 4 +- .../com/iluwatar/visitor/CommanderTest.java | 4 +- .../visitor/CommanderVisitorTest.java | 4 +- .../com/iluwatar/visitor/SergeantTest.java | 4 +- .../iluwatar/visitor/SergeantVisitorTest.java | 4 +- .../com/iluwatar/visitor/SoldierTest.java | 4 +- .../iluwatar/visitor/SoldierVisitorTest.java | 4 +- .../java/com/iluwatar/visitor/UnitTest.java | 18 +++---- .../com/iluwatar/visitor/VisitorTest.java | 22 ++++---- 39 files changed, 182 insertions(+), 201 deletions(-) diff --git a/singleton/src/main/java/com/iluwatar/singleton/App.java b/singleton/src/main/java/com/iluwatar/singleton/App.java index b085bc8afaab..604b81184674 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/App.java +++ b/singleton/src/main/java/com/iluwatar/singleton/App.java @@ -27,40 +27,40 @@ import org.slf4j.LoggerFactory; /** - * Singleton pattern ensures that the class can have only one existing instance per Java classloader - * instance and provides global access to it. - *

    - * One of the risks of this pattern is that bugs resulting from setting a singleton up in a + *

    Singleton pattern ensures that the class can have only one existing instance per Java + * classloader instance and provides global access to it.

    + * + *

    One of the risks of this pattern is that bugs resulting from setting a singleton up in a * distributed environment can be tricky to debug, since it will work fine if you debug with a * single classloader. Additionally, these problems can crop up a while after the implementation of * a singleton, since they may start out synchronous and only become async with time, so you it may - * not be clear why you are seeing certain changes in behaviour. - *

    - * There are many ways to implement the Singleton. The first one is the eagerly initialized instance - * in {@link IvoryTower}. Eager initialization implies that the implementation is thread safe. If - * you can afford giving up control of the instantiation moment, then this implementation will suit - * you fine. - *

    - * The other option to implement eagerly initialized Singleton is enum based Singleton. The example - * is found in {@link EnumIvoryTower}. At first glance the code looks short and simple. However, you - * should be aware of the downsides including committing to implementation strategy, extending the - * enum class, serializability and restrictions to coding. These are extensively discussed in Stack - * Overflow: + * not be clear why you are seeing certain changes in behaviour.

    + * + *

    There are many ways to implement the Singleton. The first one is the eagerly initialized + * instance in {@link IvoryTower}. Eager initialization implies that the implementation is thread + * safe. If you can afford giving up control of the instantiation moment, then this implementation + * will suit you fine.

    + * + *

    The other option to implement eagerly initialized Singleton is enum based Singleton. The + * example is found in {@link EnumIvoryTower}. At first glance the code looks short and simple. + * However, you should be aware of the downsides including committing to implementation strategy, + * extending the enum class, serializability and restrictions to coding. These are extensively + * discussed in Stack Overflow: * http://programmers.stackexchange.com/questions/179386/what-are-the-downsides-of-implementing - * -a-singleton-with-javas-enum - *

    - * {@link ThreadSafeLazyLoadedIvoryTower} is a Singleton implementation that is initialized on + * -a-singleton-with-javas-enum

    + * + *

    {@link ThreadSafeLazyLoadedIvoryTower} is a Singleton implementation that is initialized on * demand. The downside is that it is very slow to access since the whole access method is - * synchronized. - *

    - * Another Singleton implementation that is initialized on demand is found in + * synchronized.

    + * + *

    Another Singleton implementation that is initialized on demand is found in * {@link ThreadSafeDoubleCheckLocking}. It is somewhat faster than * {@link ThreadSafeLazyLoadedIvoryTower} since it doesn't synchronize the whole access method but - * only the method internals on specific conditions. - *

    - * Yet another way to implement thread safe lazily initialized Singleton can be found in + * only the method internals on specific conditions.

    + * + *

    Yet another way to implement thread safe lazily initialized Singleton can be found in * {@link InitializingOnDemandHolderIdiom}. However, this implementation requires at least Java 8 - * API level to work. + * API level to work.

    */ public class App { diff --git a/singleton/src/main/java/com/iluwatar/singleton/EnumIvoryTower.java b/singleton/src/main/java/com/iluwatar/singleton/EnumIvoryTower.java index 2028b7d76bd4..753201dba177 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/EnumIvoryTower.java +++ b/singleton/src/main/java/com/iluwatar/singleton/EnumIvoryTower.java @@ -24,10 +24,10 @@ package com.iluwatar.singleton; /** - * Enum based singleton implementation. Effective Java 2nd Edition (Joshua Bloch) p. 18 + *

    Enum based singleton implementation. Effective Java 2nd Edition (Joshua Bloch) p. 18

    * - * This implementation is thread safe, however adding any other method and its thread safety - * is developers responsibility. + *

    This implementation is thread safe, however adding any other method and its thread safety + * is developers responsibility.

    */ public enum EnumIvoryTower { diff --git a/singleton/src/main/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiom.java b/singleton/src/main/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiom.java index dfd4951f7726..faf53a63efd2 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiom.java +++ b/singleton/src/main/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiom.java @@ -24,16 +24,16 @@ package com.iluwatar.singleton; /** - * The Initialize-on-demand-holder idiom is a secure way of creating a lazy initialized singleton - * object in Java. - *

    - * The technique is as lazy as possible and works in all known versions of Java. It takes advantage - * of language guarantees about class initialization, and will therefore work correctly in all - * Java-compliant compilers and virtual machines. - *

    - * The inner class is referenced no earlier (and therefore loaded no earlier by the class loader) than - * the moment that getInstance() is called. Thus, this solution is thread-safe without requiring special - * language constructs (i.e. volatile or synchronized). + *

    The Initialize-on-demand-holder idiom is a secure way of creating a lazy initialized singleton + * object in Java.

    + * + *

    The technique is as lazy as possible and works in all known versions of Java. It takes + * advantage of language guarantees about class initialization, and will therefore work correctly + * in all Java-compliant compilers and virtual machines.

    + * + *

    The inner class is referenced no earlier (and therefore loaded no earlier by the class loader) + * than the moment that getInstance() is called. Thus, this solution is thread-safe without + * requiring special language constructs (i.e. volatile or synchronized).

    * */ public final class InitializingOnDemandHolderIdiom { @@ -44,6 +44,8 @@ public final class InitializingOnDemandHolderIdiom { private InitializingOnDemandHolderIdiom() {} /** + * Sigleton instance. + * * @return Singleton instance */ public static InitializingOnDemandHolderIdiom getInstance() { diff --git a/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLocking.java b/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLocking.java index a1ae935a317d..f5d47380f285 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLocking.java +++ b/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLocking.java @@ -24,11 +24,11 @@ package com.iluwatar.singleton; /** - * Double check locking - *

    - * http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html - *

    - * Broken under Java 1.4. + *

    Double check locking.

    + * + *

    http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

    + * + *

    Broken under Java 1.4.

    * * @author mortezaadi@gmail.com */ @@ -60,17 +60,21 @@ public static ThreadSafeDoubleCheckLocking getInstance() { // Joshua Bloch "Effective Java, Second Edition", p. 283-284 var result = instance; - // Check if singleton instance is initialized. If it is initialized then we can return the instance. + // Check if singleton instance is initialized. + // If it is initialized then we can return the instance. if (result == null) { - // It is not initialized but we cannot be sure because some other thread might have initialized it - // in the meanwhile. So to make sure we need to lock on an object to get mutual exclusion. + // It is not initialized but we cannot be sure because some other thread might have + // initialized it in the meanwhile. + // So to make sure we need to lock on an object to get mutual exclusion. synchronized (ThreadSafeDoubleCheckLocking.class) { - // Again assign the instance to local variable to check if it was initialized by some other thread - // while current thread was blocked to enter the locked zone. If it was initialized then we can - // return the previously created instance just like the previous null check. + // Again assign the instance to local variable to check if it was initialized by some + // other thread while current thread was blocked to enter the locked zone. + // If it was initialized then we can return the previously created instance + // just like the previous null check. result = instance; if (result == null) { - // The instance is still not initialized so we can safely (no other thread can enter this zone) + // The instance is still not initialized so we can safely + // (no other thread can enter this zone) // create an instance and make it our singleton instance. instance = result = new ThreadSafeDoubleCheckLocking(); } diff --git a/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTower.java b/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTower.java index 82580acf6896..dd6d05fea433 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTower.java +++ b/singleton/src/main/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTower.java @@ -24,11 +24,11 @@ package com.iluwatar.singleton; /** - * Thread-safe Singleton class. The instance is lazily initialized and thus needs synchronization - * mechanism. + *

    Thread-safe Singleton class. The instance is lazily initialized and thus needs synchronization + * mechanism.

    * - * Note: if created by reflection then a singleton will not be created but multiple options in the - * same classloader + *

    Note: if created by reflection then a singleton will not be created but multiple options + * in the same classloader

    */ public final class ThreadSafeLazyLoadedIvoryTower { diff --git a/singleton/src/test/java/com/iluwatar/singleton/AppTest.java b/singleton/src/test/java/com/iluwatar/singleton/AppTest.java index 66974e47271a..75043eae0bdc 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/AppTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/AppTest.java @@ -26,9 +26,7 @@ import org.junit.jupiter.api.Test; /** - * - * Application test - * + * Application test. */ public class AppTest { diff --git a/singleton/src/test/java/com/iluwatar/singleton/EnumIvoryTowerTest.java b/singleton/src/test/java/com/iluwatar/singleton/EnumIvoryTowerTest.java index 49dfae6b0d1b..6a19ca7526bc 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/EnumIvoryTowerTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/EnumIvoryTowerTest.java @@ -24,14 +24,14 @@ package com.iluwatar.singleton; /** - * Date: 12/29/15 - 19:20 PM + * Date: 12/29/15 - 19:20 PM. * * @author Jeroen Meulemeester */ public class EnumIvoryTowerTest extends SingletonTest { /** - * Create a new singleton test instance using the given 'getInstance' method + * Create a new singleton test instance using the given 'getInstance' method. */ public EnumIvoryTowerTest() { super(() -> EnumIvoryTower.INSTANCE); diff --git a/singleton/src/test/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiomTest.java b/singleton/src/test/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiomTest.java index d7021dac7bdd..e855550129f2 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiomTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiomTest.java @@ -24,14 +24,15 @@ package com.iluwatar.singleton; /** - * Date: 12/29/15 - 19:22 PM + * Date: 12/29/15 - 19:22 PM. * * @author Jeroen Meulemeester */ -public class InitializingOnDemandHolderIdiomTest extends SingletonTest { +public class InitializingOnDemandHolderIdiomTest + extends SingletonTest { /** - * Create a new singleton test instance using the given 'getInstance' method + * Create a new singleton test instance using the given 'getInstance' method. */ public InitializingOnDemandHolderIdiomTest() { super(InitializingOnDemandHolderIdiom::getInstance); diff --git a/singleton/src/test/java/com/iluwatar/singleton/IvoryTowerTest.java b/singleton/src/test/java/com/iluwatar/singleton/IvoryTowerTest.java index ac5a145cbedc..de4dc3a1814a 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/IvoryTowerTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/IvoryTowerTest.java @@ -24,14 +24,14 @@ package com.iluwatar.singleton; /** - * Date: 12/29/15 - 19:23 PM + * Date: 12/29/15 - 19:23 PM. * * @author Jeroen Meulemeester */ public class IvoryTowerTest extends SingletonTest { /** - * Create a new singleton test instance using the given 'getInstance' method + * Create a new singleton test instance using the given 'getInstance' method. */ public IvoryTowerTest() { super(IvoryTower::getInstance); diff --git a/singleton/src/test/java/com/iluwatar/singleton/SingletonTest.java b/singleton/src/test/java/com/iluwatar/singleton/SingletonTest.java index e98796aefa5b..4dc1ecdff589 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/SingletonTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/SingletonTest.java @@ -23,8 +23,10 @@ package com.iluwatar.singleton; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; +import static java.time.Duration.ofMillis; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTimeout; import java.util.ArrayList; import java.util.List; @@ -34,19 +36,17 @@ import java.util.concurrent.Future; import java.util.function.Supplier; -import static java.time.Duration.ofMillis; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTimeout; +import org.junit.jupiter.api.Test; /** - * This class provides several test case that test singleton construction. + *

    This class provides several test case that test singleton construction.

    + * + *

    The first proves that multiple calls to the singleton getInstance object are the same when + * called in the SAME thread. The second proves that multiple calls to the singleton getInstance + * object are the same when called in the DIFFERENT thread.

    * - * The first proves that multiple calls to the singleton getInstance object are the same when called - * in the SAME thread. The second proves that multiple calls to the singleton getInstance object are - * the same when called in the DIFFERENT thread. + *

    Date: 12/29/15 - 19:25 PM

    * - * Date: 12/29/15 - 19:25 PM * @param Supplier method generating singletons * @author Jeroen Meulemeester * @author Richard Jones @@ -54,12 +54,12 @@ public abstract class SingletonTest { /** - * The singleton's getInstance method + * The singleton's getInstance method. */ private final Supplier singletonInstanceMethod; /** - * Create a new singleton test instance using the given 'getInstance' method + * Create a new singleton test instance using the given 'getInstance' method. * * @param singletonInstanceMethod The singleton's getInstance method */ @@ -68,7 +68,7 @@ public SingletonTest(final Supplier singletonInstanceMethod) { } /** - * Test the singleton in a non-concurrent setting + * Test the singleton in a non-concurrent setting. */ @Test public void testMultipleCallsReturnTheSameObjectInSameThread() { @@ -83,7 +83,7 @@ public void testMultipleCallsReturnTheSameObjectInSameThread() { } /** - * Test singleton instance in a concurrent setting + * Test singleton instance in a concurrent setting. */ @Test public void testMultipleCallsReturnTheSameObjectInDifferentThreads() throws Exception { diff --git a/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLockingTest.java b/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLockingTest.java index fff516ad3a2e..8babb081e634 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLockingTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeDoubleCheckLockingTest.java @@ -23,34 +23,35 @@ package com.iluwatar.singleton; -import org.junit.Test; - import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import org.junit.Test; + /** - * Date: 12/29/15 - 19:26 PM + * Date: 12/29/15 - 19:26 PM. * * @author Jeroen Meulemeester */ public class ThreadSafeDoubleCheckLockingTest extends SingletonTest { /** - * Create a new singleton test instance using the given 'getInstance' method + * Create a new singleton test instance using the given 'getInstance' method. */ public ThreadSafeDoubleCheckLockingTest() { super(ThreadSafeDoubleCheckLocking::getInstance); } /** - * Test creating new instance by refection + * Test creating new instance by refection. */ @Test(expected = InvocationTargetException.class) public void testCreatingNewInstanceByRefection() throws Exception { ThreadSafeDoubleCheckLocking instance1 = ThreadSafeDoubleCheckLocking.getInstance(); Constructor constructor = ThreadSafeDoubleCheckLocking.class.getDeclaredConstructor(); constructor.setAccessible(true); - ThreadSafeDoubleCheckLocking instance2 = (ThreadSafeDoubleCheckLocking) constructor.newInstance(null); + ThreadSafeDoubleCheckLocking instance2 = + (ThreadSafeDoubleCheckLocking) constructor.newInstance(null); } } \ No newline at end of file diff --git a/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTowerTest.java b/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTowerTest.java index 7ca1caf3d695..da04722fc5e0 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTowerTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/ThreadSafeLazyLoadedIvoryTowerTest.java @@ -24,14 +24,15 @@ package com.iluwatar.singleton; /** - * Date: 12/29/15 - 19:26 PM + * Date: 12/29/15 - 19:26 PM. * * @author Jeroen Meulemeester */ -public class ThreadSafeLazyLoadedIvoryTowerTest extends SingletonTest { +public class ThreadSafeLazyLoadedIvoryTowerTest + extends SingletonTest { /** - * Create a new singleton test instance using the given 'getInstance' method + * Create a new singleton test instance using the given 'getInstance' method. */ public ThreadSafeLazyLoadedIvoryTowerTest() { super(ThreadSafeLazyLoadedIvoryTower::getInstance); diff --git a/strategy/src/main/java/com/iluwatar/strategy/App.java b/strategy/src/main/java/com/iluwatar/strategy/App.java index c6bd3aa3b85e..c526c791787d 100644 --- a/strategy/src/main/java/com/iluwatar/strategy/App.java +++ b/strategy/src/main/java/com/iluwatar/strategy/App.java @@ -28,15 +28,15 @@ /** * - * The Strategy pattern (also known as the policy pattern) is a software design pattern that enables - * an algorithm's behavior to be selected at runtime. - *

    - * Before Java 8 the Strategies needed to be separate classes forcing the developer + *

    The Strategy pattern (also known as the policy pattern) is a software design pattern that + * enables an algorithm's behavior to be selected at runtime.

    + * + *

    Before Java 8 the Strategies needed to be separate classes forcing the developer * to write lots of boilerplate code. With modern Java it is easy to pass behavior - * with method references and lambdas making the code shorter and more readable. - *

    - * In this example ({@link DragonSlayingStrategy}) encapsulates an algorithm. The containing object - * ({@link DragonSlayer}) can alter its behavior by changing its strategy. + * with method references and lambdas making the code shorter and more readable.

    + * + *

    In this example ({@link DragonSlayingStrategy}) encapsulates an algorithm. The containing + * object ({@link DragonSlayer}) can alter its behavior by changing its strategy.

    * */ public class App { @@ -44,7 +44,7 @@ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point + * Program entry point. * * @param args command line args */ diff --git a/strategy/src/main/java/com/iluwatar/strategy/DragonSlayer.java b/strategy/src/main/java/com/iluwatar/strategy/DragonSlayer.java index 0455edaca98b..f6b91d967aed 100644 --- a/strategy/src/main/java/com/iluwatar/strategy/DragonSlayer.java +++ b/strategy/src/main/java/com/iluwatar/strategy/DragonSlayer.java @@ -24,9 +24,7 @@ package com.iluwatar.strategy; /** - * * DragonSlayer uses different strategies to slay the dragon. - * */ public class DragonSlayer { diff --git a/strategy/src/main/java/com/iluwatar/strategy/DragonSlayingStrategy.java b/strategy/src/main/java/com/iluwatar/strategy/DragonSlayingStrategy.java index eb89523ad402..537b521f4c4d 100644 --- a/strategy/src/main/java/com/iluwatar/strategy/DragonSlayingStrategy.java +++ b/strategy/src/main/java/com/iluwatar/strategy/DragonSlayingStrategy.java @@ -24,9 +24,7 @@ package com.iluwatar.strategy; /** - * * Strategy interface. - * */ @FunctionalInterface public interface DragonSlayingStrategy { diff --git a/strategy/src/main/java/com/iluwatar/strategy/MeleeStrategy.java b/strategy/src/main/java/com/iluwatar/strategy/MeleeStrategy.java index 8cb2f24c12be..12f467b07330 100644 --- a/strategy/src/main/java/com/iluwatar/strategy/MeleeStrategy.java +++ b/strategy/src/main/java/com/iluwatar/strategy/MeleeStrategy.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * * Melee strategy. - * */ public class MeleeStrategy implements DragonSlayingStrategy { diff --git a/strategy/src/main/java/com/iluwatar/strategy/ProjectileStrategy.java b/strategy/src/main/java/com/iluwatar/strategy/ProjectileStrategy.java index 4b6031ddfa21..769b0d7d9815 100644 --- a/strategy/src/main/java/com/iluwatar/strategy/ProjectileStrategy.java +++ b/strategy/src/main/java/com/iluwatar/strategy/ProjectileStrategy.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * * Projectile strategy. - * */ public class ProjectileStrategy implements DragonSlayingStrategy { diff --git a/strategy/src/main/java/com/iluwatar/strategy/SpellStrategy.java b/strategy/src/main/java/com/iluwatar/strategy/SpellStrategy.java index ffe85c7a21f8..dfa47f72b215 100644 --- a/strategy/src/main/java/com/iluwatar/strategy/SpellStrategy.java +++ b/strategy/src/main/java/com/iluwatar/strategy/SpellStrategy.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * * Spell strategy. - * */ public class SpellStrategy implements DragonSlayingStrategy { diff --git a/strategy/src/test/java/com/iluwatar/strategy/AppTest.java b/strategy/src/test/java/com/iluwatar/strategy/AppTest.java index 598085ce4e03..713eecf43bdd 100644 --- a/strategy/src/test/java/com/iluwatar/strategy/AppTest.java +++ b/strategy/src/test/java/com/iluwatar/strategy/AppTest.java @@ -26,9 +26,7 @@ import org.junit.jupiter.api.Test; /** - * - * Application test - * + * Application test. */ public class AppTest { diff --git a/strategy/src/test/java/com/iluwatar/strategy/DragonSlayerTest.java b/strategy/src/test/java/com/iluwatar/strategy/DragonSlayerTest.java index 52dfb3ff19e9..c956126836b4 100644 --- a/strategy/src/test/java/com/iluwatar/strategy/DragonSlayerTest.java +++ b/strategy/src/test/java/com/iluwatar/strategy/DragonSlayerTest.java @@ -23,21 +23,21 @@ package com.iluwatar.strategy; -import org.junit.jupiter.api.Test; - import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; +import org.junit.jupiter.api.Test; + /** - * Date: 12/29/15 - 10:50 PM + * Date: 12/29/15 - 10:50 PM. * * @author Jeroen Meulemeester */ public class DragonSlayerTest { /** - * Verify if the dragon slayer uses the strategy during battle + * Verify if the dragon slayer uses the strategy during battle. */ @Test public void testGoToBattle() { @@ -50,7 +50,7 @@ public void testGoToBattle() { } /** - * Verify if the dragon slayer uses the new strategy during battle after a change of strategy + * Verify if the dragon slayer uses the new strategy during battle after a change of strategy. */ @Test public void testChangeStrategy() { diff --git a/strategy/src/test/java/com/iluwatar/strategy/DragonSlayingStrategyTest.java b/strategy/src/test/java/com/iluwatar/strategy/DragonSlayingStrategyTest.java index 67e4b92cc643..15106cdd9f8d 100644 --- a/strategy/src/test/java/com/iluwatar/strategy/DragonSlayingStrategyTest.java +++ b/strategy/src/test/java/com/iluwatar/strategy/DragonSlayingStrategyTest.java @@ -23,45 +23,48 @@ package com.iluwatar.strategy; +import static org.junit.jupiter.api.Assertions.assertEquals; + import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.AppenderBase; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; -import org.slf4j.LoggerFactory; import java.util.Collection; import java.util.LinkedList; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import org.slf4j.LoggerFactory; /** - * Date: 12/29/15 - 10:58 PM + * Date: 12/29/15 - 10:58 PM. * * @author Jeroen Meulemeester */ public class DragonSlayingStrategyTest { /** + * Assembles test parameters. + * * @return The test parameters for each cycle */ static Collection dataProvider() { - return List.of( - new Object[]{ - new MeleeStrategy(), - "With your Excalibur you sever the dragon's head!" - }, - new Object[]{ - new ProjectileStrategy(), - "You shoot the dragon with the magical crossbow and it falls dead on the ground!" - }, - new Object[]{ - new SpellStrategy(), - "You cast the spell of disintegration and the dragon vaporizes in a pile of dust!" - } + return List.of( + new Object[]{ + new MeleeStrategy(), + "With your Excalibur you sever the dragon's head!" + }, + new Object[]{ + new ProjectileStrategy(), + "You shoot the dragon with the magical crossbow and it falls dead on the ground!" + }, + new Object[]{ + new SpellStrategy(), + "You cast the spell of disintegration and the dragon vaporizes in a pile of dust!" + } ); } @@ -79,7 +82,7 @@ public void tearDown() { /** - * Test if executing the strategy gives the correct response + * Test if executing the strategy gives the correct response. */ @ParameterizedTest @MethodSource("dataProvider") diff --git a/visitor/src/main/java/com/iluwatar/visitor/App.java b/visitor/src/main/java/com/iluwatar/visitor/App.java index 7b33f7e4d6c4..7f0abb0f0f3b 100644 --- a/visitor/src/main/java/com/iluwatar/visitor/App.java +++ b/visitor/src/main/java/com/iluwatar/visitor/App.java @@ -24,19 +24,18 @@ package com.iluwatar.visitor; /** - * - * Visitor pattern defines mechanism to apply operations on nodes in hierarchy. New operations can - * be added without altering the node interface. - *

    - * In this example there is a unit hierarchy beginning from {@link Commander}. This hierarchy is + *

    Visitor pattern defines mechanism to apply operations on nodes in hierarchy. New operations + * can be added without altering the node interface.

    + * + *

    In this example there is a unit hierarchy beginning from {@link Commander}. This hierarchy is * traversed by visitors. {@link SoldierVisitor} applies its operation on {@link Soldier}s, - * {@link SergeantVisitor} on {@link Sergeant}s and so on. + * {@link SergeantVisitor} on {@link Sergeant}s and so on.

    * */ public class App { /** - * Program entry point + * Program entry point. * * @param args command line args */ diff --git a/visitor/src/main/java/com/iluwatar/visitor/Commander.java b/visitor/src/main/java/com/iluwatar/visitor/Commander.java index 938c42f8d0a2..782d0116c650 100644 --- a/visitor/src/main/java/com/iluwatar/visitor/Commander.java +++ b/visitor/src/main/java/com/iluwatar/visitor/Commander.java @@ -24,9 +24,7 @@ package com.iluwatar.visitor; /** - * - * Commander - * + * Commander. */ public class Commander extends Unit { diff --git a/visitor/src/main/java/com/iluwatar/visitor/CommanderVisitor.java b/visitor/src/main/java/com/iluwatar/visitor/CommanderVisitor.java index 19ea5846ecc5..c34c8ed9e36b 100644 --- a/visitor/src/main/java/com/iluwatar/visitor/CommanderVisitor.java +++ b/visitor/src/main/java/com/iluwatar/visitor/CommanderVisitor.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * - * CommanderVisitor - * + * CommanderVisitor. */ public class CommanderVisitor implements UnitVisitor { diff --git a/visitor/src/main/java/com/iluwatar/visitor/Sergeant.java b/visitor/src/main/java/com/iluwatar/visitor/Sergeant.java index 95de257729aa..bdc96892ac89 100644 --- a/visitor/src/main/java/com/iluwatar/visitor/Sergeant.java +++ b/visitor/src/main/java/com/iluwatar/visitor/Sergeant.java @@ -24,9 +24,7 @@ package com.iluwatar.visitor; /** - * - * Sergeant - * + * Sergeant. */ public class Sergeant extends Unit { diff --git a/visitor/src/main/java/com/iluwatar/visitor/SergeantVisitor.java b/visitor/src/main/java/com/iluwatar/visitor/SergeantVisitor.java index fdcdce5cad28..59fb405e58a9 100644 --- a/visitor/src/main/java/com/iluwatar/visitor/SergeantVisitor.java +++ b/visitor/src/main/java/com/iluwatar/visitor/SergeantVisitor.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * - * SergeantVisitor - * + * SergeantVisitor. */ public class SergeantVisitor implements UnitVisitor { diff --git a/visitor/src/main/java/com/iluwatar/visitor/Soldier.java b/visitor/src/main/java/com/iluwatar/visitor/Soldier.java index 7ab4a26b96be..a2a812416040 100644 --- a/visitor/src/main/java/com/iluwatar/visitor/Soldier.java +++ b/visitor/src/main/java/com/iluwatar/visitor/Soldier.java @@ -24,9 +24,7 @@ package com.iluwatar.visitor; /** - * - * Soldier - * + * Soldier. */ public class Soldier extends Unit { diff --git a/visitor/src/main/java/com/iluwatar/visitor/SoldierVisitor.java b/visitor/src/main/java/com/iluwatar/visitor/SoldierVisitor.java index 6585246a0673..1f19a6458f5e 100644 --- a/visitor/src/main/java/com/iluwatar/visitor/SoldierVisitor.java +++ b/visitor/src/main/java/com/iluwatar/visitor/SoldierVisitor.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * - * SoldierVisitor - * + * SoldierVisitor. */ public class SoldierVisitor implements UnitVisitor { diff --git a/visitor/src/main/java/com/iluwatar/visitor/Unit.java b/visitor/src/main/java/com/iluwatar/visitor/Unit.java index 49ddb8a899d4..318e84262f7a 100644 --- a/visitor/src/main/java/com/iluwatar/visitor/Unit.java +++ b/visitor/src/main/java/com/iluwatar/visitor/Unit.java @@ -24,9 +24,7 @@ package com.iluwatar.visitor; /** - * * Interface for the nodes in hierarchy. - * */ public abstract class Unit { @@ -37,7 +35,7 @@ public Unit(Unit... children) { } /** - * Accept visitor + * Accept visitor. */ public void accept(UnitVisitor visitor) { for (var child : children) { diff --git a/visitor/src/main/java/com/iluwatar/visitor/UnitVisitor.java b/visitor/src/main/java/com/iluwatar/visitor/UnitVisitor.java index 086075e5e24d..8300fd1fe381 100644 --- a/visitor/src/main/java/com/iluwatar/visitor/UnitVisitor.java +++ b/visitor/src/main/java/com/iluwatar/visitor/UnitVisitor.java @@ -24,9 +24,7 @@ package com.iluwatar.visitor; /** - * * Visitor interface. - * */ public interface UnitVisitor { diff --git a/visitor/src/test/java/com/iluwatar/visitor/AppTest.java b/visitor/src/test/java/com/iluwatar/visitor/AppTest.java index fb2fdd1233bc..45804a9c6f48 100644 --- a/visitor/src/test/java/com/iluwatar/visitor/AppTest.java +++ b/visitor/src/test/java/com/iluwatar/visitor/AppTest.java @@ -26,9 +26,7 @@ import org.junit.jupiter.api.Test; /** - * - * Application test - * + * Application test. */ public class AppTest { diff --git a/visitor/src/test/java/com/iluwatar/visitor/CommanderTest.java b/visitor/src/test/java/com/iluwatar/visitor/CommanderTest.java index f3cf823fce5d..256a0cdbdd39 100644 --- a/visitor/src/test/java/com/iluwatar/visitor/CommanderTest.java +++ b/visitor/src/test/java/com/iluwatar/visitor/CommanderTest.java @@ -27,14 +27,14 @@ import static org.mockito.Mockito.verify; /** - * Date: 12/30/15 - 19:45 PM + * Date: 12/30/15 - 19:45 PM. * * @author Jeroen Meulemeester */ public class CommanderTest extends UnitTest { /** - * Create a new test instance for the given {@link Commander} + * Create a new test instance for the given {@link Commander}. */ public CommanderTest() { super(Commander::new); diff --git a/visitor/src/test/java/com/iluwatar/visitor/CommanderVisitorTest.java b/visitor/src/test/java/com/iluwatar/visitor/CommanderVisitorTest.java index ed46ac90a592..935baa58d4fb 100644 --- a/visitor/src/test/java/com/iluwatar/visitor/CommanderVisitorTest.java +++ b/visitor/src/test/java/com/iluwatar/visitor/CommanderVisitorTest.java @@ -26,14 +26,14 @@ import java.util.Optional; /** - * Date: 12/30/15 - 18:43 PM + * Date: 12/30/15 - 18:43 PM. * * @author Jeroen Meulemeester */ public class CommanderVisitorTest extends VisitorTest { /** - * Create a new test instance for the given visitor + * Create a new test instance for the given visitor. */ public CommanderVisitorTest() { super( diff --git a/visitor/src/test/java/com/iluwatar/visitor/SergeantTest.java b/visitor/src/test/java/com/iluwatar/visitor/SergeantTest.java index b2e3d5baf68e..fd977f2bc439 100644 --- a/visitor/src/test/java/com/iluwatar/visitor/SergeantTest.java +++ b/visitor/src/test/java/com/iluwatar/visitor/SergeantTest.java @@ -27,14 +27,14 @@ import static org.mockito.Mockito.verify; /** - * Date: 12/30/15 - 19:45 PM + * Date: 12/30/15 - 19:45 PM. * * @author Jeroen Meulemeester */ public class SergeantTest extends UnitTest { /** - * Create a new test instance for the given {@link Sergeant} + * Create a new test instance for the given {@link Sergeant}. */ public SergeantTest() { super(Sergeant::new); diff --git a/visitor/src/test/java/com/iluwatar/visitor/SergeantVisitorTest.java b/visitor/src/test/java/com/iluwatar/visitor/SergeantVisitorTest.java index f7595b429003..05eae49f22f9 100644 --- a/visitor/src/test/java/com/iluwatar/visitor/SergeantVisitorTest.java +++ b/visitor/src/test/java/com/iluwatar/visitor/SergeantVisitorTest.java @@ -26,14 +26,14 @@ import java.util.Optional; /** - * Date: 12/30/15 - 18:36 PM + * Date: 12/30/15 - 18:36 PM. * * @author Jeroen Meulemeester */ public class SergeantVisitorTest extends VisitorTest { /** - * Create a new test instance for the given visitor + * Create a new test instance for the given visitor. */ public SergeantVisitorTest() { super( diff --git a/visitor/src/test/java/com/iluwatar/visitor/SoldierTest.java b/visitor/src/test/java/com/iluwatar/visitor/SoldierTest.java index 713b190e2d5e..3d2c7698f439 100644 --- a/visitor/src/test/java/com/iluwatar/visitor/SoldierTest.java +++ b/visitor/src/test/java/com/iluwatar/visitor/SoldierTest.java @@ -27,14 +27,14 @@ import static org.mockito.Mockito.verify; /** - * Date: 12/30/15 - 19:45 PM + * Date: 12/30/15 - 19:45 PM. * * @author Jeroen Meulemeester */ public class SoldierTest extends UnitTest { /** - * Create a new test instance for the given {@link Soldier} + * Create a new test instance for the given {@link Soldier}. */ public SoldierTest() { super(Soldier::new); diff --git a/visitor/src/test/java/com/iluwatar/visitor/SoldierVisitorTest.java b/visitor/src/test/java/com/iluwatar/visitor/SoldierVisitorTest.java index e5572f1ee8c9..653d814c5878 100644 --- a/visitor/src/test/java/com/iluwatar/visitor/SoldierVisitorTest.java +++ b/visitor/src/test/java/com/iluwatar/visitor/SoldierVisitorTest.java @@ -26,14 +26,14 @@ import java.util.Optional; /** - * Date: 12/30/15 - 18:59 PM + * Date: 12/30/15 - 18:59 PM. * * @author Jeroen Meulemeester */ public class SoldierVisitorTest extends VisitorTest { /** - * Create a new test instance for the given visitor + * Create a new test instance for the given visitor. */ public SoldierVisitorTest() { super( diff --git a/visitor/src/test/java/com/iluwatar/visitor/UnitTest.java b/visitor/src/test/java/com/iluwatar/visitor/UnitTest.java index 4441570d4dfb..7385ea5a7bd3 100644 --- a/visitor/src/test/java/com/iluwatar/visitor/UnitTest.java +++ b/visitor/src/test/java/com/iluwatar/visitor/UnitTest.java @@ -23,18 +23,18 @@ package com.iluwatar.visitor; -import org.junit.jupiter.api.Test; - -import java.util.Arrays; -import java.util.function.Function; - import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; +import java.util.Arrays; +import java.util.function.Function; + +import org.junit.jupiter.api.Test; + /** - * Date: 12/30/15 - 18:59 PM + * Date: 12/30/15 - 18:59 PM. * Test related to Units * @param Type of Unit * @author Jeroen Meulemeester @@ -42,12 +42,12 @@ public abstract class UnitTest { /** - * Factory to create new instances of the tested unit + * Factory to create new instances of the tested unit. */ private final Function factory; /** - * Create a new test instance for the given unit type {@link U} + * Create a new test instance for the given unit type {@link U}. * * @param factory Factory to create new instances of the tested unit */ @@ -74,7 +74,7 @@ public void testAccept() { } /** - * Verify if the correct visit method is called on the mock, depending on the tested instance + * Verify if the correct visit method is called on the mock, depending on the tested instance. * * @param unit The tested unit instance * @param mockedVisitor The mocked {@link UnitVisitor} who should have gotten a visit by the unit diff --git a/visitor/src/test/java/com/iluwatar/visitor/VisitorTest.java b/visitor/src/test/java/com/iluwatar/visitor/VisitorTest.java index c50c3822d284..3c458f6f4c85 100644 --- a/visitor/src/test/java/com/iluwatar/visitor/VisitorTest.java +++ b/visitor/src/test/java/com/iluwatar/visitor/VisitorTest.java @@ -23,6 +23,8 @@ package com.iluwatar.visitor; +import static org.junit.jupiter.api.Assertions.assertEquals; + import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.AppenderBase; @@ -35,10 +37,8 @@ import org.junit.jupiter.api.Test; import org.slf4j.LoggerFactory; -import static org.junit.jupiter.api.Assertions.assertEquals; - /** - * Date: 12/30/15 - 18:59 PM + * Date: 12/30/15 - 18:59 PM. * Test case for Visitor Pattern * @param Type of UnitVisitor * @author Jeroen Meulemeester @@ -58,34 +58,36 @@ public void tearDown() { } /** - * The tested visitor instance + * The tested visitor instance. */ private final V visitor; /** - * The optional expected response when being visited by a commander + * The optional expected response when being visited by a commander. */ private final Optional commanderResponse; /** - * The optional expected response when being visited by a sergeant + * The optional expected response when being visited by a sergeant. */ private final Optional sergeantResponse; /** - * The optional expected response when being visited by a soldier + * The optional expected response when being visited by a soldier. */ private final Optional soldierResponse; /** - * Create a new test instance for the given visitor + * Create a new test instance for the given visitor. * * @param commanderResponse The optional expected response when being visited by a commander * @param sergeantResponse The optional expected response when being visited by a sergeant * @param soldierResponse The optional expected response when being visited by a soldier */ - public VisitorTest(final V visitor, final Optional commanderResponse, - final Optional sergeantResponse, final Optional soldierResponse) { + public VisitorTest(final V visitor, + final Optional commanderResponse, + final Optional sergeantResponse, + final Optional soldierResponse) { this.visitor = visitor; this.commanderResponse = commanderResponse; From 55b0341c8dc28ab84412d535bee9ecbb461fa081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Thu, 31 Oct 2019 20:01:39 +0200 Subject: [PATCH 116/197] Fix remaining Checkstyle errors for Singleton --- .../iluwatar/singleton/InitializingOnDemandHolderIdiom.java | 3 ++- singleton/src/main/java/com/iluwatar/singleton/IvoryTower.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/singleton/src/main/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiom.java b/singleton/src/main/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiom.java index faf53a63efd2..205a7bd80bfc 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiom.java +++ b/singleton/src/main/java/com/iluwatar/singleton/InitializingOnDemandHolderIdiom.java @@ -41,7 +41,8 @@ public final class InitializingOnDemandHolderIdiom { /** * Private constructor. */ - private InitializingOnDemandHolderIdiom() {} + private InitializingOnDemandHolderIdiom() { + } /** * Sigleton instance. diff --git a/singleton/src/main/java/com/iluwatar/singleton/IvoryTower.java b/singleton/src/main/java/com/iluwatar/singleton/IvoryTower.java index c8d551404c8b..0bc3af28b2f4 100644 --- a/singleton/src/main/java/com/iluwatar/singleton/IvoryTower.java +++ b/singleton/src/main/java/com/iluwatar/singleton/IvoryTower.java @@ -31,7 +31,8 @@ public final class IvoryTower { /** * Private constructor so nobody can instantiate the class. */ - private IvoryTower() {} + private IvoryTower() { + } /** * Static to class instance of the class. From 1d4a7681e2d8699457c557fbab3d69d5f8aa105b Mon Sep 17 00:00:00 2001 From: Arpit Jain Date: Fri, 1 Nov 2019 23:31:30 +0530 Subject: [PATCH 117/197] Fix for Issue #549 : Add Fallbacks in Aggregator Service (#971) * Fix for Issue##549 Catch ClientProtocolException and Update Error Logs * Fix indentation, checkstyle errors * Fix for Issue #549 Add fallbacks in Aggregator service when other microservices fail * Make ProductInventoryClientImpl return null instead of zero in case of failure --- .../aggregator/microservices/Aggregator.java | 18 ++++++++++++++++-- .../microservices/ProductInventoryClient.java | 2 +- .../ProductInventoryClientImpl.java | 10 +++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java index e96ac9d43c2c..dbed50fc6610 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/Aggregator.java @@ -51,9 +51,23 @@ public class Aggregator { */ @RequestMapping(path = "/product", method = RequestMethod.GET) public Product getProduct() { + var product = new Product(); - product.setTitle(informationClient.getProductTitle()); - product.setProductInventories(inventoryClient.getProductInventories()); + String productTitle = informationClient.getProductTitle(); + Integer productInventory = inventoryClient.getProductInventories(); + + if (productTitle != null) { + product.setTitle(productTitle); + } else { + product.setTitle("Error: Fetching Product Title Failed"); //Fallback to error message + } + + if (productInventory != null) { + product.setProductInventories(productInventory); + } else { + product.setProductInventories(-1); //Fallback to default error inventory + } + return product; } diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClient.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClient.java index ed325be0070f..22369350a203 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClient.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClient.java @@ -28,5 +28,5 @@ */ public interface ProductInventoryClient { - int getProductInventories(); + Integer getProductInventories(); } diff --git a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java index c43fe84c61ca..fcd824de7aca 100644 --- a/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java +++ b/aggregator-microservices/aggregator-service/src/main/java/com/iluwatar/aggregator/microservices/ProductInventoryClientImpl.java @@ -42,8 +42,8 @@ public class ProductInventoryClientImpl implements ProductInventoryClient { private static final Logger LOGGER = LoggerFactory.getLogger(ProductInventoryClientImpl.class); @Override - public int getProductInventories() { - var response = "0"; + public Integer getProductInventories() { + var response = ""; var request = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:51516/inventories")).build(); var client = HttpClient.newHttpClient(); @@ -55,6 +55,10 @@ public int getProductInventories() { } catch (InterruptedException ie) { LOGGER.error("InterruptedException Occurred", ie); } - return Integer.parseInt(response); + if("".equalsIgnoreCase(response)) { + return null; + } else { + return Integer.parseInt(response); + } } } From a8c77717842bf0b0cf3006caacf3308e1ceb7866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Fri, 1 Nov 2019 20:23:01 +0200 Subject: [PATCH 118/197] #1021 style changes for Specification --- .../com/iluwatar/specification/app/App.java | 33 ++++++++++--------- .../creature/AbstractCreature.java | 4 +-- .../specification/creature/Creature.java | 2 -- .../specification/creature/Dragon.java | 2 -- .../specification/creature/Goblin.java | 2 -- .../specification/creature/KillerBee.java | 2 -- .../specification/creature/Octopus.java | 2 -- .../specification/creature/Shark.java | 2 -- .../specification/creature/Troll.java | 2 -- .../specification/property/Color.java | 4 +-- .../specification/property/Movement.java | 2 -- .../iluwatar/specification/property/Size.java | 2 -- .../specification/selector/ColorSelector.java | 11 +++---- .../selector/MovementSelector.java | 11 +++---- .../specification/selector/SizeSelector.java | 11 +++---- 15 files changed, 32 insertions(+), 60 deletions(-) diff --git a/specification/src/main/java/com/iluwatar/specification/app/App.java b/specification/src/main/java/com/iluwatar/specification/app/App.java index 00b37181438c..8ca7283c9216 100644 --- a/specification/src/main/java/com/iluwatar/specification/app/App.java +++ b/specification/src/main/java/com/iluwatar/specification/app/App.java @@ -23,41 +23,44 @@ package com.iluwatar.specification.app; -import com.iluwatar.specification.creature.*; +import com.iluwatar.specification.creature.Creature; +import com.iluwatar.specification.creature.Dragon; +import com.iluwatar.specification.creature.Goblin; +import com.iluwatar.specification.creature.KillerBee; +import com.iluwatar.specification.creature.Octopus; +import com.iluwatar.specification.creature.Shark; +import com.iluwatar.specification.creature.Troll; import com.iluwatar.specification.property.Color; import com.iluwatar.specification.property.Movement; import com.iluwatar.specification.selector.ColorSelector; import com.iluwatar.specification.selector.MovementSelector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.List; import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * - * The central idea of the Specification pattern is to separate the statement of how to match a + *

    The central idea of the Specification pattern is to separate the statement of how to match a * candidate, from the candidate object that it is matched against. As well as its usefulness in - * selection, it is also valuable for validation and for building to order. - *

    - * In this example we have a pool of creatures with different properties. We then have defined + * selection, it is also valuable for validation and for building to order.

    + * + *

    In this example we have a pool of creatures with different properties. We then have defined * separate selection rules (Specifications) that we apply to the collection and as output receive - * only the creatures that match the selection criteria. - *

    - * http://martinfowler.com/apsupp/spec.pdf + * only the creatures that match the selection criteria.

    * + *

    http://martinfowler.com/apsupp/spec.pdf

    */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point + * Program entry point. */ public static void main(String[] args) { // initialize creatures list - List creatures = - List.of(new Goblin(), new Octopus(), new Dragon(), new Shark(), new Troll(), new KillerBee()); + List creatures = List.of(new Goblin(), new Octopus(), new Dragon(), new Shark(), + new Troll(), new KillerBee()); // find all walking creatures LOGGER.info("Find all walking creatures"); List walkingCreatures = diff --git a/specification/src/main/java/com/iluwatar/specification/creature/AbstractCreature.java b/specification/src/main/java/com/iluwatar/specification/creature/AbstractCreature.java index 566885560c7e..de7a41417efa 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/AbstractCreature.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/AbstractCreature.java @@ -28,9 +28,7 @@ import com.iluwatar.specification.property.Size; /** - * * Base class for concrete creatures. - * */ public abstract class AbstractCreature implements Creature { @@ -40,7 +38,7 @@ public abstract class AbstractCreature implements Creature { private Color color; /** - * Constructor + * Constructor. */ public AbstractCreature(String name, Size size, Movement movement, Color color) { this.name = name; diff --git a/specification/src/main/java/com/iluwatar/specification/creature/Creature.java b/specification/src/main/java/com/iluwatar/specification/creature/Creature.java index c999f546d928..3f8ccdfdb259 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/Creature.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/Creature.java @@ -28,9 +28,7 @@ import com.iluwatar.specification.property.Size; /** - * * Creature interface. - * */ public interface Creature { diff --git a/specification/src/main/java/com/iluwatar/specification/creature/Dragon.java b/specification/src/main/java/com/iluwatar/specification/creature/Dragon.java index 833b8522b866..d4f5a7f23164 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/Dragon.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/Dragon.java @@ -28,9 +28,7 @@ import com.iluwatar.specification.property.Size; /** - * * Dragon creature. - * */ public class Dragon extends AbstractCreature { diff --git a/specification/src/main/java/com/iluwatar/specification/creature/Goblin.java b/specification/src/main/java/com/iluwatar/specification/creature/Goblin.java index 0153e21fe7e0..0b145b737b87 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/Goblin.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/Goblin.java @@ -28,9 +28,7 @@ import com.iluwatar.specification.property.Size; /** - * * Goblin creature. - * */ public class Goblin extends AbstractCreature { diff --git a/specification/src/main/java/com/iluwatar/specification/creature/KillerBee.java b/specification/src/main/java/com/iluwatar/specification/creature/KillerBee.java index 04c416b7abe2..77f32c9f48ba 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/KillerBee.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/KillerBee.java @@ -28,9 +28,7 @@ import com.iluwatar.specification.property.Size; /** - * * KillerBee creature. - * */ public class KillerBee extends AbstractCreature { diff --git a/specification/src/main/java/com/iluwatar/specification/creature/Octopus.java b/specification/src/main/java/com/iluwatar/specification/creature/Octopus.java index bb2c5718b8de..6958f7fbd658 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/Octopus.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/Octopus.java @@ -28,9 +28,7 @@ import com.iluwatar.specification.property.Size; /** - * * Octopus creature. - * */ public class Octopus extends AbstractCreature { diff --git a/specification/src/main/java/com/iluwatar/specification/creature/Shark.java b/specification/src/main/java/com/iluwatar/specification/creature/Shark.java index 56ec1651aa4b..b9e161da43ee 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/Shark.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/Shark.java @@ -28,9 +28,7 @@ import com.iluwatar.specification.property.Size; /** - * * Shark creature. - * */ public class Shark extends AbstractCreature { diff --git a/specification/src/main/java/com/iluwatar/specification/creature/Troll.java b/specification/src/main/java/com/iluwatar/specification/creature/Troll.java index 1d6a79bb8296..3f416bdd1ed3 100644 --- a/specification/src/main/java/com/iluwatar/specification/creature/Troll.java +++ b/specification/src/main/java/com/iluwatar/specification/creature/Troll.java @@ -28,9 +28,7 @@ import com.iluwatar.specification.property.Size; /** - * * Troll creature. - * */ public class Troll extends AbstractCreature { diff --git a/specification/src/main/java/com/iluwatar/specification/property/Color.java b/specification/src/main/java/com/iluwatar/specification/property/Color.java index 9f64e1b77b2e..00f7007ff713 100644 --- a/specification/src/main/java/com/iluwatar/specification/property/Color.java +++ b/specification/src/main/java/com/iluwatar/specification/property/Color.java @@ -24,9 +24,7 @@ package com.iluwatar.specification.property; /** - * - * Color property. - * + *

    Color property.

    */ public enum Color { diff --git a/specification/src/main/java/com/iluwatar/specification/property/Movement.java b/specification/src/main/java/com/iluwatar/specification/property/Movement.java index 5bf0863e4ed2..f76b0584f35d 100644 --- a/specification/src/main/java/com/iluwatar/specification/property/Movement.java +++ b/specification/src/main/java/com/iluwatar/specification/property/Movement.java @@ -24,9 +24,7 @@ package com.iluwatar.specification.property; /** - * * Movement property. - * */ public enum Movement { diff --git a/specification/src/main/java/com/iluwatar/specification/property/Size.java b/specification/src/main/java/com/iluwatar/specification/property/Size.java index a4a09e96c798..27bc48024fb9 100644 --- a/specification/src/main/java/com/iluwatar/specification/property/Size.java +++ b/specification/src/main/java/com/iluwatar/specification/property/Size.java @@ -24,9 +24,7 @@ package com.iluwatar.specification.property; /** - * * Size property. - * */ public enum Size { diff --git a/specification/src/main/java/com/iluwatar/specification/selector/ColorSelector.java b/specification/src/main/java/com/iluwatar/specification/selector/ColorSelector.java index 75e922bff0ab..93caf612ff92 100644 --- a/specification/src/main/java/com/iluwatar/specification/selector/ColorSelector.java +++ b/specification/src/main/java/com/iluwatar/specification/selector/ColorSelector.java @@ -23,26 +23,23 @@ package com.iluwatar.specification.selector; -import java.util.function.Predicate; - import com.iluwatar.specification.creature.Creature; import com.iluwatar.specification.property.Color; +import java.util.function.Predicate; /** - * * Color selector. - * */ public class ColorSelector implements Predicate { - private final Color c; + private final Color color; public ColorSelector(Color c) { - this.c = c; + this.color = c; } @Override public boolean test(Creature t) { - return t.getColor().equals(c); + return t.getColor().equals(color); } } diff --git a/specification/src/main/java/com/iluwatar/specification/selector/MovementSelector.java b/specification/src/main/java/com/iluwatar/specification/selector/MovementSelector.java index 19613dfeddb7..1818058c15d8 100644 --- a/specification/src/main/java/com/iluwatar/specification/selector/MovementSelector.java +++ b/specification/src/main/java/com/iluwatar/specification/selector/MovementSelector.java @@ -23,26 +23,23 @@ package com.iluwatar.specification.selector; -import java.util.function.Predicate; - import com.iluwatar.specification.creature.Creature; import com.iluwatar.specification.property.Movement; +import java.util.function.Predicate; /** - * * Movement selector. - * */ public class MovementSelector implements Predicate { - private final Movement m; + private final Movement movement; public MovementSelector(Movement m) { - this.m = m; + this.movement = m; } @Override public boolean test(Creature t) { - return t.getMovement().equals(m); + return t.getMovement().equals(movement); } } diff --git a/specification/src/main/java/com/iluwatar/specification/selector/SizeSelector.java b/specification/src/main/java/com/iluwatar/specification/selector/SizeSelector.java index 1d561e95cff1..a997c034239d 100644 --- a/specification/src/main/java/com/iluwatar/specification/selector/SizeSelector.java +++ b/specification/src/main/java/com/iluwatar/specification/selector/SizeSelector.java @@ -23,26 +23,23 @@ package com.iluwatar.specification.selector; -import java.util.function.Predicate; - import com.iluwatar.specification.creature.Creature; import com.iluwatar.specification.property.Size; +import java.util.function.Predicate; /** - * * Size selector. - * */ public class SizeSelector implements Predicate { - private final Size s; + private final Size size; public SizeSelector(Size s) { - this.s = s; + this.size = s; } @Override public boolean test(Creature t) { - return t.getSize().equals(s); + return t.getSize().equals(size); } } From 768e6471085635c66c8128b100e628e9fcdae29b Mon Sep 17 00:00:00 2001 From: Besok Date: Sat, 2 Nov 2019 11:29:52 +0000 Subject: [PATCH 119/197] add saga init dsc --- pom.xml | 2 + saga/README.md | 45 +++++++++++ saga/pom.xml | 44 +++++++++++ stirring-clicker/pom.xml | 28 +++++++ .../ie/home/besok/stirrings/Application.java | 15 ++++ .../java/ie/home/besok/stirrings/Counter.java | 14 ++++ .../ie/home/besok/stirrings/FileStorage.java | 37 +++++++++ .../java/ie/home/besok/stirrings/Gui.java | 73 ++++++++++++++++++ stirring-clicker/src/main/resources/1.png | Bin 0 -> 4434 bytes stirring-clicker/src/main/resources/2.jpg | Bin 0 -> 3603 bytes stirring-clicker/src/main/resources/3.jpg | Bin 0 -> 2903 bytes .../home/besok/stirrings/FileStorageTest.java | 25 ++++++ 12 files changed, 283 insertions(+) create mode 100644 saga/README.md create mode 100644 saga/pom.xml create mode 100644 stirring-clicker/pom.xml create mode 100644 stirring-clicker/src/main/java/ie/home/besok/stirrings/Application.java create mode 100644 stirring-clicker/src/main/java/ie/home/besok/stirrings/Counter.java create mode 100644 stirring-clicker/src/main/java/ie/home/besok/stirrings/FileStorage.java create mode 100644 stirring-clicker/src/main/java/ie/home/besok/stirrings/Gui.java create mode 100644 stirring-clicker/src/main/resources/1.png create mode 100644 stirring-clicker/src/main/resources/2.jpg create mode 100644 stirring-clicker/src/main/resources/3.jpg create mode 100644 stirring-clicker/src/test/java/ie/home/besok/stirrings/FileStorageTest.java diff --git a/pom.xml b/pom.xml index 22dedc14a59e..4e8b76c78ab7 100644 --- a/pom.xml +++ b/pom.xml @@ -183,6 +183,8 @@ data-locality subclass-sandbox circuit-breaker + role-object + saga diff --git a/saga/README.md b/saga/README.md new file mode 100644 index 000000000000..12e4c8482396 --- /dev/null +++ b/saga/README.md @@ -0,0 +1,45 @@ +--- +layout: pattern +title: Saga +folder: Communication +permalink: /patterns/saga/ +categories: Behavioral +tags: + - Java + - Difficulty-Expert + - Idiom + - Distributed communication +--- + +## Also known as +This pattern has a similar goal with two-phase commit (XA transaction) + +## Intent +This pattern is used in distributed services to perform a group of operations atomically. +This is an analog of transaction in a database but in terms of microservices architecture this is performed in a distributed environment + +## Explanation +A saga is a sequence of local transactions in a certain context. If one transaction fails for some reason, +the saga executes compensating transactions(rollbacks) to undo the impact of the preceding transactions. +There are two types of Saga: + +- Choreography-Based Saga. +In this approach, there is no central orchestrator. +Each service participating in the Saga performs their transaction and publish events. +The other services act upon those events and perform their transactions. +Also, they may or not publish other events based on the situation. + +- Orchestration-Based Saga +In this approach, there is a Saga orchestrator that manages all the transactions and directs +the participant services to execute local transactions based on events. +This orchestrator can also be though of as a Saga Manager. + +## Applicability +Use the Saga pattern, if: +- you need to perform a group of operations related to different microservices atomically +- you need to rollback changes in different places in case of failure one of the operation +- you need to take care of data consistency in different places including different databases +- you can not use 2PC(two phase commit) + +## Credits +- [pattern description](https://microservices.io/patterns/data/saga.html) \ No newline at end of file diff --git a/saga/pom.xml b/saga/pom.xml new file mode 100644 index 000000000000..26c3312373a2 --- /dev/null +++ b/saga/pom.xml @@ -0,0 +1,44 @@ + + + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.22.0-SNAPSHOT + + + saga + + + junit + junit + test + + + + diff --git a/stirring-clicker/pom.xml b/stirring-clicker/pom.xml new file mode 100644 index 000000000000..b0d223016f24 --- /dev/null +++ b/stirring-clicker/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + ie.home.besok + move-clicker + 1.0 + + 1.8 + 1.8 + + + + + org.projectlombok + lombok + 1.18.10 + + + + junit + junit + 4.12 + + + \ No newline at end of file diff --git a/stirring-clicker/src/main/java/ie/home/besok/stirrings/Application.java b/stirring-clicker/src/main/java/ie/home/besok/stirrings/Application.java new file mode 100644 index 000000000000..0835470bc987 --- /dev/null +++ b/stirring-clicker/src/main/java/ie/home/besok/stirrings/Application.java @@ -0,0 +1,15 @@ +package ie.home.besok.stirrings; + +import java.awt.*; +import java.io.IOException; + +public class Application { + public static void main(String[] args) throws IOException { + FileStorage storage = new FileStorage(); + + EventQueue.invokeLater(() -> { + Gui gui = new Gui(storage); + gui.setVisible(true); + }); + } +} diff --git a/stirring-clicker/src/main/java/ie/home/besok/stirrings/Counter.java b/stirring-clicker/src/main/java/ie/home/besok/stirrings/Counter.java new file mode 100644 index 000000000000..b0f93f9d76c3 --- /dev/null +++ b/stirring-clicker/src/main/java/ie/home/besok/stirrings/Counter.java @@ -0,0 +1,14 @@ +package ie.home.besok.stirrings; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class Counter { + public Map count(List dates){ + return null; + } +} diff --git a/stirring-clicker/src/main/java/ie/home/besok/stirrings/FileStorage.java b/stirring-clicker/src/main/java/ie/home/besok/stirrings/FileStorage.java new file mode 100644 index 000000000000..c5784eb50795 --- /dev/null +++ b/stirring-clicker/src/main/java/ie/home/besok/stirrings/FileStorage.java @@ -0,0 +1,37 @@ +package ie.home.besok.stirrings; + +import lombok.extern.slf4j.Slf4j; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; +import java.time.LocalDateTime; +import java.util.List; + +public class FileStorage { + + private Path file; + + public FileStorage() throws IOException { + this.file = Paths.get("data.log"); + if(!Files.exists(file)){ + Files.createFile(file); + } + } + + public void plus() { + String line = LocalDateTime.now().toString()+System.lineSeparator(); + try { + Files.write(file, line.getBytes(), StandardOpenOption.APPEND); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public List get() throws IOException { + return Files.readAllLines(file); + } + +} diff --git a/stirring-clicker/src/main/java/ie/home/besok/stirrings/Gui.java b/stirring-clicker/src/main/java/ie/home/besok/stirrings/Gui.java new file mode 100644 index 000000000000..3df3e21313b5 --- /dev/null +++ b/stirring-clicker/src/main/java/ie/home/besok/stirrings/Gui.java @@ -0,0 +1,73 @@ +package ie.home.besok.stirrings; + +import javax.imageio.ImageIO; +import javax.swing.*; +import java.awt.*; +import java.io.IOException; +import java.net.URL; + +public class Gui extends JFrame { + + private FileStorage storage; + + public Gui(FileStorage storage) { + this.storage = storage; + try { + createUI(storage); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void createUI(FileStorage storage) throws IOException { + setTitle("Stirring counter"); + setSize(300, 300); + setLocationRelativeTo(null); + + + JButton button = createButton(storage); + JButton graphick = new JButton(); + graphick.setIcon(getIcon("3.jpg")); + + + Container pane = getContentPane(); + GroupLayout gl = new GroupLayout(pane); + pane.setLayout(gl); + + gl.setAutoCreateContainerGaps(true); + + gl.setHorizontalGroup( + gl.createSequentialGroup().addComponent(button).addComponent(graphick) + ); + + gl.setVerticalGroup(gl.createSequentialGroup().addComponent(button).addComponent(graphick)); + + + button.addActionListener((event) -> { + storage.plus(); + try { + JOptionPane.showMessageDialog(null,"","",JOptionPane.INFORMATION_MESSAGE, getIcon("2.jpg")); + } catch (IOException e) { + e.printStackTrace(); + } + }); + + setDefaultCloseOperation(EXIT_ON_CLOSE); + } + + private JButton createButton(FileStorage storage) throws IOException { + ImageIcon babyIcon = getIcon("1.png"); + + JButton button = new JButton(); + + button.setIcon(babyIcon); + return button; + } + + private ImageIcon getIcon(String name) throws IOException { + URL file = this.getClass().getClassLoader().getResource(name); + return new ImageIcon(ImageIO.read(file)); + } + + +} diff --git a/stirring-clicker/src/main/resources/1.png b/stirring-clicker/src/main/resources/1.png new file mode 100644 index 0000000000000000000000000000000000000000..1ff5944d67256918b8cc12d43bda1aadf8040a82 GIT binary patch literal 4434 zcmV-Y5v}ftP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D5a&rmK~#8N?Op3{ z6xADEDinp54uZXb?LesHH*a19?dbIB(}&8+%Hky@C2>iT;>E?qF&u~R-jRxmio-QE zHNlr(ep%u7uOSO8TC_+~6s7y-n{STdGzN;hq4M%_emA^t-#!(`Yp{!V-+fnsM2GbW zw47YGG!88c=a>+0&-`RS*h z9@AgC2BM{+gu3bx0 zVVbC-qN2Dg%XG?~Ios0G(jc7qIEFxrc%7>o_4V~Zm>JW=fIMYDGFGfuK`k&{6AYp@ z<_8xpT##0;UOm8&5U1*6k3BZdF6R=pwY38bJ<-&NW(W>C^vWx*NyM@L6qBNv!t1$`3z(dQ#S2#3QmLb)JRlXg;cDnZT7 z&7RoL0|yQ;yA_OwRz|FHhKa`f`SYofV!Q|ok!Z*yGJ)03)P9rlnK+-1!udc2xf4M~pNJzR&YFklJ;dm0E zP2xAuKBB$oKM1XW>5RYj+H3w2miG2`I@tsx;>(sTa};kQ@}e&g-|y_~%uBdx0}LEQ zKkvBX4qurk4YDj#iW8lTojiHcwzMEw6UigAA^zNR&-uBZRhn>wgeM> zU3%6NSgo%}^f+GsVdl)4qH+mSkh50t*$f=fruC*OCJT=t3E?pTbtg}v_pc^%~+nGZy6mO z)z37k{qMv>{PD*hLKAR3>Fck*4swlJf5|q=%ggmvAaLo@rGPIP@!fadiAlV8@nT?P zWJEtpjgLP1NN-&R*O~REr-1)@wxpy)Kf4Sv2aI=Q3XNkzK%%#N2B^PK+c|UQ#O)O9 z@Htbob#n;lqjba0 z>aEN8_uqf@R&Ma+mtTH7Ha7OGej51o*Iyk~cM*h$G5-1IpToXn1SG9XZw97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BG(%`= z#HCvJC0BupCqRb;BM^;T6^!8hbS%H1sS)dRTeog?6}Ec@L@h!+vvJmw1$@l5apxel z0+t}JtD71S!ixAAp{?uibuxetykcaBrbet$H8(eBmoIn)Bx0tto|~5W`jrIke<~|0 zV|`1E6XW&|6NsmtdWsV-I*5EA|7z+jSmGC1KZ!m8{?LEpG#2OJC+NJd2rOT|oHyUl z?+GSwqg{DOlryzaU>n{(*@hafr(hc;==Q(s@7 zs&A1L;~~KuFC@3f}t$%aP zg0K4!e7H%f`?Vu@Z}MqDGUgk$qm$OHTbFrX&jjH7`SX-+Zgd!TBR`3&cRf8llgXT> z2cP&jb?Q`;x+AK}Co?2fRT+v}nILV~3XZI#PEIqF4$QWbcX-IM9L>dFomt_%_ukW_ zf7Pm05lDY>6r>T$*6;zTZkWGv@bJSA^OjoE;0p^2wfo|t(WvKxhsn_L^0umi4E-u#oU;50M zGu+l*GBPqE;j=Q{=e^#t@&1D}I0`L13Wj}x>-**=mb~K8M;{%4%^s&6UJ^~8z9)*# zdGd##xdb;T&zd!hdr(uF61&9JF=$DY&wc9e?+7_WbG`t<3ey}iAoAAb0u{~qb=2!X)= Y0pTRxRwVqi+W-In07*qoM6N<$g05LsLjV8( literal 0 HcmV?d00001 diff --git a/stirring-clicker/src/main/resources/2.jpg b/stirring-clicker/src/main/resources/2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6220fba24faf9895b96e999a0063de7fef8a8fd2 GIT binary patch literal 3603 zcmbW3c|6qnzsJ90#=bKOgDIwH(IgHTWk}Y_R>>|Q%N)s)A;V0BYzd|9W<-&YFt*6f zgmZLc8OAnaJ*1zpG=`Zmzj4p+{_f-6f9~&h-=ELxug~&$KR?Us^Wly1Xn>53g|!6$ z0)c?*`~vXC0W$zBAh1{Y0pV9c5kWx+L{LmvSV%-dOhQ6jOk7-2N=`;nN>)l-TxOq) ztUOdfK|w-#zv4cqq8wBKx;F_3%pU_06crQ{g-VJ`LjUdHwF0stfG^++2B`xAvLLW5 z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irring-clicker/src/main/resources/3.jpg b/stirring-clicker/src/main/resources/3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f2b5f6443e42014ce3fb1048422fcf2bc6a0e72a GIT binary patch literal 2903 zcmbW22~-p37RSGAvJ(SgQI?3rf`vXSUAsC@6?x#Em@@wG=@i6-p6Q zVu=E6Wf2h&3IW7|MP(Hbgs=z!A(B9VEF|+Lba}p>^UitieKT|J%zVq--<|vYFWe0e zfTi0!ygUF3g#!M_0pMP+8DP+8)rmALa^lo+I4l;Ysiw9>U0YLITT4?*OGj64sg5o| zS4(TD;ZlM=(ZIk!8*gN6NHo?X8W2^BpfJcBEKUQ5(;(_-=@9?t2G;4NWa%z@w!Ajly8iSd7YRWOOXj53mHBp2gZt zOZ0sYtE~(p+FiWku#SxG!2c6mn~oQk(Kr8j~&*1w%*Zc!{#mS z9-dphwtc>5?-%>N+(|jLdA# z-FrE?c|ZPC{IKLvX<7N>in=HDPk(J_eD+&gd&jHJuI|@8gG0k_M@IQ$V5cF8yC*e}Vmrs|RRfP{_~25C9b@b{=zn&|KIB zgM6=Y(aUH>tn$0{{gmh#-W&ODMwN8xeQX{ooOE!WFJ*_UC(#&C#$6c9&MdrG1B1d* zWzd2((ye+81I?WcT|D+ERF?{at{KQ)No3qsp6ciKGmXN`L@dAl(WLtDUtOZ3*-^W) zy7^g153Ai&;i4=7m8=44E)4wA!)7gI(Cj#M2g4Bt6K&__8irZQD)5itW=FvUa%aLS zaE^7UE@9_5BICx!1<8(rNtZFSJ2}~Vz}a^T6i&*X%Vrw$B9t*OuorkCt4O&S_vpVs zu22T&PsacxQ_?^56p~3*EDGnD-Z%0Vlq{TI_IRF?Tk7<0R@^W?HG2nxyp}~Pg2x4{ z2GY>+sOSJugCr9{Qc&w#Q0={>WNLk@EI^EW8Zqr<2v>4eU%ARppjg{rRux}G%01;A zjgO-4dIMQZdBWi55#{EEVDuJwISg8&G_AcWVNfq7`e00^%=@IuW2%TY&rk=q@gnA? znr9r?xeQep0d?2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z@W6UHBV6d-gAr6p~h3QgFs^6RNIrEP5^UbCoS`;~^uyBm3Y0XM&?w?1r z-WruO&q8EHq0(|h_}a?)U5cPJ$|_P0)f7s&gTKn9L*3i=EAF1>=}KTQsN~|~87m_g zwZy8rOvK6+VGNJ5}(B z#ih~hxibgWSZ}v2Fj^I0`%|L2si_dhU@~qfT;i+#R24*C7Biw%c44@zXr3b$G)$X| zAz8UfT`{*M2|^gSNq!uN4XShf=)oaRw^xFm&Uf9nPJQ0kS*6aV`osqmDu93S$x zbO0aZ#RLpGIfe553P{#b6+0tCLXih1rWOIbx_Hz=M6M7-RW~w=GC%Lyfn-rZlsrr9 z!wzS^sBGPc@=b}lAoCqz%=l}o! literal 0 HcmV?d00001 diff --git a/stirring-clicker/src/test/java/ie/home/besok/stirrings/FileStorageTest.java b/stirring-clicker/src/test/java/ie/home/besok/stirrings/FileStorageTest.java new file mode 100644 index 000000000000..1eaaba6d5358 --- /dev/null +++ b/stirring-clicker/src/test/java/ie/home/besok/stirrings/FileStorageTest.java @@ -0,0 +1,25 @@ +package ie.home.besok.stirrings; + +import org.junit.Test; + +import java.io.IOException; +import java.util.List; + +import static org.junit.Assert.*; + +public class FileStorageTest { + + @Test + public void fsTest() throws IOException { + FileStorage fs = new FileStorage(); + List arrs = fs.get(); + int oldSize = arrs.size(); + fs.plus(); + fs.plus(); + fs.plus(); + fs.plus(); + arrs = fs.get(); + int newSize = arrs.size(); + assertEquals(4, newSize - oldSize); + } +} \ No newline at end of file From 564cf1239f22f7b352b8fc2da20a7c9c137a4b4c Mon Sep 17 00:00:00 2001 From: Besok Date: Sat, 2 Nov 2019 11:30:41 +0000 Subject: [PATCH 120/197] add init saga dsc --- stirring-clicker/pom.xml | 28 ------- .../ie/home/besok/stirrings/Application.java | 15 ---- .../java/ie/home/besok/stirrings/Counter.java | 14 ---- .../ie/home/besok/stirrings/FileStorage.java | 37 --------- .../java/ie/home/besok/stirrings/Gui.java | 73 ------------------ stirring-clicker/src/main/resources/1.png | Bin 4434 -> 0 bytes stirring-clicker/src/main/resources/2.jpg | Bin 3603 -> 0 bytes stirring-clicker/src/main/resources/3.jpg | Bin 2903 -> 0 bytes .../home/besok/stirrings/FileStorageTest.java | 25 ------ 9 files changed, 192 deletions(-) delete mode 100644 stirring-clicker/pom.xml delete mode 100644 stirring-clicker/src/main/java/ie/home/besok/stirrings/Application.java delete mode 100644 stirring-clicker/src/main/java/ie/home/besok/stirrings/Counter.java delete mode 100644 stirring-clicker/src/main/java/ie/home/besok/stirrings/FileStorage.java delete mode 100644 stirring-clicker/src/main/java/ie/home/besok/stirrings/Gui.java delete mode 100644 stirring-clicker/src/main/resources/1.png delete mode 100644 stirring-clicker/src/main/resources/2.jpg delete mode 100644 stirring-clicker/src/main/resources/3.jpg delete mode 100644 stirring-clicker/src/test/java/ie/home/besok/stirrings/FileStorageTest.java diff --git a/stirring-clicker/pom.xml b/stirring-clicker/pom.xml deleted file mode 100644 index b0d223016f24..000000000000 --- a/stirring-clicker/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - 4.0.0 - - ie.home.besok - move-clicker - 1.0 - - 1.8 - 1.8 - - - - - org.projectlombok - lombok - 1.18.10 - - - - junit - junit - 4.12 - - - \ No newline at end of file diff --git a/stirring-clicker/src/main/java/ie/home/besok/stirrings/Application.java b/stirring-clicker/src/main/java/ie/home/besok/stirrings/Application.java deleted file mode 100644 index 0835470bc987..000000000000 --- a/stirring-clicker/src/main/java/ie/home/besok/stirrings/Application.java +++ /dev/null @@ -1,15 +0,0 @@ -package ie.home.besok.stirrings; - -import java.awt.*; -import java.io.IOException; - -public class Application { - public static void main(String[] args) throws IOException { - FileStorage storage = new FileStorage(); - - EventQueue.invokeLater(() -> { - Gui gui = new Gui(storage); - gui.setVisible(true); - }); - } -} diff --git a/stirring-clicker/src/main/java/ie/home/besok/stirrings/Counter.java b/stirring-clicker/src/main/java/ie/home/besok/stirrings/Counter.java deleted file mode 100644 index b0f93f9d76c3..000000000000 --- a/stirring-clicker/src/main/java/ie/home/besok/stirrings/Counter.java +++ /dev/null @@ -1,14 +0,0 @@ -package ie.home.besok.stirrings; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -public class Counter { - public Map count(List dates){ - return null; - } -} diff --git a/stirring-clicker/src/main/java/ie/home/besok/stirrings/FileStorage.java b/stirring-clicker/src/main/java/ie/home/besok/stirrings/FileStorage.java deleted file mode 100644 index c5784eb50795..000000000000 --- a/stirring-clicker/src/main/java/ie/home/besok/stirrings/FileStorage.java +++ /dev/null @@ -1,37 +0,0 @@ -package ie.home.besok.stirrings; - -import lombok.extern.slf4j.Slf4j; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardOpenOption; -import java.time.LocalDateTime; -import java.util.List; - -public class FileStorage { - - private Path file; - - public FileStorage() throws IOException { - this.file = Paths.get("data.log"); - if(!Files.exists(file)){ - Files.createFile(file); - } - } - - public void plus() { - String line = LocalDateTime.now().toString()+System.lineSeparator(); - try { - Files.write(file, line.getBytes(), StandardOpenOption.APPEND); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public List get() throws IOException { - return Files.readAllLines(file); - } - -} diff --git a/stirring-clicker/src/main/java/ie/home/besok/stirrings/Gui.java b/stirring-clicker/src/main/java/ie/home/besok/stirrings/Gui.java deleted file mode 100644 index 3df3e21313b5..000000000000 --- a/stirring-clicker/src/main/java/ie/home/besok/stirrings/Gui.java +++ /dev/null @@ -1,73 +0,0 @@ -package ie.home.besok.stirrings; - -import javax.imageio.ImageIO; -import javax.swing.*; -import java.awt.*; -import java.io.IOException; -import java.net.URL; - -public class Gui extends JFrame { - - private FileStorage storage; - - public Gui(FileStorage storage) { - this.storage = storage; - try { - createUI(storage); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private void createUI(FileStorage storage) throws IOException { - setTitle("Stirring counter"); - setSize(300, 300); - setLocationRelativeTo(null); - - - JButton button = createButton(storage); - JButton graphick = new JButton(); - graphick.setIcon(getIcon("3.jpg")); - - - Container pane = getContentPane(); - GroupLayout gl = new GroupLayout(pane); - pane.setLayout(gl); - - gl.setAutoCreateContainerGaps(true); - - gl.setHorizontalGroup( - gl.createSequentialGroup().addComponent(button).addComponent(graphick) - ); - - gl.setVerticalGroup(gl.createSequentialGroup().addComponent(button).addComponent(graphick)); - - - button.addActionListener((event) -> { - storage.plus(); - try { - JOptionPane.showMessageDialog(null,"","",JOptionPane.INFORMATION_MESSAGE, getIcon("2.jpg")); - } catch (IOException e) { - e.printStackTrace(); - } - }); - - setDefaultCloseOperation(EXIT_ON_CLOSE); - } - - private JButton createButton(FileStorage storage) throws IOException { - ImageIcon babyIcon = getIcon("1.png"); - - JButton button = new JButton(); - - button.setIcon(babyIcon); - return button; - } - - private ImageIcon getIcon(String name) throws IOException { - URL file = this.getClass().getClassLoader().getResource(name); - return new ImageIcon(ImageIO.read(file)); - } - - -} diff --git a/stirring-clicker/src/main/resources/1.png b/stirring-clicker/src/main/resources/1.png deleted file mode 100644 index 1ff5944d67256918b8cc12d43bda1aadf8040a82..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4434 zcmV-Y5v}ftP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D5a&rmK~#8N?Op3{ z6xADEDinp54uZXb?LesHH*a19?dbIB(}&8+%Hky@C2>iT;>E?qF&u~R-jRxmio-QE zHNlr(ep%u7uOSO8TC_+~6s7y-n{STdGzN;hq4M%_emA^t-#!(`Yp{!V-+fnsM2GbW zw47YGG!88c=a>+0&-`RS*h z9@AgC2BM{+gu3bx0 zVVbC-qN2Dg%XG?~Ios0G(jc7qIEFxrc%7>o_4V~Zm>JW=fIMYDGFGfuK`k&{6AYp@ z<_8xpT##0;UOm8&5U1*6k3BZdF6R=pwY38bJ<-&NW(W>C^vWx*NyM@L6qBNv!t1$`3z(dQ#S2#3QmLb)JRlXg;cDnZT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F61&9JF=$DY&wc9e?+7_WbG`t<3ey}iAoAAb0u{~qb=2!X)= Y0pTRxRwVqi+W-In07*qoM6N<$g05LsLjV8( diff --git a/stirring-clicker/src/main/resources/2.jpg b/stirring-clicker/src/main/resources/2.jpg deleted file mode 100644 index 6220fba24faf9895b96e999a0063de7fef8a8fd2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3603 zcmbW3c|6qnzsJ90#=bKOgDIwH(IgHTWk}Y_R>>|Q%N)s)A;V0BYzd|9W<-&YFt*6f zgmZLc8OAnaJ*1zpG=`Zmzj4p+{_f-6f9~&h-=ELxug~&$KR?Us^Wly1Xn>53g|!6$ z0)c?*`~vXC0W$zBAh1{Y0pV9c5kWx+L{LmvSV%-dOhQ6jOk7-2N=`;nN>)l-TxOq) ztUOdfK|w-#zv4cqq8wBKx;F_3%pU_06crQ{g-VJ`LjUdHwF0stfG^++2B`xAvLLW5 zh}Q|g0RSY(&vq~2e*{Q?pQDhlh^Ux2ze9}-AOHe`1t8$PtoglT`RxEiR#5Jsj;WBm zgSW7HDD>35tk)tM=PKJ290wQ(-5X)?qGJ2@D=H};I;^R6U7Q7#ns2x@1}o1U{H9(ok(m{^xcH}iAl*1Qc|;X9zV%_`t13Og2Fd%i;CZs zysxSz)zsG2H+*XE=~Vnr z@LyQ}B>P`nvV1N92m}lf-s1uZVEF>eLIe-$2+5f`2z!UhtDm|j0zH@Yy0T4FL)Vd^ za3gF$Y#&08erRnE?LW!>HL&>q7ui3-{+o*mNPt27%>&B?3ngE-+WRdGm$^MB2A>wVPPVi3c-ZJpa0dC{G^F--k7(w_q)Z?}E%K|4bZ7twkw>^T zXV>*L4KIhLmB3*|EN@14Aj$6jrz-^)8keqSAMtS_Q~yS23+{v;m103?NxoZltYcf` z@BCHZ7&3T3yO)&pLCP7-3HDH3&(jqvy3+w+bo1lH*>@>J+~u9iOeFXD=IU4o?N%oJ z89k-RJR&XT!_+&$;wC@XQ*1;g*Ol46SgJy>X6wauw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`7 zrZ17kN9qPvYlNt|+10o7zZuTkLGBOD+b>`B{(k8pyNmbgG zXdeSpnADrmJKzy$woAr~;fys|czW2?Nmh>hCc2L};WFZSi_JkQrFy5B;UW&nDuj{dI^kpqtiSK_-&=iIDWlISeNDoyc z;6*m2@A2JX6E4Jx98<6SR<2R2yB$>JUiCrQMMR}hrP7#xJc2kBzR&k^u4~i11aYu| z3m)I8-1Q)=(<9usXf0QxsI}?eo}{QTC{#45_{R~xHH^j3f1gfmx)#}dQ~9isO-gIS zkUv@00Y#M2Xg@W4=HTGe-PQCEHmb(KOC2>_jgR8Dj$%&XGCsHHbkq#5*0TzdQLBf$yuE~ zUcNaG1#OGcL#RH?r+nh@NjKJonTo`swK{_KsHtD9UfDpIPof)!_Qpq5{mF&BUw`an znl$TJ@(O!~?flYtxCSre@e!0iOzQEopJXs+95TZ*^DC+lk LXche5;*I?spOLmY diff --git a/stirring-clicker/src/main/resources/3.jpg b/stirring-clicker/src/main/resources/3.jpg deleted file mode 100644 index f2b5f6443e42014ce3fb1048422fcf2bc6a0e72a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2903 zcmbW22~-p37RSGAvJ(SgQI?3rf`vXSUAsC@6?x#Em@@wG=@i6-p6Q zVu=E6Wf2h&3IW7|MP(Hbgs=z!A(B9VEF|+Lba}p>^UitieKT|J%zVq--<|vYFWe0e zfTi0!ygUF3g#!M_0pMP+8DP+8)rmALa^lo+I4l;Ysiw9>U0YLITT4?*OGj64sg5o| zS4(TD;ZlM=(ZIk!8*gN6NHo?X8W2^BpfJcBEKUQ5(;(_-=@9?t2G;4NWa%z@w!Ajly8iSd7YRWOOXj53mHBp2gZt zOZ0sYtE~(p+FiWku#SxG!2c6mn~oQk(Kr8j~&*1w%*Zc!{#mS z9-dphwtc>5?-%>N+(|jLdA# z-FrE?c|ZPC{IKLvX<7N>in=HDPk(J_eD+&gd&jHJuI|@8gG0k_M@IQ$V5cF8yC*e}Vmrs|RRfP{_~25C9b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XlP5@qdpHoKzZ`f z(o%ho)=18a%vWLLO~fLtl=^|U0|1X`z=<`I)yM7)c`sdG$A0~?hfa`WDqf^UB-Yul z)jhM!_Pf}**&7RY0t*-1#-J{Yk0*$@fVI0ppy~B!E;Z3qT+KeLPwa2syOSg3Mk?^hG%hN8XMy?qm%!ELtRKIBk@jZNGbJLvwk z=^DQ2udn1boC!m}6>TRU?fmSWiD1Jtw!E~W^t7l+KQA!waILnwlX%^<_kuydmKHiU zpinPld3AC{+WVX5gJq$OgZFb&&RuIXY2nyiZ+WX*ZaG~yKgdmH7%HDL^d+@-WA=SE zm$jneriVGHZFYZlW!Y7I%O$89n=9RRC?1rbd? zsgp*TovHH9OCF6UqIWym1vuYR(|D=7$>trc2wKpG!45^HxI;w0hO4d=xk|TtooCy* zID9J2j$`$oO|ABme(d-xm^+XOgJRlc1|h~w*j(=@=-neKOf1Qx=XAUue$w;Q&gN=_ zkz@~gJ@tz@W6UHBV6d-gAr6p~h3QgFs^6RNIrEP5^UbCoS`;~^uyBm3Y0XM&?w?1r z-WruO&q8EHq0(|h_}a?)U5cPJ$|_P0)f7s&gTKn9L*3i=EAF1>=}KTQsN~|~87m_g zwZy8rOvK6+VGNJ5}(B z#ih~hxibgWSZ}v2Fj^I0`%|L2si_dhU@~qfT;i+#R24*C7Biw%c44@zXr3b$G)$X| zAz8UfT`{*M2|^gSNq!uN4XShf=)oaRw^xFm&Uf9nPJQ0kS*6aV`osqmDu93S$x zbO0aZ#RLpGIfe553P{#b6+0tCLXih1rWOIbx_Hz=M6M7-RW~w=GC%Lyfn-rZlsrr9 z!wzS^sBGPc@=b}lAoCqz%=l}o! diff --git a/stirring-clicker/src/test/java/ie/home/besok/stirrings/FileStorageTest.java b/stirring-clicker/src/test/java/ie/home/besok/stirrings/FileStorageTest.java deleted file mode 100644 index 1eaaba6d5358..000000000000 --- a/stirring-clicker/src/test/java/ie/home/besok/stirrings/FileStorageTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package ie.home.besok.stirrings; - -import org.junit.Test; - -import java.io.IOException; -import java.util.List; - -import static org.junit.Assert.*; - -public class FileStorageTest { - - @Test - public void fsTest() throws IOException { - FileStorage fs = new FileStorage(); - List arrs = fs.get(); - int oldSize = arrs.size(); - fs.plus(); - fs.plus(); - fs.plus(); - fs.plus(); - arrs = fs.get(); - int newSize = arrs.size(); - assertEquals(4, newSize - oldSize); - } -} \ No newline at end of file From 7ac47b291d5cd9d68fd291acdce2ade5297c0701 Mon Sep 17 00:00:00 2001 From: Besok Date: Sat, 2 Nov 2019 11:39:02 +0000 Subject: [PATCH 121/197] add changes to dsc --- saga/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/saga/README.md b/saga/README.md index 12e4c8482396..276f12ee1f37 100644 --- a/saga/README.md +++ b/saga/README.md @@ -16,7 +16,8 @@ This pattern has a similar goal with two-phase commit (XA transaction) ## Intent This pattern is used in distributed services to perform a group of operations atomically. -This is an analog of transaction in a database but in terms of microservices architecture this is performed in a distributed environment +This is an analog of transaction in a database but in terms of microservices architecture this is executed +in a distributed environment ## Explanation A saga is a sequence of local transactions in a certain context. If one transaction fails for some reason, From 0b17abdf11aeb50172c5c52c3596a825f9508bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 2 Nov 2019 14:45:50 +0200 Subject: [PATCH 122/197] #590 Add explanation for Specification pattern --- specification/README.md | 70 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/specification/README.md b/specification/README.md index 564830653d7f..a72e253d7e9b 100644 --- a/specification/README.md +++ b/specification/README.md @@ -7,6 +7,7 @@ categories: Behavioral tags: - Java - Difficulty-Beginner + - Searching --- ## Also known as @@ -16,15 +17,78 @@ Filter, Criteria Specification pattern separates the statement of how to match a candidate, from the candidate object that it is matched against. As well as its usefulness in selection, it is also valuable for validation and for building to -order +order. ![alt text](./etc/specification.png "Specification") ## Applicability Use the Specification pattern when -* you need to select a subset of objects based on some criteria, and to refresh the selection at various times -* you need to check that only suitable objects are used for a certain role (validation) +* You need to select a subset of objects based on some criteria, and to refresh the selection at various times. +* You need to check that only suitable objects are used for a certain role (validation). + +## Explanation + +Real world example + +> There is a pool of different creatures and we often need to select some subset of them. We can write our search specification such as "creatures that can fly" and give it to the party that will perform the filtering. + +In Plain Words + +> Specification pattern allows us to separate the search criteria from the object that performs the search. + +Wikipedia says + +> In computer programming, the specification pattern is a particular software design pattern, whereby business rules can be recombined by chaining the business rules together using boolean logic. + +**Programmatic Example** + +If we look at our creature pool example from above, we have a set of creatures with certain properties. + +```java +public interface Creature { + String getName(); + Size getSize(); + Movement getMovement(); + Color getColor(); +} +``` + +And dragon implementation looks like this. + +```java +public class Dragon extends AbstractCreature { + + public Dragon() { + super("Dragon", Size.LARGE, Movement.FLYING, Color.RED); + } +} +``` + +Now that we want to select some subset of them, we use selectors. To select creatures that fly, we should use MovementSelector. + +```java +public class MovementSelector implements Predicate { + + private final Movement movement; + + public MovementSelector(Movement m) { + this.movement = m; + } + + @Override + public boolean test(Creature t) { + return t.getMovement().equals(movement); + } +} +``` + +With these building blocks in place, we can perform a search for red and flying creatures like this. + +```java + List redAndFlyingCreatures = creatures.stream() + .filter(new ColorSelector(Color.RED).and(new MovementSelector(Movement.FLYING))).collect(Collectors.toList()); +``` ## Related patterns From c4c37d77e9cdc9514b48193aad14426c878e530e Mon Sep 17 00:00:00 2001 From: Besok Date: Sat, 2 Nov 2019 14:45:05 +0000 Subject: [PATCH 123/197] add --- .../iluwatar/saga/orchestration/Chapter.java | 35 ++++++++ .../saga/orchestration/ChapterResult.java | 22 +++++ .../saga/orchestration/FlyBookingService.java | 8 ++ .../orchestration/HotelBookingService.java | 8 ++ .../saga/orchestration/OrderService.java | 8 ++ .../com/iluwatar/saga/orchestration/Saga.java | 80 +++++++++++++++++++ .../saga/orchestration/SagaApplication.java | 50 ++++++++++++ .../saga/orchestration/SagaException.java | 29 +++++++ .../saga/orchestration/SagaOrchestrator.java | 30 +++++++ .../iluwatar/saga/orchestration/Service.java | 33 ++++++++ .../ServiceDiscoveryService.java | 46 +++++++++++ .../iluwatar/saga/orchestration/Utility.java | 16 ++++ .../orchestration/WithdrawMoneyService.java | 16 ++++ 13 files changed, 381 insertions(+) create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/Chapter.java create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/ChapterResult.java create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/SagaException.java create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/Service.java create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/Utility.java create mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Chapter.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Chapter.java new file mode 100644 index 000000000000..9b1e1feac666 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Chapter.java @@ -0,0 +1,35 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.orchestration; + +/** + * Chapter including into Saga + */ +public interface Chapter { + + String getName(); + + ChapterResult process(K value); + ChapterResult rollback(K value); + +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/ChapterResult.java b/saga/src/main/java/com/iluwatar/saga/orchestration/ChapterResult.java new file mode 100644 index 000000000000..ee5ae8ba1ac2 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/ChapterResult.java @@ -0,0 +1,22 @@ +package com.iluwatar.saga.orchestration; + +public class ChapterResult { + K value; + State state; + + public ChapterResult(K value, State state) { + this.value = value; + this.state = state; + } + + public static ChapterResult success(K val) { + return new ChapterResult<>(val, State.SUCCESS); + } + public static ChapterResult failure(K val) { + return new ChapterResult<>(val, State.FAILURE); + } + + public enum State { + SUCCESS, FAILURE + } +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java new file mode 100644 index 000000000000..7a78b5f17839 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java @@ -0,0 +1,8 @@ +package com.iluwatar.saga.orchestration; + +public class FlyBookingService extends Service { + @Override + public String getName() { + return "booking a Fly"; + } +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java new file mode 100644 index 000000000000..8f294cd40911 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java @@ -0,0 +1,8 @@ +package com.iluwatar.saga.orchestration; + +public class HotelBookingService extends Service { + @Override + public String getName() { + return "booking a Hotel"; + } +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java new file mode 100644 index 000000000000..d5d79ac413b6 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java @@ -0,0 +1,8 @@ +package com.iluwatar.saga.orchestration; + +public class OrderService extends Service { + @Override + public String getName() { + return "init an order"; + } +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java new file mode 100644 index 000000000000..b74d689591ff --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java @@ -0,0 +1,80 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.orchestration; + +import java.util.ArrayList; +import java.util.List; + +public class Saga { + + private List chapters; + private Result result; + + public Saga() { + this.chapters = new ArrayList<>(); + this.result = Result.INPROCESS; + } + + public void setResult(Result result) { + this.result = result; + } + + public boolean isSuccess(){ + return result == Result.FINISHED; + } + + public boolean isFinished(){ + return result != Result.INPROCESS; + } + + public Saga chapter(String name, int timeoutInSec) { + this.chapters.add(new Chapter(name, timeoutInSec)); + return this; + } + + public Chapter get(int idx) { + if (chapters.size() < idx || idx < 0) { + throw new SagaException("idx shoud be less then ch size or more then 0"); + } + return chapters.get(idx); + } + + + + public static Saga create() { + return new Saga(); + } + + public enum Result{ + FINISHED,CANCELED, INPROCESS; + } + private static class Chapter { + String name; + int timeoutInSec; + + public Chapter(String name, int timeoutInSec) { + this.name = name; + this.timeoutInSec = timeoutInSec; + } + } +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java new file mode 100644 index 000000000000..154f97bab6e6 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java @@ -0,0 +1,50 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.saga.orchestration; + + +public class SagaApplication { + public static void main(String[] args) { + + } + + + + private Saga createSaga() { + return Saga.create() + .chapter("init an order",10) + .chapter("booking a Fly",10) + .chapter("booking a Hotel",10) + .chapter("withdrawing Money",10); + } + + private static ServiceDiscoveryService sd() { + return + new ServiceDiscoveryService() + .discover(new OrderService()) + .discover(new FlyBookingService()) + .discover(new HotelBookingService()) + .discover(new WithdrawMoneyService()); + } +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaException.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaException.java new file mode 100644 index 000000000000..0055bb85ee6b --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaException.java @@ -0,0 +1,29 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.orchestration; + +public class SagaException extends RuntimeException { + public SagaException(String message) { + super(message); + } +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java new file mode 100644 index 000000000000..edc94bb2236f --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java @@ -0,0 +1,30 @@ +package com.iluwatar.saga.orchestration; + +import java.util.Objects; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +public class SagaOrchestrator { + + private ExecutorService executor; + private AtomicBoolean isNormalFlow; + private AtomicBoolean isFinished; + private AtomicInteger currentState; + private final Saga saga; + + public SagaOrchestrator(Saga saga) { + this.saga = saga; + this.isNormalFlow = new AtomicBoolean(true); + this.isFinished = new AtomicBoolean(false); + this.currentState = new AtomicInteger(0); + this.executor = Executors.newFixedThreadPool(20); + } + + public Saga.Result kickOff(K value) { + + } + + +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java new file mode 100644 index 000000000000..31a2ab70241e --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java @@ -0,0 +1,33 @@ +package com.iluwatar.saga.orchestration; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static com.iluwatar.saga.orchestration.Utility.sleepInSec; + +public abstract class Service implements Chapter { + private static final Logger logger = LoggerFactory.getLogger(Service.class); + + @Override + public abstract String getName(); + + + @Override + public ChapterResult process(K value) { + logger.info("The chapter about {} is starting", getName()); + logger.info("storing or calculating a data {} to db", value); + sleepInSec(1); + logger.info("the data {} has been stored or calculated successfully", value); + return ChapterResult.success(value); + } + + @Override + public ChapterResult rollback(K value) { + logger.info("Something is going wrong hence The chapter about {} is starting the rollback procedure", getName()); + sleepInSec(1); + logger.info("the data {} has been rollbacked successfully", value); + return ChapterResult.success(value); + } + + +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java new file mode 100644 index 000000000000..522f3f94401f --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java @@ -0,0 +1,46 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.orchestration; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +public class ServiceDiscoveryService { + private Map> services; + + public Optional> find(String service) { + return Optional.ofNullable(services.getOrDefault(service, null)); + } + + public ServiceDiscoveryService discover(Chapter chapterService) { + services.put(chapterService.getName(), chapterService); + return this; + } + + public ServiceDiscoveryService() { + this.services = new HashMap<>(); + } + + +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Utility.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Utility.java new file mode 100644 index 000000000000..bf5e902c0ce3 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Utility.java @@ -0,0 +1,16 @@ +package com.iluwatar.saga.orchestration; + +public class Utility { + private Utility() { + } + + public static void sleepInSec(int sec){ + try { + Thread.sleep(sec*1000); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + + +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java new file mode 100644 index 000000000000..25c7710dcce8 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java @@ -0,0 +1,16 @@ +package com.iluwatar.saga.orchestration; + +public class WithdrawMoneyService extends Service { + @Override + public String getName() { + return "withdrawing Money"; + } + + @Override + public ChapterResult process(String value) { + if(value.equals("no-money")){ + return ChapterResult.failure(value); + } + return super.process(value); + } +} From 3a4677c56d19a1b5d1044cf32b535f729141ec99 Mon Sep 17 00:00:00 2001 From: Besok Date: Sat, 2 Nov 2019 20:52:59 +0000 Subject: [PATCH 124/197] add orchestrator --- .../iluwatar/saga/orchestration/Chapter.java | 17 ++- .../saga/orchestration/ChapterResult.java | 41 ++++- .../saga/orchestration/FlyBookingService.java | 25 ++++ .../orchestration/HotelBookingService.java | 42 ++++++ .../saga/orchestration/OrderService.java | 25 ++++ .../com/iluwatar/saga/orchestration/Saga.java | 40 +++-- .../saga/orchestration/SagaApplication.java | 42 +++++- .../saga/orchestration/SagaException.java | 29 ---- .../saga/orchestration/SagaOrchestrator.java | 141 ++++++++++++++++-- .../iluwatar/saga/orchestration/Service.java | 42 ++++-- .../ServiceDiscoveryService.java | 5 +- .../iluwatar/saga/orchestration/Utility.java | 16 -- .../orchestration/WithdrawMoneyService.java | 30 +++- .../orchestration/SagaApplicationTest.java | 13 ++ .../SagaOrchestratorInternallyTest.java | 117 +++++++++++++++ .../orchestration/SagaOrchestratorTest.java | 37 +++++ 16 files changed, 554 insertions(+), 108 deletions(-) delete mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/SagaException.java delete mode 100644 saga/src/main/java/com/iluwatar/saga/orchestration/Utility.java create mode 100644 saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java create mode 100644 saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java create mode 100644 saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Chapter.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Chapter.java index 9b1e1feac666..961a8893733a 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/Chapter.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Chapter.java @@ -23,13 +23,28 @@ package com.iluwatar.saga.orchestration; /** - * Chapter including into Saga + * Chapter is an interface representing a contract for an external service. + * @param is type for passing params */ public interface Chapter { + /** + * @return service name. + */ String getName(); + /** + * The operation executed in general case. + * @param value incoming value + * @return result {@link ChapterResult} + */ ChapterResult process(K value); + + /** + * The operation executed in rollback case. + * @param value incoming value + * @return result {@link ChapterResult} + */ ChapterResult rollback(K value); } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/ChapterResult.java b/saga/src/main/java/com/iluwatar/saga/orchestration/ChapterResult.java index ee5ae8ba1ac2..eae95b3391f8 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/ChapterResult.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/ChapterResult.java @@ -1,17 +1,52 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.saga.orchestration; +/** + * Executing result for chapter + * @param incoming value + */ public class ChapterResult { - K value; - State state; + private K value; + private State state; - public ChapterResult(K value, State state) { + public K getValue() { + return value; + } + + ChapterResult(K value, State state) { this.value = value; this.state = state; } + public boolean isSuccess(){ + return state == State.SUCCESS; + } + public static ChapterResult success(K val) { return new ChapterResult<>(val, State.SUCCESS); } + public static ChapterResult failure(K val) { return new ChapterResult<>(val, State.FAILURE); } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java index 7a78b5f17839..6cb8479c07b2 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java @@ -1,5 +1,30 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.saga.orchestration; +/** + * Class representing a service to book a fly + */ public class FlyBookingService extends Service { @Override public String getName() { diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java index 8f294cd40911..e21046328918 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java @@ -1,8 +1,50 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.saga.orchestration; +/** + * Class representing a service to book a hotel + */ public class HotelBookingService extends Service { @Override public String getName() { return "booking a Hotel"; } + + + @Override + public ChapterResult rollback(String value) { + if(value.equals("crashed_order")){ + logger.info("The Rollback for a chapter '{}' has been started. " + + "The data {} has been failed.The saga has been crashed.", + getName(), value); + + return ChapterResult.failure(value); + } + + logger.info("The Rollback for a chapter '{}' has been started. The data {} has been rollbacked successfully", + getName(), value); + + return super.rollback(value); + } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java index d5d79ac413b6..6edd94ace40a 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java @@ -1,5 +1,30 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.saga.orchestration; +/** + * Class representing a service to init a new order. + */ public class OrderService extends Service { @Override public String getName() { diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java index b74d689591ff..c21435f20db6 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java @@ -25,56 +25,50 @@ import java.util.ArrayList; import java.util.List; +/** + * Saga representation. + * Saca consists of chapters. + * Every Chapter is executed a certain service. + */ public class Saga { private List chapters; - private Result result; public Saga() { this.chapters = new ArrayList<>(); - this.result = Result.INPROCESS; } - public void setResult(Result result) { - this.result = result; - } - public boolean isSuccess(){ - return result == Result.FINISHED; - } - - public boolean isFinished(){ - return result != Result.INPROCESS; - } - public Saga chapter(String name, int timeoutInSec) { - this.chapters.add(new Chapter(name, timeoutInSec)); + public Saga chapter(String name) { + this.chapters.add(new Chapter(name)); return this; } + public Chapter get(int idx) { - if (chapters.size() < idx || idx < 0) { - throw new SagaException("idx shoud be less then ch size or more then 0"); - } return chapters.get(idx); } + public boolean isPresent(int idx) { + return idx >= 0 && idx < chapters.size(); + } public static Saga create() { return new Saga(); } - public enum Result{ - FINISHED,CANCELED, INPROCESS; + public enum Result { + FINISHED, ROLLBACK, CRASHED } - private static class Chapter { + + public static class Chapter { String name; - int timeoutInSec; - public Chapter(String name, int timeoutInSec) { + public Chapter(String name) { this.name = name; - this.timeoutInSec = timeoutInSec; } + } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java index 154f97bab6e6..71db1a7bfb85 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java @@ -24,22 +24,48 @@ package com.iluwatar.saga.orchestration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This pattern is used in distributed services to perform a group of operations atomically. + * This is an analog of transaction in a database but in terms of microservices architecture this is executed + * in a distributed environment + * + * A saga is a sequence of local transactions in a certain context. If one transaction fails for some reason, + * the saga executes compensating transactions(rollbacks) to undo the impact of the preceding transactions. + * + * In this approach, there is an orchestrator @see {@link SagaOrchestrator} that manages all the transactions and directs + * the participant services to execute local transactions based on events. + * + * @see Saga + * @see SagaOrchestrator + * @see Service + */ public class SagaApplication { + private static final Logger logger = LoggerFactory.getLogger(SagaApplication.class); + public static void main(String[] args) { + SagaOrchestrator sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery()); - } + Saga.Result goodOrder = sagaOrchestrator.execute("god_order"); + Saga.Result badOrder = sagaOrchestrator.execute("bad_order"); + Saga.Result crashedOrder = sagaOrchestrator.execute("crashed_order"); + logger.info("orders: goodOrder is {}, badOrder is {},crashedOrder is {}",goodOrder,badOrder,crashedOrder); + } - private Saga createSaga() { - return Saga.create() - .chapter("init an order",10) - .chapter("booking a Fly",10) - .chapter("booking a Hotel",10) - .chapter("withdrawing Money",10); + private static Saga newSaga() { + return Saga + .create() + .chapter("init an order") + .chapter("booking a Fly") + .chapter("booking a Hotel") + .chapter("withdrawing Money"); } - private static ServiceDiscoveryService sd() { + private static ServiceDiscoveryService serviceDiscovery() { return new ServiceDiscoveryService() .discover(new OrderService()) diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaException.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaException.java deleted file mode 100644 index 0055bb85ee6b..000000000000 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * The MIT License - * Copyright © 2014-2019 Ilkka Seppälä - * - * 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 NONINFRINGEMENT. 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. - */ -package com.iluwatar.saga.orchestration; - -public class SagaException extends RuntimeException { - public SagaException(String message) { - super(message); - } -} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java index edc94bb2236f..34ad29b267d1 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java @@ -1,30 +1,139 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.saga.orchestration; -import java.util.Objects; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -public class SagaOrchestrator { +import java.util.Optional; + +import static com.iluwatar.saga.orchestration.Saga.Result.*; - private ExecutorService executor; - private AtomicBoolean isNormalFlow; - private AtomicBoolean isFinished; - private AtomicInteger currentState; +/** + * The orchestrator that manages all the transactions and directs + * the participant services to execute local transactions based on events. + */ +public class SagaOrchestrator { + private static final Logger logger = LoggerFactory.getLogger(SagaOrchestrator.class); private final Saga saga; + private final ServiceDiscoveryService sd; + private final CurrentState state; - public SagaOrchestrator(Saga saga) { + + public SagaOrchestrator(Saga saga, ServiceDiscoveryService sd) { this.saga = saga; - this.isNormalFlow = new AtomicBoolean(true); - this.isFinished = new AtomicBoolean(false); - this.currentState = new AtomicInteger(0); - this.executor = Executors.newFixedThreadPool(20); + this.sd = sd; + this.state = new CurrentState(); } - public Saga.Result kickOff(K value) { + /** + * + * @param value incoming value + * @param type for incoming value + * @return result @see {@link Saga.Result} + */ + @SuppressWarnings("unchecked") + public Saga.Result execute(K value) { + state.cleanUp(); + logger.info(" The new saga is about to start"); + Saga.Result result = FINISHED; + K tempVal = value; + + while (true) { + int next = state.current(); + Saga.Chapter ch = saga.get(next); + Optional srvOpt = sd.find(ch.name); + + if (!srvOpt.isPresent()) { + state.directionToBack(); + state.back(); + continue; + } + + Chapter srv = srvOpt.get(); + + if (state.isForward()) { + ChapterResult processRes = srv.process(tempVal); + if (processRes.isSuccess()) { + next = state.forward(); + tempVal = (K) processRes.getValue(); + } else { + state.directionToBack(); + } + } else { + ChapterResult rlRes = srv.rollback(tempVal); + if (rlRes.isSuccess()) { + next = state.back(); + tempVal = (K) rlRes.getValue(); + } else { + result = CRASHED; + next = state.back(); + } + } + + + if (!saga.isPresent(next)) { + return state.isForward() ? FINISHED : result == CRASHED ? CRASHED : ROLLBACK; + } + } } + private static class CurrentState { + int currentNumber; + boolean isForward; + + void cleanUp() { + currentNumber = 0; + isForward = true; + } + + CurrentState() { + this.currentNumber = 0; + this.isForward = true; + } + + + boolean isForward() { + return isForward; + } + + void directionToBack() { + isForward = false; + } + + int forward() { + return ++currentNumber; + } + + int back() { + return --currentNumber; + } + + int current() { + return currentNumber; + } + } + } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java index 31a2ab70241e..20b34f55aa95 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java @@ -1,12 +1,37 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.saga.orchestration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static com.iluwatar.saga.orchestration.Utility.sleepInSec; - +/** + * Common abstraction class representing services + * implementing a general contract @see {@link Chapter} + * @param type of incoming param + */ public abstract class Service implements Chapter { - private static final Logger logger = LoggerFactory.getLogger(Service.class); + protected static final Logger logger = LoggerFactory.getLogger(Service.class); @Override public abstract String getName(); @@ -14,18 +39,15 @@ public abstract class Service implements Chapter { @Override public ChapterResult process(K value) { - logger.info("The chapter about {} is starting", getName()); - logger.info("storing or calculating a data {} to db", value); - sleepInSec(1); - logger.info("the data {} has been stored or calculated successfully", value); + logger.info("The chapter '{}' has been started. The data {} has been stored or calculated successfully", + getName(),value); return ChapterResult.success(value); } @Override public ChapterResult rollback(K value) { - logger.info("Something is going wrong hence The chapter about {} is starting the rollback procedure", getName()); - sleepInSec(1); - logger.info("the data {} has been rollbacked successfully", value); + logger.info("The Rollback for a chapter '{}' has been started. The data {} has been rollbacked successfully", + getName(),value); return ChapterResult.success(value); } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java index 522f3f94401f..652740051b5e 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java @@ -26,10 +26,13 @@ import java.util.Map; import java.util.Optional; +/** + * The class representing a service discovery pattern. + */ public class ServiceDiscoveryService { private Map> services; - public Optional> find(String service) { + public Optional find(String service) { return Optional.ofNullable(services.getOrDefault(service, null)); } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Utility.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Utility.java deleted file mode 100644 index bf5e902c0ce3..000000000000 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/Utility.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.iluwatar.saga.orchestration; - -public class Utility { - private Utility() { - } - - public static void sleepInSec(int sec){ - try { - Thread.sleep(sec*1000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - - -} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java index 25c7710dcce8..dad15cec3864 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java @@ -1,5 +1,30 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.saga.orchestration; +/** + * Class representing a service to withdraw a money + */ public class WithdrawMoneyService extends Service { @Override public String getName() { @@ -8,7 +33,10 @@ public String getName() { @Override public ChapterResult process(String value) { - if(value.equals("no-money")){ + if (value.equals("bad_order") || value.equals("crashed_order")) { + logger.info("The chapter '{}' has been started. But the exception has been raised." + + "The rollback is about to start", + getName(), value); return ChapterResult.failure(value); } return super.process(value); diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java new file mode 100644 index 000000000000..6950158aaef1 --- /dev/null +++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java @@ -0,0 +1,13 @@ +package com.iluwatar.saga.orchestration; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class SagaApplicationTest { + + @Test + public void mainTest() { + SagaApplication.main(new String[]{}); + } +} \ No newline at end of file diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java new file mode 100644 index 000000000000..b8377cebf525 --- /dev/null +++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java @@ -0,0 +1,117 @@ +package com.iluwatar.saga.orchestration; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +public class SagaOrchestratorInternallyTest { + + private List records = new ArrayList<>(); + + @Test + public void execute() { + SagaOrchestrator sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery()); + Saga.Result result = sagaOrchestrator.execute(1); + Assert.assertEquals(result, Saga.Result.ROLLBACK); + Assert.assertArrayEquals( + records.toArray(new String[]{}), + new String[]{"+1","+2","+3","+4","-4","-3","-2","-1"}); + } + + private static Saga newSaga() { + return Saga + .create() + .chapter("1") + .chapter("2") + .chapter("3") + .chapter("4"); + } + + private ServiceDiscoveryService serviceDiscovery() { + return + new ServiceDiscoveryService() + .discover(new Service1()) + .discover(new Service2()) + .discover(new Service3()) + .discover(new Service4()); + } + + class Service1 extends Service { + + @Override + public String getName() { + return "1"; + } + + @Override + public ChapterResult process(Integer value) { + records.add("+1"); + return ChapterResult.success(value); + } + + @Override + public ChapterResult rollback(Integer value) { + records.add("-1"); + return ChapterResult.success(value); + } + } + + class Service2 extends Service { + + @Override + public String getName() { + return "2"; + } + @Override + public ChapterResult process(Integer value) { + records.add("+2"); + return ChapterResult.success(value); + } + + @Override + public ChapterResult rollback(Integer value) { + records.add("-2"); + return ChapterResult.success(value); + } + } + + class Service3 extends Service { + + @Override + public String getName() { + return "3"; + } + @Override + public ChapterResult process(Integer value) { + records.add("+3"); + return ChapterResult.success(value); + } + + @Override + public ChapterResult rollback(Integer value) { + records.add("-3"); + return ChapterResult.success(value); + } + } + + class Service4 extends Service { + + @Override + public String getName() { + return "4"; + } + @Override + public ChapterResult process(Integer value) { + records.add("+4"); + return ChapterResult.failure(value); + } + + @Override + public ChapterResult rollback(Integer value) { + records.add("-4"); + return ChapterResult.success(value); + } + } +} \ No newline at end of file diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java new file mode 100644 index 000000000000..8558b1f5a170 --- /dev/null +++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java @@ -0,0 +1,37 @@ +package com.iluwatar.saga.orchestration; + +import org.junit.Assert; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class SagaOrchestratorTest { + + @Test + public void execute() { + SagaOrchestrator sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery()); + Saga.Result badOrder = sagaOrchestrator.execute("bad_order"); + Saga.Result crashedOrder = sagaOrchestrator.execute("crashed_order"); + + Assert.assertEquals(badOrder, Saga.Result.ROLLBACK); + Assert.assertEquals(crashedOrder, Saga.Result.CRASHED); + } + + private static Saga newSaga() { + return Saga + .create() + .chapter("init an order") + .chapter("booking a Fly") + .chapter("booking a Hotel") + .chapter("withdrawing Money"); + } + + private static ServiceDiscoveryService serviceDiscovery() { + return + new ServiceDiscoveryService() + .discover(new OrderService()) + .discover(new FlyBookingService()) + .discover(new HotelBookingService()) + .discover(new WithdrawMoneyService()); + } +} \ No newline at end of file From 1b32e23493d1383033603162741c42264c8c965d Mon Sep 17 00:00:00 2001 From: Besok Date: Sun, 3 Nov 2019 12:03:33 +0000 Subject: [PATCH 125/197] add ch --- .../ServiceDiscoveryService.java | 4 +- .../iluwatar/saga/choreography/Chapter.java | 59 +++++++++++++++++++ .../choreography/ChoreographyService.java | 33 +++++++++++ .../iluwatar/saga/choreography/RichSaga.java | 4 ++ .../saga/orchestration/FlyBookingService.java | 2 +- .../orchestration/HotelBookingService.java | 2 +- ...Service.java => OrchestrationService.java} | 4 +- .../saga/orchestration/OrderService.java | 2 +- .../com/iluwatar/saga/orchestration/Saga.java | 3 + .../saga/orchestration/SagaApplication.java | 3 +- .../saga/orchestration/SagaOrchestrator.java | 1 + .../orchestration/WithdrawMoneyService.java | 2 +- .../SagaOrchestratorInternallyTest.java | 9 +-- .../orchestration/SagaOrchestratorTest.java | 3 +- 14 files changed, 117 insertions(+), 14 deletions(-) rename saga/src/main/java/com/iluwatar/saga/{orchestration => }/ServiceDiscoveryService.java (95%) create mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java create mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/ChoreographyService.java create mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/RichSaga.java rename saga/src/main/java/com/iluwatar/saga/orchestration/{Service.java => OrchestrationService.java} (95%) diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java b/saga/src/main/java/com/iluwatar/saga/ServiceDiscoveryService.java similarity index 95% rename from saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java rename to saga/src/main/java/com/iluwatar/saga/ServiceDiscoveryService.java index 652740051b5e..f9d91b53e3de 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java +++ b/saga/src/main/java/com/iluwatar/saga/ServiceDiscoveryService.java @@ -20,7 +20,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package com.iluwatar.saga.orchestration; +package com.iluwatar.saga; + +import com.iluwatar.saga.orchestration.Chapter; import java.util.HashMap; import java.util.Map; diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java b/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java new file mode 100644 index 000000000000..a76e2c4dfaa2 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java @@ -0,0 +1,59 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.choreography; + +import com.iluwatar.saga.orchestration.ChapterResult; + +/** + * Chapter is an interface representing a contract for an external service. + * @param is type for passing params + */ +public interface Chapter { + + /** + * @return service name. + */ + String getName(); + + /** + * every chapter is responsible for a part of saga. + * @param value incoming value + * @return saga result @see {@link RichSaga} + */ + RichSaga execute(K value); + + /** + * The operation executed in general case. + * @param value incoming value + * @return result {@link ChapterResult} + */ + ChapterResult process(K value); + + /** + * The operation executed in rollback case. + * @param value incoming value + * @return result {@link ChapterResult} + */ + ChapterResult rollback(K value); + +} diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/ChoreographyService.java b/saga/src/main/java/com/iluwatar/saga/choreography/ChoreographyService.java new file mode 100644 index 000000000000..e88a131b2189 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/choreography/ChoreographyService.java @@ -0,0 +1,33 @@ +package com.iluwatar.saga.choreography; + +import com.iluwatar.saga.ServiceDiscoveryService; +import com.iluwatar.saga.orchestration.Chapter; +import com.iluwatar.saga.orchestration.ChapterResult; +import com.iluwatar.saga.orchestration.OrchestrationService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public abstract class ChoreographyService implements Chapter { + + protected static final Logger logger = LoggerFactory.getLogger(OrchestrationService.class); + + private final ServiceDiscoveryService service; + protected ChoreographyService(ServiceDiscoveryService service) { + this.service = service; + } + + @Override + public ChapterResult process(K value) { + logger.info("The chapter '{}' has been started. The data {} has been stored or calculated successfully", + getName(),value); + return ChapterResult.success(value); + } + + @Override + public ChapterResult rollback(K value) { + logger.info("The Rollback for a chapter '{}' has been started. The data {} has been rollbacked successfully", + getName(),value); + return ChapterResult.success(value); + } + +} diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/RichSaga.java b/saga/src/main/java/com/iluwatar/saga/choreography/RichSaga.java new file mode 100644 index 000000000000..27e099fc793f --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/choreography/RichSaga.java @@ -0,0 +1,4 @@ +package com.iluwatar.saga.choreography; + +public class RichSaga { +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java index 6cb8479c07b2..34f3f4f18eb2 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java @@ -25,7 +25,7 @@ /** * Class representing a service to book a fly */ -public class FlyBookingService extends Service { +public class FlyBookingService extends OrchestrationService { @Override public String getName() { return "booking a Fly"; diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java index e21046328918..a4da64d36ed3 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java @@ -25,7 +25,7 @@ /** * Class representing a service to book a hotel */ -public class HotelBookingService extends Service { +public class HotelBookingService extends OrchestrationService { @Override public String getName() { return "booking a Hotel"; diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java b/saga/src/main/java/com/iluwatar/saga/orchestration/OrchestrationService.java similarity index 95% rename from saga/src/main/java/com/iluwatar/saga/orchestration/Service.java rename to saga/src/main/java/com/iluwatar/saga/orchestration/OrchestrationService.java index 20b34f55aa95..7f0e9a03cfe3 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/OrchestrationService.java @@ -30,8 +30,8 @@ * implementing a general contract @see {@link Chapter} * @param type of incoming param */ -public abstract class Service implements Chapter { - protected static final Logger logger = LoggerFactory.getLogger(Service.class); +public abstract class OrchestrationService implements Chapter { + protected static final Logger logger = LoggerFactory.getLogger(OrchestrationService.class); @Override public abstract String getName(); diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java index 6edd94ace40a..8fb7b118d739 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java @@ -25,7 +25,7 @@ /** * Class representing a service to init a new order. */ -public class OrderService extends Service { +public class OrderService extends OrchestrationService { @Override public String getName() { return "init an order"; diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java index c21435f20db6..9f8312d9f231 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java @@ -70,5 +70,8 @@ public Chapter(String name) { this.name = name; } + public String getName() { + return name; + } } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java index 71db1a7bfb85..b69d040136bd 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java @@ -24,6 +24,7 @@ package com.iluwatar.saga.orchestration; +import com.iluwatar.saga.ServiceDiscoveryService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,7 +41,7 @@ * * @see Saga * @see SagaOrchestrator - * @see Service + * @see OrchestrationService */ public class SagaApplication { private static final Logger logger = LoggerFactory.getLogger(SagaApplication.class); diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java index 34ad29b267d1..588a860aa16d 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java @@ -22,6 +22,7 @@ */ package com.iluwatar.saga.orchestration; +import com.iluwatar.saga.ServiceDiscoveryService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java index dad15cec3864..d53f106cb1b4 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java @@ -25,7 +25,7 @@ /** * Class representing a service to withdraw a money */ -public class WithdrawMoneyService extends Service { +public class WithdrawMoneyService extends OrchestrationService { @Override public String getName() { return "withdrawing Money"; diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java index b8377cebf525..a40a3ebec2a1 100644 --- a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java +++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java @@ -1,5 +1,6 @@ package com.iluwatar.saga.orchestration; +import com.iluwatar.saga.ServiceDiscoveryService; import org.junit.Assert; import org.junit.Test; @@ -38,7 +39,7 @@ private ServiceDiscoveryService serviceDiscovery() { .discover(new Service4()); } - class Service1 extends Service { + class Service1 extends OrchestrationService { @Override public String getName() { @@ -58,7 +59,7 @@ public ChapterResult rollback(Integer value) { } } - class Service2 extends Service { + class Service2 extends OrchestrationService { @Override public String getName() { @@ -77,7 +78,7 @@ public ChapterResult rollback(Integer value) { } } - class Service3 extends Service { + class Service3 extends OrchestrationService { @Override public String getName() { @@ -96,7 +97,7 @@ public ChapterResult rollback(Integer value) { } } - class Service4 extends Service { + class Service4 extends OrchestrationService { @Override public String getName() { diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java index 8558b1f5a170..cd659601eacc 100644 --- a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java +++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java @@ -1,10 +1,9 @@ package com.iluwatar.saga.orchestration; +import com.iluwatar.saga.ServiceDiscoveryService; import org.junit.Assert; import org.junit.Test; -import static org.junit.Assert.*; - public class SagaOrchestratorTest { @Test From ffeee2f1a48f1fd041f3a327814a31efe99c9434 Mon Sep 17 00:00:00 2001 From: Besok Date: Sun, 3 Nov 2019 12:35:01 +0000 Subject: [PATCH 126/197] separate pkgs --- .../iluwatar/saga/choreography/Chapter.java | 59 ------------------- .../choreography/ChoreographyService.java | 33 ----------- .../iluwatar/saga/choreography/RichSaga.java | 4 -- .../saga/orchestration/FlyBookingService.java | 2 +- .../orchestration/HotelBookingService.java | 2 +- .../saga/orchestration/OrderService.java | 2 +- .../saga/orchestration/SagaApplication.java | 2 +- ...OrchestrationService.java => Service.java} | 4 +- .../orchestration/WithdrawMoneyService.java | 2 +- .../SagaOrchestratorInternallyTest.java | 8 +-- 10 files changed, 11 insertions(+), 107 deletions(-) delete mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java delete mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/ChoreographyService.java delete mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/RichSaga.java rename saga/src/main/java/com/iluwatar/saga/orchestration/{OrchestrationService.java => Service.java} (95%) diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java b/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java deleted file mode 100644 index a76e2c4dfaa2..000000000000 --- a/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The MIT License - * Copyright © 2014-2019 Ilkka Seppälä - * - * 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 NONINFRINGEMENT. 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. - */ -package com.iluwatar.saga.choreography; - -import com.iluwatar.saga.orchestration.ChapterResult; - -/** - * Chapter is an interface representing a contract for an external service. - * @param is type for passing params - */ -public interface Chapter { - - /** - * @return service name. - */ - String getName(); - - /** - * every chapter is responsible for a part of saga. - * @param value incoming value - * @return saga result @see {@link RichSaga} - */ - RichSaga execute(K value); - - /** - * The operation executed in general case. - * @param value incoming value - * @return result {@link ChapterResult} - */ - ChapterResult process(K value); - - /** - * The operation executed in rollback case. - * @param value incoming value - * @return result {@link ChapterResult} - */ - ChapterResult rollback(K value); - -} diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/ChoreographyService.java b/saga/src/main/java/com/iluwatar/saga/choreography/ChoreographyService.java deleted file mode 100644 index e88a131b2189..000000000000 --- a/saga/src/main/java/com/iluwatar/saga/choreography/ChoreographyService.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.iluwatar.saga.choreography; - -import com.iluwatar.saga.ServiceDiscoveryService; -import com.iluwatar.saga.orchestration.Chapter; -import com.iluwatar.saga.orchestration.ChapterResult; -import com.iluwatar.saga.orchestration.OrchestrationService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public abstract class ChoreographyService implements Chapter { - - protected static final Logger logger = LoggerFactory.getLogger(OrchestrationService.class); - - private final ServiceDiscoveryService service; - protected ChoreographyService(ServiceDiscoveryService service) { - this.service = service; - } - - @Override - public ChapterResult process(K value) { - logger.info("The chapter '{}' has been started. The data {} has been stored or calculated successfully", - getName(),value); - return ChapterResult.success(value); - } - - @Override - public ChapterResult rollback(K value) { - logger.info("The Rollback for a chapter '{}' has been started. The data {} has been rollbacked successfully", - getName(),value); - return ChapterResult.success(value); - } - -} diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/RichSaga.java b/saga/src/main/java/com/iluwatar/saga/choreography/RichSaga.java deleted file mode 100644 index 27e099fc793f..000000000000 --- a/saga/src/main/java/com/iluwatar/saga/choreography/RichSaga.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.iluwatar.saga.choreography; - -public class RichSaga { -} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java index 34f3f4f18eb2..6cb8479c07b2 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java @@ -25,7 +25,7 @@ /** * Class representing a service to book a fly */ -public class FlyBookingService extends OrchestrationService { +public class FlyBookingService extends Service { @Override public String getName() { return "booking a Fly"; diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java index a4da64d36ed3..e21046328918 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java @@ -25,7 +25,7 @@ /** * Class representing a service to book a hotel */ -public class HotelBookingService extends OrchestrationService { +public class HotelBookingService extends Service { @Override public String getName() { return "booking a Hotel"; diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java index 8fb7b118d739..6edd94ace40a 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java @@ -25,7 +25,7 @@ /** * Class representing a service to init a new order. */ -public class OrderService extends OrchestrationService { +public class OrderService extends Service { @Override public String getName() { return "init an order"; diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java index b69d040136bd..013d9a5f02f3 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java @@ -41,7 +41,7 @@ * * @see Saga * @see SagaOrchestrator - * @see OrchestrationService + * @see Service */ public class SagaApplication { private static final Logger logger = LoggerFactory.getLogger(SagaApplication.class); diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/OrchestrationService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java similarity index 95% rename from saga/src/main/java/com/iluwatar/saga/orchestration/OrchestrationService.java rename to saga/src/main/java/com/iluwatar/saga/orchestration/Service.java index 7f0e9a03cfe3..20b34f55aa95 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/OrchestrationService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java @@ -30,8 +30,8 @@ * implementing a general contract @see {@link Chapter} * @param type of incoming param */ -public abstract class OrchestrationService implements Chapter { - protected static final Logger logger = LoggerFactory.getLogger(OrchestrationService.class); +public abstract class Service implements Chapter { + protected static final Logger logger = LoggerFactory.getLogger(Service.class); @Override public abstract String getName(); diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java index d53f106cb1b4..dad15cec3864 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java @@ -25,7 +25,7 @@ /** * Class representing a service to withdraw a money */ -public class WithdrawMoneyService extends OrchestrationService { +public class WithdrawMoneyService extends Service { @Override public String getName() { return "withdrawing Money"; diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java index a40a3ebec2a1..16c54c9200c1 100644 --- a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java +++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java @@ -39,7 +39,7 @@ private ServiceDiscoveryService serviceDiscovery() { .discover(new Service4()); } - class Service1 extends OrchestrationService { + class Service1 extends Service { @Override public String getName() { @@ -59,7 +59,7 @@ public ChapterResult rollback(Integer value) { } } - class Service2 extends OrchestrationService { + class Service2 extends Service { @Override public String getName() { @@ -78,7 +78,7 @@ public ChapterResult rollback(Integer value) { } } - class Service3 extends OrchestrationService { + class Service3 extends Service { @Override public String getName() { @@ -97,7 +97,7 @@ public ChapterResult rollback(Integer value) { } } - class Service4 extends OrchestrationService { + class Service4 extends Service { @Override public String getName() { From fbcfeb072a588ff6dff203c447674b40c61dccc3 Mon Sep 17 00:00:00 2001 From: Besok Date: Sun, 3 Nov 2019 12:52:38 +0000 Subject: [PATCH 127/197] add info --- .../iluwatar/saga/choreography/Chapter.java | 53 +++++++++++++++++++ .../com/iluwatar/saga/choreography/Saga.java | 34 ++++++++++++ .../com/iluwatar/saga/orchestration/Saga.java | 2 +- 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java create mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/Saga.java diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java b/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java new file mode 100644 index 000000000000..f610b9f62b03 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java @@ -0,0 +1,53 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.choreography; + +import com.iluwatar.saga.orchestration.ChapterResult; + +/** + * Chapter is an interface representing a contract for an external service. + * @param is type for passing params + */ +public interface Chapter { + + /** + * @return service name. + */ + String getName(); + + /** + * The operation executed in general case. + * @param value incoming value + * @return result {@link ChapterResult} + */ + ChapterResult process(K value); + + /** + * The operation executed in rollback case. + * @param value incoming value + * @return result {@link ChapterResult} + */ + ChapterResult rollback(K value); + + +} diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/Saga.java b/saga/src/main/java/com/iluwatar/saga/choreography/Saga.java new file mode 100644 index 000000000000..94c8a119dcec --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/choreography/Saga.java @@ -0,0 +1,34 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.choreography; + +/** + * Saga representation. + * Saga consists of chapters. + * Every Chapter is executed a certain service. + */ +public class Saga { + + + +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java index 9f8312d9f231..d6a703706e73 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java @@ -27,7 +27,7 @@ /** * Saga representation. - * Saca consists of chapters. + * Saga consists of chapters. * Every Chapter is executed a certain service. */ public class Saga { From 7dc47da131a423f8a4f601d7f4db4fb8e01aef17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Tue, 5 Nov 2019 17:22:53 +0200 Subject: [PATCH 128/197] #1021 Checkstyle fixes for Composite pattern --- .../src/main/java/com/iluwatar/composite/App.java | 8 ++++---- .../src/main/java/com/iluwatar/composite/Letter.java | 10 ++++------ .../java/com/iluwatar/composite/LetterComposite.java | 10 +++++----- .../main/java/com/iluwatar/composite/Messenger.java | 4 +--- .../src/main/java/com/iluwatar/composite/Sentence.java | 6 ++---- .../src/main/java/com/iluwatar/composite/Word.java | 6 ++---- 6 files changed, 18 insertions(+), 26 deletions(-) diff --git a/composite/src/main/java/com/iluwatar/composite/App.java b/composite/src/main/java/com/iluwatar/composite/App.java index eb55b7762c49..7389c7a960e3 100644 --- a/composite/src/main/java/com/iluwatar/composite/App.java +++ b/composite/src/main/java/com/iluwatar/composite/App.java @@ -32,9 +32,9 @@ * of a composite is to "compose" objects into tree structures to represent part-whole hierarchies. * Implementing the Composite pattern lets clients treat individual objects and compositions * uniformly. - *

    - * In this example we have sentences composed of words composed of letters. All of the objects can - * be treated through the same interface ({@link LetterComposite}). + * + *

    In this example we have sentences composed of words composed of letters. All of the objects + * can be treated through the same interface ({@link LetterComposite}). * */ public class App { @@ -42,7 +42,7 @@ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point + * Program entry point. * * @param args command line args */ diff --git a/composite/src/main/java/com/iluwatar/composite/Letter.java b/composite/src/main/java/com/iluwatar/composite/Letter.java index 4583f908985c..ab2d496ea871 100644 --- a/composite/src/main/java/com/iluwatar/composite/Letter.java +++ b/composite/src/main/java/com/iluwatar/composite/Letter.java @@ -24,20 +24,18 @@ package com.iluwatar.composite; /** - * - * Letter - * + * Letter. */ public class Letter extends LetterComposite { - private char c; + private char character; public Letter(char c) { - this.c = c; + this.character = c; } @Override protected void printThisBefore() { - System.out.print(c); + System.out.print(character); } } diff --git a/composite/src/main/java/com/iluwatar/composite/LetterComposite.java b/composite/src/main/java/com/iluwatar/composite/LetterComposite.java index 673e28f7918c..5d8af5435a45 100644 --- a/composite/src/main/java/com/iluwatar/composite/LetterComposite.java +++ b/composite/src/main/java/com/iluwatar/composite/LetterComposite.java @@ -27,9 +27,7 @@ import java.util.List; /** - * * Composite interface. - * */ public abstract class LetterComposite { @@ -43,12 +41,14 @@ public int count() { return children.size(); } - protected void printThisBefore() {} + protected void printThisBefore() { + } - protected void printThisAfter() {} + protected void printThisAfter() { + } /** - * Print + * Print. */ public void print() { printThisBefore(); diff --git a/composite/src/main/java/com/iluwatar/composite/Messenger.java b/composite/src/main/java/com/iluwatar/composite/Messenger.java index ba6a08161456..55929e7eebd3 100644 --- a/composite/src/main/java/com/iluwatar/composite/Messenger.java +++ b/composite/src/main/java/com/iluwatar/composite/Messenger.java @@ -26,9 +26,7 @@ import java.util.List; /** - * - * Messenger - * + * Messenger. */ public class Messenger { diff --git a/composite/src/main/java/com/iluwatar/composite/Sentence.java b/composite/src/main/java/com/iluwatar/composite/Sentence.java index 08e12f1526d6..c94ce84aa767 100644 --- a/composite/src/main/java/com/iluwatar/composite/Sentence.java +++ b/composite/src/main/java/com/iluwatar/composite/Sentence.java @@ -26,14 +26,12 @@ import java.util.List; /** - * - * Sentence - * + * Sentence. */ public class Sentence extends LetterComposite { /** - * Constructor + * Constructor. */ public Sentence(List words) { for (Word w : words) { diff --git a/composite/src/main/java/com/iluwatar/composite/Word.java b/composite/src/main/java/com/iluwatar/composite/Word.java index 7c71a7fddeec..353c363a287d 100644 --- a/composite/src/main/java/com/iluwatar/composite/Word.java +++ b/composite/src/main/java/com/iluwatar/composite/Word.java @@ -26,14 +26,12 @@ import java.util.List; /** - * - * Word - * + * Word. */ public class Word extends LetterComposite { /** - * Constructor + * Constructor. */ public Word(List letters) { for (Letter l : letters) { From 47ae477a566830f5e0baa4ad73a669128ef3f727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Tue, 5 Nov 2019 17:28:08 +0200 Subject: [PATCH 129/197] #1021 Checkstyle changes for Factory Method --- .../main/java/com/iluwatar/factory/method/App.java | 7 +++---- .../java/com/iluwatar/factory/method/Blacksmith.java | 2 -- .../com/iluwatar/factory/method/ElfBlacksmith.java | 11 +++++------ .../com/iluwatar/factory/method/OrcBlacksmith.java | 11 +++++------ .../java/com/iluwatar/factory/method/WeaponType.java | 4 +--- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/factory-method/src/main/java/com/iluwatar/factory/method/App.java b/factory-method/src/main/java/com/iluwatar/factory/method/App.java index 8c66b70d2549..8ebf54b03965 100644 --- a/factory-method/src/main/java/com/iluwatar/factory/method/App.java +++ b/factory-method/src/main/java/com/iluwatar/factory/method/App.java @@ -27,14 +27,13 @@ import org.slf4j.LoggerFactory; /** - * * The Factory Method is a creational design pattern which uses factory methods to deal with the * problem of creating objects without specifying the exact class of object that will be created. * This is done by creating objects via calling a factory method either specified in an interface * and implemented by child classes, or implemented in a base class and optionally overridden by * derived classes—rather than by calling a constructor. - *

    - * In this Factory Method example we have an interface ({@link Blacksmith}) with a method for + * + *

    In this Factory Method example we have an interface ({@link Blacksmith}) with a method for * creating objects ({@link Blacksmith#manufactureWeapon}). The concrete subclasses ( * {@link OrcBlacksmith}, {@link ElfBlacksmith}) then override the method to produce objects of * their liking. @@ -59,7 +58,7 @@ public App(Blacksmith blacksmith) { } /** - * Program entry point + * Program entry point. * * @param args command line args */ diff --git a/factory-method/src/main/java/com/iluwatar/factory/method/Blacksmith.java b/factory-method/src/main/java/com/iluwatar/factory/method/Blacksmith.java index 9d3a2cb0b6ff..7f3eafd605e9 100644 --- a/factory-method/src/main/java/com/iluwatar/factory/method/Blacksmith.java +++ b/factory-method/src/main/java/com/iluwatar/factory/method/Blacksmith.java @@ -24,9 +24,7 @@ package com.iluwatar.factory.method; /** - * * The interface containing method for producing objects. - * */ public interface Blacksmith { diff --git a/factory-method/src/main/java/com/iluwatar/factory/method/ElfBlacksmith.java b/factory-method/src/main/java/com/iluwatar/factory/method/ElfBlacksmith.java index eccff10d924c..0da783a34352 100644 --- a/factory-method/src/main/java/com/iluwatar/factory/method/ElfBlacksmith.java +++ b/factory-method/src/main/java/com/iluwatar/factory/method/ElfBlacksmith.java @@ -27,18 +27,17 @@ import java.util.Map; /** - * * Concrete subclass for creating new objects. - * */ public class ElfBlacksmith implements Blacksmith { private static Map ELFARSENAL; + static { - ELFARSENAL= new HashMap<>(WeaponType.values().length); - for (WeaponType type : WeaponType.values()) { - ELFARSENAL.put(type, new ElfWeapon(type)); - } + ELFARSENAL = new HashMap<>(WeaponType.values().length); + for (WeaponType type : WeaponType.values()) { + ELFARSENAL.put(type, new ElfWeapon(type)); + } } @Override diff --git a/factory-method/src/main/java/com/iluwatar/factory/method/OrcBlacksmith.java b/factory-method/src/main/java/com/iluwatar/factory/method/OrcBlacksmith.java index 6736630492c6..376b2ec34283 100644 --- a/factory-method/src/main/java/com/iluwatar/factory/method/OrcBlacksmith.java +++ b/factory-method/src/main/java/com/iluwatar/factory/method/OrcBlacksmith.java @@ -27,18 +27,17 @@ import java.util.Map; /** - * * Concrete subclass for creating new objects. - * */ public class OrcBlacksmith implements Blacksmith { private static Map ORCARSENAL; + static { - ORCARSENAL= new HashMap<>(WeaponType.values().length); - for (WeaponType type : WeaponType.values()) { - ORCARSENAL.put(type, new OrcWeapon(type)); - } + ORCARSENAL = new HashMap<>(WeaponType.values().length); + for (WeaponType type : WeaponType.values()) { + ORCARSENAL.put(type, new OrcWeapon(type)); + } } @Override diff --git a/factory-method/src/main/java/com/iluwatar/factory/method/WeaponType.java b/factory-method/src/main/java/com/iluwatar/factory/method/WeaponType.java index 4cf38ee26628..73ab10dd6d01 100644 --- a/factory-method/src/main/java/com/iluwatar/factory/method/WeaponType.java +++ b/factory-method/src/main/java/com/iluwatar/factory/method/WeaponType.java @@ -24,9 +24,7 @@ package com.iluwatar.factory.method; /** - * - * WeaponType enumeration - * + * WeaponType enumeration. */ public enum WeaponType { From 8ecdee44c81793d31dff68fe97de05b7489b9778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Tue, 5 Nov 2019 17:38:05 +0200 Subject: [PATCH 130/197] #1021 Checkstyle fixes for Layers --- .../main/java/com/iluwatar/layers/App.java | 64 +++++++++---------- .../main/java/com/iluwatar/layers/Cake.java | 4 +- .../iluwatar/layers/CakeBakingException.java | 7 +- .../iluwatar/layers/CakeBakingService.java | 16 ++--- .../layers/CakeBakingServiceImpl.java | 7 +- .../java/com/iluwatar/layers/CakeDao.java | 4 +- .../java/com/iluwatar/layers/CakeInfo.java | 10 ++- .../java/com/iluwatar/layers/CakeLayer.java | 7 +- .../com/iluwatar/layers/CakeLayerDao.java | 4 +- .../com/iluwatar/layers/CakeLayerInfo.java | 8 +-- .../java/com/iluwatar/layers/CakeTopping.java | 7 +- .../com/iluwatar/layers/CakeToppingDao.java | 4 +- .../com/iluwatar/layers/CakeToppingInfo.java | 11 ++-- .../com/iluwatar/layers/CakeViewImpl.java | 4 +- .../main/java/com/iluwatar/layers/View.java | 4 +- 15 files changed, 69 insertions(+), 92 deletions(-) diff --git a/layers/src/main/java/com/iluwatar/layers/App.java b/layers/src/main/java/com/iluwatar/layers/App.java index a4e0a4ab20fe..1c5da2d9d303 100644 --- a/layers/src/main/java/com/iluwatar/layers/App.java +++ b/layers/src/main/java/com/iluwatar/layers/App.java @@ -26,32 +26,32 @@ import java.util.List; /** - * - * Layers is an architectural style where software responsibilities are divided among the different layers of the - * application. - *

    - * This example demonstrates a traditional 3-layer architecture consisting of data access layer, business layer and - * presentation layer. - *

    - * The data access layer is formed of Spring Data repositories CakeDao, CakeToppingDao and - * CakeLayerDao. The repositories can be used for CRUD operations on cakes, cake toppings and cake layers - * respectively. - *

    - * The business layer is built on top of the data access layer. CakeBakingService offers methods to - * retrieve available cake toppings and cake layers and baked cakes. Also the service is used to create new cakes out of - * cake toppings and cake layers. - *

    - * The presentation layer is built on the business layer and in this example it simply lists the cakes that have been - * baked. - *

    - * We have applied so called strict layering which means that the layers can only access the classes directly beneath - * them. This leads the solution to create an additional set of DTOs ( CakeInfo, - * CakeToppingInfo, CakeLayerInfo) to translate data between layers. In other words, - * CakeBakingService cannot return entities ( Cake, CakeTopping, - * CakeLayer) directly since these reside on data access layer but instead translates these into business - * layer DTOs (CakeInfo, CakeToppingInfo, CakeLayerInfo) and returns them - * instead. This way the presentation layer does not have any knowledge of other layers than the business layer and thus - * is not affected by changes to them. + * Layers is an architectural style where software responsibilities are divided among the + * different layers of the application. + * + *

    This example demonstrates a traditional 3-layer architecture consisting of data access + * layer, business layer and presentation layer. + * + *

    The data access layer is formed of Spring Data repositories CakeDao, + * CakeToppingDao and CakeLayerDao. The repositories can be used + * for CRUD operations on cakes, cake toppings and cake layers respectively. + * + *

    The business layer is built on top of the data access layer. CakeBakingService + * offers methods to retrieve available cake toppings and cake layers and baked cakes. Also the + * service is used to create new cakes out of cake toppings and cake layers. + * + *

    The presentation layer is built on the business layer and in this example it simply lists + * the cakes that have been baked. + * + *

    We have applied so called strict layering which means that the layers can only access the + * classes directly beneath them. This leads the solution to create an additional set of DTOs + * ( CakeInfo, CakeToppingInfo, CakeLayerInfo) to translate + * data between layers. In other words, CakeBakingService cannot return entities + * ( Cake, CakeTopping, CakeLayer) directly since these + * reside on data access layer but instead translates these into business layer DTOs + * (CakeInfo, CakeToppingInfo, CakeLayerInfo) and returns + * them instead. This way the presentation layer does not have any knowledge of other layers than + * the business layer and thus is not affected by changes to them. * * @see Cake * @see CakeTopping @@ -70,7 +70,7 @@ public class App { private static CakeBakingService cakeBakingService = new CakeBakingServiceImpl(); /** - * Application entry point + * Application entry point. * * @param args Command line parameters */ @@ -85,7 +85,7 @@ public static void main(String[] args) { } /** - * Initializes the example data + * Initializes the example data. */ private static void initializeData(CakeBakingService cakeBakingService) { cakeBakingService.saveNewLayer(new CakeLayerInfo("chocolate", 1200)); @@ -108,10 +108,10 @@ private static void initializeData(CakeBakingService cakeBakingService) { } catch (CakeBakingException e) { e.printStackTrace(); } - CakeInfo cake2 = - new CakeInfo(new CakeToppingInfo("cherry", 0), List.of( - new CakeLayerInfo("vanilla", 0), new CakeLayerInfo("lemon", 0), new CakeLayerInfo( - "strawberry", 0))); + CakeInfo cake2 = new CakeInfo(new CakeToppingInfo("cherry", 0), List.of( + new CakeLayerInfo("vanilla", 0), + new CakeLayerInfo("lemon", 0), + new CakeLayerInfo("strawberry", 0))); try { cakeBakingService.bakeNewCake(cake2); } catch (CakeBakingException e) { diff --git a/layers/src/main/java/com/iluwatar/layers/Cake.java b/layers/src/main/java/com/iluwatar/layers/Cake.java index 3f866974cce4..ee1139a23f95 100644 --- a/layers/src/main/java/com/iluwatar/layers/Cake.java +++ b/layers/src/main/java/com/iluwatar/layers/Cake.java @@ -35,9 +35,7 @@ import javax.persistence.OneToOne; /** - * - * Cake entity - * + * Cake entity. */ @Entity public class Cake { diff --git a/layers/src/main/java/com/iluwatar/layers/CakeBakingException.java b/layers/src/main/java/com/iluwatar/layers/CakeBakingException.java index 0c6607b05a09..32ff307012b2 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeBakingException.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeBakingException.java @@ -24,15 +24,14 @@ package com.iluwatar.layers; /** - * - * Custom exception used in cake baking - * + * Custom exception used in cake baking. */ public class CakeBakingException extends Exception { private static final long serialVersionUID = 1L; - public CakeBakingException() {} + public CakeBakingException() { + } public CakeBakingException(String message) { super(message); diff --git a/layers/src/main/java/com/iluwatar/layers/CakeBakingService.java b/layers/src/main/java/com/iluwatar/layers/CakeBakingService.java index 2bface9681ac..31eaef83b537 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeBakingService.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeBakingService.java @@ -26,39 +26,37 @@ import java.util.List; /** - * - * Service for cake baking operations - * + * Service for cake baking operations. */ public interface CakeBakingService { /** - * Bakes new cake according to parameters + * Bakes new cake according to parameters. */ void bakeNewCake(CakeInfo cakeInfo) throws CakeBakingException; /** - * Get all cakes + * Get all cakes. */ List getAllCakes(); /** - * Store new cake topping + * Store new cake topping. */ void saveNewTopping(CakeToppingInfo toppingInfo); /** - * Get available cake toppings + * Get available cake toppings. */ List getAvailableToppings(); /** - * Add new cake layer + * Add new cake layer. */ void saveNewLayer(CakeLayerInfo layerInfo); /** - * Get available cake layers + * Get available cake layers. */ List getAvailableLayers(); } diff --git a/layers/src/main/java/com/iluwatar/layers/CakeBakingServiceImpl.java b/layers/src/main/java/com/iluwatar/layers/CakeBakingServiceImpl.java index 4b48b7345081..ac4c11c06ec2 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeBakingServiceImpl.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeBakingServiceImpl.java @@ -37,9 +37,7 @@ import org.springframework.transaction.annotation.Transactional; /** - * - * Implementation of CakeBakingService - * + * Implementation of CakeBakingService. */ @Service @Transactional @@ -73,7 +71,8 @@ public void bakeNewCake(CakeInfo cakeInfo) throws CakeBakingException { } } CakeToppingDao toppingBean = context.getBean(CakeToppingDao.class); - Optional topping = toppingBean.findById(matchingToppings.iterator().next().getId()); + Optional topping = toppingBean.findById( + matchingToppings.iterator().next().getId()); CakeDao cakeBean = context.getBean(CakeDao.class); if (topping.isPresent()) { Cake cake = new Cake(); diff --git a/layers/src/main/java/com/iluwatar/layers/CakeDao.java b/layers/src/main/java/com/iluwatar/layers/CakeDao.java index 3128fe973320..70071a21c34a 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeDao.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeDao.java @@ -27,9 +27,7 @@ import org.springframework.stereotype.Repository; /** - * - * CRUD repository for cakes - * + * CRUD repository for cakes. */ @Repository public interface CakeDao extends CrudRepository { diff --git a/layers/src/main/java/com/iluwatar/layers/CakeInfo.java b/layers/src/main/java/com/iluwatar/layers/CakeInfo.java index 3957dbeda77a..6d8f1c83d7ad 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeInfo.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeInfo.java @@ -27,9 +27,7 @@ import java.util.Optional; /** - * - * DTO for cakes - * + * DTO for cakes. */ public class CakeInfo { @@ -38,7 +36,7 @@ public class CakeInfo { public final List cakeLayerInfos; /** - * Constructor + * Constructor. */ public CakeInfo(Long id, CakeToppingInfo cakeToppingInfo, List cakeLayerInfos) { this.id = Optional.of(id); @@ -47,7 +45,7 @@ public CakeInfo(Long id, CakeToppingInfo cakeToppingInfo, List ca } /** - * Constructor + * Constructor. */ public CakeInfo(CakeToppingInfo cakeToppingInfo, List cakeLayerInfos) { this.id = Optional.empty(); @@ -56,7 +54,7 @@ public CakeInfo(CakeToppingInfo cakeToppingInfo, List cakeLayerIn } /** - * Calculate calories + * Calculate calories. */ public int calculateTotalCalories() { int total = cakeToppingInfo != null ? cakeToppingInfo.calories : 0; diff --git a/layers/src/main/java/com/iluwatar/layers/CakeLayer.java b/layers/src/main/java/com/iluwatar/layers/CakeLayer.java index 5fed0db22eb3..3f09c8d7700d 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeLayer.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeLayer.java @@ -30,9 +30,7 @@ import javax.persistence.ManyToOne; /** - * - * CakeLayer entity - * + * CakeLayer entity. */ @Entity public class CakeLayer { @@ -48,7 +46,8 @@ public class CakeLayer { @ManyToOne(cascade = CascadeType.ALL) private Cake cake; - public CakeLayer() {} + public CakeLayer() { + } public CakeLayer(String name, int calories) { this.setName(name); diff --git a/layers/src/main/java/com/iluwatar/layers/CakeLayerDao.java b/layers/src/main/java/com/iluwatar/layers/CakeLayerDao.java index 15d35c0df09b..d8ea05ab08e6 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeLayerDao.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeLayerDao.java @@ -27,9 +27,7 @@ import org.springframework.stereotype.Repository; /** - * - * CRUD repository for cake layers - * + * CRUD repository for cake layers. */ @Repository public interface CakeLayerDao extends CrudRepository { diff --git a/layers/src/main/java/com/iluwatar/layers/CakeLayerInfo.java b/layers/src/main/java/com/iluwatar/layers/CakeLayerInfo.java index 692cf6c444b4..60f70aa76742 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeLayerInfo.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeLayerInfo.java @@ -26,9 +26,7 @@ import java.util.Optional; /** - * - * DTO for cake layers - * + * DTO for cake layers. */ public class CakeLayerInfo { @@ -37,7 +35,7 @@ public class CakeLayerInfo { public final int calories; /** - * Constructor + * Constructor. */ public CakeLayerInfo(Long id, String name, int calories) { this.id = Optional.of(id); @@ -46,7 +44,7 @@ public CakeLayerInfo(Long id, String name, int calories) { } /** - * Constructor + * Constructor. */ public CakeLayerInfo(String name, int calories) { this.id = Optional.empty(); diff --git a/layers/src/main/java/com/iluwatar/layers/CakeTopping.java b/layers/src/main/java/com/iluwatar/layers/CakeTopping.java index d49fd50723d6..b4b057dd0a9e 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeTopping.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeTopping.java @@ -30,9 +30,7 @@ import javax.persistence.OneToOne; /** - * - * CakeTopping entity - * + * CakeTopping entity. */ @Entity public class CakeTopping { @@ -48,7 +46,8 @@ public class CakeTopping { @OneToOne(cascade = CascadeType.ALL) private Cake cake; - public CakeTopping() {} + public CakeTopping() { + } public CakeTopping(String name, int calories) { this.setName(name); diff --git a/layers/src/main/java/com/iluwatar/layers/CakeToppingDao.java b/layers/src/main/java/com/iluwatar/layers/CakeToppingDao.java index 5ae63e3458d2..e9931785e357 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeToppingDao.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeToppingDao.java @@ -27,9 +27,7 @@ import org.springframework.stereotype.Repository; /** - * - * CRUD repository cake toppings - * + * CRUD repository cake toppings. */ @Repository public interface CakeToppingDao extends CrudRepository { diff --git a/layers/src/main/java/com/iluwatar/layers/CakeToppingInfo.java b/layers/src/main/java/com/iluwatar/layers/CakeToppingInfo.java index dc138778a172..eee28601c3da 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeToppingInfo.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeToppingInfo.java @@ -26,9 +26,7 @@ import java.util.Optional; /** - * - * DTO for cake toppings - * + * DTO for cake toppings. */ public class CakeToppingInfo { @@ -37,7 +35,7 @@ public class CakeToppingInfo { public final int calories; /** - * Constructor + * Constructor. */ public CakeToppingInfo(Long id, String name, int calories) { this.id = Optional.of(id); @@ -46,7 +44,7 @@ public CakeToppingInfo(Long id, String name, int calories) { } /** - * Constructor + * Constructor. */ public CakeToppingInfo(String name, int calories) { this.id = Optional.empty(); @@ -56,6 +54,7 @@ public CakeToppingInfo(String name, int calories) { @Override public String toString() { - return String.format("CakeToppingInfo id=%d name=%s calories=%d", id.orElse(-1L), name, calories); + return String.format("CakeToppingInfo id=%d name=%s calories=%d", + id.orElse(-1L), name, calories); } } diff --git a/layers/src/main/java/com/iluwatar/layers/CakeViewImpl.java b/layers/src/main/java/com/iluwatar/layers/CakeViewImpl.java index 67c409793055..934096673d14 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeViewImpl.java +++ b/layers/src/main/java/com/iluwatar/layers/CakeViewImpl.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * - * View implementation for displaying cakes - * + * View implementation for displaying cakes. */ public class CakeViewImpl implements View { diff --git a/layers/src/main/java/com/iluwatar/layers/View.java b/layers/src/main/java/com/iluwatar/layers/View.java index e2456d524d33..14ab91f031bf 100644 --- a/layers/src/main/java/com/iluwatar/layers/View.java +++ b/layers/src/main/java/com/iluwatar/layers/View.java @@ -24,9 +24,7 @@ package com.iluwatar.layers; /** - * - * View interface - * + * View interface. */ public interface View { From 50986fa15b312d95e86717259bafca7aeaddf1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Tue, 5 Nov 2019 20:07:50 +0200 Subject: [PATCH 131/197] #590 arrange Layers into packages and add explanation --- layers/README.md | 80 ++++++++++++++++++- layers/etc/layers.ucls | 28 +++---- .../com/iluwatar/layers/{ => app}/App.java | 15 +++- .../iluwatar/layers/{ => dao}/CakeDao.java | 3 +- .../layers/{ => dao}/CakeLayerDao.java | 3 +- .../layers/{ => dao}/CakeToppingDao.java | 3 +- .../iluwatar/layers/{ => dto}/CakeInfo.java | 2 +- .../layers/{ => dto}/CakeLayerInfo.java | 2 +- .../layers/{ => dto}/CakeToppingInfo.java | 2 +- .../iluwatar/layers/{ => entity}/Cake.java | 4 +- .../layers/{ => entity}/CakeLayer.java | 6 +- .../layers/{ => entity}/CakeTopping.java | 6 +- .../{ => exception}/CakeBakingException.java | 2 +- .../{ => service}/CakeBakingService.java | 6 +- .../{ => service}/CakeBakingServiceImpl.java | 12 ++- .../layers/{ => view}/CakeViewImpl.java | 3 +- .../com/iluwatar/layers/{ => view}/View.java | 2 +- .../iluwatar/layers/{ => app}/AppTest.java | 3 +- .../layers/{ => entity}/CakeTest.java | 5 +- .../CakeBakingExceptionTest.java | 3 +- .../CakeBakingServiceImplTest.java | 7 +- .../layers/{ => view}/CakeViewImplTest.java | 7 +- 22 files changed, 164 insertions(+), 40 deletions(-) rename layers/src/main/java/com/iluwatar/layers/{ => app}/App.java (88%) rename layers/src/main/java/com/iluwatar/layers/{ => dao}/CakeDao.java (94%) rename layers/src/main/java/com/iluwatar/layers/{ => dao}/CakeLayerDao.java (94%) rename layers/src/main/java/com/iluwatar/layers/{ => dao}/CakeToppingDao.java (94%) rename layers/src/main/java/com/iluwatar/layers/{ => dto}/CakeInfo.java (98%) rename layers/src/main/java/com/iluwatar/layers/{ => dto}/CakeLayerInfo.java (98%) rename layers/src/main/java/com/iluwatar/layers/{ => dto}/CakeToppingInfo.java (98%) rename layers/src/main/java/com/iluwatar/layers/{ => entity}/Cake.java (96%) rename layers/src/main/java/com/iluwatar/layers/{ => entity}/CakeLayer.java (94%) rename layers/src/main/java/com/iluwatar/layers/{ => entity}/CakeTopping.java (95%) rename layers/src/main/java/com/iluwatar/layers/{ => exception}/CakeBakingException.java (97%) rename layers/src/main/java/com/iluwatar/layers/{ => service}/CakeBakingService.java (88%) rename layers/src/main/java/com/iluwatar/layers/{ => service}/CakeBakingServiceImpl.java (93%) rename layers/src/main/java/com/iluwatar/layers/{ => view}/CakeViewImpl.java (94%) rename layers/src/main/java/com/iluwatar/layers/{ => view}/View.java (97%) rename layers/src/test/java/com/iluwatar/layers/{ => app}/AppTest.java (95%) rename layers/src/test/java/com/iluwatar/layers/{ => entity}/CakeTest.java (95%) rename layers/src/test/java/com/iluwatar/layers/{ => exception}/CakeBakingExceptionTest.java (95%) rename layers/src/test/java/com/iluwatar/layers/{ => service}/CakeBakingServiceImplTest.java (95%) rename layers/src/test/java/com/iluwatar/layers/{ => view}/CakeViewImplTest.java (92%) diff --git a/layers/README.md b/layers/README.md index 49b74c175b96..3214a9e61756 100644 --- a/layers/README.md +++ b/layers/README.md @@ -12,7 +12,7 @@ tags: --- ## Intent -Layers is an architectural style where software responsibilities are +Layers is an architectural pattern where software responsibilities are divided among the different layers of the application. ![alt text](./etc/layers.png "Layers") @@ -24,6 +24,84 @@ Use the Layers architecture when * you want to prevent a change from propagating throughout the application * you want to make your application more maintainable and testable +## Explanation + +Real world example + +> Consider a web site displaying decorated cakes for weddings and such. Instead of the web page directly reaching into the database, it relies on a service to deliver this information. The service then queries the data layer to assimilate the needed information. + +In Plain Words + +> With Layers architectural pattern different concerns reside on separate layers. View layer is interested only in rendering, service layer assembles the requested data from various sources, and data layer gets the bits from the data storage. + +Wikipedia says + +> In software engineering, multitier architecture (often referred to as n-tier architecture) or multilayered architecture is a client–server architecture in which presentation, application processing, and data management functions are physically separated. + +**Programmatic Example** + +On the data layer, we keep our cake building blocks. Cakes consist of layers and topping. + +```java +@Entity +public class Cake { + + @Id + @GeneratedValue + private Long id; + + @OneToOne(cascade = CascadeType.REMOVE) + private CakeTopping topping; + + @OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER) + private Set layers; +} +``` + +The service layer offers CakeBakingService for easy access to different aspects of cakes. + +```java +public interface CakeBakingService { + + void bakeNewCake(CakeInfo cakeInfo) throws CakeBakingException; + + List getAllCakes(); + + void saveNewTopping(CakeToppingInfo toppingInfo); + + List getAvailableToppings(); + + void saveNewLayer(CakeLayerInfo layerInfo); + + List getAvailableLayers(); +} +``` + +On the top we have our view responsible of rendering the cakes. + +```java +public interface View { + + void render(); + +} + +public class CakeViewImpl implements View { + + private static final Logger LOGGER = LoggerFactory.getLogger(CakeViewImpl.class); + + private CakeBakingService cakeBakingService; + + public CakeViewImpl(CakeBakingService cakeBakingService) { + this.cakeBakingService = cakeBakingService; + } + + public void render() { + cakeBakingService.getAllCakes().forEach(cake -> LOGGER.info(cake.toString())); + } +} +``` + ## Credits * [Pattern Oriented Software Architecture Vol I-V](http://www.amazon.com/Pattern-Oriented-Software-Architecture-Volume-Patterns/dp/0471958697) diff --git a/layers/etc/layers.ucls b/layers/etc/layers.ucls index 060b391c0acf..a3cac547a033 100644 --- a/layers/etc/layers.ucls +++ b/layers/etc/layers.ucls @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - getLayers() { return layers; } - public final void setLayers(Set layers) { + public void setLayers(Set layers) { this.layers = layers; } diff --git a/layers/src/main/java/com/iluwatar/layers/CakeLayer.java b/layers/src/main/java/com/iluwatar/layers/entity/CakeLayer.java similarity index 94% rename from layers/src/main/java/com/iluwatar/layers/CakeLayer.java rename to layers/src/main/java/com/iluwatar/layers/entity/CakeLayer.java index 3f09c8d7700d..3e3ab8a0e587 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeLayer.java +++ b/layers/src/main/java/com/iluwatar/layers/entity/CakeLayer.java @@ -21,7 +21,7 @@ * THE SOFTWARE. */ -package com.iluwatar.layers; +package com.iluwatar.layers.entity; import javax.persistence.CascadeType; import javax.persistence.Entity; @@ -66,7 +66,7 @@ public String getName() { return name; } - public final void setName(String name) { + public void setName(String name) { this.name = name; } @@ -74,7 +74,7 @@ public int getCalories() { return calories; } - public final void setCalories(int calories) { + public void setCalories(int calories) { this.calories = calories; } diff --git a/layers/src/main/java/com/iluwatar/layers/CakeTopping.java b/layers/src/main/java/com/iluwatar/layers/entity/CakeTopping.java similarity index 95% rename from layers/src/main/java/com/iluwatar/layers/CakeTopping.java rename to layers/src/main/java/com/iluwatar/layers/entity/CakeTopping.java index b4b057dd0a9e..ae5277499f8e 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeTopping.java +++ b/layers/src/main/java/com/iluwatar/layers/entity/CakeTopping.java @@ -21,7 +21,7 @@ * THE SOFTWARE. */ -package com.iluwatar.layers; +package com.iluwatar.layers.entity; import javax.persistence.CascadeType; import javax.persistence.Entity; @@ -66,11 +66,11 @@ public String getName() { return name; } - public final void setName(String name) { + public void setName(String name) { this.name = name; } - public final int getCalories() { + public int getCalories() { return calories; } diff --git a/layers/src/main/java/com/iluwatar/layers/CakeBakingException.java b/layers/src/main/java/com/iluwatar/layers/exception/CakeBakingException.java similarity index 97% rename from layers/src/main/java/com/iluwatar/layers/CakeBakingException.java rename to layers/src/main/java/com/iluwatar/layers/exception/CakeBakingException.java index 32ff307012b2..a027fee98e28 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeBakingException.java +++ b/layers/src/main/java/com/iluwatar/layers/exception/CakeBakingException.java @@ -21,7 +21,7 @@ * THE SOFTWARE. */ -package com.iluwatar.layers; +package com.iluwatar.layers.exception; /** * Custom exception used in cake baking. diff --git a/layers/src/main/java/com/iluwatar/layers/CakeBakingService.java b/layers/src/main/java/com/iluwatar/layers/service/CakeBakingService.java similarity index 88% rename from layers/src/main/java/com/iluwatar/layers/CakeBakingService.java rename to layers/src/main/java/com/iluwatar/layers/service/CakeBakingService.java index 31eaef83b537..1ccfa5cf83f9 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeBakingService.java +++ b/layers/src/main/java/com/iluwatar/layers/service/CakeBakingService.java @@ -21,8 +21,12 @@ * THE SOFTWARE. */ -package com.iluwatar.layers; +package com.iluwatar.layers.service; +import com.iluwatar.layers.dto.CakeInfo; +import com.iluwatar.layers.dto.CakeLayerInfo; +import com.iluwatar.layers.dto.CakeToppingInfo; +import com.iluwatar.layers.exception.CakeBakingException; import java.util.List; /** diff --git a/layers/src/main/java/com/iluwatar/layers/CakeBakingServiceImpl.java b/layers/src/main/java/com/iluwatar/layers/service/CakeBakingServiceImpl.java similarity index 93% rename from layers/src/main/java/com/iluwatar/layers/CakeBakingServiceImpl.java rename to layers/src/main/java/com/iluwatar/layers/service/CakeBakingServiceImpl.java index ac4c11c06ec2..403816421a4b 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeBakingServiceImpl.java +++ b/layers/src/main/java/com/iluwatar/layers/service/CakeBakingServiceImpl.java @@ -21,8 +21,18 @@ * THE SOFTWARE. */ -package com.iluwatar.layers; +package com.iluwatar.layers.service; +import com.iluwatar.layers.dto.CakeInfo; +import com.iluwatar.layers.dto.CakeLayerInfo; +import com.iluwatar.layers.dto.CakeToppingInfo; +import com.iluwatar.layers.dao.CakeDao; +import com.iluwatar.layers.dao.CakeLayerDao; +import com.iluwatar.layers.dao.CakeToppingDao; +import com.iluwatar.layers.entity.Cake; +import com.iluwatar.layers.entity.CakeLayer; +import com.iluwatar.layers.entity.CakeTopping; +import com.iluwatar.layers.exception.CakeBakingException; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; diff --git a/layers/src/main/java/com/iluwatar/layers/CakeViewImpl.java b/layers/src/main/java/com/iluwatar/layers/view/CakeViewImpl.java similarity index 94% rename from layers/src/main/java/com/iluwatar/layers/CakeViewImpl.java rename to layers/src/main/java/com/iluwatar/layers/view/CakeViewImpl.java index 934096673d14..5fcaac776b7a 100644 --- a/layers/src/main/java/com/iluwatar/layers/CakeViewImpl.java +++ b/layers/src/main/java/com/iluwatar/layers/view/CakeViewImpl.java @@ -21,8 +21,9 @@ * THE SOFTWARE. */ -package com.iluwatar.layers; +package com.iluwatar.layers.view; +import com.iluwatar.layers.service.CakeBakingService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/layers/src/main/java/com/iluwatar/layers/View.java b/layers/src/main/java/com/iluwatar/layers/view/View.java similarity index 97% rename from layers/src/main/java/com/iluwatar/layers/View.java rename to layers/src/main/java/com/iluwatar/layers/view/View.java index 14ab91f031bf..0002b23f6447 100644 --- a/layers/src/main/java/com/iluwatar/layers/View.java +++ b/layers/src/main/java/com/iluwatar/layers/view/View.java @@ -21,7 +21,7 @@ * THE SOFTWARE. */ -package com.iluwatar.layers; +package com.iluwatar.layers.view; /** * View interface. diff --git a/layers/src/test/java/com/iluwatar/layers/AppTest.java b/layers/src/test/java/com/iluwatar/layers/app/AppTest.java similarity index 95% rename from layers/src/test/java/com/iluwatar/layers/AppTest.java rename to layers/src/test/java/com/iluwatar/layers/app/AppTest.java index b95e899d7d5b..10d224a8e283 100644 --- a/layers/src/test/java/com/iluwatar/layers/AppTest.java +++ b/layers/src/test/java/com/iluwatar/layers/app/AppTest.java @@ -21,8 +21,9 @@ * THE SOFTWARE. */ -package com.iluwatar.layers; +package com.iluwatar.layers.app; +import com.iluwatar.layers.app.App; import org.junit.jupiter.api.Test; /** diff --git a/layers/src/test/java/com/iluwatar/layers/CakeTest.java b/layers/src/test/java/com/iluwatar/layers/entity/CakeTest.java similarity index 95% rename from layers/src/test/java/com/iluwatar/layers/CakeTest.java rename to layers/src/test/java/com/iluwatar/layers/entity/CakeTest.java index 81bb6d1deec9..3c0051bbc0dc 100644 --- a/layers/src/test/java/com/iluwatar/layers/CakeTest.java +++ b/layers/src/test/java/com/iluwatar/layers/entity/CakeTest.java @@ -21,8 +21,11 @@ * THE SOFTWARE. */ -package com.iluwatar.layers; +package com.iluwatar.layers.entity; +import com.iluwatar.layers.entity.Cake; +import com.iluwatar.layers.entity.CakeLayer; +import com.iluwatar.layers.entity.CakeTopping; import org.junit.jupiter.api.Test; import java.util.HashSet; diff --git a/layers/src/test/java/com/iluwatar/layers/CakeBakingExceptionTest.java b/layers/src/test/java/com/iluwatar/layers/exception/CakeBakingExceptionTest.java similarity index 95% rename from layers/src/test/java/com/iluwatar/layers/CakeBakingExceptionTest.java rename to layers/src/test/java/com/iluwatar/layers/exception/CakeBakingExceptionTest.java index 4535be67889d..8c96b7d8e8f0 100644 --- a/layers/src/test/java/com/iluwatar/layers/CakeBakingExceptionTest.java +++ b/layers/src/test/java/com/iluwatar/layers/exception/CakeBakingExceptionTest.java @@ -21,8 +21,9 @@ * THE SOFTWARE. */ -package com.iluwatar.layers; +package com.iluwatar.layers.exception; +import com.iluwatar.layers.exception.CakeBakingException; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/layers/src/test/java/com/iluwatar/layers/CakeBakingServiceImplTest.java b/layers/src/test/java/com/iluwatar/layers/service/CakeBakingServiceImplTest.java similarity index 95% rename from layers/src/test/java/com/iluwatar/layers/CakeBakingServiceImplTest.java rename to layers/src/test/java/com/iluwatar/layers/service/CakeBakingServiceImplTest.java index 21f3623298fb..41c8b17537ff 100644 --- a/layers/src/test/java/com/iluwatar/layers/CakeBakingServiceImplTest.java +++ b/layers/src/test/java/com/iluwatar/layers/service/CakeBakingServiceImplTest.java @@ -21,8 +21,13 @@ * THE SOFTWARE. */ -package com.iluwatar.layers; +package com.iluwatar.layers.service; +import com.iluwatar.layers.dto.CakeInfo; +import com.iluwatar.layers.dto.CakeLayerInfo; +import com.iluwatar.layers.dto.CakeToppingInfo; +import com.iluwatar.layers.exception.CakeBakingException; +import com.iluwatar.layers.service.CakeBakingServiceImpl; import org.junit.jupiter.api.Test; import java.util.Collections; diff --git a/layers/src/test/java/com/iluwatar/layers/CakeViewImplTest.java b/layers/src/test/java/com/iluwatar/layers/view/CakeViewImplTest.java similarity index 92% rename from layers/src/test/java/com/iluwatar/layers/CakeViewImplTest.java rename to layers/src/test/java/com/iluwatar/layers/view/CakeViewImplTest.java index ec19b115ce45..c396208b729b 100644 --- a/layers/src/test/java/com/iluwatar/layers/CakeViewImplTest.java +++ b/layers/src/test/java/com/iluwatar/layers/view/CakeViewImplTest.java @@ -21,11 +21,16 @@ * THE SOFTWARE. */ -package com.iluwatar.layers; +package com.iluwatar.layers.view; import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.AppenderBase; +import com.iluwatar.layers.dto.CakeInfo; +import com.iluwatar.layers.dto.CakeLayerInfo; +import com.iluwatar.layers.dto.CakeToppingInfo; +import com.iluwatar.layers.service.CakeBakingService; +import com.iluwatar.layers.view.CakeViewImpl; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; From 1fa8a604eb9fa5b2ca3866fd1fe0ca7bcee8fd1e Mon Sep 17 00:00:00 2001 From: Azureyjt Date: Fri, 8 Nov 2019 14:20:32 +0800 Subject: [PATCH 132/197] Sharding Pattern (#1056) * Create sharding module * Add Unit Tests * Fix readme hyperlink * Fix check-style issue --- pom.xml | 1 + sharding/README.md | 27 +++++ sharding/pom.xml | 45 ++++++++ .../main/java/com/iluwatar/sharding/App.java | 88 +++++++++++++++ .../main/java/com/iluwatar/sharding/Data.java | 84 ++++++++++++++ .../iluwatar/sharding/HashShardManager.java | 55 +++++++++ .../iluwatar/sharding/LookupShardManager.java | 66 +++++++++++ .../iluwatar/sharding/RangeShardManager.java | 66 +++++++++++ .../java/com/iluwatar/sharding/Shard.java | 59 ++++++++++ .../com/iluwatar/sharding/ShardManager.java | 103 +++++++++++++++++ .../java/com/iluwatar/sharding/AppTest.java | 39 +++++++ .../sharding/HashShardManagerTest.java | 64 +++++++++++ .../sharding/LookupShardManagerTest.java | 68 ++++++++++++ .../sharding/RangeShardManagerTest.java | 58 ++++++++++ .../iluwatar/sharding/ShardManagerTest.java | 104 ++++++++++++++++++ .../java/com/iluwatar/sharding/ShardTest.java | 83 ++++++++++++++ 16 files changed, 1010 insertions(+) create mode 100644 sharding/README.md create mode 100644 sharding/pom.xml create mode 100644 sharding/src/main/java/com/iluwatar/sharding/App.java create mode 100644 sharding/src/main/java/com/iluwatar/sharding/Data.java create mode 100644 sharding/src/main/java/com/iluwatar/sharding/HashShardManager.java create mode 100644 sharding/src/main/java/com/iluwatar/sharding/LookupShardManager.java create mode 100644 sharding/src/main/java/com/iluwatar/sharding/RangeShardManager.java create mode 100644 sharding/src/main/java/com/iluwatar/sharding/Shard.java create mode 100644 sharding/src/main/java/com/iluwatar/sharding/ShardManager.java create mode 100644 sharding/src/test/java/com/iluwatar/sharding/AppTest.java create mode 100644 sharding/src/test/java/com/iluwatar/sharding/HashShardManagerTest.java create mode 100644 sharding/src/test/java/com/iluwatar/sharding/LookupShardManagerTest.java create mode 100644 sharding/src/test/java/com/iluwatar/sharding/RangeShardManagerTest.java create mode 100644 sharding/src/test/java/com/iluwatar/sharding/ShardManagerTest.java create mode 100644 sharding/src/test/java/com/iluwatar/sharding/ShardTest.java diff --git a/pom.xml b/pom.xml index 8b8139f790e3..6a666caabb3a 100644 --- a/pom.xml +++ b/pom.xml @@ -184,6 +184,7 @@ subclass-sandbox circuit-breaker double-buffer + sharding diff --git a/sharding/README.md b/sharding/README.md new file mode 100644 index 000000000000..b40f08cfccd5 --- /dev/null +++ b/sharding/README.md @@ -0,0 +1,27 @@ + +--- +layout: pattern +title: Sharding +folder: sharding +permalink: /patterns/sharding/ +categories: Other +tags: + - Java + - Difficulty-Beginner +--- + +## Intent +Sharding pattern means divide the data store into horizontal partitions or shards. Each shard has the same schema, but holds its own distinct subset of the data. +A shard is a data store in its own right (it can contain the data for many entities of different types), running on a server acting as a storage node. + +## Applicability +This pattern offers the following benefits: + +- You can scale the system out by adding further shards running on additional storage nodes. +- A system can use off the shelf commodity hardware rather than specialized (and expensive) computers for each storage node. +- You can reduce contention and improved performance by balancing the workload across shards. +- In the cloud, shards can be located physically close to the users that will access the data. + +## Credits + +* [Cloud Design Patterns: Prescriptive Architecture Guidance for Cloud Applications - Sharding Pattern](https://docs.microsoft.com/en-us/previous-versions/msp-n-p/dn589797(v=pandp.10)?redirectedfrom=MSDN) \ No newline at end of file diff --git a/sharding/pom.xml b/sharding/pom.xml new file mode 100644 index 000000000000..f0dd01a7c8a2 --- /dev/null +++ b/sharding/pom.xml @@ -0,0 +1,45 @@ + + + + + java-design-patterns + com.iluwatar + 1.22.0-SNAPSHOT + + 4.0.0 + + sharding + + + + junit + junit + + + + \ No newline at end of file diff --git a/sharding/src/main/java/com/iluwatar/sharding/App.java b/sharding/src/main/java/com/iluwatar/sharding/App.java new file mode 100644 index 000000000000..482b056b165f --- /dev/null +++ b/sharding/src/main/java/com/iluwatar/sharding/App.java @@ -0,0 +1,88 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +/** + * Sharding pattern means dividing a data store into a set of horizontal partitions + * or shards. This pattern can improve scalability when storing and accessing large + * volumes of data. + */ +public class App { + + /** + * Program main entry point. + * @param args program runtime arguments + */ + public static void main(String[] args) { + + var data1 = new Data(1, "data1", Data.DataType.type1); + var data2 = new Data(2, "data2", Data.DataType.type2); + var data3 = new Data(3, "data3", Data.DataType.type3); + var data4 = new Data(4, "data4", Data.DataType.type1); + + var shard1 = new Shard(1); + var shard2 = new Shard(2); + var shard3 = new Shard(3); + + ShardManager manager = new LookupShardManager(); + manager.addNewShard(shard1); + manager.addNewShard(shard2); + manager.addNewShard(shard3); + manager.storeData(data1); + manager.storeData(data2); + manager.storeData(data3); + manager.storeData(data4); + + shard1.clearData(); + shard2.clearData(); + shard3.clearData(); + + manager = new RangeShardManager(); + manager.addNewShard(shard1); + manager.addNewShard(shard2); + manager.addNewShard(shard3); + manager.storeData(data1); + manager.storeData(data2); + manager.storeData(data3); + manager.storeData(data4); + + shard1.clearData(); + shard2.clearData(); + shard3.clearData(); + + manager = new HashShardManager(); + manager.addNewShard(shard1); + manager.addNewShard(shard2); + manager.addNewShard(shard3); + manager.storeData(data1); + manager.storeData(data2); + manager.storeData(data3); + manager.storeData(data4); + + shard1.clearData(); + shard2.clearData(); + shard3.clearData(); + } + +} diff --git a/sharding/src/main/java/com/iluwatar/sharding/Data.java b/sharding/src/main/java/com/iluwatar/sharding/Data.java new file mode 100644 index 000000000000..92e84e93ae18 --- /dev/null +++ b/sharding/src/main/java/com/iluwatar/sharding/Data.java @@ -0,0 +1,84 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +/** + * Basic data structure for each tuple stored in data shards. + */ +public class Data { + + private int key; + + private String value; + + private DataType type; + + /** + * Constructor of Data class. + * @param key data key + * @param value data vlue + * @param type data type + */ + public Data(final int key, final String value, final DataType type) { + this.key = key; + this.value = value; + this.type = type; + } + + public int getKey() { + return key; + } + + public void setKey(final int key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(final String value) { + this.value = value; + } + + public DataType getType() { + return type; + } + + public void setType(DataType type) { + this.type = type; + } + + enum DataType { + type1, type2, type3 + } + + @Override + public String toString() { + return "Data {" + "key=" + + key + ", value='" + value + + '\'' + ", type=" + type + '}'; + } +} + diff --git a/sharding/src/main/java/com/iluwatar/sharding/HashShardManager.java b/sharding/src/main/java/com/iluwatar/sharding/HashShardManager.java new file mode 100644 index 000000000000..11ada60d72ae --- /dev/null +++ b/sharding/src/main/java/com/iluwatar/sharding/HashShardManager.java @@ -0,0 +1,55 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * ShardManager with hash strategy. The purpose of this strategy is to reduce the + * chance of hot-spots in the data. It aims to distribute the data across the shards + * in a way that achieves a balance between the size of each shard and the average + * load that each shard will encounter. + */ +public class HashShardManager extends ShardManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(HashShardManager.class); + + @Override + public int storeData(Data data) { + var shardId = allocateShard(data); + var shard = shardMap.get(shardId); + shard.storeData(data); + LOGGER.info(data.toString() + " is stored in Shard " + shardId); + return shardId; + } + + @Override + protected int allocateShard(Data data) { + var shardCount = shardMap.size(); + var hash = data.getKey() % shardCount; + return hash == 0 ? hash + shardCount : hash; + } + +} diff --git a/sharding/src/main/java/com/iluwatar/sharding/LookupShardManager.java b/sharding/src/main/java/com/iluwatar/sharding/LookupShardManager.java new file mode 100644 index 000000000000..f282afd28bf8 --- /dev/null +++ b/sharding/src/main/java/com/iluwatar/sharding/LookupShardManager.java @@ -0,0 +1,66 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +import java.util.HashMap; +import java.util.Map; +import java.util.Random; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * ShardManager with lookup strategy. In this strategy the sharding logic implements + * a map that routes a request for data to the shard that contains that data by using + * the shard key. + */ +public class LookupShardManager extends ShardManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(LookupShardManager.class); + + private Map lookupMap = new HashMap<>(); + + @Override + public int storeData(Data data) { + var shardId = allocateShard(data); + lookupMap.put(data.getKey(), shardId); + var shard = shardMap.get(shardId); + shard.storeData(data); + LOGGER.info(data.toString() + " is stored in Shard " + shardId); + return shardId; + } + + @Override + protected int allocateShard(Data data) { + var key = data.getKey(); + if (lookupMap.containsKey(key)) { + return lookupMap.get(key); + } else { + var shardCount = shardMap.size(); + var allocatedShardId = new Random().nextInt(shardCount - 1) + 1; + return allocatedShardId; + } + } + +} diff --git a/sharding/src/main/java/com/iluwatar/sharding/RangeShardManager.java b/sharding/src/main/java/com/iluwatar/sharding/RangeShardManager.java new file mode 100644 index 000000000000..f7a8a90af601 --- /dev/null +++ b/sharding/src/main/java/com/iluwatar/sharding/RangeShardManager.java @@ -0,0 +1,66 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * ShardManager with range strategy. This strategy groups related items together + * in the same shard, and orders them by shard key. + */ +public class RangeShardManager extends ShardManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(RangeShardManager.class); + + @Override + public int storeData(Data data) { + var shardId = allocateShard(data); + var shard = shardMap.get(shardId); + shard.storeData(data); + LOGGER.info(data.toString() + " is stored in Shard " + shardId); + return shardId; + } + + @Override + protected int allocateShard(Data data) { + var type = data.getType(); + var shardId = -1; + switch (type) { + case type1: + shardId = 1; + break; + case type2: + shardId = 2; + break; + case type3: + shardId = 3; + break; + default: + break; + } + return shardId; + } + +} diff --git a/sharding/src/main/java/com/iluwatar/sharding/Shard.java b/sharding/src/main/java/com/iluwatar/sharding/Shard.java new file mode 100644 index 000000000000..eb081425887e --- /dev/null +++ b/sharding/src/main/java/com/iluwatar/sharding/Shard.java @@ -0,0 +1,59 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +import java.util.HashMap; +import java.util.Map; + +/** + * The Shard class stored data in a HashMap. + */ +public class Shard { + + private final int id; + + private Map dataStore; + + public Shard(final int id) { + this.id = id; + this.dataStore = new HashMap<>(); + } + + public void storeData(Data data) { + dataStore.put(data.getKey(), data); + } + + public void clearData() { + dataStore.clear(); + } + + public Data getDataById(final int id) { + return dataStore.get(id); + } + + public int getId() { + return id; + } + +} diff --git a/sharding/src/main/java/com/iluwatar/sharding/ShardManager.java b/sharding/src/main/java/com/iluwatar/sharding/ShardManager.java new file mode 100644 index 000000000000..f244509d503a --- /dev/null +++ b/sharding/src/main/java/com/iluwatar/sharding/ShardManager.java @@ -0,0 +1,103 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +import java.util.HashMap; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Abstract class for ShardManager. + */ +public abstract class ShardManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(ShardManager.class); + + protected Map shardMap; + + public ShardManager() { + shardMap = new HashMap<>(); + } + + /** + * Add a provided shard instance to shardMap. + * + * @param shard new shard instance. + * @return {@code true} if succeed to add the new instance. + * {@code false} if the shardId is already existed. + */ + public boolean addNewShard(final Shard shard) { + var shardId = shard.getId(); + if (!shardMap.containsKey(shardId)) { + shardMap.put(shardId, shard); + return true; + } else { + return false; + } + } + + /** + * Remove a shard instance by provided Id. + * + * @param shardId Id of shard instance to remove. + * @return {@code true} if removed. {@code false} if the shardId is not existed. + */ + public boolean removeShardById(final int shardId) { + if (shardMap.containsKey(shardId)) { + shardMap.remove(shardId); + return true; + } else { + return false; + } + } + + /** + * Get shard instance by provided shardId. + * + * @param shardId id of shard instance to get + * @return required shard instance + */ + public Shard getShardById(final int shardId) { + return shardMap.get(shardId); + } + + /** + * Store data in proper shard instance. + * + * @param data new data + * @return id of shard that the data is stored in + */ + public abstract int storeData(final Data data); + + /** + * Allocate proper shard to provided data. + * + * @param data new data + * @return id of shard that the data should be stored + */ + protected abstract int allocateShard(final Data data); + +} diff --git a/sharding/src/test/java/com/iluwatar/sharding/AppTest.java b/sharding/src/test/java/com/iluwatar/sharding/AppTest.java new file mode 100644 index 000000000000..fce8d89a3ca6 --- /dev/null +++ b/sharding/src/test/java/com/iluwatar/sharding/AppTest.java @@ -0,0 +1,39 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +import org.junit.Test; + +/** + * Unit tests for App class. + */ +public class AppTest { + + @Test + public void testMain() { + String[] args = {}; + App.main(args); + } + +} diff --git a/sharding/src/test/java/com/iluwatar/sharding/HashShardManagerTest.java b/sharding/src/test/java/com/iluwatar/sharding/HashShardManagerTest.java new file mode 100644 index 000000000000..6418cf0c4f5b --- /dev/null +++ b/sharding/src/test/java/com/iluwatar/sharding/HashShardManagerTest.java @@ -0,0 +1,64 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Unit tests for HashShardManager class. + */ +public class HashShardManagerTest { + + private HashShardManager hashShardManager; + + /** + * Initialize hashShardManager instance. + */ + @Before + public void setup() { + hashShardManager = new HashShardManager(); + var shard1 = new Shard(1); + var shard2 = new Shard(2); + var shard3 = new Shard(3); + hashShardManager.addNewShard(shard1); + hashShardManager.addNewShard(shard2); + hashShardManager.addNewShard(shard3); + } + + @After + public void tearDown() { + + } + + @Test + public void testStoreData() { + var data = new Data(1, "test", Data.DataType.type1); + hashShardManager.storeData(data); + Assert.assertEquals(data, hashShardManager.getShardById(1).getDataById(1)); + } + +} diff --git a/sharding/src/test/java/com/iluwatar/sharding/LookupShardManagerTest.java b/sharding/src/test/java/com/iluwatar/sharding/LookupShardManagerTest.java new file mode 100644 index 000000000000..7379859b8272 --- /dev/null +++ b/sharding/src/test/java/com/iluwatar/sharding/LookupShardManagerTest.java @@ -0,0 +1,68 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +import java.util.Map; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Unit tests for LookupShardManager class. + */ +public class LookupShardManagerTest { + + private LookupShardManager lookupShardManager; + + /** + * Initialize lookupShardManager instance. + */ + @Before + public void setup() { + lookupShardManager = new LookupShardManager(); + var shard1 = new Shard(1); + var shard2 = new Shard(2); + var shard3 = new Shard(3); + lookupShardManager.addNewShard(shard1); + lookupShardManager.addNewShard(shard2); + lookupShardManager.addNewShard(shard3); + } + + @Test + public void testStoreData() { + try { + var data = new Data(1, "test", Data.DataType.type1); + lookupShardManager.storeData(data); + var field = LookupShardManager.class.getDeclaredField("lookupMap"); + field.setAccessible(true); + Map lookupMap = (Map) field.get(lookupShardManager); + var shardId = lookupMap.get(1); + var shard = lookupShardManager.getShardById(shardId); + Assert.assertEquals(data, shard.getDataById(1)); + } catch (NoSuchFieldException | IllegalAccessException e) { + Assert.fail("Fail to modify field access."); + } + } +} diff --git a/sharding/src/test/java/com/iluwatar/sharding/RangeShardManagerTest.java b/sharding/src/test/java/com/iluwatar/sharding/RangeShardManagerTest.java new file mode 100644 index 000000000000..997687dfc9f6 --- /dev/null +++ b/sharding/src/test/java/com/iluwatar/sharding/RangeShardManagerTest.java @@ -0,0 +1,58 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Unit tests for RangeShardManager class. + */ +public class RangeShardManagerTest { + + private RangeShardManager rangeShardManager; + + /** + * Initialize rangeShardManager instance. + */ + @Before + public void setup() { + rangeShardManager = new RangeShardManager(); + var shard1 = new Shard(1); + var shard2 = new Shard(2); + var shard3 = new Shard(3); + rangeShardManager.addNewShard(shard1); + rangeShardManager.addNewShard(shard2); + rangeShardManager.addNewShard(shard3); + } + + @Test + public void testStoreData() { + var data = new Data(1, "test", Data.DataType.type1); + rangeShardManager.storeData(data); + Assert.assertEquals(data, rangeShardManager.getShardById(1).getDataById(1)); + } + +} diff --git a/sharding/src/test/java/com/iluwatar/sharding/ShardManagerTest.java b/sharding/src/test/java/com/iluwatar/sharding/ShardManagerTest.java new file mode 100644 index 000000000000..ff4544973ef7 --- /dev/null +++ b/sharding/src/test/java/com/iluwatar/sharding/ShardManagerTest.java @@ -0,0 +1,104 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +import java.util.Map; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Unit tests for ShardManager class. + */ +public class ShardManagerTest { + + private ShardManager shardManager; + + /** + * Initialize shardManager instance. + */ + @Before + public void setup() { + shardManager = new TestShardManager(); + } + + @After + public void tearDown() { + + } + + @Test + public void testAddNewShard() { + try { + var shard = new Shard(1); + shardManager.addNewShard(shard); + var field = ShardManager.class.getDeclaredField("shardMap"); + field.setAccessible(true); + Map map = (Map) field.get(shardManager); + Assert.assertEquals(1, map.size()); + Assert.assertEquals(shard, map.get(1)); + } catch (NoSuchFieldException | IllegalAccessException e) { + Assert.fail("Fail to modify field access."); + } + } + + @Test + public void testRemoveShardById() { + try { + var shard = new Shard(1); + shardManager.addNewShard(shard); + boolean flag = shardManager.removeShardById(1); + var field = ShardManager.class.getDeclaredField("shardMap"); + field.setAccessible(true); + Map map = (Map) field.get(shardManager); + Assert.assertEquals(true, flag); + Assert.assertEquals(0, map.size()); + } catch (IllegalAccessException | NoSuchFieldException e) { + Assert.fail("Fail to modify field access."); + } + } + + @Test + public void testGetShardById() { + Shard shard = new Shard(1); + shardManager.addNewShard(shard); + Shard tmpShard = shardManager.getShardById(1); + Assert.assertEquals(shard, tmpShard); + } + + class TestShardManager extends ShardManager { + + @Override + public int storeData(Data data) { + return 0; + } + + @Override + protected int allocateShard(Data data) { + return 0; + } + } +} diff --git a/sharding/src/test/java/com/iluwatar/sharding/ShardTest.java b/sharding/src/test/java/com/iluwatar/sharding/ShardTest.java new file mode 100644 index 000000000000..4c0f74fa2e8d --- /dev/null +++ b/sharding/src/test/java/com/iluwatar/sharding/ShardTest.java @@ -0,0 +1,83 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ + +package com.iluwatar.sharding; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + + +/** + * Unit tests for Shard class. + */ +public class ShardTest { + + private Data data; + + private Shard shard; + + @Before + public void setup() { + data = new Data(1, "test", Data.DataType.type1); + shard = new Shard(1); + } + + @After + public void tearDown() {} + + @Test + public void testStoreData() { + try { + shard.storeData(data); + var field = Shard.class.getDeclaredField("dataStore"); + field.setAccessible(true); + Map dataMap = (Map) field.get(shard); + Assert.assertEquals(1, dataMap.size()); + Assert.assertEquals(data, dataMap.get(1)); + } catch (NoSuchFieldException | IllegalAccessException e) { + Assert.fail("Fail to modify field access."); + } + + } + + @Test + public void testClearData() { + try { + Map dataMap = new HashMap<>(); + dataMap.put(1, data); + var field = Shard.class.getDeclaredField("dataStore"); + field.setAccessible(true); + field.set(shard, dataMap); + shard.clearData(); + dataMap = (Map) field.get(shard); + Assert.assertEquals(0, dataMap.size()); + } catch (NoSuchFieldException | IllegalAccessException e) { + Assert.fail("Fail to modify field access."); + } + } +} From 09b4663b9a15c406b899bc6900320a8361c92253 Mon Sep 17 00:00:00 2001 From: Besok Date: Sat, 9 Nov 2019 17:42:49 +0000 Subject: [PATCH 133/197] add choreogr --- .../iluwatar/saga/choreography/Chapter.java | 27 ++-- .../saga/choreography/FlyBookingService.java | 38 ++++++ .../choreography/HotelBookingService.java | 40 ++++++ .../saga/choreography/OrderService.java | 39 ++++++ .../com/iluwatar/saga/choreography/Saga.java | 125 ++++++++++++++++++ .../saga/choreography/SagaApplication.java | 77 +++++++++++ .../iluwatar/saga/choreography/Service.java | 103 +++++++++++++++ .../choreography/ServiceDiscoveryService.java | 60 +++++++++ .../choreography/WithdrawMoneyService.java | 53 ++++++++ .../com/iluwatar/saga/orchestration/Saga.java | 3 +- .../saga/orchestration/SagaApplication.java | 5 +- .../saga/orchestration/SagaOrchestrator.java | 2 +- .../ServiceDiscoveryService.java | 4 +- .../choreography/SagaApplicationTest.java | 35 +++++ .../choreography/SagaChoreographyTest.java | 59 +++++++++ .../orchestration/SagaApplicationTest.java | 22 +++ .../SagaOrchestratorInternallyTest.java | 25 +++- .../orchestration/SagaOrchestratorTest.java | 23 +++- 18 files changed, 719 insertions(+), 21 deletions(-) create mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/FlyBookingService.java create mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/HotelBookingService.java create mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/OrderService.java create mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/SagaApplication.java create mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/Service.java create mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/ServiceDiscoveryService.java create mode 100644 saga/src/main/java/com/iluwatar/saga/choreography/WithdrawMoneyService.java rename saga/src/main/java/com/iluwatar/saga/{ => orchestration}/ServiceDiscoveryService.java (95%) create mode 100644 saga/src/test/java/com/iluwatar/saga/choreography/SagaApplicationTest.java create mode 100644 saga/src/test/java/com/iluwatar/saga/choreography/SagaChoreographyTest.java diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java b/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java index f610b9f62b03..51b0ce6b83f9 100644 --- a/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java +++ b/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java @@ -22,13 +22,20 @@ */ package com.iluwatar.saga.choreography; -import com.iluwatar.saga.orchestration.ChapterResult; /** * Chapter is an interface representing a contract for an external service. - * @param is type for passing params - */ -public interface Chapter { + * In that case, a service needs to make a decision what to do further + * hence the server needs to get all context representing {@link Saga} + * */ +public interface Chapter { + + /** + * In that case, every method is responsible to make a decision on what to do then + * @param saga incoming saga + * @return saga result + */ + Saga execute(Saga saga); /** * @return service name. @@ -37,17 +44,17 @@ public interface Chapter { /** * The operation executed in general case. - * @param value incoming value - * @return result {@link ChapterResult} + * @param saga incoming saga + * @return result {@link Saga} */ - ChapterResult process(K value); + Saga process(Saga saga); /** * The operation executed in rollback case. - * @param value incoming value - * @return result {@link ChapterResult} + * @param saga incoming saga + * @return result {@link Saga} */ - ChapterResult rollback(K value); + Saga rollback(Saga saga); } diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/FlyBookingService.java b/saga/src/main/java/com/iluwatar/saga/choreography/FlyBookingService.java new file mode 100644 index 000000000000..591324c52848 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/choreography/FlyBookingService.java @@ -0,0 +1,38 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.choreography; + + +/** + * Class representing a service to book a fly + */ +public class FlyBookingService extends Service { + public FlyBookingService(ServiceDiscoveryService service) { + super(service); + } + + @Override + public String getName() { + return "booking a Fly"; + } +} diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/HotelBookingService.java b/saga/src/main/java/com/iluwatar/saga/choreography/HotelBookingService.java new file mode 100644 index 000000000000..e822a35682cf --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/choreography/HotelBookingService.java @@ -0,0 +1,40 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.choreography; + + +/** + * Class representing a service to book a hotel + */ +public class HotelBookingService extends Service { + public HotelBookingService(ServiceDiscoveryService service) { + super(service); + } + + @Override + public String getName() { + return "booking a Hotel"; + } + + + } diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/OrderService.java b/saga/src/main/java/com/iluwatar/saga/choreography/OrderService.java new file mode 100644 index 000000000000..6c8b9912ec10 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/choreography/OrderService.java @@ -0,0 +1,39 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.choreography; + + +/** + * Class representing a service to init a new order. + */ +public class OrderService extends Service{ + + public OrderService(ServiceDiscoveryService service) { + super(service); + } + + @Override + public String getName() { + return "init an order"; + } +} diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/Saga.java b/saga/src/main/java/com/iluwatar/saga/choreography/Saga.java index 94c8a119dcec..34a8d6a0f39d 100644 --- a/saga/src/main/java/com/iluwatar/saga/choreography/Saga.java +++ b/saga/src/main/java/com/iluwatar/saga/choreography/Saga.java @@ -22,6 +22,10 @@ */ package com.iluwatar.saga.choreography; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + /** * Saga representation. * Saga consists of chapters. @@ -29,6 +33,127 @@ */ public class Saga { + private List chapters; + private int pos; + private boolean forward; + private boolean finished; + + + public static Saga create() { + return new Saga(); + } + public SagaResult getResult() { + return !finished ? + SagaResult.PROGRESS : + forward ? + SagaResult.FINISHED : + SagaResult.ROLLBACKED; + } + public Saga chapter(String name) { + this.chapters.add(new Chapter(name)); + return this; + } + public Saga setInValue(Object value){ + if(chapters.isEmpty()){ + return this; + } + chapters.get(chapters.size()-1).setInValue(value); + return this; + } + public Object getCurrentValue(){ + return chapters.get(pos).getInValue(); + } + public void setCurrentValue(Object value){ + chapters.get(pos).setInValue(value); + } + public void setCurrentStatus(ChapterResult result){ + chapters.get(pos).setResult(result); + } + + void setFinished(boolean finished) { + this.finished = finished; + } + boolean isForward() { + return forward; + } + int forward() { + return ++pos; + } + + int back() { + this.forward = false; + return --pos; + } + + + public Saga() { + this.chapters = new ArrayList<>(); + this.pos = 0; + this.forward = true; + this.finished = false; + } + + Chapter getCurrent() { + return chapters.get(pos); + } + + + boolean isPresent() { + return pos >= 0 && pos < chapters.size(); + } + boolean isCurrentSuccess(){ + return chapters.get(pos).isSuccess(); + } + + /*** + * Class presents a chapter status and incoming parameters(incoming parameter transforms to outcoming parameter) + */ + public static class Chapter { + private String name; + private ChapterResult result; + private Object inValue; + + + public Chapter(String name) { + this.name = name; + this.result = ChapterResult.INIT; + } + + public Object getInValue() { + return inValue; + } + + public void setInValue(Object object) { + this.inValue = object; + } + + public String getName() { + return name; + } + public void setResult(ChapterResult result){ + this.result = result; + } + + public boolean isSuccess(){ + return result == ChapterResult.SUCCESS; + } + } + + + public enum ChapterResult { + INIT, SUCCESS, ROLLBACK + } + public enum SagaResult { + PROGRESS, FINISHED, ROLLBACKED + } + @Override + public String toString() { + return "Saga{" + + "chapters=" + Arrays.toString(chapters.toArray()) + + ", pos=" + pos + + ", forward=" + forward + + '}'; + } } diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/SagaApplication.java b/saga/src/main/java/com/iluwatar/saga/choreography/SagaApplication.java new file mode 100644 index 000000000000..46792adac113 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/choreography/SagaApplication.java @@ -0,0 +1,77 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.choreography; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This pattern is used in distributed services to perform a group of operations atomically. + * This is an analog of transaction in a database but in terms of microservices architecture this is executed + * in a distributed environment + *

    + * A saga is a sequence of local transactions in a certain context. If one transaction fails for some reason, + * the saga executes compensating transactions(rollbacks) to undo the impact of the preceding transactions. + *

    + * In this approach, there are no mediators or orchestrators services. + * All chapters are handled and moved by services manually. + *

    + * The major difference with choreography saga is an ability to handle crashed services + * (otherwise in choreography services very hard to prevent a saga if one of them has been crashed) + * + * @see com.iluwatar.saga.choreography.Saga + * @see Service + */ +public class SagaApplication { + private static final Logger logger = LoggerFactory.getLogger(SagaApplication.class); + + public static void main(String[] args) { + ServiceDiscoveryService sd = serviceDiscovery(); + Chapter service = sd.findAny(); + Saga goodOrderSaga = service.execute(newSaga("good_order")); + Saga badOrderSaga = service.execute(newSaga("bad_order")); + logger.info("orders: goodOrder is {}, badOrder is {}", + goodOrderSaga.getResult(), badOrderSaga.getResult()); + + } + + + private static Saga newSaga(Object value) { + return Saga + .create() + .chapter("init an order").setInValue(value) + .chapter("booking a Fly") + .chapter("booking a Hotel") + .chapter("withdrawing Money"); + } + + private static ServiceDiscoveryService serviceDiscovery() { + ServiceDiscoveryService sd = new ServiceDiscoveryService(); + return sd + .discover(new OrderService(sd)) + .discover(new FlyBookingService(sd)) + .discover(new HotelBookingService(sd)) + .discover(new WithdrawMoneyService(sd)); + } +} diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/Service.java b/saga/src/main/java/com/iluwatar/saga/choreography/Service.java new file mode 100644 index 000000000000..0f182e570927 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/choreography/Service.java @@ -0,0 +1,103 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.choreography; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Common abstraction class representing services + * implementing a general contract @see {@link Chapter} + */ +public abstract class Service implements Chapter { + protected static final Logger logger = LoggerFactory.getLogger(Service.class); + + private final ServiceDiscoveryService sd; + + public Service(ServiceDiscoveryService service) { + this.sd = service; + } + + @Override + public Saga execute(Saga saga) { + Saga nextSaga = saga; + Object nextVal; + String chapterName = saga.getCurrent().getName(); + if (chapterName.equals(getName())) { + if (saga.isForward()) { + nextSaga = process(saga); + nextVal = nextSaga.getCurrentValue(); + if (nextSaga.isCurrentSuccess()) { + nextSaga.forward(); + } else { + nextSaga.back(); + } + } else { + nextSaga = rollback(saga); + nextVal = nextSaga.getCurrentValue(); + nextSaga.back(); + } + + if (isSagaFinished(nextSaga)) { + return nextSaga; + } + + nextSaga.setCurrentValue(nextVal); + } + Saga finalNextSaga = nextSaga; + + return sd.find(chapterName).map(ch -> ch.execute(finalNextSaga)) + .orElseThrow(RuntimeException::new); + } + + @Override + public Saga process(Saga saga) { + Object inValue = saga.getCurrentValue(); + logger.info("The chapter '{}' has been started. The data {} has been stored or calculated successfully", + getName(), inValue); + saga.setCurrentStatus(Saga.ChapterResult.SUCCESS); + saga.setCurrentValue(inValue); + return saga; + } + + @Override + public Saga rollback(Saga saga) { + Object inValue = saga.getCurrentValue(); + logger.info("The Rollback for a chapter '{}' has been started. The data {} has been rollbacked successfully", + getName(), inValue); + + saga.setCurrentStatus(Saga.ChapterResult.ROLLBACK); + saga.setCurrentValue(inValue); + return saga; + } + + private boolean isSagaFinished(Saga saga) { + if (!saga.isPresent()) { + saga.setFinished(true); + logger.info(" the saga has been finished with {} status", saga.getResult()); + return true; + } + return false; + } + +} diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/ServiceDiscoveryService.java b/saga/src/main/java/com/iluwatar/saga/choreography/ServiceDiscoveryService.java new file mode 100644 index 000000000000..11512d112ea5 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/choreography/ServiceDiscoveryService.java @@ -0,0 +1,60 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.choreography; + + +import java.util.HashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Optional; + +/** + * The class representing a service discovery pattern. + */ +public class ServiceDiscoveryService { + private Map services; + + /** + * find any service + * @return any service + * @throws NoSuchElementException if no elements further + */ + public Chapter findAny(){ + return services.values().iterator().next(); + } + + public Optional find(String service) { + return Optional.ofNullable(services.getOrDefault(service, null)); + } + + public ServiceDiscoveryService discover(Chapter chapterService) { + services.put(chapterService.getName(), chapterService); + return this; + } + + public ServiceDiscoveryService() { + this.services = new HashMap<>(); + } + + +} diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/WithdrawMoneyService.java b/saga/src/main/java/com/iluwatar/saga/choreography/WithdrawMoneyService.java new file mode 100644 index 000000000000..c13b1b1f8891 --- /dev/null +++ b/saga/src/main/java/com/iluwatar/saga/choreography/WithdrawMoneyService.java @@ -0,0 +1,53 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.choreography; + + +/** + * Class representing a service to withdraw a money + */ +public class WithdrawMoneyService extends Service { + + public WithdrawMoneyService(ServiceDiscoveryService service) { + super(service); + } + + @Override + public String getName() { + return "withdrawing Money"; + } + + @Override + public Saga process(Saga saga) { + Object inValue = saga.getCurrentValue(); + + if (inValue.equals("bad_order") ) { + logger.info("The chapter '{}' has been started. But the exception has been raised." + + "The rollback is about to start", + getName(), inValue); + saga.setCurrentStatus(Saga.ChapterResult.ROLLBACK); + return saga; + } + return super.process(saga); + } +} diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java index d6a703706e73..f24a8366c56f 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java @@ -28,7 +28,7 @@ /** * Saga representation. * Saga consists of chapters. - * Every Chapter is executed a certain service. + * Every Chapter is executed by a certain service. */ public class Saga { @@ -39,7 +39,6 @@ public Saga() { } - public Saga chapter(String name) { this.chapters.add(new Chapter(name)); return this; diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java index 013d9a5f02f3..bbeca62bb039 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java @@ -24,7 +24,6 @@ package com.iluwatar.saga.orchestration; -import com.iluwatar.saga.ServiceDiscoveryService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,6 +37,8 @@ * * In this approach, there is an orchestrator @see {@link SagaOrchestrator} that manages all the transactions and directs * the participant services to execute local transactions based on events. + * The major difference with choreography saga is an ability to handle crashed services + * (otherwise in choreography services very hard to prevent a saga if one of them has been crashed) * * @see Saga * @see SagaOrchestrator @@ -49,7 +50,7 @@ public class SagaApplication { public static void main(String[] args) { SagaOrchestrator sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery()); - Saga.Result goodOrder = sagaOrchestrator.execute("god_order"); + Saga.Result goodOrder = sagaOrchestrator.execute("good_order"); Saga.Result badOrder = sagaOrchestrator.execute("bad_order"); Saga.Result crashedOrder = sagaOrchestrator.execute("crashed_order"); diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java index 588a860aa16d..c005d70df187 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java @@ -22,7 +22,6 @@ */ package com.iluwatar.saga.orchestration; -import com.iluwatar.saga.ServiceDiscoveryService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,6 +47,7 @@ public SagaOrchestrator(Saga saga, ServiceDiscoveryService sd) { } /** + * pipeline to execute saga process/story * * @param value incoming value * @param type for incoming value diff --git a/saga/src/main/java/com/iluwatar/saga/ServiceDiscoveryService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java similarity index 95% rename from saga/src/main/java/com/iluwatar/saga/ServiceDiscoveryService.java rename to saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java index f9d91b53e3de..652740051b5e 100644 --- a/saga/src/main/java/com/iluwatar/saga/ServiceDiscoveryService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java @@ -20,9 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package com.iluwatar.saga; - -import com.iluwatar.saga.orchestration.Chapter; +package com.iluwatar.saga.orchestration; import java.util.HashMap; import java.util.Map; diff --git a/saga/src/test/java/com/iluwatar/saga/choreography/SagaApplicationTest.java b/saga/src/test/java/com/iluwatar/saga/choreography/SagaApplicationTest.java new file mode 100644 index 000000000000..5802f54ec6c5 --- /dev/null +++ b/saga/src/test/java/com/iluwatar/saga/choreography/SagaApplicationTest.java @@ -0,0 +1,35 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.choreography; + +import com.iluwatar.saga.orchestration.SagaApplication; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class SagaApplicationTest { + @Test + public void mainTest() { + SagaApplication.main(new String[]{}); + } +} \ No newline at end of file diff --git a/saga/src/test/java/com/iluwatar/saga/choreography/SagaChoreographyTest.java b/saga/src/test/java/com/iluwatar/saga/choreography/SagaChoreographyTest.java new file mode 100644 index 000000000000..8c8daa7c991f --- /dev/null +++ b/saga/src/test/java/com/iluwatar/saga/choreography/SagaChoreographyTest.java @@ -0,0 +1,59 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ +package com.iluwatar.saga.choreography; + +import org.junit.Assert; +import org.junit.Test; + +public class SagaChoreographyTest { + + + @Test + public void executeTest() { + ServiceDiscoveryService sd = serviceDiscovery(); + Chapter service = sd.findAny(); + Saga badOrderSaga = service.execute(newSaga("bad_order")); + Saga goodOrderSaga = service.execute(newSaga("good_order")); + + Assert.assertEquals(badOrderSaga.getResult(), Saga.SagaResult.ROLLBACKED); + Assert.assertEquals(goodOrderSaga.getResult(), Saga.SagaResult.FINISHED); + } + + private static Saga newSaga(Object value) { + return Saga + .create() + .chapter("init an order").setInValue(value) + .chapter("booking a Fly") + .chapter("booking a Hotel") + .chapter("withdrawing Money"); + } + + private static ServiceDiscoveryService serviceDiscovery() { + ServiceDiscoveryService sd = new ServiceDiscoveryService(); + return sd + .discover(new OrderService(sd)) + .discover(new FlyBookingService(sd)) + .discover(new HotelBookingService(sd)) + .discover(new WithdrawMoneyService(sd)); + } +} diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java index 6950158aaef1..4e4d86644b10 100644 --- a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java +++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java @@ -1,3 +1,25 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.saga.orchestration; import org.junit.Test; diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java index 16c54c9200c1..ce3b926a3775 100644 --- a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java +++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java @@ -1,6 +1,27 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.saga.orchestration; -import com.iluwatar.saga.ServiceDiscoveryService; import org.junit.Assert; import org.junit.Test; @@ -12,7 +33,7 @@ public class SagaOrchestratorInternallyTest { private List records = new ArrayList<>(); @Test - public void execute() { + public void executeTest() { SagaOrchestrator sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery()); Saga.Result result = sagaOrchestrator.execute(1); Assert.assertEquals(result, Saga.Result.ROLLBACK); diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java index cd659601eacc..bead0343d1b9 100644 --- a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java +++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java @@ -1,6 +1,27 @@ +/* + * The MIT License + * Copyright © 2014-2019 Ilkka Seppälä + * + * 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 NONINFRINGEMENT. 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. + */ package com.iluwatar.saga.orchestration; -import com.iluwatar.saga.ServiceDiscoveryService; import org.junit.Assert; import org.junit.Test; From 74c7273381a9c2fb521f1aa3b2924d9d290c876b Mon Sep 17 00:00:00 2001 From: Besok Date: Sat, 9 Nov 2019 18:57:31 +0000 Subject: [PATCH 134/197] rem space --- .../src/main/java/com/iluwatar/roleobject/InvestorRole.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/role-object/src/main/java/com/iluwatar/roleobject/InvestorRole.java b/role-object/src/main/java/com/iluwatar/roleobject/InvestorRole.java index 6d5c17c904f7..d6ec6bc42050 100644 --- a/role-object/src/main/java/com/iluwatar/roleobject/InvestorRole.java +++ b/role-object/src/main/java/com/iluwatar/roleobject/InvestorRole.java @@ -43,6 +43,6 @@ public void setAmountToInvest(long amountToInvest) { } public String invest() { - return String.format("Investor %s has invested %d dollars", name, amountToInvest); + return String.format("Investor %s has invested %d dollars", name, amountToInvest); } } From 6d1c0b1563caa1cc243cbe341864f99d42ee4fcb Mon Sep 17 00:00:00 2001 From: Anurag Agarwal Date: Sun, 10 Nov 2019 00:33:22 +0530 Subject: [PATCH 135/197] Resolves checkstyle errors for ambassador, async-method-invocation, balking, bridge, builder (#1058) * Decreases checkstyle errors for ambassador pattern * Reduces checkstyle errors in async-method-invocation * Reduces checkstyle errors in balking * Reduces checkstyle errors in bridge * Reduces checkstyle errors in builder --- .../java/com/iluwatar/ambassador/App.java | 23 +++---- .../java/com/iluwatar/ambassador/Client.java | 5 +- .../iluwatar/ambassador/RemoteService.java | 10 +-- .../ambassador/ServiceAmbassador.java | 9 ++- .../iluwatar/async/method/invocation/App.java | 68 +++++++++---------- .../method/invocation/AsyncCallback.java | 8 +-- .../method/invocation/AsyncExecutor.java | 8 +-- .../async/method/invocation/AsyncResult.java | 5 +- .../invocation/ThreadAsyncExecutor.java | 30 ++++---- .../async/method/invocation/AppTest.java | 2 - .../invocation/ThreadAsyncExecutorTest.java | 64 ++++++++--------- .../main/java/com/iluwatar/balking/App.java | 21 +++--- .../com/iluwatar/balking/WashingMachine.java | 24 +++---- .../iluwatar/balking/WashingMachineState.java | 5 +- .../iluwatar/balking/WashingMachineTest.java | 5 +- .../main/java/com/iluwatar/bridge/App.java | 26 +++---- .../java/com/iluwatar/bridge/Enchantment.java | 4 +- .../iluwatar/bridge/FlyingEnchantment.java | 4 +- .../main/java/com/iluwatar/bridge/Hammer.java | 4 +- .../bridge/SoulEatingEnchantment.java | 4 +- .../main/java/com/iluwatar/bridge/Sword.java | 4 +- .../main/java/com/iluwatar/bridge/Weapon.java | 4 +- .../main/java/com/iluwatar/builder/App.java | 35 +++++----- .../main/java/com/iluwatar/builder/Armor.java | 4 +- .../java/com/iluwatar/builder/HairColor.java | 4 +- .../java/com/iluwatar/builder/HairType.java | 4 +- .../main/java/com/iluwatar/builder/Hero.java | 12 ++-- .../java/com/iluwatar/builder/Profession.java | 4 +- .../java/com/iluwatar/builder/Weapon.java | 4 +- 29 files changed, 179 insertions(+), 225 deletions(-) diff --git a/ambassador/src/main/java/com/iluwatar/ambassador/App.java b/ambassador/src/main/java/com/iluwatar/ambassador/App.java index 6b0b048c8b97..c61ef4935fd1 100644 --- a/ambassador/src/main/java/com/iluwatar/ambassador/App.java +++ b/ambassador/src/main/java/com/iluwatar/ambassador/App.java @@ -24,27 +24,26 @@ package com.iluwatar.ambassador; /** - * * The ambassador pattern creates a helper service that sends network requests on behalf of a * client. It is often used in cloud-based applications to offload features of a remote service. * - * An ambassador service can be thought of as an out-of-process proxy that is co-located with - * the client. Similar to the proxy design pattern, the ambassador service provides an interface - * for another remote service. In addition to the interface, the ambassador provides extra - * functionality and features, specifically offloaded common connectivity tasks. This usually - * consists of monitoring, logging, routing, security etc. This is extremely useful in - * legacy applications where the codebase is difficult to modify and allows for improvements - * in the application's networking capabilities. + *

    An ambassador service can be thought of as an out-of-process proxy that is co-located with + * the client. Similar to the proxy design pattern, the ambassador service provides an interface for + * another remote service. In addition to the interface, the ambassador provides extra functionality + * and features, specifically offloaded common connectivity tasks. This usually consists of + * monitoring, logging, routing, security etc. This is extremely useful in legacy applications where + * the codebase is difficult to modify and allows for improvements in the application's networking + * capabilities. * - * In this example, we will the ({@link ServiceAmbassador}) class represents the ambassador while the + *

    In this example, we will the ({@link ServiceAmbassador}) class represents the ambassador while + * the * ({@link RemoteService}) class represents a remote application. - * */ public class App { /** - * Entry point - */ + * Entry point. + */ public static void main(String[] args) { Client host1 = new Client(); Client host2 = new Client(); diff --git a/ambassador/src/main/java/com/iluwatar/ambassador/Client.java b/ambassador/src/main/java/com/iluwatar/ambassador/Client.java index fdadd71d26dd..60d0e164dbf5 100644 --- a/ambassador/src/main/java/com/iluwatar/ambassador/Client.java +++ b/ambassador/src/main/java/com/iluwatar/ambassador/Client.java @@ -23,12 +23,11 @@ package com.iluwatar.ambassador; -import org.slf4j.LoggerFactory; - import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * A simple Client + * A simple Client. */ public class Client { diff --git a/ambassador/src/main/java/com/iluwatar/ambassador/RemoteService.java b/ambassador/src/main/java/com/iluwatar/ambassador/RemoteService.java index 10da79d0b937..34993159548f 100644 --- a/ambassador/src/main/java/com/iluwatar/ambassador/RemoteService.java +++ b/ambassador/src/main/java/com/iluwatar/ambassador/RemoteService.java @@ -23,12 +23,12 @@ package com.iluwatar.ambassador; +import static java.lang.Thread.sleep; + import com.iluwatar.ambassador.util.RandomProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static java.lang.Thread.sleep; - /** * A remote legacy application represented by a Singleton implementation. */ @@ -55,9 +55,11 @@ private RemoteService() { RemoteService(RandomProvider randomProvider) { this.randomProvider = randomProvider; } + /** - * Remote function takes a value and multiplies it by 10 taking a random amount of time. - * Will sometimes return -1. This imitates connectivity issues a client might have to account for. + * Remote function takes a value and multiplies it by 10 taking a random amount of time. Will + * sometimes return -1. This imitates connectivity issues a client might have to account for. + * * @param value integer value to be multiplied. * @return if waitTime is less than {@link RemoteService#THRESHOLD}, it returns value * 10, * otherwise {@link RemoteServiceInterface#FAILURE}. diff --git a/ambassador/src/main/java/com/iluwatar/ambassador/ServiceAmbassador.java b/ambassador/src/main/java/com/iluwatar/ambassador/ServiceAmbassador.java index 37b6970b451d..4f191977c1c1 100644 --- a/ambassador/src/main/java/com/iluwatar/ambassador/ServiceAmbassador.java +++ b/ambassador/src/main/java/com/iluwatar/ambassador/ServiceAmbassador.java @@ -23,17 +23,15 @@ package com.iluwatar.ambassador; +import static java.lang.Thread.sleep; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static java.lang.Thread.sleep; - /** - * * ServiceAmbassador provides an interface for a ({@link Client}) to access ({@link RemoteService}). * The interface adds logging, latency testing and usage of the service in a safe way that will not * add stress to the remote service when connectivity issues occur. - * */ public class ServiceAmbassador implements RemoteServiceInterface { @@ -41,7 +39,8 @@ public class ServiceAmbassador implements RemoteServiceInterface { private static final int RETRIES = 3; private static final int DELAY_MS = 3000; - ServiceAmbassador() {} + ServiceAmbassador() { + } @Override public long doRemoteFunction(int value) { diff --git a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/App.java b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/App.java index bc33494f73f5..a85a51ab815b 100644 --- a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/App.java +++ b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/App.java @@ -23,35 +23,34 @@ package com.iluwatar.async.method.invocation; +import java.util.concurrent.Callable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.Callable; - /** * This application demonstrates the async method invocation pattern. Key parts of the pattern are - * AsyncResult which is an intermediate container for an asynchronously evaluated value, - * AsyncCallback which can be provided to be executed on task completion and AsyncExecutor - * that manages the execution of the async tasks. - *

    - * The main method shows example flow of async invocations. The main thread starts multiple tasks with variable - * durations and then continues its own work. When the main thread has done it's job it collects the results of the - * async tasks. Two of the tasks are handled with callbacks, meaning the callbacks are executed immediately when the - * tasks complete. - *

    - * Noteworthy difference of thread usage between the async results and callbacks is that the async results are collected - * in the main thread but the callbacks are executed within the worker threads. This should be noted when working with - * thread pools. - *

    - * Java provides its own implementations of async method invocation pattern. FutureTask, CompletableFuture and - * ExecutorService are the real world implementations of this pattern. But due to the nature of parallel programming, - * the implementations are not trivial. This example does not take all possible scenarios into account but rather - * provides a simple version that helps to understand the pattern. + * AsyncResult which is an intermediate container for an asynchronously evaluated + * value, AsyncCallback which can be provided to be executed on task completion and + * AsyncExecutor that manages the execution of the async tasks. + * + *

    The main method shows example flow of async invocations. The main thread starts multiple + * tasks with variable durations and then continues its own work. When the main thread has done it's + * job it collects the results of the async tasks. Two of the tasks are handled with callbacks, + * meaning the callbacks are executed immediately when the tasks complete. + * + *

    Noteworthy difference of thread usage between the async results and callbacks is that the + * async results are collected in the main thread but the callbacks are executed within the worker + * threads. This should be noted when working with thread pools. + * + *

    Java provides its own implementations of async method invocation pattern. FutureTask, + * CompletableFuture and ExecutorService are the real world implementations of this pattern. But due + * to the nature of parallel programming, the implementations are not trivial. This example does not + * take all possible scenarios into account but rather provides a simple version that helps to + * understand the pattern. * * @see AsyncResult * @see AsyncCallback * @see AsyncExecutor - * * @see java.util.concurrent.FutureTask * @see java.util.concurrent.CompletableFuture * @see java.util.concurrent.ExecutorService @@ -61,27 +60,29 @@ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point + * Program entry point. */ public static void main(String[] args) throws Exception { // construct a new executor that will run async tasks AsyncExecutor executor = new ThreadAsyncExecutor(); // start few async tasks with varying processing times, two last with callback handlers - AsyncResult asyncResult1 = executor.startProcess(lazyval(10, 500)); - AsyncResult asyncResult2 = executor.startProcess(lazyval("test", 300)); - AsyncResult asyncResult3 = executor.startProcess(lazyval(50L, 700)); - AsyncResult asyncResult4 = executor.startProcess(lazyval(20, 400), callback("Callback result 4")); - AsyncResult asyncResult5 = executor.startProcess(lazyval("callback", 600), callback("Callback result 5")); + final AsyncResult asyncResult1 = executor.startProcess(lazyval(10, 500)); + final AsyncResult asyncResult2 = executor.startProcess(lazyval("test", 300)); + final AsyncResult asyncResult3 = executor.startProcess(lazyval(50L, 700)); + final AsyncResult asyncResult4 = + executor.startProcess(lazyval(20, 400), callback("Callback result 4")); + final AsyncResult asyncResult5 = + executor.startProcess(lazyval("callback", 600), callback("Callback result 5")); // emulate processing in the current thread while async tasks are running in their own threads Thread.sleep(350); // Oh boy I'm working hard here log("Some hard work done"); // wait for completion of the tasks - Integer result1 = executor.endProcess(asyncResult1); - String result2 = executor.endProcess(asyncResult2); - Long result3 = executor.endProcess(asyncResult3); + final Integer result1 = executor.endProcess(asyncResult1); + final String result2 = executor.endProcess(asyncResult2); + final Long result3 = executor.endProcess(asyncResult3); asyncResult4.await(); asyncResult5.await(); @@ -94,10 +95,8 @@ public static void main(String[] args) throws Exception { /** * Creates a callable that lazily evaluates to given value with artificial delay. * - * @param value - * value to evaluate - * @param delayMillis - * artificial delay in milliseconds + * @param value value to evaluate + * @param delayMillis artificial delay in milliseconds * @return new callable for lazy evaluation */ private static Callable lazyval(T value, long delayMillis) { @@ -111,8 +110,7 @@ private static Callable lazyval(T value, long delayMillis) { /** * Creates a simple callback that logs the complete status of the async result. * - * @param name - * callback name + * @param name callback name * @return new async callback */ private static AsyncCallback callback(String name) { diff --git a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncCallback.java b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncCallback.java index 950444fe7a17..22b36134ff97 100644 --- a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncCallback.java +++ b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncCallback.java @@ -26,11 +26,9 @@ import java.util.Optional; /** - * - * AsyncCallback interface + * AsyncCallback interface. * - * @param - * + * @param Type of Result */ public interface AsyncCallback { @@ -38,7 +36,7 @@ public interface AsyncCallback { * Complete handler which is executed when async task is completed or fails execution. * * @param value the evaluated value from async task, undefined when execution fails - * @param ex empty value if execution succeeds, some exception if executions fails + * @param ex empty value if execution succeeds, some exception if executions fails */ void onComplete(T value, Optional ex); } diff --git a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncExecutor.java b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncExecutor.java index 14e30cbebdc2..819ffd2377ca 100644 --- a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncExecutor.java +++ b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncExecutor.java @@ -27,9 +27,7 @@ import java.util.concurrent.ExecutionException; /** - * - * AsyncExecutor interface - * + * AsyncExecutor interface. */ public interface AsyncExecutor { @@ -45,7 +43,7 @@ public interface AsyncExecutor { * Starts processing of an async task. Returns immediately with async result. Executes callback * when the task is completed. * - * @param task task to be executed asynchronously + * @param task task to be executed asynchronously * @param callback callback to be executed on task completion * @return async result for the task */ @@ -57,7 +55,7 @@ public interface AsyncExecutor { * * @param asyncResult async result of a task * @return evaluated value of the completed task - * @throws ExecutionException if execution has failed, containing the root cause + * @throws ExecutionException if execution has failed, containing the root cause * @throws InterruptedException if the execution is interrupted */ T endProcess(AsyncResult asyncResult) throws ExecutionException, InterruptedException; diff --git a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncResult.java b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncResult.java index c3b8467f1c8a..6aaf233b44f7 100644 --- a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncResult.java +++ b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/AsyncResult.java @@ -26,7 +26,8 @@ import java.util.concurrent.ExecutionException; /** - * AsyncResult interface + * AsyncResult interface. + * * @param parameter returned when getValue is invoked */ public interface AsyncResult { @@ -42,7 +43,7 @@ public interface AsyncResult { * Gets the value of completed async task. * * @return evaluated value or throws ExecutionException if execution has failed - * @throws ExecutionException if execution has failed, containing the root cause + * @throws ExecutionException if execution has failed, containing the root cause * @throws IllegalStateException if execution is not completed */ T getValue() throws ExecutionException; diff --git a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutor.java b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutor.java index f05b83b4f21a..ecd28f51941d 100644 --- a/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutor.java +++ b/async-method-invocation/src/main/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutor.java @@ -29,13 +29,13 @@ import java.util.concurrent.atomic.AtomicInteger; /** - * * Implementation of async executor that creates a new thread for every task. - * */ public class ThreadAsyncExecutor implements AsyncExecutor { - /** Index for thread naming */ + /** + * Index for thread naming. + */ private final AtomicInteger idx = new AtomicInteger(0); @Override @@ -52,12 +52,13 @@ public AsyncResult startProcess(Callable task, AsyncCallback callba } catch (Exception ex) { result.setException(ex); } - } , "executor-" + idx.incrementAndGet()).start(); + }, "executor-" + idx.incrementAndGet()).start(); return result; } @Override - public T endProcess(AsyncResult asyncResult) throws ExecutionException, InterruptedException { + public T endProcess(AsyncResult asyncResult) throws ExecutionException, + InterruptedException { if (!asyncResult.isCompleted()) { asyncResult.await(); } @@ -65,8 +66,9 @@ public T endProcess(AsyncResult asyncResult) throws ExecutionException, I } /** - * Simple implementation of async result that allows completing it successfully with a value or exceptionally with an - * exception. A really simplified version from its real life cousins FutureTask and CompletableFuture. + * Simple implementation of async result that allows completing it successfully with a value or + * exceptionally with an exception. A really simplified version from its real life cousins + * FutureTask and CompletableFuture. * * @see java.util.concurrent.FutureTask * @see java.util.concurrent.CompletableFuture @@ -90,11 +92,10 @@ private static class CompletableResult implements AsyncResult { } /** - * Sets the value from successful execution and executes callback if available. Notifies any thread waiting for - * completion. + * Sets the value from successful execution and executes callback if available. Notifies any + * thread waiting for completion. * - * @param value - * value of the evaluated task + * @param value value of the evaluated task */ void setValue(T value) { this.value = value; @@ -106,11 +107,10 @@ void setValue(T value) { } /** - * Sets the exception from failed execution and executes callback if available. Notifies any thread waiting for - * completion. + * Sets the exception from failed execution and executes callback if available. Notifies any + * thread waiting for completion. * - * @param exception - * exception of the failed task + * @param exception exception of the failed task */ void setException(Exception exception) { this.exception = exception; diff --git a/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/AppTest.java b/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/AppTest.java index 769cd66c4f90..75aebc0dfb91 100644 --- a/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/AppTest.java +++ b/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/AppTest.java @@ -26,9 +26,7 @@ import org.junit.jupiter.api.Test; /** - * * Application test - * */ public class AppTest { diff --git a/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutorTest.java b/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutorTest.java index d240f3c2eca1..4d97d60e5d08 100644 --- a/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutorTest.java +++ b/async-method-invocation/src/test/java/com/iluwatar/async/method/invocation/ThreadAsyncExecutorTest.java @@ -23,30 +23,18 @@ package com.iluwatar.async.method.invocation; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Matchers; +import static java.time.Duration.ofMillis; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.*; +import static org.mockito.internal.verification.VerificationModeFactory.times; import java.util.Optional; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; - -import static java.time.Duration.ofMillis; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTimeout; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.timeout; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; -import static org.mockito.internal.verification.VerificationModeFactory.times; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Matchers; /** * Date: 12/6/15 - 10:49 AM @@ -82,7 +70,8 @@ public void testSuccessfulTaskWithoutCallback() throws Exception { } /** - * Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable, AsyncCallback)} + * Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable, + * AsyncCallback)} */ @Test public void testSuccessfulTaskWithCallback() throws Exception { @@ -104,7 +93,8 @@ public void testSuccessfulTaskWithCallback() throws Exception { verify(task, times(1)).call(); // ... same for the callback, we expect our object - final ArgumentCaptor> optionalCaptor = ArgumentCaptor.forClass((Class) Optional.class); + final ArgumentCaptor> optionalCaptor = + ArgumentCaptor.forClass((Class) Optional.class); verify(callback, times(1)).onComplete(eq(result), optionalCaptor.capture()); final Optional optionalException = optionalCaptor.getValue(); @@ -117,8 +107,8 @@ public void testSuccessfulTaskWithCallback() throws Exception { } /** - * Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable)} when a task takes a while - * to execute + * Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable)} when a + * task takes a while to execute */ @Test public void testLongRunningTaskWithoutCallback() throws Exception { @@ -158,8 +148,8 @@ public void testLongRunningTaskWithoutCallback() throws Exception { } /** - * Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable, AsyncCallback)} when a task - * takes a while to execute + * Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable, + * AsyncCallback)} when a task takes a while to execute */ @Test public void testLongRunningTaskWithCallback() throws Exception { @@ -191,7 +181,8 @@ public void testLongRunningTaskWithCallback() throws Exception { // Our task should only execute once, but it can take a while ... verify(task, timeout(3000).times(1)).call(); - final ArgumentCaptor> optionalCaptor = ArgumentCaptor.forClass((Class) Optional.class); + final ArgumentCaptor> optionalCaptor = + ArgumentCaptor.forClass((Class) Optional.class); verify(callback, timeout(3000).times(1)).onComplete(eq(result), optionalCaptor.capture()); final Optional optionalException = optionalCaptor.getValue(); @@ -209,8 +200,9 @@ public void testLongRunningTaskWithCallback() throws Exception { } /** - * Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable)} when a task takes a while - * to execute, while waiting on the result using {@link ThreadAsyncExecutor#endProcess(AsyncResult)} + * Test used to verify the happy path of {@link ThreadAsyncExecutor#startProcess(Callable)} when a + * task takes a while to execute, while waiting on the result using {@link + * ThreadAsyncExecutor#endProcess(AsyncResult)} */ @Test public void testEndProcess() throws Exception { @@ -247,7 +239,8 @@ public void testEndProcess() throws Exception { } /** - * Test used to verify the behaviour of {@link ThreadAsyncExecutor#startProcess(Callable)} when the callable is 'null' + * Test used to verify the behaviour of {@link ThreadAsyncExecutor#startProcess(Callable)} when + * the callable is 'null' */ @Test public void testNullTask() throws Exception { @@ -273,8 +266,8 @@ public void testNullTask() throws Exception { } /** - * Test used to verify the behaviour of {@link ThreadAsyncExecutor#startProcess(Callable, AsyncCallback)} when the - * callable is 'null', but the asynchronous callback is provided + * Test used to verify the behaviour of {@link ThreadAsyncExecutor#startProcess(Callable, + * AsyncCallback)} when the callable is 'null', but the asynchronous callback is provided */ @Test public void testNullTaskWithCallback() throws Exception { @@ -288,7 +281,8 @@ public void testNullTaskWithCallback() throws Exception { asyncResult.await(); // Prevent timing issues, and wait until the result is available assertTrue(asyncResult.isCompleted()); - final ArgumentCaptor> optionalCaptor = ArgumentCaptor.forClass((Class) Optional.class); + final ArgumentCaptor> optionalCaptor = + ArgumentCaptor.forClass((Class) Optional.class); verify(callback, times(1)).onComplete(Matchers.isNull(), optionalCaptor.capture()); final Optional optionalException = optionalCaptor.getValue(); @@ -312,8 +306,8 @@ public void testNullTaskWithCallback() throws Exception { } /** - * Test used to verify the behaviour of {@link ThreadAsyncExecutor#startProcess(Callable, AsyncCallback)} when both - * the callable and the asynchronous callback are 'null' + * Test used to verify the behaviour of {@link ThreadAsyncExecutor#startProcess(Callable, + * AsyncCallback)} when both the callable and the asynchronous callback are 'null' */ @Test public void testNullTaskWithNullCallback() throws Exception { diff --git a/balking/src/main/java/com/iluwatar/balking/App.java b/balking/src/main/java/com/iluwatar/balking/App.java index bb3fb085c077..3e64a299032b 100644 --- a/balking/src/main/java/com/iluwatar/balking/App.java +++ b/balking/src/main/java/com/iluwatar/balking/App.java @@ -23,23 +23,22 @@ package com.iluwatar.balking; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * In Balking Design Pattern if an object’s method is invoked when it is in an inappropriate state, - * then the method will return without doing anything. Objects that use this pattern are generally only in a - * state that is prone to balking temporarily but for an unknown amount of time + * then the method will return without doing anything. Objects that use this pattern are generally + * only in a state that is prone to balking temporarily but for an unknown amount of time * - * In this example implementation WashingMachine is an object that has two states - * in which it can be: ENABLED and WASHING. If the machine is ENABLED - * the state is changed into WASHING that any other thread can't invoke this action on this and then do the job. - * On the other hand if it have been already washing and any other thread execute wash() - * it can't do that once again and returns doing nothing. + *

    In this example implementation WashingMachine is an object that has two states in which it + * can be: ENABLED and WASHING. If the machine is ENABLED the state is changed into WASHING that any + * other thread can't invoke this action on this and then do the job. On the other hand if it have + * been already washing and any other thread execute wash() it can't do that once again and returns + * doing nothing. */ public class App { @@ -47,6 +46,8 @@ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** + * Entry Point. + * * @param args the command line arguments - not used */ public static void main(String... args) { diff --git a/balking/src/main/java/com/iluwatar/balking/WashingMachine.java b/balking/src/main/java/com/iluwatar/balking/WashingMachine.java index 044b1b6e9f36..c47c96c3a091 100644 --- a/balking/src/main/java/com/iluwatar/balking/WashingMachine.java +++ b/balking/src/main/java/com/iluwatar/balking/WashingMachine.java @@ -23,13 +23,12 @@ package com.iluwatar.balking; +import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.TimeUnit; - /** - * Washing machine class + * Washing machine class. */ public class WashingMachine { @@ -38,7 +37,7 @@ public class WashingMachine { private WashingMachineState washingMachineState; /** - * Creates a new instance of WashingMachine + * Creates a new instance of WashingMachine. */ public WashingMachine() { this((interval, timeUnit, task) -> { @@ -52,8 +51,8 @@ public WashingMachine() { } /** - * Creates a new instance of WashingMachine using provided delayProvider. This constructor is used only for - * unit testing purposes. + * Creates a new instance of WashingMachine using provided delayProvider. This constructor is used + * only for unit testing purposes. */ public WashingMachine(DelayProvider delayProvider) { this.delayProvider = delayProvider; @@ -65,17 +64,17 @@ public WashingMachineState getWashingMachineState() { } /** - * Method responsible for washing - * if the object is in appropriate state + * Method responsible for washing if the object is in appropriate state. */ public void wash() { synchronized (this) { - LOGGER.info("{}: Actual machine state: {}", Thread.currentThread().getName(), getWashingMachineState()); - if (washingMachineState == WashingMachineState.WASHING) { + WashingMachineState machineState = getWashingMachineState(); + LOGGER.info("{}: Actual machine state: {}", Thread.currentThread().getName(), machineState); + if (this.washingMachineState == WashingMachineState.WASHING) { LOGGER.error("ERROR: Cannot wash if the machine has been already washing!"); return; } - washingMachineState = WashingMachineState.WASHING; + this.washingMachineState = WashingMachineState.WASHING; } LOGGER.info("{}: Doing the washing", Thread.currentThread().getName()); @@ -83,8 +82,7 @@ public void wash() { } /** - * Method responsible of ending the washing - * by changing machine state + * Method responsible of ending the washing by changing machine state. */ public synchronized void endOfWashing() { washingMachineState = WashingMachineState.ENABLED; diff --git a/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java b/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java index 0799d3fd8edb..664a4c0c9941 100644 --- a/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java +++ b/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java @@ -24,10 +24,9 @@ package com.iluwatar.balking; /** - * WashingMachineState enum describes in which state machine is, - * it can be enabled and ready to work as well as during washing + * WashingMachineState enum describes in which state machine is, it can be enabled and ready to work + * as well as during washing. */ - public enum WashingMachineState { ENABLED, WASHING } diff --git a/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java b/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java index 8348f9256dee..7c6bd73ecae6 100644 --- a/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java +++ b/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java @@ -23,11 +23,10 @@ package com.iluwatar.balking; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.concurrent.TimeUnit; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /** * Tests for {@link WashingMachine} diff --git a/bridge/src/main/java/com/iluwatar/bridge/App.java b/bridge/src/main/java/com/iluwatar/bridge/App.java index 195f463cf40d..74104257eefa 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/App.java +++ b/bridge/src/main/java/com/iluwatar/bridge/App.java @@ -27,25 +27,25 @@ import org.slf4j.LoggerFactory; /** - * - * Composition over inheritance. The Bridge pattern can also be thought of as two layers of abstraction. - * With Bridge, you can decouple an abstraction from its implementation so that the two can vary independently. - *

    - * In Bridge pattern both abstraction ({@link Weapon}) and implementation ( - * {@link Enchantment}) have their own class hierarchies. The interface of the implementations - * can be changed without affecting the clients. - *

    - * In this example we have two class hierarchies. One of weapons and another one of enchantments. We can easily - * combine any weapon with any enchantment using composition instead of creating deep class hierarchy. - * + * Composition over inheritance. The Bridge pattern can also be thought of as two layers of + * abstraction. With Bridge, you can decouple an abstraction from its implementation so that the two + * can vary independently. + * + *

    In Bridge pattern both abstraction ({@link Weapon}) and implementation ( {@link Enchantment}) + * have their own class hierarchies. The interface of the implementations can be changed without + * affecting the clients. + * + *

    In this example we have two class hierarchies. One of weapons and another one of + * enchantments. We can easily combine any weapon with any enchantment using composition instead of + * creating deep class hierarchy. */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point - * + * Program entry point. + * * @param args command line args */ public static void main(String[] args) { diff --git a/bridge/src/main/java/com/iluwatar/bridge/Enchantment.java b/bridge/src/main/java/com/iluwatar/bridge/Enchantment.java index 22acac8f9a1d..8388fe91eb2b 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/Enchantment.java +++ b/bridge/src/main/java/com/iluwatar/bridge/Enchantment.java @@ -24,9 +24,7 @@ package com.iluwatar.bridge; /** - * - * Enchantment - * + * Enchantment. */ public interface Enchantment { diff --git a/bridge/src/main/java/com/iluwatar/bridge/FlyingEnchantment.java b/bridge/src/main/java/com/iluwatar/bridge/FlyingEnchantment.java index 14abe4c635cd..772456b88881 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/FlyingEnchantment.java +++ b/bridge/src/main/java/com/iluwatar/bridge/FlyingEnchantment.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * - * FlyingEnchantment - * + * FlyingEnchantment. */ public class FlyingEnchantment implements Enchantment { diff --git a/bridge/src/main/java/com/iluwatar/bridge/Hammer.java b/bridge/src/main/java/com/iluwatar/bridge/Hammer.java index 47f60613d239..ffab542cb169 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/Hammer.java +++ b/bridge/src/main/java/com/iluwatar/bridge/Hammer.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * - * Hammer - * + * Hammer. */ public class Hammer implements Weapon { diff --git a/bridge/src/main/java/com/iluwatar/bridge/SoulEatingEnchantment.java b/bridge/src/main/java/com/iluwatar/bridge/SoulEatingEnchantment.java index 3655c7e97722..ede98d2cbd08 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/SoulEatingEnchantment.java +++ b/bridge/src/main/java/com/iluwatar/bridge/SoulEatingEnchantment.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * - * SoulEatingEnchantment - * + * SoulEatingEnchantment. */ public class SoulEatingEnchantment implements Enchantment { diff --git a/bridge/src/main/java/com/iluwatar/bridge/Sword.java b/bridge/src/main/java/com/iluwatar/bridge/Sword.java index ab6f4ab7feff..71f87a55dcd8 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/Sword.java +++ b/bridge/src/main/java/com/iluwatar/bridge/Sword.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * - * Sword - * + * Sword. */ public class Sword implements Weapon { diff --git a/bridge/src/main/java/com/iluwatar/bridge/Weapon.java b/bridge/src/main/java/com/iluwatar/bridge/Weapon.java index b264dddca794..76272332e76d 100644 --- a/bridge/src/main/java/com/iluwatar/bridge/Weapon.java +++ b/bridge/src/main/java/com/iluwatar/bridge/Weapon.java @@ -24,9 +24,7 @@ package com.iluwatar.bridge; /** - * - * Weapon - * + * Weapon. */ public interface Weapon { diff --git a/builder/src/main/java/com/iluwatar/builder/App.java b/builder/src/main/java/com/iluwatar/builder/App.java index f57e4d42f26f..ae29ee3678d9 100644 --- a/builder/src/main/java/com/iluwatar/builder/App.java +++ b/builder/src/main/java/com/iluwatar/builder/App.java @@ -28,36 +28,33 @@ import org.slf4j.LoggerFactory; /** - * * The intention of the Builder pattern is to find a solution to the telescoping constructor * anti-pattern. The telescoping constructor anti-pattern occurs when the increase of object * constructor parameter combination leads to an exponential list of constructors. Instead of using * numerous constructors, the builder pattern uses another object, a builder, that receives each * initialization parameter step by step and then returns the resulting constructed object at once. - *

    - * The Builder pattern has another benefit. It can be used for objects that contain flat data (html - * code, SQL query, X.509 certificate...), that is to say, data that can't be easily edited. This - * type of data cannot be edited step by step and must be edited at once. The best way to construct - * such an object is to use a builder class. - *

    - * In this example we have the Builder pattern variation as described by Joshua Bloch in Effective - * Java 2nd Edition. - *

    - * We want to build {@link Hero} objects, but its construction is complex because of the many - * parameters needed. To aid the user we introduce {@link Builder} class. {@link Hero.Builder} - * takes the minimum parameters to build {@link Hero} object in its constructor. After that - * additional configuration for the {@link Hero} object can be done using the fluent - * {@link Builder} interface. When configuration is ready the build method is called to receive - * the final {@link Hero} object. - * + * + *

    The Builder pattern has another benefit. It can be used for objects that contain flat data + * (html code, SQL query, X.509 certificate...), that is to say, data that can't be easily edited. + * This type of data cannot be edited step by step and must be edited at once. The best way to + * construct such an object is to use a builder class. + * + *

    In this example we have the Builder pattern variation as described by Joshua Bloch in + * Effective Java 2nd Edition. + * + *

    We want to build {@link Hero} objects, but its construction is complex because of the many + * parameters needed. To aid the user we introduce {@link Builder} class. {@link Hero.Builder} takes + * the minimum parameters to build {@link Hero} object in its constructor. After that additional + * configuration for the {@link Hero} object can be done using the fluent {@link Builder} interface. + * When configuration is ready the build method is called to receive the final {@link Hero} object. */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point - * + * Program entry point. + * * @param args command line args */ public static void main(String[] args) { diff --git a/builder/src/main/java/com/iluwatar/builder/Armor.java b/builder/src/main/java/com/iluwatar/builder/Armor.java index 8cf57a361a9e..2ab9bf831899 100644 --- a/builder/src/main/java/com/iluwatar/builder/Armor.java +++ b/builder/src/main/java/com/iluwatar/builder/Armor.java @@ -24,9 +24,7 @@ package com.iluwatar.builder; /** - * - * Armor enumeration - * + * Armor enumeration. */ public enum Armor { diff --git a/builder/src/main/java/com/iluwatar/builder/HairColor.java b/builder/src/main/java/com/iluwatar/builder/HairColor.java index f94de35564a4..1beccff5e5b8 100644 --- a/builder/src/main/java/com/iluwatar/builder/HairColor.java +++ b/builder/src/main/java/com/iluwatar/builder/HairColor.java @@ -24,9 +24,7 @@ package com.iluwatar.builder; /** - * - * HairColor enumeration - * + * HairColor enumeration. */ public enum HairColor { diff --git a/builder/src/main/java/com/iluwatar/builder/HairType.java b/builder/src/main/java/com/iluwatar/builder/HairType.java index 6eece1e373dd..3d16eb4d741f 100644 --- a/builder/src/main/java/com/iluwatar/builder/HairType.java +++ b/builder/src/main/java/com/iluwatar/builder/HairType.java @@ -24,9 +24,7 @@ package com.iluwatar.builder; /** - * - * HairType enumeration - * + * HairType enumeration. */ public enum HairType { diff --git a/builder/src/main/java/com/iluwatar/builder/Hero.java b/builder/src/main/java/com/iluwatar/builder/Hero.java index a8f285b66eda..b33ce10078fe 100644 --- a/builder/src/main/java/com/iluwatar/builder/Hero.java +++ b/builder/src/main/java/com/iluwatar/builder/Hero.java @@ -24,9 +24,7 @@ package com.iluwatar.builder; /** - * * Hero, the class with many parameters. - * */ public final class Hero { @@ -75,9 +73,9 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("This is a ") - .append(profession) - .append(" named ") - .append(name); + .append(profession) + .append(" named ") + .append(name); if (hairColor != null || hairType != null) { sb.append(" with "); if (hairColor != null) { @@ -99,9 +97,7 @@ public String toString() { } /** - * * The builder class. - * */ public static class Builder { @@ -113,7 +109,7 @@ public static class Builder { private Weapon weapon; /** - * Constructor + * Constructor. */ public Builder(Profession profession, String name) { if (profession == null || name == null) { diff --git a/builder/src/main/java/com/iluwatar/builder/Profession.java b/builder/src/main/java/com/iluwatar/builder/Profession.java index 1e22a1c67d85..23b1ac220c92 100644 --- a/builder/src/main/java/com/iluwatar/builder/Profession.java +++ b/builder/src/main/java/com/iluwatar/builder/Profession.java @@ -24,9 +24,7 @@ package com.iluwatar.builder; /** - * - * Profession enumeration - * + * Profession enumeration. */ public enum Profession { diff --git a/builder/src/main/java/com/iluwatar/builder/Weapon.java b/builder/src/main/java/com/iluwatar/builder/Weapon.java index 51ddeafbce29..4ca78b95ff20 100644 --- a/builder/src/main/java/com/iluwatar/builder/Weapon.java +++ b/builder/src/main/java/com/iluwatar/builder/Weapon.java @@ -24,9 +24,7 @@ package com.iluwatar.builder; /** - * - * Weapon enumeration - * + * Weapon enumeration. */ public enum Weapon { From efc17fcc70781c13b1c3cc938de73b6514721cb7 Mon Sep 17 00:00:00 2001 From: Anurag Agarwal Date: Sun, 10 Nov 2019 00:53:12 +0530 Subject: [PATCH 136/197] Resolves checkstyle errors for business-delegate, bytecode, caching (#1059) * Reduces checkstyle errors in business-delegate * Reduces checkstyle errors in bytecode * Reduces checkstyle errors in caching --- .../com/iluwatar/business/delegate/App.java | 4 +- .../business/delegate/BusinessDelegate.java | 2 +- .../business/delegate/BusinessLookup.java | 2 + .../business/delegate/BusinessService.java | 4 +- .../iluwatar/business/delegate/Client.java | 4 +- .../business/delegate/EjbService.java | 4 +- .../business/delegate/JmsService.java | 4 +- .../business/delegate/ServiceType.java | 4 +- .../main/java/com/iluwatar/bytecode/App.java | 54 ++++++++--------- .../com/iluwatar/bytecode/Instruction.java | 5 +- .../com/iluwatar/bytecode/VirtualMachine.java | 7 ++- .../java/com/iluwatar/bytecode/Wizard.java | 3 +- .../util/InstructionConverterUtil.java | 7 ++- .../main/java/com/iluwatar/caching/App.java | 22 ++++--- .../java/com/iluwatar/caching/AppManager.java | 13 ++--- .../java/com/iluwatar/caching/CacheStore.java | 29 +++++----- .../com/iluwatar/caching/CachingPolicy.java | 2 - .../java/com/iluwatar/caching/DbManager.java | 58 ++++++++++--------- .../java/com/iluwatar/caching/LruCache.java | 19 +++--- .../com/iluwatar/caching/UserAccount.java | 2 +- .../caching/constants/CachingConstants.java | 4 +- 21 files changed, 119 insertions(+), 134 deletions(-) diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/App.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/App.java index 68e382c0f051..fcb1acd1b477 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/App.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/App.java @@ -28,11 +28,11 @@ * tiers. By using the pattern we gain loose coupling between the tiers. The Business Delegate * encapsulates knowledge about how to locate, connect to, and interact with the business objects * that make up the application. - * + * *

    Some of the services the Business Delegate uses are instantiated directly, and some can be * retrieved through service lookups. The Business Delegate itself may contain business logic too * potentially tying together multiple service calls, exception handling, retrying etc. - * + * *

    In this example the client ({@link Client}) utilizes a business delegate ( * {@link BusinessDelegate}) to execute a task. The Business Delegate then selects the appropriate * service and makes the service call. diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessDelegate.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessDelegate.java index cf2b251295ad..c39a2ad39372 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessDelegate.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessDelegate.java @@ -24,7 +24,7 @@ package com.iluwatar.business.delegate; /** - * BusinessDelegate separates the presentation and business tiers + * BusinessDelegate separates the presentation and business tiers. */ public class BusinessDelegate { diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessLookup.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessLookup.java index e7d8400d3249..489caa23c407 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessLookup.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessLookup.java @@ -33,6 +33,8 @@ public class BusinessLookup { private JmsService jmsService; /** + * Gets service instance based on service type. + * * @param serviceType Type of service instance to be returned. * @return Service instance. */ diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessService.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessService.java index 6e08aca1f939..3094d3f6e95f 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessService.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/BusinessService.java @@ -24,9 +24,7 @@ package com.iluwatar.business.delegate; /** - * - * Interface for service implementations - * + * Interface for service implementations. */ public interface BusinessService { diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/Client.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/Client.java index c9c8950db3a4..dcf4ce6b29d3 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/Client.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/Client.java @@ -24,9 +24,7 @@ package com.iluwatar.business.delegate; /** - * - * Client utilizes BusinessDelegate to call the business tier - * + * Client utilizes BusinessDelegate to call the business tier. */ public class Client { diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/EjbService.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/EjbService.java index aa9457abfada..6f39abb1ae42 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/EjbService.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/EjbService.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * - * Service EJB implementation - * + * Service EJB implementation. */ public class EjbService implements BusinessService { diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/JmsService.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/JmsService.java index 83abd9762301..2317d783af0f 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/JmsService.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/JmsService.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * - * Service JMS implementation - * + * Service JMS implementation. */ public class JmsService implements BusinessService { diff --git a/business-delegate/src/main/java/com/iluwatar/business/delegate/ServiceType.java b/business-delegate/src/main/java/com/iluwatar/business/delegate/ServiceType.java index a09dde59c661..87fd1562da66 100644 --- a/business-delegate/src/main/java/com/iluwatar/business/delegate/ServiceType.java +++ b/business-delegate/src/main/java/com/iluwatar/business/delegate/ServiceType.java @@ -24,9 +24,7 @@ package com.iluwatar.business.delegate; /** - * - * Enumeration for service types - * + * Enumeration for service types. */ public enum ServiceType { diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/App.java b/bytecode/src/main/java/com/iluwatar/bytecode/App.java index 9a5f66d886fe..165043c70691 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/App.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/App.java @@ -24,57 +24,59 @@ package com.iluwatar.bytecode; import com.iluwatar.bytecode.util.InstructionConverterUtil; +import java.util.Stack; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * The intention of Bytecode pattern is to give behavior the flexibility of data by encoding it as instructions - * for a virtual machine. - * An instruction set defines the low-level operations that can be performed. A series of instructions is encoded as - * a sequence of bytes. A virtual machine executes these instructions one at a time, - * using a stack for intermediate values. By combining instructions, complex high-level behavior can be defined. - * - * This pattern should be used when there is a need to define high number of behaviours and implementation engine - * is not a good choice because - * It is too lowe level - * Iterating on it takes too long due to slow compile times or other tooling issues. - * It has too much trust. If you want to ensure the behavior being defined can’t break the game, - * you need to sandbox it from the rest of the codebase. + * The intention of Bytecode pattern is to give behavior the flexibility of data by encoding it as + * instructions for a virtual machine. An instruction set defines the low-level operations that can + * be performed. A series of instructions is encoded as a sequence of bytes. A virtual machine + * executes these instructions one at a time, using a stack for intermediate values. By combining + * instructions, complex high-level behavior can be defined. * + *

    This pattern should be used when there is a need to define high number of behaviours and + * implementation engine is not a good choice because It is too lowe level Iterating on it takes too + * long due to slow compile times or other tooling issues. It has too much trust. If you want to + * ensure the behavior being defined can’t break the game, you need to sandbox it from the rest of + * the codebase. */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Main app method + * Main app method. + * * @param args command line args */ public static void main(String[] args) { - VirtualMachine vm = new VirtualMachine(); Wizard wizard = new Wizard(); wizard.setHealth(45); wizard.setAgility(7); wizard.setWisdom(11); + + VirtualMachine vm = new VirtualMachine(); vm.getWizards()[0] = wizard; interpretInstruction("LITERAL 0", vm); - interpretInstruction( "LITERAL 0", vm); - interpretInstruction( "GET_HEALTH", vm); - interpretInstruction( "LITERAL 0", vm); - interpretInstruction( "GET_AGILITY", vm); - interpretInstruction( "LITERAL 0", vm); - interpretInstruction( "GET_WISDOM ", vm); - interpretInstruction( "ADD", vm); - interpretInstruction( "LITERAL 2", vm); - interpretInstruction( "DIVIDE", vm); - interpretInstruction( "ADD", vm); - interpretInstruction( "SET_HEALTH", vm); + interpretInstruction("LITERAL 0", vm); + interpretInstruction("GET_HEALTH", vm); + interpretInstruction("LITERAL 0", vm); + interpretInstruction("GET_AGILITY", vm); + interpretInstruction("LITERAL 0", vm); + interpretInstruction("GET_WISDOM ", vm); + interpretInstruction("ADD", vm); + interpretInstruction("LITERAL 2", vm); + interpretInstruction("DIVIDE", vm); + interpretInstruction("ADD", vm); + interpretInstruction("SET_HEALTH", vm); } private static void interpretInstruction(String instruction, VirtualMachine vm) { InstructionConverterUtil converter = new InstructionConverterUtil(); vm.execute(converter.convertToByteCode(instruction)); - LOGGER.info(instruction + String.format("%" + (12 - instruction.length()) + "s", "" ) + vm.getStack()); + Stack stack = vm.getStack(); + LOGGER.info(instruction + String.format("%" + (12 - instruction.length()) + "s", "") + stack); } } diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java b/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java index 99b632ed853e..7684c778dc55 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java @@ -24,7 +24,7 @@ package com.iluwatar.bytecode; /** - * Representation of instructions understandable by virtual machine + * Representation of instructions understandable by virtual machine. */ public enum Instruction { @@ -51,7 +51,8 @@ public int getIntValue() { } /** - * Converts integer value to Instruction + * Converts integer value to Instruction. + * * @param value value of instruction * @return representation of the instruction */ diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java b/bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java index c6b120963284..111c27e7343a 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/VirtualMachine.java @@ -26,7 +26,7 @@ import java.util.Stack; /** - * Implementation of virtual machine + * Implementation of virtual machine. */ public class VirtualMachine { @@ -35,7 +35,7 @@ public class VirtualMachine { private Wizard[] wizards = new Wizard[2]; /** - * Constructor + * Constructor. */ public VirtualMachine() { for (int i = 0; i < wizards.length; i++) { @@ -44,7 +44,8 @@ public VirtualMachine() { } /** - * Executes provided bytecode + * Executes provided bytecode. + * * @param bytecode to execute */ public void execute(int[] bytecode) { diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/Wizard.java b/bytecode/src/main/java/com/iluwatar/bytecode/Wizard.java index 434a1bddd1e8..5153969d9145 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/Wizard.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/Wizard.java @@ -27,7 +27,8 @@ import org.slf4j.LoggerFactory; /** - * This class represent game objects which properties can be changed by instructions interpreted by virtual machine + * This class represent game objects which properties can be changed by instructions interpreted by + * virtual machine. */ public class Wizard { private static final Logger LOGGER = LoggerFactory.getLogger(Wizard.class); diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/util/InstructionConverterUtil.java b/bytecode/src/main/java/com/iluwatar/bytecode/util/InstructionConverterUtil.java index bdc0782dd593..1d3002cb104c 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/util/InstructionConverterUtil.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/util/InstructionConverterUtil.java @@ -26,11 +26,11 @@ import com.iluwatar.bytecode.Instruction; /** - * Utility class used for instruction validation and conversion + * Utility class used for instruction validation and conversion. */ public class InstructionConverterUtil { /** - * Converts instructions represented as String + * Converts instructions represented as String. * * @param instructions to convert * @return array of int representing bytecode @@ -48,7 +48,8 @@ public static int[] convertToByteCode(String instructions) { } else if (isValidInt(splitedInstructions[i])) { bytecode[i] = Integer.valueOf(splitedInstructions[i]); } else { - throw new IllegalArgumentException("Invalid instruction or number: " + splitedInstructions[i]); + String errorMessage = "Invalid instruction or number: " + splitedInstructions[i]; + throw new IllegalArgumentException(errorMessage); } } diff --git a/caching/src/main/java/com/iluwatar/caching/App.java b/caching/src/main/java/com/iluwatar/caching/App.java index 4ef12b7de784..e1e4e67ca08c 100644 --- a/caching/src/main/java/com/iluwatar/caching/App.java +++ b/caching/src/main/java/com/iluwatar/caching/App.java @@ -27,7 +27,6 @@ import org.slf4j.LoggerFactory; /** - * * The Caching pattern describes how to avoid expensive re-acquisition of resources by not releasing * the resources immediately after their use. The resources retain their identity, are kept in some * fast-access storage, and are re-used to avoid having to acquire them again. There are four main @@ -43,8 +42,8 @@ * should be written back to the backing store (i.e. Database) and help keep both data sources * synchronized/up-to-date. This pattern can improve performance and also helps to maintain * consistency between data held in the cache and the data in the underlying data store. - *

    - * In this example, the user account ({@link UserAccount}) entity is used as the underlying + * + *

    In this example, the user account ({@link UserAccount}) entity is used as the underlying * application data. The cache itself is implemented as an internal (Java) data structure. It adopts * a Least-Recently-Used (LRU) strategy for evicting data from itself when its full. The four * strategies are individually tested. The testing of the cache is restricted towards saving and @@ -60,7 +59,6 @@ * @see CacheStore * @see LruCache * @see CachingPolicy - * */ public class App { @@ -68,15 +66,15 @@ public class App { /** - * Program entry point + * Program entry point. * * @param args command line args */ public static void main(String[] args) { AppManager.initDb(false); // VirtualDB (instead of MongoDB) was used in running the JUnit tests - // and the App class to avoid Maven compilation errors. Set flag to - // true to run the tests with MongoDB (provided that MongoDB is - // installed and socket connection is open). + // and the App class to avoid Maven compilation errors. Set flag to + // true to run the tests with MongoDB (provided that MongoDB is + // installed and socket connection is open). AppManager.initCacheCapacity(3); App app = new App(); app.useReadAndWriteThroughStrategy(); @@ -86,7 +84,7 @@ public static void main(String[] args) { } /** - * Read-through and write-through + * Read-through and write-through. */ public void useReadAndWriteThroughStrategy() { LOGGER.info("# CachingPolicy.THROUGH"); @@ -101,7 +99,7 @@ public void useReadAndWriteThroughStrategy() { } /** - * Read-through and write-around + * Read-through and write-around. */ public void useReadThroughAndWriteAroundStrategy() { LOGGER.info("# CachingPolicy.AROUND"); @@ -123,7 +121,7 @@ public void useReadThroughAndWriteAroundStrategy() { } /** - * Read-through and write-behind + * Read-through and write-behind. */ public void useReadThroughAndWriteBehindStrategy() { LOGGER.info("# CachingPolicy.BEHIND"); @@ -147,7 +145,7 @@ public void useReadThroughAndWriteBehindStrategy() { } /** - * Cache-Aside + * Cache-Aside. */ public void useCacheAsideStategy() { LOGGER.info("# CachingPolicy.ASIDE"); diff --git a/caching/src/main/java/com/iluwatar/caching/AppManager.java b/caching/src/main/java/com/iluwatar/caching/AppManager.java index 6939c6b80b79..ec7f0df6971f 100644 --- a/caching/src/main/java/com/iluwatar/caching/AppManager.java +++ b/caching/src/main/java/com/iluwatar/caching/AppManager.java @@ -26,13 +26,11 @@ import java.text.ParseException; /** - * * AppManager helps to bridge the gap in communication between the main class and the application's * back-end. DB connection is initialized through this class. The chosen caching strategy/policy is * also initialized here. Before the cache can be used, the size of the cache has to be set. * Depending on the chosen caching policy, AppManager will call the appropriate function in the * CacheStore class. - * */ public final class AppManager { @@ -42,7 +40,6 @@ private AppManager() { } /** - * * Developer/Tester is able to choose whether the application should use MongoDB as its underlying * data storage or a simple Java data structure to (temporarily) store the data/objects during * runtime. @@ -60,7 +57,7 @@ public static void initDb(boolean useMongoDb) { } /** - * Initialize caching policy + * Initialize caching policy. */ public static void initCachingPolicy(CachingPolicy policy) { cachingPolicy = policy; @@ -75,7 +72,7 @@ public static void initCacheCapacity(int capacity) { } /** - * Find user account + * Find user account. */ public static UserAccount find(String userId) { if (cachingPolicy == CachingPolicy.THROUGH || cachingPolicy == CachingPolicy.AROUND) { @@ -89,7 +86,7 @@ public static UserAccount find(String userId) { } /** - * Save user account + * Save user account. */ public static void save(UserAccount userAccount) { if (cachingPolicy == CachingPolicy.THROUGH) { @@ -108,7 +105,7 @@ public static String printCacheContent() { } /** - * Cache-Aside save user account helper + * Cache-Aside save user account helper. */ private static void saveAside(UserAccount userAccount) { DbManager.updateDb(userAccount); @@ -116,7 +113,7 @@ private static void saveAside(UserAccount userAccount) { } /** - * Cache-Aside find user account helper + * Cache-Aside find user account helper. */ private static UserAccount findAside(String userId) { UserAccount userAccount = CacheStore.get(userId); diff --git a/caching/src/main/java/com/iluwatar/caching/CacheStore.java b/caching/src/main/java/com/iluwatar/caching/CacheStore.java index e221f16e7878..17a733188c64 100644 --- a/caching/src/main/java/com/iluwatar/caching/CacheStore.java +++ b/caching/src/main/java/com/iluwatar/caching/CacheStore.java @@ -23,15 +23,12 @@ package com.iluwatar.caching; +import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - /** - * * The caching strategies are implemented in this class. - * */ public class CacheStore { @@ -43,7 +40,7 @@ private CacheStore() { } /** - * Init cache capacity + * Init cache capacity. */ public static void initCapacity(int capacity) { if (cache == null) { @@ -54,7 +51,7 @@ public static void initCapacity(int capacity) { } /** - * Get user account using read-through cache + * Get user account using read-through cache. */ public static UserAccount readThrough(String userId) { if (cache.contains(userId)) { @@ -68,7 +65,7 @@ public static UserAccount readThrough(String userId) { } /** - * Get user account using write-through cache + * Get user account using write-through cache. */ public static void writeThrough(UserAccount userAccount) { if (cache.contains(userAccount.getUserId())) { @@ -80,20 +77,20 @@ public static void writeThrough(UserAccount userAccount) { } /** - * Get user account using write-around cache + * Get user account using write-around cache. */ public static void writeAround(UserAccount userAccount) { if (cache.contains(userAccount.getUserId())) { DbManager.updateDb(userAccount); cache.invalidate(userAccount.getUserId()); // Cache data has been updated -- remove older - // version from cache. + // version from cache. } else { DbManager.writeToDb(userAccount); } } /** - * Get user account using read-through cache with write-back policy + * Get user account using read-through cache with write-back policy. */ public static UserAccount readThroughWithWriteBackPolicy(String userId) { if (cache.contains(userId)) { @@ -112,7 +109,7 @@ public static UserAccount readThroughWithWriteBackPolicy(String userId) { } /** - * Set user account + * Set user account. */ public static void writeBehind(UserAccount userAccount) { if (cache.isFull() && !cache.contains(userAccount.getUserId())) { @@ -124,7 +121,7 @@ public static void writeBehind(UserAccount userAccount) { } /** - * Clears cache + * Clears cache. */ public static void clearCache() { if (cache != null) { @@ -147,7 +144,7 @@ public static void flushCache() { } /** - * Print user accounts + * Print user accounts. */ public static String print() { List listOfUserAccounts = cache.getCacheDataInListForm(); @@ -161,21 +158,21 @@ public static String print() { } /** - * Delegate to backing cache store + * Delegate to backing cache store. */ public static UserAccount get(String userId) { return cache.get(userId); } /** - * Delegate to backing cache store + * Delegate to backing cache store. */ public static void set(String userId, UserAccount userAccount) { cache.set(userId, userAccount); } /** - * Delegate to backing cache store + * Delegate to backing cache store. */ public static void invalidate(String userId) { cache.invalidate(userId); diff --git a/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java b/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java index 23be7d7e2b2d..6bc6dbd77d3a 100644 --- a/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java +++ b/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java @@ -24,9 +24,7 @@ package com.iluwatar.caching; /** - * * Enum class containing the four caching strategies implemented in the pattern. - * */ public enum CachingPolicy { THROUGH("through"), AROUND("around"), BEHIND("behind"), ASIDE("aside"); diff --git a/caching/src/main/java/com/iluwatar/caching/DbManager.java b/caching/src/main/java/com/iluwatar/caching/DbManager.java index 01b727fa540e..dbb885ee2277 100644 --- a/caching/src/main/java/com/iluwatar/caching/DbManager.java +++ b/caching/src/main/java/com/iluwatar/caching/DbManager.java @@ -23,28 +23,24 @@ package com.iluwatar.caching; -import java.text.ParseException; -import java.util.HashMap; -import java.util.Map; - -import org.bson.Document; - import com.iluwatar.caching.constants.CachingConstants; import com.mongodb.MongoClient; import com.mongodb.client.FindIterable; import com.mongodb.client.MongoDatabase; import com.mongodb.client.model.UpdateOptions; +import java.text.ParseException; +import java.util.HashMap; +import java.util.Map; +import org.bson.Document; /** + *

    DBManager handles the communication with the underlying data store i.e. Database. It contains + * the implemented methods for querying, inserting, and updating data. MongoDB was used as the + * database for the application.

    * - *

    DBManager handles the communication with the underlying data store i.e. Database. It contains the - * implemented methods for querying, inserting, and updating data. MongoDB was used as the database - * for the application.

    - * - *

    Developer/Tester is able to choose whether the application should use MongoDB as its underlying - * data storage (connect()) or a simple Java data structure to (temporarily) store the data/objects - * during runtime (createVirtualDB()).

    - * + *

    Developer/Tester is able to choose whether the application should use MongoDB as its + * underlying data storage (connect()) or a simple Java data structure to (temporarily) store the + * data/objects during runtime (createVirtualDB()).

    */ public final class DbManager { @@ -58,7 +54,7 @@ private DbManager() { } /** - * Create DB + * Create DB. */ public static void createVirtualDb() { useMongoDB = false; @@ -66,7 +62,7 @@ public static void createVirtualDb() { } /** - * Connect to DB + * Connect to DB. */ public static void connect() throws ParseException { useMongoDB = true; @@ -75,7 +71,7 @@ public static void connect() throws ParseException { } /** - * Read user account from DB + * Read user account from DB. */ public static UserAccount readFromDb(String userId) { if (!useMongoDB) { @@ -91,17 +87,20 @@ public static UserAccount readFromDb(String userId) { e.printStackTrace(); } } - FindIterable iterable = - db.getCollection(CachingConstants.USER_ACCOUNT).find(new Document(CachingConstants.USER_ID, userId)); + FindIterable iterable = db + .getCollection(CachingConstants.USER_ACCOUNT) + .find(new Document(CachingConstants.USER_ID, userId)); if (iterable == null) { return null; } Document doc = iterable.first(); - return new UserAccount(userId, doc.getString(CachingConstants.USER_NAME), doc.getString(CachingConstants.ADD_INFO)); + String userName = doc.getString(CachingConstants.USER_NAME); + String appInfo = doc.getString(CachingConstants.ADD_INFO); + return new UserAccount(userId, userName, appInfo); } /** - * Write user account to DB + * Write user account to DB. */ public static void writeToDb(UserAccount userAccount) { if (!useMongoDB) { @@ -116,12 +115,14 @@ public static void writeToDb(UserAccount userAccount) { } } db.getCollection(CachingConstants.USER_ACCOUNT).insertOne( - new Document(CachingConstants.USER_ID ,userAccount.getUserId()).append(CachingConstants.USER_NAME, - userAccount.getUserName()).append(CachingConstants.ADD_INFO, userAccount.getAdditionalInfo())); + new Document(CachingConstants.USER_ID, userAccount.getUserId()) + .append(CachingConstants.USER_NAME, userAccount.getUserName()) + .append(CachingConstants.ADD_INFO, userAccount.getAdditionalInfo()) + ); } /** - * Update DB + * Update DB. */ public static void updateDb(UserAccount userAccount) { if (!useMongoDB) { @@ -142,7 +143,6 @@ public static void updateDb(UserAccount userAccount) { } /** - * * Insert data into DB if it does not exist. Else, update it. */ public static void upsertDb(UserAccount userAccount) { @@ -161,8 +161,10 @@ public static void upsertDb(UserAccount userAccount) { new Document(CachingConstants.USER_ID, userAccount.getUserId()), new Document("$set", new Document(CachingConstants.USER_ID, userAccount.getUserId()) - .append(CachingConstants.USER_NAME, userAccount.getUserName()).append(CachingConstants.ADD_INFO, - userAccount.getAdditionalInfo())), - new UpdateOptions().upsert(true)); + .append(CachingConstants.USER_NAME, userAccount.getUserName()) + .append(CachingConstants.ADD_INFO, userAccount.getAdditionalInfo()) + ), + new UpdateOptions().upsert(true) + ); } } diff --git a/caching/src/main/java/com/iluwatar/caching/LruCache.java b/caching/src/main/java/com/iluwatar/caching/LruCache.java index 0f2e53823a0a..32bb3838eb39 100644 --- a/caching/src/main/java/com/iluwatar/caching/LruCache.java +++ b/caching/src/main/java/com/iluwatar/caching/LruCache.java @@ -23,22 +23,19 @@ package com.iluwatar.caching; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * * Data structure/implementation of the application's cache. The data structure consists of a hash * table attached with a doubly linked-list. The linked-list helps in capturing and maintaining the * LRU data in the cache. When a data is queried (from the cache), added (to the cache), or updated, * the data is moved to the front of the list to depict itself as the most-recently-used data. The * LRU data is always at the end of the list. - * */ public class LruCache { @@ -66,7 +63,7 @@ public LruCache(int capacity) { } /** - * Get user account + * Get user account. */ public UserAccount get(String userId) { if (cache.containsKey(userId)) { @@ -110,7 +107,7 @@ public void setHead(Node node) { } /** - * Set user account + * Set user account. */ public void set(String userId, UserAccount userAccount) { if (cache.containsKey(userId)) { @@ -137,7 +134,7 @@ public boolean contains(String userId) { } /** - * Invalidate cache for user + * Invalidate cache for user. */ public void invalidate(String userId) { Node toBeRemoved = cache.remove(userId); @@ -156,7 +153,7 @@ public UserAccount getLruData() { } /** - * Clear cache + * Clear cache. */ public void clear() { head = null; @@ -178,12 +175,12 @@ public List getCacheDataInListForm() { } /** - * Set cache capacity + * Set cache capacity. */ public void setCapacity(int newCapacity) { if (capacity > newCapacity) { clear(); // Behavior can be modified to accommodate for decrease in cache size. For now, we'll - // just clear the cache. + // just clear the cache. } else { this.capacity = newCapacity; } diff --git a/caching/src/main/java/com/iluwatar/caching/UserAccount.java b/caching/src/main/java/com/iluwatar/caching/UserAccount.java index fc6b8cb4c5eb..4c58cfb08a59 100644 --- a/caching/src/main/java/com/iluwatar/caching/UserAccount.java +++ b/caching/src/main/java/com/iluwatar/caching/UserAccount.java @@ -32,7 +32,7 @@ public class UserAccount { private String additionalInfo; /** - * Constructor + * Constructor. */ public UserAccount(String userId, String userName, String additionalInfo) { this.userId = userId; diff --git a/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java b/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java index 7e53f61f0cf6..86d2bd2a7a8f 100644 --- a/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java +++ b/caching/src/main/java/com/iluwatar/caching/constants/CachingConstants.java @@ -24,9 +24,7 @@ package com.iluwatar.caching.constants; /** - * - * Constant class for defining constants - * + * Constant class for defining constants. */ public class CachingConstants { From 31f27a720b3ebc420783bd2ac885a74f6a90c754 Mon Sep 17 00:00:00 2001 From: Anurag Agarwal Date: Sun, 10 Nov 2019 00:57:14 +0530 Subject: [PATCH 137/197] Resolves checkstyle errors for callback, chain, circuit-breaker (#1060) * Reduces checkstyle errors in callback * Reduces checkstyle errors in chain * Reduces checkstyle errors in circuit-breaker --- .../main/java/com/iluwatar/callback/App.java | 14 ++--- .../java/com/iluwatar/callback/Callback.java | 4 +- .../com/iluwatar/callback/LambdasApp.java | 15 +++-- .../com/iluwatar/callback/SimpleTask.java | 10 ++-- .../main/java/com/iluwatar/callback/Task.java | 6 +- .../src/main/java/com/iluwatar/chain/App.java | 16 +++--- .../java/com/iluwatar/chain/OrcCommander.java | 4 +- .../main/java/com/iluwatar/chain/OrcKing.java | 2 - .../java/com/iluwatar/chain/OrcOfficer.java | 4 +- .../java/com/iluwatar/chain/OrcSoldier.java | 4 +- .../main/java/com/iluwatar/chain/Request.java | 16 +++--- .../com/iluwatar/chain/RequestHandler.java | 6 +- .../java/com/iluwatar/chain/RequestType.java | 4 +- .../java/com/iluwatar/circuitbreaker/App.java | 57 +++++++++---------- .../circuitbreaker/CircuitBreaker.java | 43 ++++++++------ .../circuitbreaker/DelayedService.java | 14 +++-- .../circuitbreaker/MonitoringService.java | 12 ++-- .../com/iluwatar/circuitbreaker/State.java | 8 +-- 18 files changed, 114 insertions(+), 125 deletions(-) diff --git a/callback/src/main/java/com/iluwatar/callback/App.java b/callback/src/main/java/com/iluwatar/callback/App.java index 842f01dcdf3d..1b92d98debb4 100644 --- a/callback/src/main/java/com/iluwatar/callback/App.java +++ b/callback/src/main/java/com/iluwatar/callback/App.java @@ -23,16 +23,14 @@ package com.iluwatar.callback; -import org.slf4j.Logger; - import static org.slf4j.LoggerFactory.getLogger; +import org.slf4j.Logger; + /** - * - * Callback pattern is more native for functional languages where functions are - * treated as first-class citizens. Prior to Java 8 callbacks can be simulated - * using simple (alike command) interfaces. - * + * Callback pattern is more native for functional languages where functions are treated as + * first-class citizens. Prior to Java 8 callbacks can be simulated using simple (alike command) + * interfaces. */ public final class App { @@ -42,7 +40,7 @@ private App() { } /** - * Program entry point + * Program entry point. */ public static void main(final String[] args) { Task task = new SimpleTask(); diff --git a/callback/src/main/java/com/iluwatar/callback/Callback.java b/callback/src/main/java/com/iluwatar/callback/Callback.java index 0158dcda0fe6..ad98e27deefa 100644 --- a/callback/src/main/java/com/iluwatar/callback/Callback.java +++ b/callback/src/main/java/com/iluwatar/callback/Callback.java @@ -24,9 +24,7 @@ package com.iluwatar.callback; /** - * - * Callback interface - * + * Callback interface. */ public interface Callback { diff --git a/callback/src/main/java/com/iluwatar/callback/LambdasApp.java b/callback/src/main/java/com/iluwatar/callback/LambdasApp.java index 18715e3b79ca..f87d04969d86 100644 --- a/callback/src/main/java/com/iluwatar/callback/LambdasApp.java +++ b/callback/src/main/java/com/iluwatar/callback/LambdasApp.java @@ -23,24 +23,23 @@ package com.iluwatar.callback; -import org.slf4j.Logger; - import static org.slf4j.LoggerFactory.getLogger; +import org.slf4j.Logger; + /** - * - * This example generates the exact same output as {@link App} however the - * callback has been defined as a Lambdas expression. - * + * This example generates the exact same output as {@link App} however the callback has been defined + * as a Lambdas expression. */ public final class LambdasApp { private static final Logger LOGGER = getLogger(LambdasApp.class); - private LambdasApp() { } + private LambdasApp() { + } /** - * Program entry point + * Program entry point. */ public static void main(final String[] args) { Task task = new SimpleTask(); diff --git a/callback/src/main/java/com/iluwatar/callback/SimpleTask.java b/callback/src/main/java/com/iluwatar/callback/SimpleTask.java index 21162833a72c..f12448d9683c 100644 --- a/callback/src/main/java/com/iluwatar/callback/SimpleTask.java +++ b/callback/src/main/java/com/iluwatar/callback/SimpleTask.java @@ -23,14 +23,12 @@ package com.iluwatar.callback; -import org.slf4j.Logger; - import static org.slf4j.LoggerFactory.getLogger; +import org.slf4j.Logger; + /** - * - * Implementation of task that need to be executed - * + * Implementation of task that need to be executed. */ public final class SimpleTask extends Task { @@ -39,6 +37,6 @@ public final class SimpleTask extends Task { @Override public void execute() { LOGGER.info("Perform some important activity and after call the" - + " callback method."); + + " callback method."); } } diff --git a/callback/src/main/java/com/iluwatar/callback/Task.java b/callback/src/main/java/com/iluwatar/callback/Task.java index 15cd99e9ae70..09c8f67afcf8 100644 --- a/callback/src/main/java/com/iluwatar/callback/Task.java +++ b/callback/src/main/java/com/iluwatar/callback/Task.java @@ -24,14 +24,12 @@ package com.iluwatar.callback; /** - * - * Template-method class for callback hook execution - * + * Template-method class for callback hook execution. */ public abstract class Task { /** - * Execute with callback + * Execute with callback. */ final void executeWith(final Callback callback) { execute(); diff --git a/chain/src/main/java/com/iluwatar/chain/App.java b/chain/src/main/java/com/iluwatar/chain/App.java index c45d682769bf..d6b7ebe2ef10 100644 --- a/chain/src/main/java/com/iluwatar/chain/App.java +++ b/chain/src/main/java/com/iluwatar/chain/App.java @@ -24,23 +24,21 @@ package com.iluwatar.chain; /** - * * The Chain of Responsibility pattern is a design pattern consisting of command objects and a * series of processing objects. Each processing object contains logic that defines the types of * command objects that it can handle; the rest are passed to the next processing object in the * chain. A mechanism also exists for adding new processing objects to the end of this chain. - *

    - * In this example we organize the request handlers ({@link RequestHandler}) into a chain where each - * handler has a chance to act on the request on its turn. Here the king ({@link OrcKing}) makes - * requests and the military orcs ({@link OrcCommander}, {@link OrcOfficer}, {@link OrcSoldier}) - * form the handler chain. - * + * + *

    In this example we organize the request handlers ({@link RequestHandler}) into a chain where + * each handler has a chance to act on the request on its turn. Here the king ({@link OrcKing}) + * makes requests and the military orcs ({@link OrcCommander}, {@link OrcOfficer}, {@link + * OrcSoldier}) form the handler chain. */ public class App { /** - * Program entry point - * + * Program entry point. + * * @param args command line args */ public static void main(String[] args) { diff --git a/chain/src/main/java/com/iluwatar/chain/OrcCommander.java b/chain/src/main/java/com/iluwatar/chain/OrcCommander.java index 4770eafcb624..a0dab903a76a 100644 --- a/chain/src/main/java/com/iluwatar/chain/OrcCommander.java +++ b/chain/src/main/java/com/iluwatar/chain/OrcCommander.java @@ -24,9 +24,7 @@ package com.iluwatar.chain; /** - * - * OrcCommander - * + * OrcCommander. */ public class OrcCommander extends RequestHandler { diff --git a/chain/src/main/java/com/iluwatar/chain/OrcKing.java b/chain/src/main/java/com/iluwatar/chain/OrcKing.java index 39243d0fdc5c..93c01da81c4b 100644 --- a/chain/src/main/java/com/iluwatar/chain/OrcKing.java +++ b/chain/src/main/java/com/iluwatar/chain/OrcKing.java @@ -24,9 +24,7 @@ package com.iluwatar.chain; /** - * * OrcKing makes requests that are handled by the chain. - * */ public class OrcKing { diff --git a/chain/src/main/java/com/iluwatar/chain/OrcOfficer.java b/chain/src/main/java/com/iluwatar/chain/OrcOfficer.java index 6cf78b11dcb7..abf1afe8bded 100644 --- a/chain/src/main/java/com/iluwatar/chain/OrcOfficer.java +++ b/chain/src/main/java/com/iluwatar/chain/OrcOfficer.java @@ -24,9 +24,7 @@ package com.iluwatar.chain; /** - * - * OrcOfficer - * + * OrcOfficer. */ public class OrcOfficer extends RequestHandler { diff --git a/chain/src/main/java/com/iluwatar/chain/OrcSoldier.java b/chain/src/main/java/com/iluwatar/chain/OrcSoldier.java index 686840d9548f..f1291a0a782b 100644 --- a/chain/src/main/java/com/iluwatar/chain/OrcSoldier.java +++ b/chain/src/main/java/com/iluwatar/chain/OrcSoldier.java @@ -24,9 +24,7 @@ package com.iluwatar.chain; /** - * - * OrcSoldier - * + * OrcSoldier. */ public class OrcSoldier extends RequestHandler { diff --git a/chain/src/main/java/com/iluwatar/chain/Request.java b/chain/src/main/java/com/iluwatar/chain/Request.java index c8962aafa954..621303d93749 100644 --- a/chain/src/main/java/com/iluwatar/chain/Request.java +++ b/chain/src/main/java/com/iluwatar/chain/Request.java @@ -26,24 +26,24 @@ import java.util.Objects; /** - * Request + * Request. */ public class Request { /** * The type of this request, used by each item in the chain to see if they should or can handle - * this particular request + * this particular request. */ private final RequestType requestType; /** - * A description of the request + * A description of the request. */ private final String requestDescription; /** * Indicates if the request is handled or not. A request can only switch state from unhandled to - * handled, there's no way to 'unhandle' a request + * handled, there's no way to 'unhandle' a request. */ private boolean handled; @@ -59,7 +59,7 @@ public Request(final RequestType requestType, final String requestDescription) { } /** - * Get a description of the request + * Get a description of the request. * * @return A human readable description of the request */ @@ -69,7 +69,7 @@ public String getRequestDescription() { /** * Get the type of this request, used by each person in the chain of command to see if they should - * or can handle this particular request + * or can handle this particular request. * * @return The request type */ @@ -78,14 +78,14 @@ public RequestType getRequestType() { } /** - * Mark the request as handled + * Mark the request as handled. */ public void markHandled() { this.handled = true; } /** - * Indicates if this request is handled or not + * Indicates if this request is handled or not. * * @return true when the request is handled, false if not */ diff --git a/chain/src/main/java/com/iluwatar/chain/RequestHandler.java b/chain/src/main/java/com/iluwatar/chain/RequestHandler.java index aed5c0611cd6..7923f03a6ddb 100644 --- a/chain/src/main/java/com/iluwatar/chain/RequestHandler.java +++ b/chain/src/main/java/com/iluwatar/chain/RequestHandler.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * - * RequestHandler - * + * RequestHandler. */ public abstract class RequestHandler { @@ -42,7 +40,7 @@ public RequestHandler(RequestHandler next) { } /** - * Request handler + * Request handler. */ public void handleRequest(Request req) { if (next != null) { diff --git a/chain/src/main/java/com/iluwatar/chain/RequestType.java b/chain/src/main/java/com/iluwatar/chain/RequestType.java index 4e377a2b6215..b63cf940270c 100644 --- a/chain/src/main/java/com/iluwatar/chain/RequestType.java +++ b/chain/src/main/java/com/iluwatar/chain/RequestType.java @@ -24,9 +24,7 @@ package com.iluwatar.chain; /** - * - * RequestType enumeration - * + * RequestType enumeration. */ public enum RequestType { diff --git a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java index 054158e9b6ae..c3465d801905 100644 --- a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java +++ b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java @@ -28,42 +28,39 @@ /** *

    - * The intention of the Circuit Builder pattern is to handle remote failures - * robustly, which is to mean that if a service is dependant on n number of - * other services, and m of them fail, we should be able to recover from that - * failure by ensuring that the user can still use the services that are actually - * functional, and resources are not tied up by uselessly by the services which - * are not working. However, we should also be able to detect when any of the m - * failing services become operational again, so that we can use it + * The intention of the Circuit Builder pattern is to handle remote failures robustly, which is to + * mean that if a service is dependant on n number of other services, and m of them fail, we should + * be able to recover from that failure by ensuring that the user can still use the services that + * are actually functional, and resources are not tied up by uselessly by the services which are not + * working. However, we should also be able to detect when any of the m failing services become + * operational again, so that we can use it *

    *

    - * In this example, the circuit breaker pattern is demonstrated by using two services: - * {@link MonitoringService} and {@link DelayedService}. The monitoring service - * is responsible for calling two services: a local service and a remote service {@link DelayedService} - * , and by using the circuit breaker construction we ensure that if the call to - * remote service is going to fail, we are going to save our resources and not make the - * function call at all, by wrapping our call to the remote service in the circuit - * breaker object. + * In this example, the circuit breaker pattern is demonstrated by using two services: {@link + * MonitoringService} and {@link DelayedService}. The monitoring service is responsible for calling + * two services: a local service and a remote service {@link DelayedService} , and by using the + * circuit breaker construction we ensure that if the call to remote service is going to fail, we + * are going to save our resources and not make the function call at all, by wrapping our call to + * the remote service in the circuit breaker object. *

    *

    - * This works as follows: The {@link CircuitBreaker} object can be in one of three - * states: Open, Closed and Half-Open, which represents the real - * world circuits. If the state is closed (initial), we assume everything is alright - * and perform the function call. However, every time the call fails, we note it - * and once it crosses a threshold, we set the state to Open, preventing any further - * calls to the remote server. Then, after a certain retry period (during which we - * expect thee service to recover), we make another call to the remote server and - * this state is called the Half-Open state, where it stays till the service is down, - * and once it recovers, it goes back to the closed state and the cycle continues. + * This works as follows: The {@link CircuitBreaker} object can be in one of three states: + * Open, Closed and Half-Open, which represents the real world circuits. If the + * state is closed (initial), we assume everything is alright and perform the function call. + * However, every time the call fails, we note it and once it crosses a threshold, we set the state + * to Open, preventing any further calls to the remote server. Then, after a certain retry period + * (during which we expect thee service to recover), we make another call to the remote server and + * this state is called the Half-Open state, where it stays till the service is down, and once it + * recovers, it goes back to the closed state and the cycle continues. *

    */ public class App { - + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); - - /** - * Program entry point - * + + /** + * Program entry point. + * * @param args command line args */ @SuppressWarnings("squid:S2189") @@ -71,14 +68,14 @@ public static void main(String[] args) { //Create an object of monitoring service which makes both local and remote calls var obj = new MonitoringService(); //Set the circuit Breaker parameters - var circuitBreaker = new CircuitBreaker(3000, 1, 2000 * 1000 * 1000); + var circuitBreaker = new CircuitBreaker(3000, 1, 2000 * 1000 * 1000); var serverStartTime = System.nanoTime(); while (true) { LOGGER.info(obj.localResourceResponse()); LOGGER.info(obj.remoteResourceResponse(circuitBreaker, serverStartTime)); LOGGER.info(circuitBreaker.getState()); try { - Thread.sleep(5 * 1000); + Thread.sleep(5 * 1000); } catch (InterruptedException e) { LOGGER.error(e.getMessage()); } diff --git a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/CircuitBreaker.java b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/CircuitBreaker.java index 005a000dff49..18268b1ce107 100644 --- a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/CircuitBreaker.java +++ b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/CircuitBreaker.java @@ -24,7 +24,7 @@ package com.iluwatar.circuitbreaker; /** - * The circuit breaker class with all configurations + * The circuit breaker class with all configurations. */ public class CircuitBreaker { private final long timeout; @@ -36,27 +36,31 @@ public class CircuitBreaker { private final long futureTime = 1000 * 1000 * 1000 * 1000; /** - * Constructor to create an instance of Circuit Breaker - * @param timeout Timeout for the API request. Not necessary for this simple example - * @param failureThreshold Number of failures we receive from the depended service before changing state to 'OPEN' - * @param retryTimePeriod Time period after which a new request is made to remote service for status check. + * Constructor to create an instance of Circuit Breaker. + * + * @param timeout Timeout for the API request. Not necessary for this simple example + * @param failureThreshold Number of failures we receive from the depended service before changing + * state to 'OPEN' + * @param retryTimePeriod Time period after which a new request is made to remote service for + * status check. */ CircuitBreaker(long timeout, int failureThreshold, long retryTimePeriod) { // We start in a closed state hoping that everything is fine this.state = State.CLOSED; this.failureThreshold = failureThreshold; - // Timeout for the API request. Used to break the calls made to remote resource if it exceeds the limit + // Timeout for the API request. + // Used to break the calls made to remote resource if it exceeds the limit this.timeout = timeout; this.retryTimePeriod = retryTimePeriod; //An absurd amount of time in future which basically indicates the last failure never happened this.lastFailureTime = System.nanoTime() + futureTime; this.failureCount = 0; } - + //Reset everything to defaults private void reset() { this.failureCount = 0; - this.lastFailureTime = System.nanoTime() + futureTime; + this.lastFailureTime = System.nanoTime() + futureTime; this.state = State.CLOSED; } @@ -64,7 +68,7 @@ private void recordFailure() { failureCount = failureCount + 1; this.lastFailureTime = System.nanoTime(); } - + protected void setState() { if (failureCount > failureThreshold) { //Then something is wrong with remote service if ((System.nanoTime() - lastFailureTime) > retryTimePeriod) { @@ -79,23 +83,28 @@ protected void setState() { state = State.CLOSED; } } - + public String getState() { return state.name(); } - + /** - * Break the circuit beforehand if it is known service is down - * Or connect the circuit manually if service comes online before expected + * Break the circuit beforehand if it is known service is down Or connect the circuit manually if + * service comes online before expected. + * * @param state State at which circuit is in */ public void setStateForBypass(State state) { this.state = state; } - + /** - * @param serviceToCall The name of the service in String. Can be changed to data URLs in case of web applications - * @param serverStartTime Time at which actual server was started which makes calls to this service + * Executes service call. + * + * @param serviceToCall The name of the service in String. Can be changed to data URLs in case + * of web applications + * @param serverStartTime Time at which actual server was started which makes calls to this + * service * @return Value from the remote resource, stale response or a custom exception */ public String call(String serviceToCall, long serverStartTime) throws Exception { @@ -104,7 +113,7 @@ public String call(String serviceToCall, long serverStartTime) throws Exception // return cached response if no the circuit is in OPEN state return "This is stale response from API"; } else { - // Make the API request if the circuit is not OPEN + // Make the API request if the circuit is not OPEN if (serviceToCall.equals("delayedService")) { var delayedService = new DelayedService(20); var response = delayedService.response(serverStartTime); diff --git a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/DelayedService.java b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/DelayedService.java index b291c3fe5bf3..13861923b7a4 100644 --- a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/DelayedService.java +++ b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/DelayedService.java @@ -24,14 +24,15 @@ package com.iluwatar.circuitbreaker; /** -* This simulates the remote service -* It responds only after a certain timeout period (default set to 20 seconds) -*/ + * This simulates the remote service It responds only after a certain timeout period (default set to + * 20 seconds). + */ public class DelayedService { private final int delay; /** - * Constructor to create an instance of DelayedService, which is down for first few seconds + * Constructor to create an instance of DelayedService, which is down for first few seconds. + * * @param delay the delay after which service would behave properly, in seconds */ public DelayedService(int delay) { @@ -43,7 +44,10 @@ public DelayedService() { } /** - * @param serverStartTime Time at which actual server was started which makes calls to this service + * Responds based on delay, current time and server start time if the service is down / working. + * + * @param serverStartTime Time at which actual server was started which makes calls to this + * service * @return The state of the service */ public String response(long serverStartTime) { diff --git a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/MonitoringService.java b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/MonitoringService.java index f46843766527..e91367175a66 100644 --- a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/MonitoringService.java +++ b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/MonitoringService.java @@ -24,8 +24,8 @@ package com.iluwatar.circuitbreaker; /** - * The service class which makes local and remote calls - * Uses {@link CircuitBreaker} object to ensure remote calls don't use up resources + * The service class which makes local and remote calls Uses {@link CircuitBreaker} object to ensure + * remote calls don't use up resources. */ public class MonitoringService { @@ -35,9 +35,11 @@ public String localResourceResponse() { } /** - * Try to get result from remote server - * @param circuitBreaker The circuitBreaker object with all parameters - * @param serverStartTime Time at which actual server was started which makes calls to this service + * Try to get result from remote server. + * + * @param circuitBreaker The circuitBreaker object with all parameters + * @param serverStartTime Time at which actual server was started which makes calls to this + * service * @return result from the remote response or exception raised by it. */ public String remoteResourceResponse(CircuitBreaker circuitBreaker, long serverStartTime) { diff --git a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/State.java b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/State.java index 92fe0f2546ef..95fdb08d65ca 100644 --- a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/State.java +++ b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/State.java @@ -24,10 +24,10 @@ package com.iluwatar.circuitbreaker; /** - * Enumeration for states the circuit breaker could be in + * Enumeration for states the circuit breaker could be in. */ public enum State { - CLOSED, - OPEN, - HALF_OPEN + CLOSED, + OPEN, + HALF_OPEN } \ No newline at end of file From 2f49648047e60bd4a7e14b58a8ebb2a2a2046201 Mon Sep 17 00:00:00 2001 From: Anurag Agarwal Date: Sun, 10 Nov 2019 01:05:15 +0530 Subject: [PATCH 138/197] Resolves checkstyle errors for collection-pipeline, command, commander (#1061) * Reduces checkstyle errors in collection-pipeline * Reduces checkstyle errors in command * Reduces checkstyle errors in commander --- .../com/iluwatar/collectionpipeline/App.java | 42 +- .../com/iluwatar/collectionpipeline/Car.java | 9 +- .../collectionpipeline/CarFactory.java | 1 + .../iluwatar/collectionpipeline/Category.java | 2 +- .../FunctionalProgramming.java | 43 +-- .../ImperativeProgramming.java | 53 ++- .../iluwatar/collectionpipeline/Person.java | 1 + .../iluwatar/collectionpipeline/AppTest.java | 29 +- .../main/java/com/iluwatar/command/App.java | 27 +- .../java/com/iluwatar/command/Command.java | 2 - .../java/com/iluwatar/command/Goblin.java | 4 +- .../iluwatar/command/InvisibilitySpell.java | 4 +- .../com/iluwatar/command/ShrinkSpell.java | 4 +- .../main/java/com/iluwatar/command/Size.java | 2 - .../java/com/iluwatar/command/Target.java | 4 +- .../java/com/iluwatar/command/Visibility.java | 2 - .../java/com/iluwatar/command/Wizard.java | 15 +- .../commander/AppEmployeeDbFailCases.java | 50 +-- .../commander/AppMessagingFailCases.java | 95 +++-- .../commander/AppPaymentFailCases.java | 43 ++- .../iluwatar/commander/AppQueueFailCases.java | 99 +++-- .../commander/AppShippingFailCases.java | 55 +-- .../com/iluwatar/commander/Commander.java | 361 ++++++++++-------- .../java/com/iluwatar/commander/Database.java | 8 +- .../java/com/iluwatar/commander/Order.java | 12 +- .../java/com/iluwatar/commander/Retry.java | 37 +- .../java/com/iluwatar/commander/Service.java | 28 +- .../employeehandle/EmployeeDatabase.java | 8 +- .../employeehandle/EmployeeHandle.java | 12 +- .../DatabaseUnavailableException.java | 4 +- .../PaymentDetailsErrorException.java | 4 +- .../ShippingNotPossibleException.java | 4 +- .../messagingservice/MessagingDatabase.java | 6 +- .../messagingservice/MessagingService.java | 35 +- .../paymentservice/PaymentDatabase.java | 7 +- .../paymentservice/PaymentService.java | 16 +- .../com/iluwatar/commander/queue/Queue.java | 14 +- .../commander/queue/QueueDatabase.java | 19 +- .../iluwatar/commander/queue/QueueTask.java | 34 +- .../shippingservice/ShippingDatabase.java | 8 +- .../shippingservice/ShippingService.java | 17 +- 41 files changed, 646 insertions(+), 574 deletions(-) diff --git a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/App.java b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/App.java index de19a3b15508..e0cc904d67bf 100644 --- a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/App.java +++ b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/App.java @@ -23,21 +23,18 @@ package com.iluwatar.collectionpipeline; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.List; import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * In imperative-style programming, it is common to use for and while loops for - * most kinds of data processing. Function composition is a simple technique - * that lets you sequence modular functions to create more complex operations. - * When you run data through the sequence, you have a collection pipeline. - * Together, the Function Composition and Collection Pipeline patterns enable - * you to create sophisticated programs where data flow from upstream to - * downstream and is passed through a series of transformations. - * + * In imperative-style programming, it is common to use for and while loops for most kinds of data + * processing. Function composition is a simple technique that lets you sequence modular functions + * to create more complex operations. When you run data through the sequence, you have a collection + * pipeline. Together, the Function Composition and Collection Pipeline patterns enable you to + * create sophisticated programs where data flow from upstream to downstream and is passed through a + * series of transformations. */ public class App { @@ -45,32 +42,35 @@ public class App { /** * Program entry point. - * - * @param args - * command line args + * + * @param args command line args */ public static void main(String[] args) { List cars = CarFactory.createCars(); - + List modelsImperative = ImperativeProgramming.getModelsAfter2000(cars); LOGGER.info(modelsImperative.toString()); List modelsFunctional = FunctionalProgramming.getModelsAfter2000(cars); LOGGER.info(modelsFunctional.toString()); - - Map> groupingByCategoryImperative = ImperativeProgramming.getGroupingOfCarsByCategory(cars); + + Map> groupingByCategoryImperative = + ImperativeProgramming.getGroupingOfCarsByCategory(cars); LOGGER.info(groupingByCategoryImperative.toString()); - Map> groupingByCategoryFunctional = FunctionalProgramming.getGroupingOfCarsByCategory(cars); + Map> groupingByCategoryFunctional = + FunctionalProgramming.getGroupingOfCarsByCategory(cars); LOGGER.info(groupingByCategoryFunctional.toString()); - + Person john = new Person(cars); - List sedansOwnedImperative = ImperativeProgramming.getSedanCarsOwnedSortedByDate(List.of(john)); + List sedansOwnedImperative = + ImperativeProgramming.getSedanCarsOwnedSortedByDate(List.of(john)); LOGGER.info(sedansOwnedImperative.toString()); - List sedansOwnedFunctional = FunctionalProgramming.getSedanCarsOwnedSortedByDate(List.of(john)); + List sedansOwnedFunctional = + FunctionalProgramming.getSedanCarsOwnedSortedByDate(List.of(john)); LOGGER.info(sedansOwnedFunctional.toString()); } } diff --git a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/Car.java b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/Car.java index 314728797cfa..2828cffd4708 100644 --- a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/Car.java +++ b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/Car.java @@ -34,10 +34,11 @@ public class Car { /** * Constructor to create an instance of car. - * @param make the make of the car - * @param model the model of the car + * + * @param make the make of the car + * @param model the model of the car * @param yearOfMake the year of built of the car - * @param category the {@link Category} of the car + * @param category the {@link Category} of the car */ public Car(String make, String model, int yearOfMake, Category category) { this.make = make; @@ -103,7 +104,7 @@ public String getModel() { public int getYear() { return year; } - + public Category getCategory() { return category; } diff --git a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/CarFactory.java b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/CarFactory.java index aee1e21932df..ea29ceda64a1 100644 --- a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/CarFactory.java +++ b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/CarFactory.java @@ -34,6 +34,7 @@ private CarFactory() { /** * Factory method to create a {@link List} of {@link Car} instances. + * * @return {@link List} of {@link Car} */ public static List createCars() { diff --git a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/Category.java b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/Category.java index 170d4df33e65..2214ebd4c9f8 100644 --- a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/Category.java +++ b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/Category.java @@ -24,7 +24,7 @@ package com.iluwatar.collectionpipeline; /** - * Enum for the category of car + * Enum for the category of car. */ public enum Category { JEEP, SEDAN, CONVERTIBLE diff --git a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/FunctionalProgramming.java b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/FunctionalProgramming.java index 2a72aa00848a..bb216d2bc507 100644 --- a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/FunctionalProgramming.java +++ b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/FunctionalProgramming.java @@ -30,20 +30,17 @@ /** * Iterating and sorting with a collection pipeline - * + * *

    In functional programming, it's common to sequence complex operations through - * a series of smaller modular functions or operations. The series is called a - * composition of functions, or a function composition. When a collection of - * data flows through a function composition, it becomes a collection pipeline. - * Function Composition and Collection Pipeline are two design patterns - * frequently used in functional-style programming. - * + * a series of smaller modular functions or operations. The series is called a composition of + * functions, or a function composition. When a collection of data flows through a function + * composition, it becomes a collection pipeline. Function Composition and Collection Pipeline are + * two design patterns frequently used in functional-style programming. + * *

    Instead of passing a lambda expression to the map method, we passed the - * method reference Car::getModel. Likewise, instead of passing the lambda - * expression car -> car.getYear() to the comparing method, we passed the method - * reference Car::getYear. Method references are short, concise, and expressive. - * It is best to use them wherever possible. - * + * method reference Car::getModel. Likewise, instead of passing the lambda expression car -> + * car.getYear() to the comparing method, we passed the method reference Car::getYear. Method + * references are short, concise, and expressive. It is best to use them wherever possible. */ public class FunctionalProgramming { private FunctionalProgramming() { @@ -51,35 +48,35 @@ private FunctionalProgramming() { /** * Method to get models using for collection pipeline. - * + * * @param cars {@link List} of {@link Car} to be used for filtering * @return {@link List} of {@link String} representing models built after year 2000 */ public static List getModelsAfter2000(List cars) { return cars.stream().filter(car -> car.getYear() > 2000) - .sorted(Comparator.comparing(Car::getYear)) - .map(Car::getModel).collect(Collectors.toList()); + .sorted(Comparator.comparing(Car::getYear)) + .map(Car::getModel).collect(Collectors.toList()); } - + /** - * Method to group cars by category using groupingBy - * + * Method to group cars by category using groupingBy. + * * @param cars {@link List} of {@link Car} to be used for grouping * @return {@link Map} with category as key and cars belonging to that category as value */ public static Map> getGroupingOfCarsByCategory(List cars) { return cars.stream().collect(Collectors.groupingBy(Car::getCategory)); } - + /** - * Method to get all Sedan cars belonging to a group of persons sorted by year of manufacture - * + * Method to get all Sedan cars belonging to a group of persons sorted by year of manufacture. + * * @param persons {@link List} of {@link Person} to be used * @return {@link List} of {@link Car} to belonging to the group */ public static List getSedanCarsOwnedSortedByDate(List persons) { return persons.stream().map(Person::getCars).flatMap(List::stream) - .filter(car -> Category.SEDAN.equals(car.getCategory())) - .sorted(Comparator.comparing(Car::getYear)).collect(Collectors.toList()); + .filter(car -> Category.SEDAN.equals(car.getCategory())) + .sorted(Comparator.comparing(Car::getYear)).collect(Collectors.toList()); } } diff --git a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/ImperativeProgramming.java b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/ImperativeProgramming.java index 01d095e96099..a587e9c37084 100644 --- a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/ImperativeProgramming.java +++ b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/ImperativeProgramming.java @@ -31,23 +31,20 @@ import java.util.Map; /** - * Imperative-style programming to iterate over the list and get the names of - * cars made later than the year 2000. We then sort the models in ascending - * order by year. - * + * Imperative-style programming to iterate over the list and get the names of cars made later than + * the year 2000. We then sort the models in ascending order by year. + * *

    As you can see, there's a lot of looping in this code. First, the - * getModelsAfter2000UsingFor method takes a list of cars as its parameter. It - * extracts or filters out cars made after the year 2000, putting them into a - * new list named carsSortedByYear. Next, it sorts that list in ascending order - * by year-of-make. Finally, it loops through the list carsSortedByYear to get - * the model names and returns them in a list. - * + * getModelsAfter2000UsingFor method takes a list of cars as its parameter. It extracts or filters + * out cars made after the year 2000, putting them into a new list named carsSortedByYear. Next, it + * sorts that list in ascending order by year-of-make. Finally, it loops through the list + * carsSortedByYear to get the model names and returns them in a list. + * *

    This short example demonstrates what I call the effect of statements. While - * functions and methods in general can be used as expressions, the {@link Collections} - * sort method doesn't return a result. Because it is used as a statement, it - * mutates the list given as argument. Both of the for loops also mutate lists - * as they iterate. Being statements, that's just how these elements work. As a - * result, the code contains unnecessary garbage variables + * functions and methods in general can be used as expressions, the {@link Collections} sort method + * doesn't return a result. Because it is used as a statement, it mutates the list given as + * argument. Both of the for loops also mutate lists as they iterate. Being statements, that's just + * how these elements work. As a result, the code contains unnecessary garbage variables */ public class ImperativeProgramming { private ImperativeProgramming() { @@ -55,6 +52,7 @@ private ImperativeProgramming() { /** * Method to return the car models built after year 2000 using for loops. + * * @param cars {@link List} of {@link Car} to iterate over * @return {@link List} of {@link String} of car models built after year 2000 */ @@ -80,16 +78,16 @@ public int compare(Car car1, Car car2) { return models; } - + /** - * Method to group cars by category using for loops - * + * Method to group cars by category using for loops. + * * @param cars {@link List} of {@link Car} to be used for grouping * @return {@link Map} with category as key and cars belonging to that category as value */ public static Map> getGroupingOfCarsByCategory(List cars) { Map> groupingByCategory = new HashMap<>(); - for (Car car: cars) { + for (Car car : cars) { if (groupingByCategory.containsKey(car.getCategory())) { groupingByCategory.get(car.getCategory()).add(car); } else { @@ -100,33 +98,34 @@ public static Map> getGroupingOfCarsByCategory(List car } return groupingByCategory; } - + /** - * Method to get all Sedan cars belonging to a group of persons sorted by year of manufacture using for loops - * + * Method to get all Sedan cars belonging to a group of persons sorted by year of manufacture + * using for loops. + * * @param persons {@link List} of {@link Person} to be used * @return {@link List} of {@link Car} to belonging to the group */ public static List getSedanCarsOwnedSortedByDate(List persons) { List cars = new ArrayList<>(); - for (Person person: persons) { + for (Person person : persons) { cars.addAll(person.getCars()); } - + List sedanCars = new ArrayList<>(); - for (Car car: cars) { + for (Car car : cars) { if (Category.SEDAN.equals(car.getCategory())) { sedanCars.add(car); } } - + sedanCars.sort(new Comparator() { @Override public int compare(Car o1, Car o2) { return o1.getYear() - o2.getYear(); } }); - + return sedanCars; } } diff --git a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/Person.java b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/Person.java index 9bf01052a667..2e564b701800 100644 --- a/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/Person.java +++ b/collection-pipeline/src/main/java/com/iluwatar/collectionpipeline/Person.java @@ -33,6 +33,7 @@ public class Person { /** * Constructor to create an instance of person. + * * @param cars the list of cars owned */ public Person(List cars) { diff --git a/collection-pipeline/src/test/java/com/iluwatar/collectionpipeline/AppTest.java b/collection-pipeline/src/test/java/com/iluwatar/collectionpipeline/AppTest.java index 6bc035920d88..1fa27ec4d12c 100644 --- a/collection-pipeline/src/test/java/com/iluwatar/collectionpipeline/AppTest.java +++ b/collection-pipeline/src/test/java/com/iluwatar/collectionpipeline/AppTest.java @@ -23,14 +23,13 @@ package com.iluwatar.collectionpipeline; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.List; import java.util.Map; - -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Tests that Collection Pipeline methods work as expected. @@ -39,35 +38,35 @@ public class AppTest { private static final Logger LOGGER = LoggerFactory.getLogger(AppTest.class); private List cars = CarFactory.createCars(); - + @Test public void testGetModelsAfter2000UsingFor() { var models = ImperativeProgramming.getModelsAfter2000(cars); assertEquals(List.of("Avenger", "Wrangler", "Focus", "Cascada"), models); } - + @Test public void testGetModelsAfter2000UsingPipeline() { var models = FunctionalProgramming.getModelsAfter2000(cars); assertEquals(List.of("Avenger", "Wrangler", "Focus", "Cascada"), models); } - + @Test public void testGetGroupingOfCarsByCategory() { var modelsExpected = Map.of( - Category.CONVERTIBLE, List.of(new Car("Buick", "Cascada", 2016, Category.CONVERTIBLE), - new Car("Chevrolet", "Geo Metro", 1992, Category.CONVERTIBLE)), - Category.SEDAN, List.of(new Car("Dodge", "Avenger", 2010, Category.SEDAN), - new Car("Ford", "Focus", 2012, Category.SEDAN)), - Category.JEEP, List.of(new Car("Jeep", "Wrangler", 2011, Category.JEEP), - new Car("Jeep", "Comanche", 1990, Category.JEEP))); + Category.CONVERTIBLE, List.of(new Car("Buick", "Cascada", 2016, Category.CONVERTIBLE), + new Car("Chevrolet", "Geo Metro", 1992, Category.CONVERTIBLE)), + Category.SEDAN, List.of(new Car("Dodge", "Avenger", 2010, Category.SEDAN), + new Car("Ford", "Focus", 2012, Category.SEDAN)), + Category.JEEP, List.of(new Car("Jeep", "Wrangler", 2011, Category.JEEP), + new Car("Jeep", "Comanche", 1990, Category.JEEP))); var modelsFunctional = FunctionalProgramming.getGroupingOfCarsByCategory(cars); var modelsImperative = ImperativeProgramming.getGroupingOfCarsByCategory(cars); LOGGER.info("Category " + modelsFunctional); assertEquals(modelsExpected, modelsFunctional); assertEquals(modelsExpected, modelsImperative); } - + @Test public void testGetSedanCarsOwnedSortedByDate() { var john = new Person(cars); diff --git a/command/src/main/java/com/iluwatar/command/App.java b/command/src/main/java/com/iluwatar/command/App.java index 39e59077e721..8e7ee31a81d0 100644 --- a/command/src/main/java/com/iluwatar/command/App.java +++ b/command/src/main/java/com/iluwatar/command/App.java @@ -24,31 +24,28 @@ package com.iluwatar.command; /** - * * The Command pattern is a behavioral design pattern in which an object is used to encapsulate all * information needed to perform an action or trigger an event at a later time. This information * includes the method name, the object that owns the method and values for the method parameters. - *

    - * Four terms always associated with the command pattern are command, receiver, invoker and client. - * A command object (spell) knows about the receiver (target) and invokes a method of the receiver. - * Values for parameters of the receiver method are stored in the command. The receiver then does - * the work. An invoker object (wizard) knows how to execute a command, and optionally does - * bookkeeping about the command execution. The invoker does not know anything about a concrete + * + *

    Four terms always associated with the command pattern are command, receiver, invoker and + * client. A command object (spell) knows about the receiver (target) and invokes a method of the + * receiver. Values for parameters of the receiver method are stored in the command. The receiver + * then does the work. An invoker object (wizard) knows how to execute a command, and optionally + * does bookkeeping about the command execution. The invoker does not know anything about a concrete * command, it knows only about command interface. Both an invoker object and several command * objects are held by a client object (app). The client decides which commands to execute at which * points. To execute a command, it passes the command object to the invoker object. - *

    - * In other words, in this example the wizard casts spells on the goblin. The wizard keeps track of - * the previous spells cast, so it is easy to undo them. In addition, the wizard keeps track of the - * spells undone, so they can be redone. - * - * + * + *

    In other words, in this example the wizard casts spells on the goblin. The wizard keeps track + * of the previous spells cast, so it is easy to undo them. In addition, the wizard keeps track of + * the spells undone, so they can be redone. */ public class App { /** - * Program entry point - * + * Program entry point. + * * @param args command line args */ public static void main(String[] args) { diff --git a/command/src/main/java/com/iluwatar/command/Command.java b/command/src/main/java/com/iluwatar/command/Command.java index b5854f6be3b8..85deff74efd8 100644 --- a/command/src/main/java/com/iluwatar/command/Command.java +++ b/command/src/main/java/com/iluwatar/command/Command.java @@ -24,9 +24,7 @@ package com.iluwatar.command; /** - * * Interface for Commands. - * */ public abstract class Command { diff --git a/command/src/main/java/com/iluwatar/command/Goblin.java b/command/src/main/java/com/iluwatar/command/Goblin.java index b2c0d75d0c2b..72ddc43b5c3f 100644 --- a/command/src/main/java/com/iluwatar/command/Goblin.java +++ b/command/src/main/java/com/iluwatar/command/Goblin.java @@ -24,9 +24,7 @@ package com.iluwatar.command; /** - * - * Goblin is the target of the spells - * + * Goblin is the target of the spells. */ public class Goblin extends Target { diff --git a/command/src/main/java/com/iluwatar/command/InvisibilitySpell.java b/command/src/main/java/com/iluwatar/command/InvisibilitySpell.java index bdbc54889916..3e0f7bbf4fef 100644 --- a/command/src/main/java/com/iluwatar/command/InvisibilitySpell.java +++ b/command/src/main/java/com/iluwatar/command/InvisibilitySpell.java @@ -24,9 +24,7 @@ package com.iluwatar.command; /** - * - * InvisibilitySpell is a concrete command - * + * InvisibilitySpell is a concrete command. */ public class InvisibilitySpell extends Command { diff --git a/command/src/main/java/com/iluwatar/command/ShrinkSpell.java b/command/src/main/java/com/iluwatar/command/ShrinkSpell.java index 81f04d40747f..6bbc339f41f3 100644 --- a/command/src/main/java/com/iluwatar/command/ShrinkSpell.java +++ b/command/src/main/java/com/iluwatar/command/ShrinkSpell.java @@ -24,9 +24,7 @@ package com.iluwatar.command; /** - * - * ShrinkSpell is a concrete command - * + * ShrinkSpell is a concrete command. */ public class ShrinkSpell extends Command { diff --git a/command/src/main/java/com/iluwatar/command/Size.java b/command/src/main/java/com/iluwatar/command/Size.java index a10fb84bc079..ae327d8b1ad8 100644 --- a/command/src/main/java/com/iluwatar/command/Size.java +++ b/command/src/main/java/com/iluwatar/command/Size.java @@ -24,9 +24,7 @@ package com.iluwatar.command; /** - * * Enumeration for target size. - * */ public enum Size { diff --git a/command/src/main/java/com/iluwatar/command/Target.java b/command/src/main/java/com/iluwatar/command/Target.java index 8bf652e6ce56..f5ac4344c918 100644 --- a/command/src/main/java/com/iluwatar/command/Target.java +++ b/command/src/main/java/com/iluwatar/command/Target.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * * Base class for spell targets. - * */ public abstract class Target { @@ -59,7 +57,7 @@ public void setVisibility(Visibility visibility) { public abstract String toString(); /** - * Print status + * Print status. */ public void printStatus() { LOGGER.info("{}, [size={}] [visibility={}]", this, getSize(), getVisibility()); diff --git a/command/src/main/java/com/iluwatar/command/Visibility.java b/command/src/main/java/com/iluwatar/command/Visibility.java index a8ed73052930..3c48990a0acf 100644 --- a/command/src/main/java/com/iluwatar/command/Visibility.java +++ b/command/src/main/java/com/iluwatar/command/Visibility.java @@ -24,9 +24,7 @@ package com.iluwatar.command; /** - * * Enumeration for target visibility. - * */ public enum Visibility { diff --git a/command/src/main/java/com/iluwatar/command/Wizard.java b/command/src/main/java/com/iluwatar/command/Wizard.java index a56c5650513d..fcd6e3a5b702 100644 --- a/command/src/main/java/com/iluwatar/command/Wizard.java +++ b/command/src/main/java/com/iluwatar/command/Wizard.java @@ -23,16 +23,13 @@ package com.iluwatar.command; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Deque; import java.util.LinkedList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * - * Wizard is the invoker of the commands - * + * Wizard is the invoker of the commands. */ public class Wizard { @@ -46,7 +43,7 @@ public Wizard() { } /** - * Cast spell + * Cast spell. */ public void castSpell(Command command, Target target) { LOGGER.info("{} casts {} at {}", this, command, target); @@ -55,7 +52,7 @@ public void castSpell(Command command, Target target) { } /** - * Undo last spell + * Undo last spell. */ public void undoLastSpell() { if (!undoStack.isEmpty()) { @@ -67,7 +64,7 @@ public void undoLastSpell() { } /** - * Redo last spell + * Redo last spell. */ public void redoLastSpell() { if (!redoStack.isEmpty()) { diff --git a/commander/src/main/java/com/iluwatar/commander/AppEmployeeDbFailCases.java b/commander/src/main/java/com/iluwatar/commander/AppEmployeeDbFailCases.java index b488056a6ac4..84297f828350 100644 --- a/commander/src/main/java/com/iluwatar/commander/AppEmployeeDbFailCases.java +++ b/commander/src/main/java/com/iluwatar/commander/AppEmployeeDbFailCases.java @@ -31,16 +31,15 @@ import com.iluwatar.commander.messagingservice.MessagingService; import com.iluwatar.commander.paymentservice.PaymentDatabase; import com.iluwatar.commander.paymentservice.PaymentService; +import com.iluwatar.commander.queue.QueueDatabase; import com.iluwatar.commander.shippingservice.ShippingDatabase; import com.iluwatar.commander.shippingservice.ShippingService; -import com.iluwatar.commander.queue.QueueDatabase; /** - * AppEmployeeDbFailCases class looks at possible cases when Employee handle service is + * AppEmployeeDbFailCases class looks at possible cases when Employee handle service is * available/unavailable. */ - -public class AppEmployeeDbFailCases { +public class AppEmployeeDbFailCases { final int numOfRetries = 3; final long retryDuration = 30000; final long queueTime = 240000; //4 mins @@ -50,33 +49,40 @@ public class AppEmployeeDbFailCases { final long employeeTime = 240000; //4 mins void employeeDatabaseUnavailableCase() throws Exception { - PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); + PaymentService ps = + new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); ShippingService ss = new ShippingService(new ShippingDatabase()); MessagingService ms = new MessagingService(new MessagingDatabase()); - EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); - QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException()); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + EmployeeHandle eh = + new EmployeeHandle(new EmployeeDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + QueueDatabase qdb = + new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); } void employeeDbSuccessCase() throws Exception { - PaymentService ps = new PaymentService(new PaymentDatabase()); - ShippingService ss = new ShippingService(new ShippingDatabase(), new ItemUnavailableException()); + PaymentService ps = new PaymentService(new PaymentDatabase()); + ShippingService ss = + new ShippingService(new ShippingDatabase(), new ItemUnavailableException()); MessagingService ms = new MessagingService(new MessagingDatabase()); - EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException()); + EmployeeHandle eh = + new EmployeeHandle(new EmployeeDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); QueueDatabase qdb = new QueueDatabase(); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); @@ -87,7 +93,7 @@ void employeeDbSuccessCase() throws Exception { * * @param args command line args */ - + public static void main(String[] args) throws Exception { AppEmployeeDbFailCases aefc = new AppEmployeeDbFailCases(); //aefc.employeeDatabaseUnavailableCase(); diff --git a/commander/src/main/java/com/iluwatar/commander/AppMessagingFailCases.java b/commander/src/main/java/com/iluwatar/commander/AppMessagingFailCases.java index a6010229e1ac..d644d1c1f0e4 100644 --- a/commander/src/main/java/com/iluwatar/commander/AppMessagingFailCases.java +++ b/commander/src/main/java/com/iluwatar/commander/AppMessagingFailCases.java @@ -30,12 +30,12 @@ import com.iluwatar.commander.messagingservice.MessagingService; import com.iluwatar.commander.paymentservice.PaymentDatabase; import com.iluwatar.commander.paymentservice.PaymentService; +import com.iluwatar.commander.queue.QueueDatabase; import com.iluwatar.commander.shippingservice.ShippingDatabase; import com.iluwatar.commander.shippingservice.ShippingService; -import com.iluwatar.commander.queue.QueueDatabase; /** - * AppMessagingFailCases class looks at possible cases when Messaging service is + * AppMessagingFailCases class looks at possible cases when Messaging service is * available/unavailable. */ @@ -50,15 +50,17 @@ public class AppMessagingFailCases { void messagingDatabaseUnavailableCasePaymentSuccess() throws Exception { //rest is successful - PaymentService ps = new PaymentService(new PaymentDatabase()); + PaymentService ps = new PaymentService(new PaymentDatabase()); ShippingService ss = new ShippingService(new ShippingDatabase()); - MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); + MessagingService ms = + new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); QueueDatabase qdb = new QueueDatabase(); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); @@ -66,40 +68,52 @@ void messagingDatabaseUnavailableCasePaymentSuccess() throws Exception { void messagingDatabaseUnavailableCasePaymentError() throws Exception { //rest is successful - PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); + PaymentService ps = + new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); ShippingService ss = new ShippingService(new ShippingDatabase()); - MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException()); + MessagingService ms = + new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); QueueDatabase qdb = new QueueDatabase(); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); } - void messagingDatabaseUnavailableCasePaymentFailure() throws Exception { + void messagingDatabaseUnavailableCasePaymentFailure() throws Exception { //rest is successful - PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); + PaymentService ps = + new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); ShippingService ss = new ShippingService(new ShippingDatabase()); - MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); + MessagingService ms = + new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); - QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException()); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration,queueTime,queueTaskTime, - paymentTime,messageTime,employeeTime); + QueueDatabase qdb = + new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + Commander c = + new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, queueTime, queueTaskTime, + paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); @@ -107,16 +121,19 @@ void messagingDatabaseUnavailableCasePaymentFailure() throws Exception { void messagingSuccessCase() throws Exception { //done here - PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); + PaymentService ps = + new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); ShippingService ss = new ShippingService(new ShippingDatabase()); - MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException()); + MessagingService ms = + new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); QueueDatabase qdb = new QueueDatabase(); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); @@ -127,7 +144,7 @@ void messagingSuccessCase() throws Exception { * * @param args command line args */ - + public static void main(String[] args) throws Exception { AppMessagingFailCases amfc = new AppMessagingFailCases(); //amfc.messagingDatabaseUnavailableCasePaymentSuccess(); diff --git a/commander/src/main/java/com/iluwatar/commander/AppPaymentFailCases.java b/commander/src/main/java/com/iluwatar/commander/AppPaymentFailCases.java index 86fd5a83c7f1..4e65b1d28cfb 100644 --- a/commander/src/main/java/com/iluwatar/commander/AppPaymentFailCases.java +++ b/commander/src/main/java/com/iluwatar/commander/AppPaymentFailCases.java @@ -31,13 +31,12 @@ import com.iluwatar.commander.messagingservice.MessagingService; import com.iluwatar.commander.paymentservice.PaymentDatabase; import com.iluwatar.commander.paymentservice.PaymentService; +import com.iluwatar.commander.queue.QueueDatabase; import com.iluwatar.commander.shippingservice.ShippingDatabase; import com.iluwatar.commander.shippingservice.ShippingService; -import com.iluwatar.commander.queue.QueueDatabase; /** - * AppPaymentFailCases class looks at possible cases when Payment service is - * available/unavailable. + * AppPaymentFailCases class looks at possible cases when Payment service is available/unavailable. */ public class AppPaymentFailCases { @@ -50,14 +49,16 @@ public class AppPaymentFailCases { final long employeeTime = 240000; //4 mins void paymentNotPossibleCase() throws Exception { - PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), - new PaymentDetailsErrorException()); + PaymentService ps = + new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new PaymentDetailsErrorException()); ShippingService ss = new ShippingService(new ShippingDatabase()); - MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException()); + MessagingService ms = + new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException()); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); @@ -65,15 +66,17 @@ void paymentNotPossibleCase() throws Exception { void paymentDatabaseUnavailableCase() throws Exception { //rest is successful - PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); + PaymentService ps = + new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); ShippingService ss = new ShippingService(new ShippingDatabase()); MessagingService ms = new MessagingService(new MessagingDatabase()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); QueueDatabase qdb = new QueueDatabase(); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); @@ -81,14 +84,16 @@ void paymentDatabaseUnavailableCase() throws Exception { void paymentSuccessCase() throws Exception { //goes to message after 2 retries maybe - rest is successful for now - PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException()); + PaymentService ps = + new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); ShippingService ss = new ShippingService(new ShippingDatabase()); - MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException()); + MessagingService ms = + new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException()); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); @@ -99,7 +104,7 @@ void paymentSuccessCase() throws Exception { * * @param args command line args */ - + public static void main(String[] args) throws Exception { AppPaymentFailCases apfc = new AppPaymentFailCases(); //apfc.paymentNotPossibleCase(); diff --git a/commander/src/main/java/com/iluwatar/commander/AppQueueFailCases.java b/commander/src/main/java/com/iluwatar/commander/AppQueueFailCases.java index f8c3548b271b..34ed81c0fb84 100644 --- a/commander/src/main/java/com/iluwatar/commander/AppQueueFailCases.java +++ b/commander/src/main/java/com/iluwatar/commander/AppQueueFailCases.java @@ -31,13 +31,12 @@ import com.iluwatar.commander.messagingservice.MessagingService; import com.iluwatar.commander.paymentservice.PaymentDatabase; import com.iluwatar.commander.paymentservice.PaymentService; +import com.iluwatar.commander.queue.QueueDatabase; import com.iluwatar.commander.shippingservice.ShippingDatabase; import com.iluwatar.commander.shippingservice.ShippingService; -import com.iluwatar.commander.queue.QueueDatabase; /** - * AppQueueFailCases class looks at possible cases when Queue Database is - * available/unavailable. + * AppQueueFailCases class looks at possible cases when Queue Database is available/unavailable. */ public class AppQueueFailCases { @@ -50,71 +49,87 @@ public class AppQueueFailCases { final long employeeTime = 240000; //4 mins void queuePaymentTaskDatabaseUnavailableCase() throws Exception { - PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); + PaymentService ps = + new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); ShippingService ss = new ShippingService(new ShippingDatabase()); MessagingService ms = new MessagingService(new MessagingDatabase()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); - QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException()); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + QueueDatabase qdb = + new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); } void queueMessageTaskDatabaseUnavailableCase() throws Exception { - PaymentService ps = new PaymentService(new PaymentDatabase()); + PaymentService ps = new PaymentService(new PaymentDatabase()); ShippingService ss = new ShippingService(new ShippingDatabase()); - MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); + MessagingService ms = + new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); - QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException()); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + QueueDatabase qdb = + new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); } void queueEmployeeDbTaskDatabaseUnavailableCase() throws Exception { - PaymentService ps = new PaymentService(new PaymentDatabase()); - ShippingService ss = new ShippingService(new ShippingDatabase(), new ItemUnavailableException()); + PaymentService ps = new PaymentService(new PaymentDatabase()); + ShippingService ss = + new ShippingService(new ShippingDatabase(), new ItemUnavailableException()); MessagingService ms = new MessagingService(new MessagingDatabase()); - EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); - QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException()); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + EmployeeHandle eh = + new EmployeeHandle(new EmployeeDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + QueueDatabase qdb = + new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException()); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); } void queueSuccessCase() throws Exception { - PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); + PaymentService ps = + new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); ShippingService ss = new ShippingService(new ShippingDatabase()); - MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException()); + MessagingService ms = + new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); - QueueDatabase qdb = new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException()); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + QueueDatabase qdb = + new QueueDatabase(new DatabaseUnavailableException(), new DatabaseUnavailableException()); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); diff --git a/commander/src/main/java/com/iluwatar/commander/AppShippingFailCases.java b/commander/src/main/java/com/iluwatar/commander/AppShippingFailCases.java index b65f4fa4e793..a055ba699694 100644 --- a/commander/src/main/java/com/iluwatar/commander/AppShippingFailCases.java +++ b/commander/src/main/java/com/iluwatar/commander/AppShippingFailCases.java @@ -32,12 +32,12 @@ import com.iluwatar.commander.messagingservice.MessagingService; import com.iluwatar.commander.paymentservice.PaymentDatabase; import com.iluwatar.commander.paymentservice.PaymentService; +import com.iluwatar.commander.queue.QueueDatabase; import com.iluwatar.commander.shippingservice.ShippingDatabase; import com.iluwatar.commander.shippingservice.ShippingService; -import com.iluwatar.commander.queue.QueueDatabase; /** - * AppShippingFailCases class looks at possible cases when Shipping service is + * AppShippingFailCases class looks at possible cases when Shipping service is * available/unavailable. */ @@ -51,26 +51,28 @@ public class AppShippingFailCases { final long employeeTime = 240000; //4 mins void itemUnavailableCase() throws Exception { - PaymentService ps = new PaymentService(new PaymentDatabase()); - ShippingService ss = new ShippingService(new ShippingDatabase(), new ItemUnavailableException()); + PaymentService ps = new PaymentService(new PaymentDatabase()); + ShippingService ss = + new ShippingService(new ShippingDatabase(), new ItemUnavailableException()); MessagingService ms = new MessagingService(new MessagingDatabase()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); QueueDatabase qdb = new QueueDatabase(); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); } void shippingNotPossibleCase() throws Exception { - PaymentService ps = new PaymentService(new PaymentDatabase()); - ShippingService ss = new ShippingService(new ShippingDatabase(), new ShippingNotPossibleException()); + PaymentService ps = new PaymentService(new PaymentDatabase()); + ShippingService ss = + new ShippingService(new ShippingDatabase(), new ShippingNotPossibleException()); MessagingService ms = new MessagingService(new MessagingDatabase()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); QueueDatabase qdb = new QueueDatabase(); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); @@ -78,15 +80,17 @@ void shippingNotPossibleCase() throws Exception { void shippingDatabaseUnavailableCase() throws Exception { //rest is successful - PaymentService ps = new PaymentService(new PaymentDatabase()); - ShippingService ss = new ShippingService(new ShippingDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException(), new DatabaseUnavailableException(), - new DatabaseUnavailableException(), new DatabaseUnavailableException()); + PaymentService ps = new PaymentService(new PaymentDatabase()); + ShippingService ss = + new ShippingService(new ShippingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); MessagingService ms = new MessagingService(new MessagingDatabase()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); QueueDatabase qdb = new QueueDatabase(); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); @@ -94,25 +98,28 @@ void shippingDatabaseUnavailableCase() throws Exception { void shippingSuccessCase() throws Exception { //goes to payment after 2 retries maybe - rest is successful for now - PaymentService ps = new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException()); - ShippingService ss = new ShippingService(new ShippingDatabase(), new DatabaseUnavailableException(), - new DatabaseUnavailableException()); - MessagingService ms = new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException()); + PaymentService ps = + new PaymentService(new PaymentDatabase(), new DatabaseUnavailableException()); + ShippingService ss = + new ShippingService(new ShippingDatabase(), new DatabaseUnavailableException(), + new DatabaseUnavailableException()); + MessagingService ms = + new MessagingService(new MessagingDatabase(), new DatabaseUnavailableException()); EmployeeHandle eh = new EmployeeHandle(new EmployeeDatabase()); QueueDatabase qdb = new QueueDatabase(); - Commander c = new Commander(eh,ps,ss,ms,qdb,numOfRetries,retryDuration, - queueTime,queueTaskTime,paymentTime,messageTime,employeeTime); + Commander c = new Commander(eh, ps, ss, ms, qdb, numOfRetries, retryDuration, + queueTime, queueTaskTime, paymentTime, messageTime, employeeTime); User user = new User("Jim", "ABCD"); Order order = new Order(user, "book", 10f); c.placeOrder(order); } - + /** * Program entry point. * * @param args command line args */ - + public static void main(String[] args) throws Exception { AppShippingFailCases asfc = new AppShippingFailCases(); //asfc.itemUnavailableCase(); diff --git a/commander/src/main/java/com/iluwatar/commander/Commander.java b/commander/src/main/java/com/iluwatar/commander/Commander.java index d161f7b9ff00..0c0989adea0b 100644 --- a/commander/src/main/java/com/iluwatar/commander/Commander.java +++ b/commander/src/main/java/com/iluwatar/commander/Commander.java @@ -23,53 +23,51 @@ package com.iluwatar.commander; -import java.util.ArrayList; +import com.iluwatar.commander.Order.MessageSent; +import com.iluwatar.commander.Order.PaymentStatus; import com.iluwatar.commander.employeehandle.EmployeeHandle; import com.iluwatar.commander.exceptions.DatabaseUnavailableException; import com.iluwatar.commander.exceptions.ItemUnavailableException; import com.iluwatar.commander.exceptions.PaymentDetailsErrorException; import com.iluwatar.commander.exceptions.ShippingNotPossibleException; import com.iluwatar.commander.messagingservice.MessagingService; -import com.iluwatar.commander.Order.MessageSent; -import com.iluwatar.commander.Order.PaymentStatus; import com.iluwatar.commander.paymentservice.PaymentService; import com.iluwatar.commander.queue.QueueDatabase; import com.iluwatar.commander.queue.QueueTask; import com.iluwatar.commander.queue.QueueTask.TaskType; import com.iluwatar.commander.shippingservice.ShippingService; +import java.util.ArrayList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - *

    Commander pattern is used to handle all issues that can come up while making a - * distributed transaction. The idea is to have a commander, which coordinates the - * execution of all instructions and ensures proper completion using retries and - * taking care of idempotence. By queueing instructions while they haven't been done, - * we can ensure a state of 'eventual consistency'.

    + *

    Commander pattern is used to handle all issues that can come up while making a + * distributed transaction. The idea is to have a commander, which coordinates the execution of all + * instructions and ensures proper completion using retries and taking care of idempotence. By + * queueing instructions while they haven't been done, we can ensure a state of 'eventual + * consistency'.

    *

    In our example, we have an e-commerce application. When the user places an order, - * the shipping service is intimated first. If the service does not respond for some - * reason, the order is not placed. If response is received, the commander then calls - * for the payment service to be intimated. If this fails, the shipping still takes - * place (order converted to COD) and the item is queued. If the queue is also found - * to be unavailable, the payment is noted to be not done and this is added to an - * employee database. Three types of messages are sent to the user - one, if payment - * succeeds; two, if payment fails definitively; and three, if payment fails in the - * first attempt. If the message is not sent, this is also queued and is added to employee - * db. We also have a time limit for each instruction to be completed, after which, the - * instruction is not executed, thereby ensuring that resources are not held for too long. - * In the rare occasion in which everything fails, an individual would have to step in to - * figure out how to solve the issue.

    + * the shipping service is intimated first. If the service does not respond for some reason, the + * order is not placed. If response is received, the commander then calls for the payment service to + * be intimated. If this fails, the shipping still takes place (order converted to COD) and the item + * is queued. If the queue is also found to be unavailable, the payment is noted to be not done and + * this is added to an employee database. Three types of messages are sent to the user - one, if + * payment succeeds; two, if payment fails definitively; and three, if payment fails in the first + * attempt. If the message is not sent, this is also queued and is added to employee db. We also + * have a time limit for each instruction to be completed, after which, the instruction is not + * executed, thereby ensuring that resources are not held for too long. In the rare occasion in + * which everything fails, an individual would have to step in to figure out how to solve the + * issue.

    *

    We have abstract classes {@link Database} and {@link Service} which are extended - * by all the databases and services. Each service has a database to be updated, and - * receives request from an outside user (the {@link Commander} class here). There are - * 5 microservices - {@link ShippingService}, {@link PaymentService}, {@link MessagingService}, - * {@link EmployeeHandle} and a {@link QueueDatabase}. We use retries to execute any - * instruction using {@link Retry} class, and idempotence is ensured by going through some - * checks before making requests to services and making change in {@link Order} class fields - * if request succeeds or definitively fails. There are 5 classes - - * {@link AppShippingFailCases}, {@link AppPaymentFailCases}, {@link AppMessagingFailCases}, - * {@link AppQueueFailCases} and {@link AppEmployeeDbFailCases}, which look at the different - * scenarios that may be encountered during the placing of an order.

    + * by all the databases and services. Each service has a database to be updated, and receives + * request from an outside user (the {@link Commander} class here). There are 5 microservices - + * {@link ShippingService}, {@link PaymentService}, {@link MessagingService}, {@link EmployeeHandle} + * and a {@link QueueDatabase}. We use retries to execute any instruction using {@link Retry} class, + * and idempotence is ensured by going through some checks before making requests to services and + * making change in {@link Order} class fields if request succeeds or definitively fails. There are + * 5 classes - {@link AppShippingFailCases}, {@link AppPaymentFailCases}, {@link + * AppMessagingFailCases}, {@link AppQueueFailCases} and {@link AppEmployeeDbFailCases}, which look + * at the different scenarios that may be encountered during the placing of an order.

    */ public class Commander { @@ -86,17 +84,18 @@ public class Commander { private final long queueTaskTime; private final long paymentTime; private final long messageTime; - private final long employeeTime; + private final long employeeTime; private boolean finalSiteMsgShown; static final Logger LOG = LoggerFactory.getLogger(Commander.class); //we could also have another db where it stores all orders - - Commander(EmployeeHandle empDb, PaymentService pService, ShippingService sService, - MessagingService mService, QueueDatabase qdb, int numOfRetries, long retryDuration, - long queueTime, long queueTaskTime, long paymentTime, long messageTime, long employeeTime) { - this.paymentService = pService; - this.shippingService = sService; - this.messagingService = mService; + + Commander(EmployeeHandle empDb, PaymentService paymentService, ShippingService shippingService, + MessagingService messagingService, QueueDatabase qdb, int numOfRetries, + long retryDuration, long queueTime, long queueTaskTime, long paymentTime, + long messageTime, long employeeTime) { + this.paymentService = paymentService; + this.shippingService = shippingService; + this.messagingService = messagingService; this.employeeDb = empDb; this.queue = qdb; this.numOfRetries = numOfRetries; @@ -106,7 +105,7 @@ public class Commander { this.paymentTime = paymentTime; this.messageTime = messageTime; this.employeeTime = employeeTime; - this.finalSiteMsgShown = false; + this.finalSiteMsgShown = false; } void placeOrder(Order order) throws Exception { @@ -118,40 +117,43 @@ private void sendShippingRequest(Order order) throws Exception { Retry.Operation op = (l) -> { if (!l.isEmpty()) { if (DatabaseUnavailableException.class.isAssignableFrom(l.get(0).getClass())) { - LOG.debug("Order " + order.id + ": Error in connecting to shipping service, trying again.."); + LOG.debug("Order " + order.id + ": Error in connecting to shipping service, " + + "trying again.."); } else { LOG.debug("Order " + order.id + ": Error in creating shipping request.."); } throw l.remove(0); - } - String transactionId = shippingService.receiveRequest(order.item, order.user.address); + } + String transactionId = shippingService.receiveRequest(order.item, order.user.address); //could save this transaction id in a db too - LOG.info("Order " + order.id + ": Shipping placed successfully, transaction id: " + transactionId); + LOG.info("Order " + order.id + ": Shipping placed successfully, transaction id: " + + transactionId); LOG.info("Order has been placed and will be shipped to you. Please wait while we make your" - + " payment... "); - sendPaymentRequest(order); - return; + + " payment... "); + sendPaymentRequest(order); + return; }; - Retry.HandleErrorIssue handleError = (o,err) -> { + Retry.HandleErrorIssue handleError = (o, err) -> { if (ShippingNotPossibleException.class.isAssignableFrom(err.getClass())) { - LOG.info("Shipping is currently not possible to your address. We are working on the problem " - + "and will get back to you asap."); + LOG.info("Shipping is currently not possible to your address. We are working on the problem" + + " and will get back to you asap."); finalSiteMsgShown = true; - LOG.info("Order " + order.id + ": Shipping not possible to address, trying to add problem to employee db.."); + LOG.info("Order " + order.id + ": Shipping not possible to address, trying to add problem " + + "to employee db.."); employeeHandleIssue(o); } else if (ItemUnavailableException.class.isAssignableFrom(err.getClass())) { - LOG.info("This item is currently unavailable. We will inform you as soon as the item becomes " - + "available again."); + LOG.info("This item is currently unavailable. We will inform you as soon as the item " + + "becomes available again."); finalSiteMsgShown = true; - LOG.info("Order " + order.id + ": Item " + order.item + " unavailable, trying to add problem to employee " - + "handle.."); + LOG.info("Order " + order.id + ": Item " + order.item + " unavailable, trying to add " + + "problem to employee handle.."); employeeHandleIssue(o); } else { LOG.info("Sorry, there was a problem in creating your order. Please try later."); LOG.error("Order " + order.id + ": Shipping service unavailable, order not placed.."); finalSiteMsgShown = true; } - return; + return; }; Retry r = new Retry(op, handleError, numOfRetries, retryDuration, e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); @@ -174,28 +176,31 @@ public void run() { Retry.Operation op = (l) -> { if (!l.isEmpty()) { if (DatabaseUnavailableException.class.isAssignableFrom(l.get(0).getClass())) { - LOG.debug("Order " + order.id + ": Error in connecting to payment service, trying again.."); + LOG.debug("Order " + order.id + ": Error in connecting to payment service," + + " trying again.."); } else { LOG.debug("Order " + order.id + ": Error in creating payment request.."); } - throw l.remove(0); - } + throw l.remove(0); + } if (order.paid.equals(PaymentStatus.Trying)) { String transactionId = paymentService.receiveRequest(order.price); - order.paid = PaymentStatus.Done; - LOG.info("Order " + order.id + ": Payment successful, transaction Id: " + transactionId); - if (!finalSiteMsgShown) { - LOG.info("Payment made successfully, thank you for shopping with us!!"); - finalSiteMsgShown = true; - } - sendSuccessMessage(order); - return; - } + order.paid = PaymentStatus.Done; + LOG.info("Order " + order.id + ": Payment successful, transaction Id: " + + transactionId); + if (!finalSiteMsgShown) { + LOG.info("Payment made successfully, thank you for shopping with us!!"); + finalSiteMsgShown = true; + } + sendSuccessMessage(order); + return; + } }; - Retry.HandleErrorIssue handleError = (o,err) -> { + Retry.HandleErrorIssue handleError = (o, err) -> { if (PaymentDetailsErrorException.class.isAssignableFrom(err.getClass())) { if (!finalSiteMsgShown) { - LOG.info("There was an error in payment. Your account/card details may have been incorrect. " + LOG.info("There was an error in payment. Your account/card details " + + "may have been incorrect. " + "Meanwhile, your order has been converted to COD and will be shipped."); finalSiteMsgShown = true; } @@ -213,15 +218,16 @@ public void run() { LOG.warn("Order " + order.id + ": Payment error, going to queue.."); sendPaymentPossibleErrorMsg(o); } - if (o.paid.equals(PaymentStatus.Trying) && System.currentTimeMillis() - o.createdTime < paymentTime) { - QueueTask qt = new QueueTask(o, TaskType.Payment,-1); + if (o.paid.equals(PaymentStatus.Trying) && System + .currentTimeMillis() - o.createdTime < paymentTime) { + QueueTask qt = new QueueTask(o, TaskType.Payment, -1); updateQueue(qt); - } + } } catch (InterruptedException e1) { e1.printStackTrace(); - } - } - return; + } + } + return; }; Retry r = new Retry(op, handleError, numOfRetries, retryDuration, e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); @@ -229,7 +235,7 @@ public void run() { r.perform(list, order); } catch (Exception e1) { e1.printStackTrace(); - } + } } }); t.start(); @@ -237,17 +243,18 @@ public void run() { private void updateQueue(QueueTask qt) throws InterruptedException { if (System.currentTimeMillis() - qt.order.createdTime >= this.queueTime) { - //since payment time is lesser than queuetime it would have already failed..additional check not needed + // since payment time is lesser than queuetime it would have already failed.. + // additional check not needed LOG.trace("Order " + qt.order.id + ": Queue time for order over, failed.."); return; } else if (qt.taskType.equals(TaskType.Payment) && !qt.order.paid.equals(PaymentStatus.Trying) || qt.taskType.equals(TaskType.Messaging) && (qt.messageType == 1 && !qt.order.messageSent.equals(MessageSent.NoneSent) - || qt.order.messageSent.equals(MessageSent.PaymentFail) + || qt.order.messageSent.equals(MessageSent.PaymentFail) || qt.order.messageSent.equals(MessageSent.PaymentSuccessful)) || qt.taskType.equals(TaskType.EmployeeDb) && qt.order.addedToEmployeeHandle) { LOG.trace("Order " + qt.order.id + ": Not queueing task since task already done.."); - return; + return; } ArrayList list = queue.exceptionsList; Thread t = new Thread(new Runnable() { @@ -256,24 +263,25 @@ public void run() { Retry.Operation op = (list) -> { if (!list.isEmpty()) { LOG.warn("Order " + qt.order.id + ": Error in connecting to queue db, trying again.."); - throw list.remove(0); - } - queue.add(qt); - queueItems++; + throw list.remove(0); + } + queue.add(qt); + queueItems++; LOG.info("Order " + qt.order.id + ": " + qt.getType() + " task enqueued.."); tryDoingTasksInQueue(); - return; + return; }; - Retry.HandleErrorIssue handleError = (qt,err) -> { + Retry.HandleErrorIssue handleError = (qt, err) -> { if (qt.taskType.equals(TaskType.Payment)) { - qt.order.paid = PaymentStatus.NotDone; - sendPaymentFailureMessage(qt.order); - LOG.error("Order " + qt.order.id + ": Unable to enqueue payment task, payment failed.."); + qt.order.paid = PaymentStatus.NotDone; + sendPaymentFailureMessage(qt.order); + LOG.error("Order " + qt.order.id + ": Unable to enqueue payment task," + + " payment failed.."); } - LOG.error("Order " + qt.order.id + ": Unable to enqueue task of type " + qt.getType() + LOG.error("Order " + qt.order.id + ": Unable to enqueue task of type " + qt.getType() + ", trying to add to employee handle.."); employeeHandleIssue(qt.order); - return; + return; }; Retry r = new Retry(op, handleError, numOfRetries, retryDuration, e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); @@ -281,8 +289,8 @@ public void run() { r.perform(list, qt); } catch (Exception e1) { e1.printStackTrace(); - } - } + } + } }); t.start(); } @@ -295,13 +303,13 @@ public void run() { Retry.Operation op = (list) -> { if (!list.isEmpty()) { LOG.warn("Error in accessing queue db to do tasks, trying again.."); - throw list.remove(0); + throw list.remove(0); } doTasksInQueue(); - return; + return; }; - Retry.HandleErrorIssue handleError = (o,err) -> { - return; + Retry.HandleErrorIssue handleError = (o, err) -> { + return; }; Retry r = new Retry(op, handleError, numOfRetries, retryDuration, e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); @@ -309,8 +317,8 @@ public void run() { r.perform(list, null); } catch (Exception e1) { e1.printStackTrace(); - } - } + } + } }); t2.start(); } @@ -323,14 +331,14 @@ public void run() { Retry.Operation op = (list) -> { if (!list.isEmpty()) { LOG.warn("Error in accessing queue db to dequeue task, trying again.."); - throw list.remove(0); - } - queue.dequeue(); - queueItems--; + throw list.remove(0); + } + queue.dequeue(); + queueItems--; return; }; - Retry.HandleErrorIssue handleError = (o,err) -> { - return; + Retry.HandleErrorIssue handleError = (o, err) -> { + return; }; Retry r = new Retry(op, handleError, numOfRetries, retryDuration, e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); @@ -338,12 +346,12 @@ public void run() { r.perform(list, null); } catch (Exception e1) { e1.printStackTrace(); - } + } } }); t3.start(); } - + private void sendSuccessMessage(Order order) { if (System.currentTimeMillis() - order.createdTime >= this.messageTime) { LOG.trace("Order " + order.id + ": Message time for order over, returning.."); @@ -359,32 +367,35 @@ public void run() { LOG.debug("Order " + order.id + ": Error in connecting to messaging service " + "(Payment Success msg), trying again.."); } else { - LOG.debug("Order " + order.id + ": Error in creating Payment Success messaging request.."); + LOG.debug("Order " + order.id + ": Error in creating Payment Success" + + " messaging request.."); } - throw l.remove(0); - } - if (!order.messageSent.equals(MessageSent.PaymentFail) + throw l.remove(0); + } + if (!order.messageSent.equals(MessageSent.PaymentFail) && !order.messageSent.equals(MessageSent.PaymentSuccessful)) { - String requestId = messagingService.receiveRequest(2); + String requestId = messagingService.receiveRequest(2); order.messageSent = MessageSent.PaymentSuccessful; - LOG.info("Order " + order.id + ": Payment Success message sent, request Id: " + requestId); - } - return; + LOG.info("Order " + order.id + ": Payment Success message sent," + + " request Id: " + requestId); + } + return; }; - Retry.HandleErrorIssue handleError = (o,err) -> { + Retry.HandleErrorIssue handleError = (o, err) -> { try { - if ((o.messageSent.equals(MessageSent.NoneSent) || o.messageSent.equals(MessageSent.PaymentTrying)) + if ((o.messageSent.equals(MessageSent.NoneSent) || o.messageSent + .equals(MessageSent.PaymentTrying)) && System.currentTimeMillis() - o.createdTime < messageTime) { - QueueTask qt = new QueueTask(order, TaskType.Messaging,2); + QueueTask qt = new QueueTask(order, TaskType.Messaging, 2); updateQueue(qt); - LOG.info("Order " + order.id + ": Error in sending Payment Success message, trying to " - + "queue task and add to employee handle.."); + LOG.info("Order " + order.id + ": Error in sending Payment Success message, trying to" + + " queue task and add to employee handle.."); employeeHandleIssue(order); } } catch (InterruptedException e1) { e1.printStackTrace(); - } - return; + } + return; }; Retry r = new Retry(op, handleError, numOfRetries, retryDuration, e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); @@ -392,8 +403,8 @@ public void run() { r.perform(list, order); } catch (Exception e1) { e1.printStackTrace(); - } - } + } + } }); t.start(); } @@ -413,32 +424,35 @@ public void run() { LOG.debug("Order " + order.id + ": Error in connecting to messaging service " + "(Payment Failure msg), trying again.."); } else { - LOG.debug("Order " + order.id + ": Error in creating Payment Failure message request.."); + LOG.debug("Order " + order.id + ": Error in creating Payment Failure" + + " message request.."); } - throw l.remove(0); - } - if (!order.messageSent.equals(MessageSent.PaymentFail) - && !order.messageSent.equals(MessageSent.PaymentSuccessful)) { - String requestId = messagingService.receiveRequest(0); + throw l.remove(0); + } + if (!order.messageSent.equals(MessageSent.PaymentFail) + && !order.messageSent.equals(MessageSent.PaymentSuccessful)) { + String requestId = messagingService.receiveRequest(0); order.messageSent = MessageSent.PaymentFail; - LOG.info("Order " + order.id + ": Payment Failure message sent successfully, request Id: " + requestId); - } - return; + LOG.info("Order " + order.id + ": Payment Failure message sent successfully," + + " request Id: " + requestId); + } + return; }; - Retry.HandleErrorIssue handleError = (o,err) -> { - if ((o.messageSent.equals(MessageSent.NoneSent) || o.messageSent.equals(MessageSent.PaymentTrying)) + Retry.HandleErrorIssue handleError = (o, err) -> { + if ((o.messageSent.equals(MessageSent.NoneSent) || o.messageSent + .equals(MessageSent.PaymentTrying)) && System.currentTimeMillis() - o.createdTime < messageTime) { try { - QueueTask qt = new QueueTask(order, TaskType.Messaging,0); + QueueTask qt = new QueueTask(order, TaskType.Messaging, 0); updateQueue(qt); LOG.warn("Order " + order.id + ": Error in sending Payment Failure message, " + "trying to queue task and add to employee handle.."); employeeHandleIssue(o); } catch (InterruptedException e1) { e1.printStackTrace(); - } - return; - } + } + return; + } }; Retry r = new Retry(op, handleError, numOfRetries, retryDuration, e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); @@ -446,8 +460,8 @@ public void run() { r.perform(list, order); } catch (Exception e1) { e1.printStackTrace(); - } - } + } + } }); t.start(); } @@ -467,31 +481,35 @@ public void run() { LOG.debug("Order " + order.id + ": Error in connecting to messaging service " + "(Payment Error msg), trying again.."); } else { - LOG.debug("Order " + order.id + ": Error in creating Payment Error messaging request.."); + LOG.debug("Order " + order.id + ": Error in creating Payment Error" + + " messaging request.."); } - throw l.remove(0); + throw l.remove(0); + } + if (order.paid.equals(PaymentStatus.Trying) && order.messageSent + .equals(MessageSent.NoneSent)) { + String requestId = messagingService.receiveRequest(1); + order.messageSent = MessageSent.PaymentTrying; + LOG.info("Order " + order.id + ": Payment Error message sent successfully," + + " request Id: " + requestId); } - if (order.paid.equals(PaymentStatus.Trying) && order.messageSent.equals(MessageSent.NoneSent)) { - String requestId = messagingService.receiveRequest(1); - order.messageSent = MessageSent.PaymentTrying; - LOG.info("Order " + order.id + ": Payment Error message sent successfully, request Id: " + requestId); - } - return; + return; }; - Retry.HandleErrorIssue handleError = (o,err) -> { + Retry.HandleErrorIssue handleError = (o, err) -> { try { - if (o.messageSent.equals(MessageSent.NoneSent) && order.paid.equals(PaymentStatus.Trying) + if (o.messageSent.equals(MessageSent.NoneSent) && order.paid + .equals(PaymentStatus.Trying) && System.currentTimeMillis() - o.createdTime < messageTime) { - QueueTask qt = new QueueTask(order,TaskType.Messaging,1); + QueueTask qt = new QueueTask(order, TaskType.Messaging, 1); updateQueue(qt); LOG.warn("Order " + order.id + ": Error in sending Payment Error message, " + "trying to queue task and add to employee handle.."); employeeHandleIssue(o); - } + } } catch (InterruptedException e1) { e1.printStackTrace(); - } - return; + } + return; }; Retry r = new Retry(op, handleError, numOfRetries, retryDuration, e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); @@ -516,28 +534,31 @@ private void employeeHandleIssue(Order order) { public void run() { Retry.Operation op = (l) -> { if (!l.isEmpty()) { - LOG.warn("Order " + order.id + ": Error in connecting to employee handle, trying again.."); - throw l.remove(0); - } + LOG.warn("Order " + order.id + ": Error in connecting to employee handle," + + " trying again.."); + throw l.remove(0); + } if (!order.addedToEmployeeHandle) { - employeeDb.receiveRequest(order); + employeeDb.receiveRequest(order); order.addedToEmployeeHandle = true; LOG.info("Order " + order.id + ": Added order to employee database"); } - return; + return; }; - Retry.HandleErrorIssue handleError = (o,err) -> { + Retry.HandleErrorIssue handleError = (o, err) -> { try { - if (!o.addedToEmployeeHandle && System.currentTimeMillis() - order.createdTime < employeeTime) { - QueueTask qt = new QueueTask(order, TaskType.EmployeeDb,-1); + if (!o.addedToEmployeeHandle && System + .currentTimeMillis() - order.createdTime < employeeTime) { + QueueTask qt = new QueueTask(order, TaskType.EmployeeDb, -1); updateQueue(qt); - LOG.warn("Order " + order.id + ": Error in adding to employee db, trying to queue task.."); + LOG.warn("Order " + order.id + ": Error in adding to employee db," + + " trying to queue task.."); return; - } + } } catch (InterruptedException e1) { e1.printStackTrace(); } - return; + return; }; Retry r = new Retry(op, handleError, numOfRetries, retryDuration, e -> DatabaseUnavailableException.class.isAssignableFrom(e.getClass())); @@ -558,7 +579,7 @@ private void doTasksInQueue() throws Exception { LOG.trace("Order " + qt.order.id + ": Started doing task of type " + qt.getType()); if (qt.firstAttemptTime == -1) { qt.firstAttemptTime = System.currentTimeMillis(); - } + } if (System.currentTimeMillis() - qt.firstAttemptTime >= queueTaskTime) { tryDequeue(); LOG.trace("Order " + qt.order.id + ": This queue task of type " + qt.getType() @@ -573,14 +594,15 @@ private void doTasksInQueue() throws Exception { LOG.debug("Order " + qt.order.id + ": Trying to connect to payment service.."); } } else if (qt.taskType.equals(TaskType.Messaging)) { - if (qt.order.messageSent.equals(MessageSent.PaymentFail) + if (qt.order.messageSent.equals(MessageSent.PaymentFail) || qt.order.messageSent.equals(MessageSent.PaymentSuccessful)) { tryDequeue(); LOG.trace("Order " + qt.order.id + ": This messaging task already done, dequeue.."); } else if (qt.messageType == 1 && (!qt.order.messageSent.equals(MessageSent.NoneSent) || !qt.order.paid.equals(PaymentStatus.Trying))) { tryDequeue(); - LOG.trace("Order " + qt.order.id + ": This messaging task does not need to be done, dequeue.."); + LOG.trace("Order " + qt.order.id + ": This messaging task does not need to be done," + + " dequeue.."); } else if (qt.messageType == 0) { sendPaymentFailureMessage(qt.order); LOG.debug("Order " + qt.order.id + ": Trying to connect to messaging service.."); @@ -594,7 +616,8 @@ private void doTasksInQueue() throws Exception { } else if (qt.taskType.equals(TaskType.EmployeeDb)) { if (qt.order.addedToEmployeeHandle) { tryDequeue(); - LOG.trace("Order " + qt.order.id + ": This employee handle task already done, dequeue.."); + LOG.trace("Order " + qt.order.id + ": This employee handle task already done," + + " dequeue.."); } else { employeeHandleIssue(qt.order); LOG.debug("Order " + qt.order.id + ": Trying to connect to employee handle.."); diff --git a/commander/src/main/java/com/iluwatar/commander/Database.java b/commander/src/main/java/com/iluwatar/commander/Database.java index 3f850f90a8c2..ebd333e021c7 100644 --- a/commander/src/main/java/com/iluwatar/commander/Database.java +++ b/commander/src/main/java/com/iluwatar/commander/Database.java @@ -26,12 +26,14 @@ import com.iluwatar.commander.exceptions.DatabaseUnavailableException; /** - * Database abstract class is extended by all databases in our example. The add and get - * methods are used by the respective service to add to database or get from database. + * Database abstract class is extended by all databases in our example. The add and get methods are + * used by the respective service to add to database or get from database. + * * @param T is the type of object being held by database. */ public abstract class Database { public abstract T add(T obj) throws DatabaseUnavailableException; - public abstract T get(String tId) throws DatabaseUnavailableException; + + public abstract T get(String id) throws DatabaseUnavailableException; } diff --git a/commander/src/main/java/com/iluwatar/commander/Order.java b/commander/src/main/java/com/iluwatar/commander/Order.java index 20002e1b9cca..0293c478ced5 100644 --- a/commander/src/main/java/com/iluwatar/commander/Order.java +++ b/commander/src/main/java/com/iluwatar/commander/Order.java @@ -34,11 +34,15 @@ public class Order { //can store all transactions ids also enum PaymentStatus { NotDone, Trying, Done - }; - + } + + ; + enum MessageSent { NoneSent, PaymentFail, PaymentTrying, PaymentSuccessful - }; + } + + ; final User user; final String item; @@ -78,5 +82,5 @@ String createUniqueId() { } return random.toString(); } - + } diff --git a/commander/src/main/java/com/iluwatar/commander/Retry.java b/commander/src/main/java/com/iluwatar/commander/Retry.java index 7b9d06d2df75..65c92d3ef90f 100644 --- a/commander/src/main/java/com/iluwatar/commander/Retry.java +++ b/commander/src/main/java/com/iluwatar/commander/Retry.java @@ -30,29 +30,31 @@ import java.util.function.Predicate; /** - * Retry pattern + * Retry pattern. + * * @param is the type of object passed into HandleErrorIssue as a parameter. */ public class Retry { - /** - * Operation Interface will define method to be implemented. - */ + /** + * Operation Interface will define method to be implemented. + */ public interface Operation { - void operation(ArrayList list) throws Exception; + void operation(ArrayList list) throws Exception; } - /** - * HandleErrorIssue defines how to handle errors. - * @param is the type of object to be passed into the method as parameter. - */ - + /** + * HandleErrorIssue defines how to handle errors. + * + * @param is the type of object to be passed into the method as parameter. + */ + public interface HandleErrorIssue { void handleIssue(T obj, Exception e); } - + private static final Random RANDOM = new Random(); private final Operation op; @@ -64,7 +66,7 @@ public interface HandleErrorIssue { private final ArrayList errors; Retry(Operation op, HandleErrorIssue handleError, int maxAttempts, - long maxDelay, Predicate... ignoreTests) { + long maxDelay, Predicate... ignoreTests) { this.op = op; this.handleError = handleError; this.maxAttempts = maxAttempts; @@ -76,10 +78,11 @@ public interface HandleErrorIssue { /** * Performing the operation with retries. + * * @param list is the exception list - * @param obj is the parameter to be passed into handleIsuue method + * @param obj is the parameter to be passed into handleIsuue method */ - + public void perform(ArrayList list, T obj) throws Exception { do { try { @@ -92,15 +95,15 @@ public void perform(ArrayList list, T obj) throws Exception { return; //return here...dont go further } try { - long testDelay = (long) Math.pow(2, this.attempts.intValue()) * 1000 + RANDOM.nextInt(1000); + long testDelay = + (long) Math.pow(2, this.attempts.intValue()) * 1000 + RANDOM.nextInt(1000); long delay = testDelay < this.maxDelay ? testDelay : maxDelay; Thread.sleep(delay); } catch (InterruptedException f) { //ignore } } - } - while (true); + } while (true); } } diff --git a/commander/src/main/java/com/iluwatar/commander/Service.java b/commander/src/main/java/com/iluwatar/commander/Service.java index 64af79053459..ddcc2d5bf4e9 100644 --- a/commander/src/main/java/com/iluwatar/commander/Service.java +++ b/commander/src/main/java/com/iluwatar/commander/Service.java @@ -23,35 +23,37 @@ package com.iluwatar.commander; -import java.util.*; - import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.Random; /** - * Service class is an abstract class extended by all services in this example. They - * all have a public receiveRequest method to receive requests, which could also contain - * details of the user other than the implementation details (though we are not doing - * that here) and updateDb method which adds to their respective databases. There is a - * method to generate transaction/request id for the transactions/requests, which are - * then sent back. These could be stored by the {@link Commander} class in a separate - * database for reference (though we are not doing that here). + * Service class is an abstract class extended by all services in this example. They all have a + * public receiveRequest method to receive requests, which could also contain details of the user + * other than the implementation details (though we are not doing that here) and updateDb method + * which adds to their respective databases. There is a method to generate transaction/request id + * for the transactions/requests, which are then sent back. These could be stored by the {@link + * Commander} class in a separate database for reference (though we are not doing that here). */ public abstract class Service { - + protected final Database database; public ArrayList exceptionsList; private static final Random RANDOM = new Random(); private static final String ALL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; private static final Hashtable USED_IDS = new Hashtable<>(); - protected Service(Database db, Exception...exc) { + protected Service(Database db, Exception... exc) { this.database = db; this.exceptionsList = new ArrayList<>(List.of(exc)); } - public abstract String receiveRequest(Object...parameters) throws DatabaseUnavailableException; - protected abstract String updateDb(Object...parameters) throws DatabaseUnavailableException; + public abstract String receiveRequest(Object... parameters) throws DatabaseUnavailableException; + + protected abstract String updateDb(Object... parameters) throws DatabaseUnavailableException; protected String generateId() { StringBuilder random = new StringBuilder(); diff --git a/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeDatabase.java b/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeDatabase.java index 0626e5ce0983..3f5b7bcc0c2c 100644 --- a/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeDatabase.java +++ b/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeDatabase.java @@ -23,10 +23,10 @@ package com.iluwatar.commander.employeehandle; -import java.util.Hashtable; import com.iluwatar.commander.Database; import com.iluwatar.commander.Order; import com.iluwatar.commander.exceptions.DatabaseUnavailableException; +import java.util.Hashtable; /** * The Employee Database is where orders which have encountered some issue(s) are added. @@ -41,11 +41,11 @@ public EmployeeDatabase() { @Override public Order add(Order o) throws DatabaseUnavailableException { - return data.put(o.id,o); + return data.put(o.id, o); } @Override - public Order get(String oId) throws DatabaseUnavailableException { - return data.get(oId); + public Order get(String orderId) throws DatabaseUnavailableException { + return data.get(orderId); } } diff --git a/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeHandle.java b/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeHandle.java index ed3e36d7c24c..9f4d8fb483a8 100644 --- a/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeHandle.java +++ b/commander/src/main/java/com/iluwatar/commander/employeehandle/EmployeeHandle.java @@ -28,21 +28,21 @@ import com.iluwatar.commander.exceptions.DatabaseUnavailableException; /** - * The EmployeeHandle class is the middle-man between {@link Commander} and - * {@link EmployeeDatabase}. + * The EmployeeHandle class is the middle-man between {@link Commander} and {@link + * EmployeeDatabase}. */ public class EmployeeHandle extends Service { - public EmployeeHandle(EmployeeDatabase db, Exception...exc) { + public EmployeeHandle(EmployeeDatabase db, Exception... exc) { super(db, exc); } - public String receiveRequest(Object...parameters) throws DatabaseUnavailableException { - return updateDb((Order)parameters[0]); + public String receiveRequest(Object... parameters) throws DatabaseUnavailableException { + return updateDb((Order) parameters[0]); } - protected String updateDb(Object...parameters) throws DatabaseUnavailableException { + protected String updateDb(Object... parameters) throws DatabaseUnavailableException { Order o = (Order) parameters[0]; if (database.get(o.id) == null) { database.add(o); diff --git a/commander/src/main/java/com/iluwatar/commander/exceptions/DatabaseUnavailableException.java b/commander/src/main/java/com/iluwatar/commander/exceptions/DatabaseUnavailableException.java index 71254fb317c1..8997b1a10a2d 100644 --- a/commander/src/main/java/com/iluwatar/commander/exceptions/DatabaseUnavailableException.java +++ b/commander/src/main/java/com/iluwatar/commander/exceptions/DatabaseUnavailableException.java @@ -24,8 +24,8 @@ package com.iluwatar.commander.exceptions; /** - * DatabaseUnavailableException is thrown when database is unavailable and nothing - * can be added or retrieved. + * DatabaseUnavailableException is thrown when database is unavailable and nothing can be added or + * retrieved. */ public class DatabaseUnavailableException extends Exception { diff --git a/commander/src/main/java/com/iluwatar/commander/exceptions/PaymentDetailsErrorException.java b/commander/src/main/java/com/iluwatar/commander/exceptions/PaymentDetailsErrorException.java index 306cf4c18bda..eb7c0fb3fd35 100644 --- a/commander/src/main/java/com/iluwatar/commander/exceptions/PaymentDetailsErrorException.java +++ b/commander/src/main/java/com/iluwatar/commander/exceptions/PaymentDetailsErrorException.java @@ -24,8 +24,8 @@ package com.iluwatar.commander.exceptions; /** - * PaymentDetailsErrorException is thrown when the details entered are incorrect or - * payment cannot be made with the details given. + * PaymentDetailsErrorException is thrown when the details entered are incorrect or payment cannot + * be made with the details given. */ public class PaymentDetailsErrorException extends Exception { diff --git a/commander/src/main/java/com/iluwatar/commander/exceptions/ShippingNotPossibleException.java b/commander/src/main/java/com/iluwatar/commander/exceptions/ShippingNotPossibleException.java index 8c2b5334121b..b374f2a7d65c 100644 --- a/commander/src/main/java/com/iluwatar/commander/exceptions/ShippingNotPossibleException.java +++ b/commander/src/main/java/com/iluwatar/commander/exceptions/ShippingNotPossibleException.java @@ -24,8 +24,8 @@ package com.iluwatar.commander.exceptions; /** - * ShippingNotPossibleException is thrown when the address entered cannot be shipped to - * by service currently for some reason. + * ShippingNotPossibleException is thrown when the address entered cannot be shipped to by service + * currently for some reason. */ public class ShippingNotPossibleException extends Exception { diff --git a/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingDatabase.java b/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingDatabase.java index 7078726bee2a..45bd1e23a9f3 100644 --- a/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingDatabase.java +++ b/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingDatabase.java @@ -23,10 +23,10 @@ package com.iluwatar.commander.messagingservice; -import java.util.Hashtable; import com.iluwatar.commander.Database; import com.iluwatar.commander.exceptions.DatabaseUnavailableException; import com.iluwatar.commander.messagingservice.MessagingService.MessageRequest; +import java.util.Hashtable; /** * The MessagingDatabase is where the MessageRequest is added. @@ -45,8 +45,8 @@ public MessageRequest add(MessageRequest r) throws DatabaseUnavailableException } @Override - public MessageRequest get(String rId) throws DatabaseUnavailableException { - return data.get(rId); + public MessageRequest get(String requestId) throws DatabaseUnavailableException { + return data.get(requestId); } } diff --git a/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingService.java b/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingService.java index 2742dfd5d9e7..1dcdac926de3 100644 --- a/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingService.java +++ b/commander/src/main/java/com/iluwatar/commander/messagingservice/MessagingService.java @@ -29,9 +29,9 @@ import org.slf4j.LoggerFactory; /** - * The MessagingService is used to send messages to user regarding their order and - * payment status. In case an error is encountered in payment and this service is - * found to be unavailable, the order is added to the {@link EmployeeDatabase}. + * The MessagingService is used to send messages to user regarding their order and payment status. + * In case an error is encountered in payment and this service is found to be unavailable, the order + * is added to the {@link EmployeeDatabase}. */ public class MessagingService extends Service { @@ -39,7 +39,9 @@ public class MessagingService extends Service { enum MessageToSend { PaymentFail, PaymentTrying, PaymentSuccessful - }; + } + + ; class MessageRequest { String reqId; @@ -51,17 +53,16 @@ class MessageRequest { } } - public MessagingService(MessagingDatabase db, Exception...exc) { + public MessagingService(MessagingDatabase db, Exception... exc) { super(db, exc); } /** * Public method which will receive request from {@link Commander}. */ - - public String receiveRequest(Object...parameters) throws DatabaseUnavailableException { + public String receiveRequest(Object... parameters) throws DatabaseUnavailableException { int messageToSend = (int) parameters[0]; - String rId = generateId(); + String id = generateId(); MessageToSend msg = null; if (messageToSend == 0) { msg = MessageToSend.PaymentFail; @@ -70,11 +71,11 @@ public String receiveRequest(Object...parameters) throws DatabaseUnavailableExce } else { //messageToSend == 2 msg = MessageToSend.PaymentSuccessful; } - MessageRequest req = new MessageRequest(rId, msg); + MessageRequest req = new MessageRequest(id, msg); return updateDb(req); } - protected String updateDb(Object...parameters) throws DatabaseUnavailableException { + protected String updateDb(Object... parameters) throws DatabaseUnavailableException { MessageRequest req = (MessageRequest) parameters[0]; if (this.database.get(req.reqId) == null) { //idempotence, in case db fails here database.add(req); //if successful: @@ -86,13 +87,17 @@ protected String updateDb(Object...parameters) throws DatabaseUnavailableExcepti String sendMessage(MessageToSend m) { if (m.equals(MessageToSend.PaymentSuccessful)) { - return "Msg: Your order has been placed and paid for successfully! Thank you for shopping with us!"; + return "Msg: Your order has been placed and paid for successfully!" + + " Thank you for shopping with us!"; } else if (m.equals(MessageToSend.PaymentTrying)) { - return "Msg: There was an error in your payment process, we are working on it and will return back to you" - + " shortly. Meanwhile, your order has been placed and will be shipped."; + return "Msg: There was an error in your payment process," + + " we are working on it and will return back to you shortly." + + " Meanwhile, your order has been placed and will be shipped."; } else { - return "Msg: There was an error in your payment process. Your order is placed and has been converted to COD." - + " Please reach us on CUSTOMER-CARE-NUBER in case of any queries. Thank you for shopping with us!"; + return "Msg: There was an error in your payment process." + + " Your order is placed and has been converted to COD." + + " Please reach us on CUSTOMER-CARE-NUBER in case of any queries." + + " Thank you for shopping with us!"; } } } diff --git a/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentDatabase.java b/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentDatabase.java index b597abe68af5..ed308dbfbd03 100644 --- a/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentDatabase.java +++ b/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentDatabase.java @@ -23,11 +23,10 @@ package com.iluwatar.commander.paymentservice; -import java.util.Hashtable; - import com.iluwatar.commander.Database; import com.iluwatar.commander.exceptions.DatabaseUnavailableException; import com.iluwatar.commander.paymentservice.PaymentService.PaymentRequest; +import java.util.Hashtable; /** * PaymentDatabase is where the PaymentRequest is added, along with details. @@ -48,8 +47,8 @@ public PaymentRequest add(PaymentRequest r) throws DatabaseUnavailableException } @Override - public PaymentRequest get(String tId) throws DatabaseUnavailableException { - return data.get(tId); + public PaymentRequest get(String requestId) throws DatabaseUnavailableException { + return data.get(requestId); } } diff --git a/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentService.java b/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentService.java index 9abb15db2253..95ca92a65ea0 100644 --- a/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentService.java +++ b/commander/src/main/java/com/iluwatar/commander/paymentservice/PaymentService.java @@ -27,8 +27,8 @@ import com.iluwatar.commander.exceptions.DatabaseUnavailableException; /** - * The PaymentService class receives request from the {@link Commander} and adds - * to the {@link PaymentDatabase}. + * The PaymentService class receives request from the {@link Commander} and adds to the {@link + * PaymentDatabase}. */ public class PaymentService extends Service { @@ -45,22 +45,22 @@ class PaymentRequest { } } - public PaymentService(PaymentDatabase db, Exception...exc) { + public PaymentService(PaymentDatabase db, Exception... exc) { super(db, exc); } /** * Public method which will receive request from {@link Commander}. */ - - public String receiveRequest(Object...parameters) throws DatabaseUnavailableException { + + public String receiveRequest(Object... parameters) throws DatabaseUnavailableException { //it could also be sending a userid, payment details here or something, not added here - String tId = generateId(); - PaymentRequest req = new PaymentRequest(tId, (float)parameters[0]); + String id = generateId(); + PaymentRequest req = new PaymentRequest(id, (float) parameters[0]); return updateDb(req); } - protected String updateDb(Object...parameters) throws DatabaseUnavailableException { + protected String updateDb(Object... parameters) throws DatabaseUnavailableException { PaymentRequest req = (PaymentRequest) parameters[0]; if (database.get(req.transactionId) == null || !req.paid) { database.add(req); diff --git a/commander/src/main/java/com/iluwatar/commander/queue/Queue.java b/commander/src/main/java/com/iluwatar/commander/queue/Queue.java index 16fdaa88323e..1770e6c0546f 100644 --- a/commander/src/main/java/com/iluwatar/commander/queue/Queue.java +++ b/commander/src/main/java/com/iluwatar/commander/queue/Queue.java @@ -27,6 +27,7 @@ /** * Queue data structure implementation. + * * @param is the type of object the queue will hold. */ @@ -47,15 +48,14 @@ class Node { } /** - * Queue constructor + * Queue constructor. */ - Queue() { front = null; rear = null; size = 0; } - + boolean isEmpty() { if (size == 0) { return true; @@ -63,7 +63,7 @@ boolean isEmpty() { return false; } } - + void enqueue(T obj) { if (front == null) { front = new Node(obj, null); @@ -75,7 +75,7 @@ void enqueue(T obj) { } size++; } - + T dequeue() throws IsEmptyException { if (isEmpty()) { throw new IsEmptyException(); @@ -86,12 +86,12 @@ T dequeue() throws IsEmptyException { return (T) temp.value; } } - + T peek() throws IsEmptyException { if (isEmpty()) { throw new IsEmptyException(); } else { - return (T)front.value; + return (T) front.value; } } } diff --git a/commander/src/main/java/com/iluwatar/commander/queue/QueueDatabase.java b/commander/src/main/java/com/iluwatar/commander/queue/QueueDatabase.java index 6b9007b9fd36..3874cc27da70 100644 --- a/commander/src/main/java/com/iluwatar/commander/queue/QueueDatabase.java +++ b/commander/src/main/java/com/iluwatar/commander/queue/QueueDatabase.java @@ -26,7 +26,6 @@ import com.iluwatar.commander.Database; import com.iluwatar.commander.exceptions.DatabaseUnavailableException; import com.iluwatar.commander.exceptions.IsEmptyException; - import java.util.ArrayList; import java.util.List; @@ -39,7 +38,7 @@ public class QueueDatabase extends Database { private Queue data; public ArrayList exceptionsList; - public QueueDatabase(Exception...exc) { + public QueueDatabase(Exception... exc) { this.data = new Queue<>(); this.exceptionsList = new ArrayList<>(List.of(exc)); } @@ -52,31 +51,33 @@ public QueueTask add(QueueTask t) throws DatabaseUnavailableException { } /** - * peek method returns object at front without removing it from queue + * peek method returns object at front without removing it from queue. + * * @return object at front of queue - * @throws IsEmptyException if queue is empty + * @throws IsEmptyException if queue is empty * @throws DatabaseUnavailableException if queue db is unavailable */ - + public QueueTask peek() throws IsEmptyException, DatabaseUnavailableException { QueueTask qt = this.data.peek(); return qt; } /** - * dequeue method removes the object at front and returns it + * dequeue method removes the object at front and returns it. + * * @return object at front of queue - * @throws IsEmptyException if queue is empty + * @throws IsEmptyException if queue is empty * @throws DatabaseUnavailableException if queue db is unavailable */ - + public QueueTask dequeue() throws IsEmptyException, DatabaseUnavailableException { QueueTask qt = this.data.dequeue(); return qt; } @Override - public QueueTask get(String tId) throws DatabaseUnavailableException { + public QueueTask get(String taskId) throws DatabaseUnavailableException { return null; } diff --git a/commander/src/main/java/com/iluwatar/commander/queue/QueueTask.java b/commander/src/main/java/com/iluwatar/commander/queue/QueueTask.java index 206b2daf1416..f8ba09fc1ad6 100644 --- a/commander/src/main/java/com/iluwatar/commander/queue/QueueTask.java +++ b/commander/src/main/java/com/iluwatar/commander/queue/QueueTask.java @@ -31,13 +31,15 @@ public class QueueTask { -/** - * TaskType is the type of task to be done. - */ + /** + * TaskType is the type of task to be done. + */ public enum TaskType { Messaging, Payment, EmployeeDb - }; + } + + ; public Order order; public TaskType taskType; @@ -46,26 +48,28 @@ public enum TaskType { but keeping it simple here*/ public long firstAttemptTime; //when first time attempt made to do task -/** - * QueueTask constructor - * @param o is the order for which the queuetask is being created - * @param t is the type of task to be done - * @param messageType if it is a message, which type of message - this could have instead been object varargs, - * and contained all additional details related to tasktype. - */ - + /** + * QueueTask constructor. + * + * @param o is the order for which the queuetask is being created + * @param t is the type of task to be done + * @param messageType if it is a message, which type of message - this could have instead been + * object varargs, and contained all additional details related to tasktype. + */ + public QueueTask(Order o, TaskType t, int messageType) { this.order = o; this.taskType = t; this.messageType = messageType; this.firstAttemptTime = -1; } - + /** - * getType method + * getType method. + * * @return String representing type of task */ - + public String getType() { if (!this.taskType.equals(TaskType.Messaging)) { return this.taskType.toString(); diff --git a/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingDatabase.java b/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingDatabase.java index fd2bf79968e2..a45dd00e16d5 100644 --- a/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingDatabase.java +++ b/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingDatabase.java @@ -23,17 +23,17 @@ package com.iluwatar.commander.shippingservice; -import java.util.Hashtable; import com.iluwatar.commander.Database; import com.iluwatar.commander.exceptions.DatabaseUnavailableException; import com.iluwatar.commander.shippingservice.ShippingService.ShippingRequest; +import java.util.Hashtable; /** * ShippingDatabase is where the ShippingRequest objects are added. */ public class ShippingDatabase extends Database { - + private Hashtable data; public ShippingDatabase() { @@ -45,8 +45,8 @@ public ShippingRequest add(ShippingRequest r) throws DatabaseUnavailableExceptio return data.put(r.transactionId, r); } - public ShippingRequest get(String transactionId) throws DatabaseUnavailableException { - return data.get(transactionId); + public ShippingRequest get(String trasnactionId) throws DatabaseUnavailableException { + return data.get(trasnactionId); } } diff --git a/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingService.java b/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingService.java index a14690306fcd..6539316b1e12 100644 --- a/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingService.java +++ b/commander/src/main/java/com/iluwatar/commander/shippingservice/ShippingService.java @@ -27,8 +27,8 @@ import com.iluwatar.commander.exceptions.DatabaseUnavailableException; /** - * ShippingService class receives request from {@link Commander} class and adds it - * to the {@link ShippingDatabase}. + * ShippingService class receives request from {@link Commander} class and adds it to the {@link + * ShippingDatabase}. */ public class ShippingService extends Service { @@ -45,21 +45,22 @@ class ShippingRequest { } } - public ShippingService(ShippingDatabase db, Exception...exc) { + public ShippingService(ShippingDatabase db, Exception... exc) { super(db, exc); } /** * Public method which will receive request from {@link Commander}. */ - - public String receiveRequest(Object...parameters) throws DatabaseUnavailableException { - String tId = generateId(); - ShippingRequest req = new ShippingRequest(tId, (String) parameters[0] /*item*/, (String) parameters[1]/*address*/); + + public String receiveRequest(Object... parameters) throws DatabaseUnavailableException { + String id = generateId(); + ShippingRequest req = + new ShippingRequest(id, (String) parameters[0] /*item*/, (String) parameters[1]/*address*/); return updateDb(req); } - protected String updateDb(Object...parameters) throws DatabaseUnavailableException { + protected String updateDb(Object... parameters) throws DatabaseUnavailableException { ShippingRequest req = (ShippingRequest) parameters[0]; if (this.database.get(req.transactionId) == null) { database.add(req); From de56cbb971207e7d754e0d86038e5ac9f998ea79 Mon Sep 17 00:00:00 2001 From: Besok Date: Sun, 10 Nov 2019 13:09:41 +0000 Subject: [PATCH 139/197] change according to cgeckstyle --- saga/README.md | 4 +- saga/pom.xml | 33 +- ...{Chapter.java => ChoreographyChapter.java} | 61 ++-- .../saga/choreography/FlyBookingService.java | 14 +- .../choreography/HotelBookingService.java | 16 +- .../saga/choreography/OrderService.java | 16 +- .../com/iluwatar/saga/choreography/Saga.java | 296 +++++++++++------- .../saga/choreography/SagaApplication.java | 53 ++-- .../iluwatar/saga/choreography/Service.java | 126 ++++---- .../choreography/ServiceDiscoveryService.java | 47 +-- .../choreography/WithdrawMoneyService.java | 36 +-- .../saga/orchestration/ChapterResult.java | 46 +-- .../saga/orchestration/FlyBookingService.java | 8 +- .../orchestration/HotelBookingService.java | 32 +- ...Chapter.java => OrchestrationChapter.java} | 39 +-- .../saga/orchestration/OrderService.java | 8 +- .../com/iluwatar/saga/orchestration/Saga.java | 65 ++-- .../saga/orchestration/SagaApplication.java | 58 ++-- .../saga/orchestration/SagaOrchestrator.java | 179 ++++++----- .../iluwatar/saga/orchestration/Service.java | 43 +-- .../ServiceDiscoveryService.java | 22 +- .../orchestration/WithdrawMoneyService.java | 26 +- .../choreography/SagaApplicationTest.java | 12 +- .../choreography/SagaChoreographyTest.java | 53 ++-- .../orchestration/SagaApplicationTest.java | 11 +- .../SagaOrchestratorInternallyTest.java | 184 +++++------ .../orchestration/SagaOrchestratorTest.java | 51 +-- 27 files changed, 825 insertions(+), 714 deletions(-) rename saga/src/main/java/com/iluwatar/saga/choreography/{Chapter.java => ChoreographyChapter.java} (65%) rename saga/src/main/java/com/iluwatar/saga/orchestration/{Chapter.java => OrchestrationChapter.java} (69%) diff --git a/saga/README.md b/saga/README.md index 276f12ee1f37..546ad598b7c0 100644 --- a/saga/README.md +++ b/saga/README.md @@ -1,7 +1,7 @@ --- layout: pattern title: Saga -folder: Communication +folder: saga permalink: /patterns/saga/ categories: Behavioral tags: @@ -43,4 +43,4 @@ Use the Saga pattern, if: - you can not use 2PC(two phase commit) ## Credits -- [pattern description](https://microservices.io/patterns/data/saga.html) \ No newline at end of file +- [Pattern: Saga](https://microservices.io/patterns/data/saga.html) \ No newline at end of file diff --git a/saga/pom.xml b/saga/pom.xml index 26c3312373a2..111f4e7b8134 100644 --- a/saga/pom.xml +++ b/saga/pom.xml @@ -23,22 +23,23 @@ THE SOFTWARE. --> - - 4.0.0 - - com.iluwatar - java-design-patterns - 1.22.0-SNAPSHOT - + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.22.0-SNAPSHOT + - saga - - - junit - junit - test - - + saga + + + junit + junit + test + + diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java b/saga/src/main/java/com/iluwatar/saga/choreography/ChoreographyChapter.java similarity index 65% rename from saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java rename to saga/src/main/java/com/iluwatar/saga/choreography/ChoreographyChapter.java index 51b0ce6b83f9..caa377a1e118 100644 --- a/saga/src/main/java/com/iluwatar/saga/choreography/Chapter.java +++ b/saga/src/main/java/com/iluwatar/saga/choreography/ChoreographyChapter.java @@ -24,37 +24,40 @@ /** - * Chapter is an interface representing a contract for an external service. + * ChoreographyChapter is an interface representing a contract for an external service. * In that case, a service needs to make a decision what to do further * hence the server needs to get all context representing {@link Saga} - * */ -public interface Chapter { - - /** - * In that case, every method is responsible to make a decision on what to do then - * @param saga incoming saga - * @return saga result - */ - Saga execute(Saga saga); - - /** - * @return service name. - */ - String getName(); - - /** - * The operation executed in general case. - * @param saga incoming saga - * @return result {@link Saga} - */ - Saga process(Saga saga); - - /** - * The operation executed in rollback case. - * @param saga incoming saga - * @return result {@link Saga} - */ - Saga rollback(Saga saga); + */ +public interface ChoreographyChapter { + + /** + * In that case, every method is responsible to make a decision on what to do then + * + * @param saga incoming saga + * @return saga result + */ + Saga execute(Saga saga); + + /** + * @return service name. + */ + String getName(); + + /** + * The operation executed in general case. + * + * @param saga incoming saga + * @return result {@link Saga} + */ + Saga process(Saga saga); + + /** + * The operation executed in rollback case. + * + * @param saga incoming saga + * @return result {@link Saga} + */ + Saga rollback(Saga saga); } diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/FlyBookingService.java b/saga/src/main/java/com/iluwatar/saga/choreography/FlyBookingService.java index 591324c52848..60b183be36f1 100644 --- a/saga/src/main/java/com/iluwatar/saga/choreography/FlyBookingService.java +++ b/saga/src/main/java/com/iluwatar/saga/choreography/FlyBookingService.java @@ -27,12 +27,12 @@ * Class representing a service to book a fly */ public class FlyBookingService extends Service { - public FlyBookingService(ServiceDiscoveryService service) { - super(service); - } + public FlyBookingService(ServiceDiscoveryService service) { + super(service); + } - @Override - public String getName() { - return "booking a Fly"; - } + @Override + public String getName() { + return "booking a Fly"; + } } diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/HotelBookingService.java b/saga/src/main/java/com/iluwatar/saga/choreography/HotelBookingService.java index e822a35682cf..0bbf1d3e3118 100644 --- a/saga/src/main/java/com/iluwatar/saga/choreography/HotelBookingService.java +++ b/saga/src/main/java/com/iluwatar/saga/choreography/HotelBookingService.java @@ -27,14 +27,14 @@ * Class representing a service to book a hotel */ public class HotelBookingService extends Service { - public HotelBookingService(ServiceDiscoveryService service) { - super(service); - } + public HotelBookingService(ServiceDiscoveryService service) { + super(service); + } - @Override - public String getName() { - return "booking a Hotel"; - } + @Override + public String getName() { + return "booking a Hotel"; + } - } +} diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/OrderService.java b/saga/src/main/java/com/iluwatar/saga/choreography/OrderService.java index 6c8b9912ec10..3a2c002b1796 100644 --- a/saga/src/main/java/com/iluwatar/saga/choreography/OrderService.java +++ b/saga/src/main/java/com/iluwatar/saga/choreography/OrderService.java @@ -26,14 +26,14 @@ /** * Class representing a service to init a new order. */ -public class OrderService extends Service{ +public class OrderService extends Service { - public OrderService(ServiceDiscoveryService service) { - super(service); - } + public OrderService(ServiceDiscoveryService service) { + super(service); + } - @Override - public String getName() { - return "init an order"; - } + @Override + public String getName() { + return "init an order"; + } } diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/Saga.java b/saga/src/main/java/com/iluwatar/saga/choreography/Saga.java index 34a8d6a0f39d..35069b80f9db 100644 --- a/saga/src/main/java/com/iluwatar/saga/choreography/Saga.java +++ b/saga/src/main/java/com/iluwatar/saga/choreography/Saga.java @@ -29,131 +29,187 @@ /** * Saga representation. * Saga consists of chapters. - * Every Chapter is executed a certain service. + * Every ChoreographyChapter is executed a certain service. */ public class Saga { - private List chapters; - private int pos; - private boolean forward; - private boolean finished; - - - public static Saga create() { - return new Saga(); - } - public SagaResult getResult() { - return !finished ? - SagaResult.PROGRESS : - forward ? - SagaResult.FINISHED : - SagaResult.ROLLBACKED; - } - public Saga chapter(String name) { - this.chapters.add(new Chapter(name)); - return this; - } - public Saga setInValue(Object value){ - if(chapters.isEmpty()){ - return this; - } - chapters.get(chapters.size()-1).setInValue(value); - return this; - } - public Object getCurrentValue(){ - return chapters.get(pos).getInValue(); - } - public void setCurrentValue(Object value){ - chapters.get(pos).setInValue(value); - } - public void setCurrentStatus(ChapterResult result){ - chapters.get(pos).setResult(result); + private List chapters; + private int pos; + private boolean forward; + private boolean finished; + + + public static Saga create() { + return new Saga(); + } + + /** + * get resuzlt of saga + * + * @return result of saga @see {@link SagaResult} + */ + public SagaResult getResult() { + if (finished) { + return forward + ? SagaResult.FINISHED + : SagaResult.ROLLBACKED; + } + + return SagaResult.PROGRESS; + } + + /** + * add chapter to saga + * @param name chapter name + * @return this + */ + public Saga chapter(String name) { + this.chapters.add(new Chapter(name)); + return this; + } + + /** + * set value to last chapter + * @param value invalue + * @return this + */ + public Saga setInValue(Object value) { + if (chapters.isEmpty()) { + return this; + } + chapters.get(chapters.size() - 1).setInValue(value); + return this; + } + + /** + * get value from current chapter + * @return value + */ + public Object getCurrentValue() { + return chapters.get(pos).getInValue(); + } + + /** + * set value to current chapter + * @param value to set + */ + public void setCurrentValue(Object value) { + chapters.get(pos).setInValue(value); + } + + /** + * set status for current chapter + * @param result to set + */ + public void setCurrentStatus(ChapterResult result) { + chapters.get(pos).setResult(result); + } + + void setFinished(boolean finished) { + this.finished = finished; + } + + boolean isForward() { + return forward; + } + + int forward() { + return ++pos; + } + + int back() { + this.forward = false; + return --pos; + } + + + private Saga() { + this.chapters = new ArrayList<>(); + this.pos = 0; + this.forward = true; + this.finished = false; + } + + Chapter getCurrent() { + return chapters.get(pos); + } + + + boolean isPresent() { + return pos >= 0 && pos < chapters.size(); + } + + boolean isCurrentSuccess() { + return chapters.get(pos).isSuccess(); + } + + /*** + * Class presents a chapter status and incoming parameters(incoming parameter transforms to outcoming parameter) + */ + public static class Chapter { + private String name; + private ChapterResult result; + private Object inValue; + + + public Chapter(String name) { + this.name = name; + this.result = ChapterResult.INIT; + } + + public Object getInValue() { + return inValue; + } + + public void setInValue(Object object) { + this.inValue = object; + } + + public String getName() { + return name; } - - void setFinished(boolean finished) { - this.finished = finished; - } - boolean isForward() { - return forward; - } - int forward() { - return ++pos; - } - - int back() { - this.forward = false; - return --pos; - } - - - public Saga() { - this.chapters = new ArrayList<>(); - this.pos = 0; - this.forward = true; - this.finished = false; - } - - Chapter getCurrent() { - return chapters.get(pos); - } - - - boolean isPresent() { - return pos >= 0 && pos < chapters.size(); - } - boolean isCurrentSuccess(){ - return chapters.get(pos).isSuccess(); - } - - /*** - * Class presents a chapter status and incoming parameters(incoming parameter transforms to outcoming parameter) + + /** + * set result + * @param result {@link ChapterResult} */ - public static class Chapter { - private String name; - private ChapterResult result; - private Object inValue; - - - public Chapter(String name) { - this.name = name; - this.result = ChapterResult.INIT; - } - - public Object getInValue() { - return inValue; - } - - public void setInValue(Object object) { - this.inValue = object; - } - - public String getName() { - return name; - } - public void setResult(ChapterResult result){ - this.result = result; - } - - public boolean isSuccess(){ - return result == ChapterResult.SUCCESS; - } + public void setResult(ChapterResult result) { + this.result = result; } - - public enum ChapterResult { - INIT, SUCCESS, ROLLBACK - } - - public enum SagaResult { - PROGRESS, FINISHED, ROLLBACKED - } - - @Override - public String toString() { - return "Saga{" + - "chapters=" + Arrays.toString(chapters.toArray()) + - ", pos=" + pos + - ", forward=" + forward + - '}'; - } + /** + * the result for chapter is good + * @return true if is good otherwise bad + */ + public boolean isSuccess() { + return result == ChapterResult.SUCCESS; + } + } + + + /** + * result for chapter + */ + public enum ChapterResult { + INIT, SUCCESS, ROLLBACK + } + + /** + * result for saga + */ + public enum SagaResult { + PROGRESS, FINISHED, ROLLBACKED + } + + @Override + public String toString() { + return "Saga{" + + "chapters=" + + Arrays.toString(chapters.toArray()) + + ", pos=" + + pos + + ", forward=" + + forward + + '}'; + } } diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/SagaApplication.java b/saga/src/main/java/com/iluwatar/saga/choreography/SagaApplication.java index 46792adac113..3aeb8672c534 100644 --- a/saga/src/main/java/com/iluwatar/saga/choreography/SagaApplication.java +++ b/saga/src/main/java/com/iluwatar/saga/choreography/SagaApplication.java @@ -44,34 +44,37 @@ * @see Service */ public class SagaApplication { - private static final Logger logger = LoggerFactory.getLogger(SagaApplication.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SagaApplication.class); - public static void main(String[] args) { - ServiceDiscoveryService sd = serviceDiscovery(); - Chapter service = sd.findAny(); - Saga goodOrderSaga = service.execute(newSaga("good_order")); - Saga badOrderSaga = service.execute(newSaga("bad_order")); - logger.info("orders: goodOrder is {}, badOrder is {}", - goodOrderSaga.getResult(), badOrderSaga.getResult()); + /** + * main method + */ + public static void main(String[] args) { + ServiceDiscoveryService sd = serviceDiscovery(); + ChoreographyChapter service = sd.findAny(); + Saga goodOrderSaga = service.execute(newSaga("good_order")); + Saga badOrderSaga = service.execute(newSaga("bad_order")); + LOGGER.info("orders: goodOrder is {}, badOrder is {}", + goodOrderSaga.getResult(), badOrderSaga.getResult()); - } + } - private static Saga newSaga(Object value) { - return Saga - .create() - .chapter("init an order").setInValue(value) - .chapter("booking a Fly") - .chapter("booking a Hotel") - .chapter("withdrawing Money"); - } + private static Saga newSaga(Object value) { + return Saga + .create() + .chapter("init an order").setInValue(value) + .chapter("booking a Fly") + .chapter("booking a Hotel") + .chapter("withdrawing Money"); + } - private static ServiceDiscoveryService serviceDiscovery() { - ServiceDiscoveryService sd = new ServiceDiscoveryService(); - return sd - .discover(new OrderService(sd)) - .discover(new FlyBookingService(sd)) - .discover(new HotelBookingService(sd)) - .discover(new WithdrawMoneyService(sd)); - } + private static ServiceDiscoveryService serviceDiscovery() { + ServiceDiscoveryService sd = new ServiceDiscoveryService(); + return sd + .discover(new OrderService(sd)) + .discover(new FlyBookingService(sd)) + .discover(new HotelBookingService(sd)) + .discover(new WithdrawMoneyService(sd)); + } } diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/Service.java b/saga/src/main/java/com/iluwatar/saga/choreography/Service.java index 0f182e570927..a602b1147ba7 100644 --- a/saga/src/main/java/com/iluwatar/saga/choreography/Service.java +++ b/saga/src/main/java/com/iluwatar/saga/choreography/Service.java @@ -25,79 +25,85 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.function.Supplier; + /** * Common abstraction class representing services - * implementing a general contract @see {@link Chapter} + * implementing a general contract @see {@link ChoreographyChapter} */ -public abstract class Service implements Chapter { - protected static final Logger logger = LoggerFactory.getLogger(Service.class); - - private final ServiceDiscoveryService sd; +public abstract class Service implements ChoreographyChapter { + protected static final Logger LOGGER = LoggerFactory.getLogger(Service.class); - public Service(ServiceDiscoveryService service) { - this.sd = service; - } + private final ServiceDiscoveryService sd; - @Override - public Saga execute(Saga saga) { - Saga nextSaga = saga; - Object nextVal; - String chapterName = saga.getCurrent().getName(); - if (chapterName.equals(getName())) { - if (saga.isForward()) { - nextSaga = process(saga); - nextVal = nextSaga.getCurrentValue(); - if (nextSaga.isCurrentSuccess()) { - nextSaga.forward(); - } else { - nextSaga.back(); - } - } else { - nextSaga = rollback(saga); - nextVal = nextSaga.getCurrentValue(); - nextSaga.back(); - } + public Service(ServiceDiscoveryService service) { + this.sd = service; + } - if (isSagaFinished(nextSaga)) { - return nextSaga; - } - - nextSaga.setCurrentValue(nextVal); + @Override + public Saga execute(Saga saga) { + Saga nextSaga = saga; + Object nextVal; + String chapterName = saga.getCurrent().getName(); + if (chapterName.equals(getName())) { + if (saga.isForward()) { + nextSaga = process(saga); + nextVal = nextSaga.getCurrentValue(); + if (nextSaga.isCurrentSuccess()) { + nextSaga.forward(); + } else { + nextSaga.back(); } - Saga finalNextSaga = nextSaga; + } else { + nextSaga = rollback(saga); + nextVal = nextSaga.getCurrentValue(); + nextSaga.back(); + } - return sd.find(chapterName).map(ch -> ch.execute(finalNextSaga)) - .orElseThrow(RuntimeException::new); - } + if (isSagaFinished(nextSaga)) { + return nextSaga; + } - @Override - public Saga process(Saga saga) { - Object inValue = saga.getCurrentValue(); - logger.info("The chapter '{}' has been started. The data {} has been stored or calculated successfully", - getName(), inValue); - saga.setCurrentStatus(Saga.ChapterResult.SUCCESS); - saga.setCurrentValue(inValue); - return saga; + nextSaga.setCurrentValue(nextVal); } + Saga finalNextSaga = nextSaga; - @Override - public Saga rollback(Saga saga) { - Object inValue = saga.getCurrentValue(); - logger.info("The Rollback for a chapter '{}' has been started. The data {} has been rollbacked successfully", - getName(), inValue); + return sd.find(chapterName).map(ch -> ch.execute(finalNextSaga)) + .orElseThrow(serviceNotFoundException(chapterName)); + } - saga.setCurrentStatus(Saga.ChapterResult.ROLLBACK); - saga.setCurrentValue(inValue); - return saga; - } + private Supplier serviceNotFoundException(String chServiceName) { + return () -> new RuntimeException(String.format("the service %s has not been found", chServiceName)); + } - private boolean isSagaFinished(Saga saga) { - if (!saga.isPresent()) { - saga.setFinished(true); - logger.info(" the saga has been finished with {} status", saga.getResult()); - return true; - } - return false; + @Override + public Saga process(Saga saga) { + Object inValue = saga.getCurrentValue(); + LOGGER.info("The chapter '{}' has been started. The data {} has been stored or calculated successfully", + getName(), inValue); + saga.setCurrentStatus(Saga.ChapterResult.SUCCESS); + saga.setCurrentValue(inValue); + return saga; + } + + @Override + public Saga rollback(Saga saga) { + Object inValue = saga.getCurrentValue(); + LOGGER.info("The Rollback for a chapter '{}' has been started. The data {} has been rollbacked successfully", + getName(), inValue); + + saga.setCurrentStatus(Saga.ChapterResult.ROLLBACK); + saga.setCurrentValue(inValue); + return saga; + } + + private boolean isSagaFinished(Saga saga) { + if (!saga.isPresent()) { + saga.setFinished(true); + LOGGER.info(" the saga has been finished with {} status", saga.getResult()); + return true; } + return false; + } } diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/ServiceDiscoveryService.java b/saga/src/main/java/com/iluwatar/saga/choreography/ServiceDiscoveryService.java index 11512d112ea5..919c99f02ede 100644 --- a/saga/src/main/java/com/iluwatar/saga/choreography/ServiceDiscoveryService.java +++ b/saga/src/main/java/com/iluwatar/saga/choreography/ServiceDiscoveryService.java @@ -32,29 +32,30 @@ * The class representing a service discovery pattern. */ public class ServiceDiscoveryService { - private Map services; - - /** - * find any service - * @return any service - * @throws NoSuchElementException if no elements further - */ - public Chapter findAny(){ - return services.values().iterator().next(); - } - - public Optional find(String service) { - return Optional.ofNullable(services.getOrDefault(service, null)); - } - - public ServiceDiscoveryService discover(Chapter chapterService) { - services.put(chapterService.getName(), chapterService); - return this; - } - - public ServiceDiscoveryService() { - this.services = new HashMap<>(); - } + private Map services; + + /** + * find any service + * + * @return any service + * @throws NoSuchElementException if no elements further + */ + public ChoreographyChapter findAny() { + return services.values().iterator().next(); + } + + public Optional find(String service) { + return Optional.ofNullable(services.getOrDefault(service, null)); + } + + public ServiceDiscoveryService discover(ChoreographyChapter chapterService) { + services.put(chapterService.getName(), chapterService); + return this; + } + + public ServiceDiscoveryService() { + this.services = new HashMap<>(); + } } diff --git a/saga/src/main/java/com/iluwatar/saga/choreography/WithdrawMoneyService.java b/saga/src/main/java/com/iluwatar/saga/choreography/WithdrawMoneyService.java index c13b1b1f8891..b30a05e9576c 100644 --- a/saga/src/main/java/com/iluwatar/saga/choreography/WithdrawMoneyService.java +++ b/saga/src/main/java/com/iluwatar/saga/choreography/WithdrawMoneyService.java @@ -28,26 +28,26 @@ */ public class WithdrawMoneyService extends Service { - public WithdrawMoneyService(ServiceDiscoveryService service) { - super(service); - } + public WithdrawMoneyService(ServiceDiscoveryService service) { + super(service); + } - @Override - public String getName() { - return "withdrawing Money"; - } + @Override + public String getName() { + return "withdrawing Money"; + } - @Override - public Saga process(Saga saga) { - Object inValue = saga.getCurrentValue(); + @Override + public Saga process(Saga saga) { + Object inValue = saga.getCurrentValue(); - if (inValue.equals("bad_order") ) { - logger.info("The chapter '{}' has been started. But the exception has been raised." + - "The rollback is about to start", - getName(), inValue); - saga.setCurrentStatus(Saga.ChapterResult.ROLLBACK); - return saga; - } - return super.process(saga); + if (inValue.equals("bad_order")) { + LOGGER.info("The chapter '{}' has been started. But the exception has been raised." + + "The rollback is about to start", + getName(), inValue); + saga.setCurrentStatus(Saga.ChapterResult.ROLLBACK); + return saga; } + return super.process(saga); + } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/ChapterResult.java b/saga/src/main/java/com/iluwatar/saga/orchestration/ChapterResult.java index eae95b3391f8..a8a1e7b5e869 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/ChapterResult.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/ChapterResult.java @@ -24,34 +24,38 @@ /** * Executing result for chapter + * * @param incoming value */ public class ChapterResult { - private K value; - private State state; + private K value; + private State state; - public K getValue() { - return value; - } + public K getValue() { + return value; + } - ChapterResult(K value, State state) { - this.value = value; - this.state = state; - } + ChapterResult(K value, State state) { + this.value = value; + this.state = state; + } - public boolean isSuccess(){ - return state == State.SUCCESS; - } + public boolean isSuccess() { + return state == State.SUCCESS; + } - public static ChapterResult success(K val) { - return new ChapterResult<>(val, State.SUCCESS); - } + public static ChapterResult success(K val) { + return new ChapterResult<>(val, State.SUCCESS); + } - public static ChapterResult failure(K val) { - return new ChapterResult<>(val, State.FAILURE); - } + public static ChapterResult failure(K val) { + return new ChapterResult<>(val, State.FAILURE); + } - public enum State { - SUCCESS, FAILURE - } + /** + * state for chapter + */ + public enum State { + SUCCESS, FAILURE + } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java index 6cb8479c07b2..5dc0577bc35d 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/FlyBookingService.java @@ -26,8 +26,8 @@ * Class representing a service to book a fly */ public class FlyBookingService extends Service { - @Override - public String getName() { - return "booking a Fly"; - } + @Override + public String getName() { + return "booking a Fly"; + } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java index e21046328918..51d8d5aad8f9 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/HotelBookingService.java @@ -26,25 +26,25 @@ * Class representing a service to book a hotel */ public class HotelBookingService extends Service { - @Override - public String getName() { - return "booking a Hotel"; - } + @Override + public String getName() { + return "booking a Hotel"; + } - @Override - public ChapterResult rollback(String value) { - if(value.equals("crashed_order")){ - logger.info("The Rollback for a chapter '{}' has been started. " + - "The data {} has been failed.The saga has been crashed.", - getName(), value); + @Override + public ChapterResult rollback(String value) { + if (value.equals("crashed_order")) { + LOGGER.info("The Rollback for a chapter '{}' has been started. " + + "The data {} has been failed.The saga has been crashed.", + getName(), value); - return ChapterResult.failure(value); - } + return ChapterResult.failure(value); + } - logger.info("The Rollback for a chapter '{}' has been started. The data {} has been rollbacked successfully", - getName(), value); + LOGGER.info("The Rollback for a chapter '{}' has been started. The data {} has been rollbacked successfully", + getName(), value); - return super.rollback(value); - } + return super.rollback(value); + } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Chapter.java b/saga/src/main/java/com/iluwatar/saga/orchestration/OrchestrationChapter.java similarity index 69% rename from saga/src/main/java/com/iluwatar/saga/orchestration/Chapter.java rename to saga/src/main/java/com/iluwatar/saga/orchestration/OrchestrationChapter.java index 961a8893733a..861382a00ee8 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/Chapter.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/OrchestrationChapter.java @@ -23,28 +23,31 @@ package com.iluwatar.saga.orchestration; /** - * Chapter is an interface representing a contract for an external service. + * ChoreographyChapter is an interface representing a contract for an external service. + * * @param is type for passing params */ -public interface Chapter { +public interface OrchestrationChapter { - /** - * @return service name. - */ - String getName(); + /** + * @return service name. + */ + String getName(); - /** - * The operation executed in general case. - * @param value incoming value - * @return result {@link ChapterResult} - */ - ChapterResult process(K value); + /** + * The operation executed in general case. + * + * @param value incoming value + * @return result {@link ChapterResult} + */ + ChapterResult process(K value); - /** - * The operation executed in rollback case. - * @param value incoming value - * @return result {@link ChapterResult} - */ - ChapterResult rollback(K value); + /** + * The operation executed in rollback case. + * + * @param value incoming value + * @return result {@link ChapterResult} + */ + ChapterResult rollback(K value); } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java index 6edd94ace40a..32b9ce90b2c6 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/OrderService.java @@ -26,8 +26,8 @@ * Class representing a service to init a new order. */ public class OrderService extends Service { - @Override - public String getName() { - return "init an order"; - } + @Override + public String getName() { + return "init an order"; + } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java index f24a8366c56f..e42b06f9a955 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Saga.java @@ -28,49 +28,56 @@ /** * Saga representation. * Saga consists of chapters. - * Every Chapter is executed by a certain service. + * Every ChoreographyChapter is executed by a certain service. */ public class Saga { - private List chapters; + private List chapters; - public Saga() { - this.chapters = new ArrayList<>(); - } + private Saga() { + this.chapters = new ArrayList<>(); + } - public Saga chapter(String name) { - this.chapters.add(new Chapter(name)); - return this; - } + public Saga chapter(String name) { + this.chapters.add(new Chapter(name)); + return this; + } - public Chapter get(int idx) { - return chapters.get(idx); - } - public boolean isPresent(int idx) { - return idx >= 0 && idx < chapters.size(); - } + public Chapter get(int idx) { + return chapters.get(idx); + } + public boolean isPresent(int idx) { + return idx >= 0 && idx < chapters.size(); + } - public static Saga create() { - return new Saga(); - } - public enum Result { - FINISHED, ROLLBACK, CRASHED - } + public static Saga create() { + return new Saga(); + } - public static class Chapter { - String name; + /** + * result for saga + */ + public enum Result { + FINISHED, ROLLBACK, CRASHED + } - public Chapter(String name) { - this.name = name; - } + /** + * class represents chapter name + */ + public static class Chapter { + String name; + + public Chapter(String name) { + this.name = name; + } - public String getName() { - return name; - } + public String getName() { + return name; } + } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java index bbeca62bb039..6d7e9fd8d794 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaApplication.java @@ -31,11 +31,12 @@ * This pattern is used in distributed services to perform a group of operations atomically. * This is an analog of transaction in a database but in terms of microservices architecture this is executed * in a distributed environment - * + *

    * A saga is a sequence of local transactions in a certain context. If one transaction fails for some reason, * the saga executes compensating transactions(rollbacks) to undo the impact of the preceding transactions. - * - * In this approach, there is an orchestrator @see {@link SagaOrchestrator} that manages all the transactions and directs + *

    + * In this approach, there is an orchestrator @see {@link SagaOrchestrator} + * that manages all the transactions and directs * the participant services to execute local transactions based on events. * The major difference with choreography saga is an ability to handle crashed services * (otherwise in choreography services very hard to prevent a saga if one of them has been crashed) @@ -45,34 +46,37 @@ * @see Service */ public class SagaApplication { - private static final Logger logger = LoggerFactory.getLogger(SagaApplication.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SagaApplication.class); - public static void main(String[] args) { - SagaOrchestrator sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery()); + /** + * method to show common saga logic + */ + public static void main(String[] args) { + SagaOrchestrator sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery()); - Saga.Result goodOrder = sagaOrchestrator.execute("good_order"); - Saga.Result badOrder = sagaOrchestrator.execute("bad_order"); - Saga.Result crashedOrder = sagaOrchestrator.execute("crashed_order"); + Saga.Result goodOrder = sagaOrchestrator.execute("good_order"); + Saga.Result badOrder = sagaOrchestrator.execute("bad_order"); + Saga.Result crashedOrder = sagaOrchestrator.execute("crashed_order"); - logger.info("orders: goodOrder is {}, badOrder is {},crashedOrder is {}",goodOrder,badOrder,crashedOrder); - } + LOGGER.info("orders: goodOrder is {}, badOrder is {},crashedOrder is {}", goodOrder, badOrder, crashedOrder); + } - private static Saga newSaga() { - return Saga - .create() - .chapter("init an order") - .chapter("booking a Fly") - .chapter("booking a Hotel") - .chapter("withdrawing Money"); - } + private static Saga newSaga() { + return Saga + .create() + .chapter("init an order") + .chapter("booking a Fly") + .chapter("booking a Hotel") + .chapter("withdrawing Money"); + } - private static ServiceDiscoveryService serviceDiscovery() { - return - new ServiceDiscoveryService() - .discover(new OrderService()) - .discover(new FlyBookingService()) - .discover(new HotelBookingService()) - .discover(new WithdrawMoneyService()); - } + private static ServiceDiscoveryService serviceDiscovery() { + return + new ServiceDiscoveryService() + .discover(new OrderService()) + .discover(new FlyBookingService()) + .discover(new HotelBookingService()) + .discover(new WithdrawMoneyService()); + } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java index c005d70df187..2f25ebd462e7 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/SagaOrchestrator.java @@ -34,107 +34,112 @@ * the participant services to execute local transactions based on events. */ public class SagaOrchestrator { - private static final Logger logger = LoggerFactory.getLogger(SagaOrchestrator.class); - private final Saga saga; - private final ServiceDiscoveryService sd; - private final CurrentState state; + private static final Logger LOGGER = LoggerFactory.getLogger(SagaOrchestrator.class); + private final Saga saga; + private final ServiceDiscoveryService sd; + private final CurrentState state; + + + /** + * Create a new service to orchetrate sagas + * @param saga saga to process + * @param sd service discovery @see {@link ServiceDiscoveryService} + */ + public SagaOrchestrator(Saga saga, ServiceDiscoveryService sd) { + this.saga = saga; + this.sd = sd; + this.state = new CurrentState(); + } + + /** + * pipeline to execute saga process/story + * + * @param value incoming value + * @param type for incoming value + * @return result @see {@link Saga.Result} + */ + @SuppressWarnings("unchecked") + public Saga.Result execute(K value) { + state.cleanUp(); + LOGGER.info(" The new saga is about to start"); + Saga.Result result = FINISHED; + K tempVal = value; + + while (true) { + int next = state.current(); + Saga.Chapter ch = saga.get(next); + Optional srvOpt = sd.find(ch.name); + + if (!srvOpt.isPresent()) { + state.directionToBack(); + state.back(); + continue; + } + + OrchestrationChapter srv = srvOpt.get(); + + if (state.isForward()) { + ChapterResult processRes = srv.process(tempVal); + if (processRes.isSuccess()) { + next = state.forward(); + tempVal = (K) processRes.getValue(); + } else { + state.directionToBack(); + } + } else { + ChapterResult rlRes = srv.rollback(tempVal); + if (rlRes.isSuccess()) { + next = state.back(); + tempVal = (K) rlRes.getValue(); + } else { + result = CRASHED; + next = state.back(); + } + } - public SagaOrchestrator(Saga saga, ServiceDiscoveryService sd) { - this.saga = saga; - this.sd = sd; - this.state = new CurrentState(); + if (!saga.isPresent(next)) { + return state.isForward() ? FINISHED : result == CRASHED ? CRASHED : ROLLBACK; + } } - /** - * pipeline to execute saga process/story - * - * @param value incoming value - * @param type for incoming value - * @return result @see {@link Saga.Result} - */ - @SuppressWarnings("unchecked") - public Saga.Result execute(K value) { - state.cleanUp(); - logger.info(" The new saga is about to start"); - Saga.Result result = FINISHED; - K tempVal = value; - - while (true) { - int next = state.current(); - Saga.Chapter ch = saga.get(next); - Optional srvOpt = sd.find(ch.name); - - if (!srvOpt.isPresent()) { - state.directionToBack(); - state.back(); - continue; - } - - Chapter srv = srvOpt.get(); - - if (state.isForward()) { - ChapterResult processRes = srv.process(tempVal); - if (processRes.isSuccess()) { - next = state.forward(); - tempVal = (K) processRes.getValue(); - } else { - state.directionToBack(); - } - } else { - ChapterResult rlRes = srv.rollback(tempVal); - if (rlRes.isSuccess()) { - next = state.back(); - tempVal = (K) rlRes.getValue(); - } else { - result = CRASHED; - next = state.back(); - } - } - - - if (!saga.isPresent(next)) { - return state.isForward() ? FINISHED : result == CRASHED ? CRASHED : ROLLBACK; - } - } - - } + } - private static class CurrentState { - int currentNumber; - boolean isForward; + private static class CurrentState { + int currentNumber; + boolean isForward; - void cleanUp() { - currentNumber = 0; - isForward = true; - } + void cleanUp() { + currentNumber = 0; + isForward = true; + } - CurrentState() { - this.currentNumber = 0; - this.isForward = true; - } + CurrentState() { + this.currentNumber = 0; + this.isForward = true; + } - boolean isForward() { - return isForward; - } + boolean isForward() { + return isForward; + } - void directionToBack() { - isForward = false; - } + void directionToBack() { + isForward = false; + } - int forward() { - return ++currentNumber; - } + int forward() { + return ++currentNumber; + } - int back() { - return --currentNumber; - } + int back() { + return --currentNumber; + } - int current() { - return currentNumber; - } + int current() { + return currentNumber; } + } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java b/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java index 20b34f55aa95..c4ba2a9e198e 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/Service.java @@ -27,29 +27,30 @@ /** * Common abstraction class representing services - * implementing a general contract @see {@link Chapter} + * implementing a general contract @see {@link OrchestrationChapter} + * * @param type of incoming param */ -public abstract class Service implements Chapter { - protected static final Logger logger = LoggerFactory.getLogger(Service.class); - - @Override - public abstract String getName(); - - - @Override - public ChapterResult process(K value) { - logger.info("The chapter '{}' has been started. The data {} has been stored or calculated successfully", - getName(),value); - return ChapterResult.success(value); - } - - @Override - public ChapterResult rollback(K value) { - logger.info("The Rollback for a chapter '{}' has been started. The data {} has been rollbacked successfully", - getName(),value); - return ChapterResult.success(value); - } +public abstract class Service implements OrchestrationChapter { + protected static final Logger LOGGER = LoggerFactory.getLogger(Service.class); + + @Override + public abstract String getName(); + + + @Override + public ChapterResult process(K value) { + LOGGER.info("The chapter '{}' has been started. The data {} has been stored or calculated successfully", + getName(), value); + return ChapterResult.success(value); + } + + @Override + public ChapterResult rollback(K value) { + LOGGER.info("The Rollback for a chapter '{}' has been started. The data {} has been rollbacked successfully", + getName(), value); + return ChapterResult.success(value); + } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java index 652740051b5e..4831730a72db 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/ServiceDiscoveryService.java @@ -30,20 +30,20 @@ * The class representing a service discovery pattern. */ public class ServiceDiscoveryService { - private Map> services; + private Map> services; - public Optional find(String service) { - return Optional.ofNullable(services.getOrDefault(service, null)); - } + public Optional find(String service) { + return Optional.ofNullable(services.getOrDefault(service, null)); + } - public ServiceDiscoveryService discover(Chapter chapterService) { - services.put(chapterService.getName(), chapterService); - return this; - } + public ServiceDiscoveryService discover(OrchestrationChapter orchestrationChapterService) { + services.put(orchestrationChapterService.getName(), orchestrationChapterService); + return this; + } - public ServiceDiscoveryService() { - this.services = new HashMap<>(); - } + public ServiceDiscoveryService() { + this.services = new HashMap<>(); + } } diff --git a/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java b/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java index dad15cec3864..f5a0c90f3707 100644 --- a/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java +++ b/saga/src/main/java/com/iluwatar/saga/orchestration/WithdrawMoneyService.java @@ -26,19 +26,19 @@ * Class representing a service to withdraw a money */ public class WithdrawMoneyService extends Service { - @Override - public String getName() { - return "withdrawing Money"; - } + @Override + public String getName() { + return "withdrawing Money"; + } - @Override - public ChapterResult process(String value) { - if (value.equals("bad_order") || value.equals("crashed_order")) { - logger.info("The chapter '{}' has been started. But the exception has been raised." + - "The rollback is about to start", - getName(), value); - return ChapterResult.failure(value); - } - return super.process(value); + @Override + public ChapterResult process(String value) { + if (value.equals("bad_order") || value.equals("crashed_order")) { + LOGGER.info("The chapter '{}' has been started. But the exception has been raised." + + "The rollback is about to start", + getName(), value); + return ChapterResult.failure(value); } + return super.process(value); + } } diff --git a/saga/src/test/java/com/iluwatar/saga/choreography/SagaApplicationTest.java b/saga/src/test/java/com/iluwatar/saga/choreography/SagaApplicationTest.java index 5802f54ec6c5..d7a2a34b2787 100644 --- a/saga/src/test/java/com/iluwatar/saga/choreography/SagaApplicationTest.java +++ b/saga/src/test/java/com/iluwatar/saga/choreography/SagaApplicationTest.java @@ -25,11 +25,13 @@ import com.iluwatar.saga.orchestration.SagaApplication; import org.junit.Test; -import static org.junit.Assert.*; +/*** + * empty test + */ public class SagaApplicationTest { - @Test - public void mainTest() { - SagaApplication.main(new String[]{}); - } + @Test + public void mainTest() { + SagaApplication.main(new String[]{}); + } } \ No newline at end of file diff --git a/saga/src/test/java/com/iluwatar/saga/choreography/SagaChoreographyTest.java b/saga/src/test/java/com/iluwatar/saga/choreography/SagaChoreographyTest.java index 8c8daa7c991f..4300d4057780 100644 --- a/saga/src/test/java/com/iluwatar/saga/choreography/SagaChoreographyTest.java +++ b/saga/src/test/java/com/iluwatar/saga/choreography/SagaChoreographyTest.java @@ -25,35 +25,38 @@ import org.junit.Assert; import org.junit.Test; +/** + * test to check choreography saga + */ public class SagaChoreographyTest { - @Test - public void executeTest() { - ServiceDiscoveryService sd = serviceDiscovery(); - Chapter service = sd.findAny(); - Saga badOrderSaga = service.execute(newSaga("bad_order")); - Saga goodOrderSaga = service.execute(newSaga("good_order")); + @Test + public void executeTest() { + ServiceDiscoveryService sd = serviceDiscovery(); + ChoreographyChapter service = sd.findAny(); + Saga badOrderSaga = service.execute(newSaga("bad_order")); + Saga goodOrderSaga = service.execute(newSaga("good_order")); - Assert.assertEquals(badOrderSaga.getResult(), Saga.SagaResult.ROLLBACKED); - Assert.assertEquals(goodOrderSaga.getResult(), Saga.SagaResult.FINISHED); - } + Assert.assertEquals(badOrderSaga.getResult(), Saga.SagaResult.ROLLBACKED); + Assert.assertEquals(goodOrderSaga.getResult(), Saga.SagaResult.FINISHED); + } - private static Saga newSaga(Object value) { - return Saga - .create() - .chapter("init an order").setInValue(value) - .chapter("booking a Fly") - .chapter("booking a Hotel") - .chapter("withdrawing Money"); - } + private static Saga newSaga(Object value) { + return Saga + .create() + .chapter("init an order").setInValue(value) + .chapter("booking a Fly") + .chapter("booking a Hotel") + .chapter("withdrawing Money"); + } - private static ServiceDiscoveryService serviceDiscovery() { - ServiceDiscoveryService sd = new ServiceDiscoveryService(); - return sd - .discover(new OrderService(sd)) - .discover(new FlyBookingService(sd)) - .discover(new HotelBookingService(sd)) - .discover(new WithdrawMoneyService(sd)); - } + private static ServiceDiscoveryService serviceDiscovery() { + ServiceDiscoveryService sd = new ServiceDiscoveryService(); + return sd + .discover(new OrderService(sd)) + .discover(new FlyBookingService(sd)) + .discover(new HotelBookingService(sd)) + .discover(new WithdrawMoneyService(sd)); + } } diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java index 4e4d86644b10..aa3c8773f46a 100644 --- a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java +++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaApplicationTest.java @@ -26,10 +26,13 @@ import static org.junit.Assert.*; +/** + * empty test + */ public class SagaApplicationTest { - @Test - public void mainTest() { - SagaApplication.main(new String[]{}); - } + @Test + public void mainTest() { + SagaApplication.main(new String[]{}); + } } \ No newline at end of file diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java index ce3b926a3775..a93bf5280cb6 100644 --- a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java +++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorInternallyTest.java @@ -28,112 +28,118 @@ import java.util.ArrayList; import java.util.List; +/** + * test to test orchestration logic + */ public class SagaOrchestratorInternallyTest { - private List records = new ArrayList<>(); + private List records = new ArrayList<>(); + + @Test + public void executeTest() { + SagaOrchestrator sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery()); + Saga.Result result = sagaOrchestrator.execute(1); + Assert.assertEquals(result, Saga.Result.ROLLBACK); + Assert.assertArrayEquals( + records.toArray(new String[]{}), + new String[]{"+1", "+2", "+3", "+4", "-4", "-3", "-2", "-1"}); + } + + private static Saga newSaga() { + return Saga + .create() + .chapter("1") + .chapter("2") + .chapter("3") + .chapter("4"); + } + + private ServiceDiscoveryService serviceDiscovery() { + return + new ServiceDiscoveryService() + .discover(new Service1()) + .discover(new Service2()) + .discover(new Service3()) + .discover(new Service4()); + } + + class Service1 extends Service { + + @Override + public String getName() { + return "1"; + } + + @Override + public ChapterResult process(Integer value) { + records.add("+1"); + return ChapterResult.success(value); + } + + @Override + public ChapterResult rollback(Integer value) { + records.add("-1"); + return ChapterResult.success(value); + } + } + + class Service2 extends Service { - @Test - public void executeTest() { - SagaOrchestrator sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery()); - Saga.Result result = sagaOrchestrator.execute(1); - Assert.assertEquals(result, Saga.Result.ROLLBACK); - Assert.assertArrayEquals( - records.toArray(new String[]{}), - new String[]{"+1","+2","+3","+4","-4","-3","-2","-1"}); + @Override + public String getName() { + return "2"; } - private static Saga newSaga() { - return Saga - .create() - .chapter("1") - .chapter("2") - .chapter("3") - .chapter("4"); + @Override + public ChapterResult process(Integer value) { + records.add("+2"); + return ChapterResult.success(value); } - private ServiceDiscoveryService serviceDiscovery() { - return - new ServiceDiscoveryService() - .discover(new Service1()) - .discover(new Service2()) - .discover(new Service3()) - .discover(new Service4()); + @Override + public ChapterResult rollback(Integer value) { + records.add("-2"); + return ChapterResult.success(value); } + } - class Service1 extends Service { + class Service3 extends Service { - @Override - public String getName() { - return "1"; - } + @Override + public String getName() { + return "3"; + } - @Override - public ChapterResult process(Integer value) { - records.add("+1"); - return ChapterResult.success(value); - } + @Override + public ChapterResult process(Integer value) { + records.add("+3"); + return ChapterResult.success(value); + } - @Override - public ChapterResult rollback(Integer value) { - records.add("-1"); - return ChapterResult.success(value); - } + @Override + public ChapterResult rollback(Integer value) { + records.add("-3"); + return ChapterResult.success(value); } + } + + class Service4 extends Service { - class Service2 extends Service { - - @Override - public String getName() { - return "2"; - } - @Override - public ChapterResult process(Integer value) { - records.add("+2"); - return ChapterResult.success(value); - } - - @Override - public ChapterResult rollback(Integer value) { - records.add("-2"); - return ChapterResult.success(value); - } + @Override + public String getName() { + return "4"; } - class Service3 extends Service { - - @Override - public String getName() { - return "3"; - } - @Override - public ChapterResult process(Integer value) { - records.add("+3"); - return ChapterResult.success(value); - } - - @Override - public ChapterResult rollback(Integer value) { - records.add("-3"); - return ChapterResult.success(value); - } + @Override + public ChapterResult process(Integer value) { + records.add("+4"); + return ChapterResult.failure(value); } - class Service4 extends Service { - - @Override - public String getName() { - return "4"; - } - @Override - public ChapterResult process(Integer value) { - records.add("+4"); - return ChapterResult.failure(value); - } - - @Override - public ChapterResult rollback(Integer value) { - records.add("-4"); - return ChapterResult.success(value); - } + @Override + public ChapterResult rollback(Integer value) { + records.add("-4"); + return ChapterResult.success(value); } + } } \ No newline at end of file diff --git a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java index bead0343d1b9..d3522418c346 100644 --- a/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java +++ b/saga/src/test/java/com/iluwatar/saga/orchestration/SagaOrchestratorTest.java @@ -25,33 +25,36 @@ import org.junit.Assert; import org.junit.Test; +/** + * test to check general logic + */ public class SagaOrchestratorTest { - @Test - public void execute() { - SagaOrchestrator sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery()); - Saga.Result badOrder = sagaOrchestrator.execute("bad_order"); - Saga.Result crashedOrder = sagaOrchestrator.execute("crashed_order"); + @Test + public void execute() { + SagaOrchestrator sagaOrchestrator = new SagaOrchestrator(newSaga(), serviceDiscovery()); + Saga.Result badOrder = sagaOrchestrator.execute("bad_order"); + Saga.Result crashedOrder = sagaOrchestrator.execute("crashed_order"); - Assert.assertEquals(badOrder, Saga.Result.ROLLBACK); - Assert.assertEquals(crashedOrder, Saga.Result.CRASHED); - } + Assert.assertEquals(badOrder, Saga.Result.ROLLBACK); + Assert.assertEquals(crashedOrder, Saga.Result.CRASHED); + } - private static Saga newSaga() { - return Saga - .create() - .chapter("init an order") - .chapter("booking a Fly") - .chapter("booking a Hotel") - .chapter("withdrawing Money"); - } + private static Saga newSaga() { + return Saga + .create() + .chapter("init an order") + .chapter("booking a Fly") + .chapter("booking a Hotel") + .chapter("withdrawing Money"); + } - private static ServiceDiscoveryService serviceDiscovery() { - return - new ServiceDiscoveryService() - .discover(new OrderService()) - .discover(new FlyBookingService()) - .discover(new HotelBookingService()) - .discover(new WithdrawMoneyService()); - } + private static ServiceDiscoveryService serviceDiscovery() { + return + new ServiceDiscoveryService() + .discover(new OrderService()) + .discover(new FlyBookingService()) + .discover(new HotelBookingService()) + .discover(new WithdrawMoneyService()); + } } \ No newline at end of file From 4f9ee0189c614085841668540b5350b66a85a927 Mon Sep 17 00:00:00 2001 From: Anurag Agarwal Date: Sun, 10 Nov 2019 22:09:27 +0530 Subject: [PATCH 140/197] Resolves checkstyle errors for converter, cqrs (#1063) * Reduces checkstyle errors in converter * Reduces checkstyle errors in cqrs --- .../main/java/com/iluwatar/converter/App.java | 7 ++- .../com/iluwatar/converter/Converter.java | 31 ++++++++---- .../java/com/iluwatar/converter/User.java | 19 ++++--- .../com/iluwatar/converter/UserConverter.java | 4 +- .../java/com/iluwatar/converter/UserDto.java | 18 ++++--- .../main/java/com/iluwatar/cqrs/app/App.java | 50 +++++++++---------- .../cqrs/commandes/CommandServiceImpl.java | 11 ++-- .../cqrs/commandes/ICommandService.java | 3 +- .../iluwatar/cqrs/constants/AppConstants.java | 4 +- .../iluwatar/cqrs/domain/model/Author.java | 13 ++--- .../com/iluwatar/cqrs/domain/model/Book.java | 14 +++--- .../java/com/iluwatar/cqrs/dto/Author.java | 19 +++---- .../main/java/com/iluwatar/cqrs/dto/Book.java | 13 ++--- .../iluwatar/cqrs/queries/IQueryService.java | 9 ++-- .../cqrs/queries/QueryServiceImpl.java | 34 ++++++------- .../com/iluwatar/cqrs/util/HibernateUtil.java | 7 +-- 16 files changed, 129 insertions(+), 127 deletions(-) diff --git a/converter/src/main/java/com/iluwatar/converter/App.java b/converter/src/main/java/com/iluwatar/converter/App.java index fab472328afd..935fc4f19943 100644 --- a/converter/src/main/java/com/iluwatar/converter/App.java +++ b/converter/src/main/java/com/iluwatar/converter/App.java @@ -23,12 +23,10 @@ package com.iluwatar.converter; - +import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - /** * The Converter pattern is a behavioral design pattern which allows a common way of bidirectional * conversion between corresponding types (e.g. DTO and domain representations of the logically @@ -38,8 +36,9 @@ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); + /** - * Program entry point + * Program entry point. * * @param args command line args */ diff --git a/converter/src/main/java/com/iluwatar/converter/Converter.java b/converter/src/main/java/com/iluwatar/converter/Converter.java index 256acec24942..10425e1ca907 100644 --- a/converter/src/main/java/com/iluwatar/converter/Converter.java +++ b/converter/src/main/java/com/iluwatar/converter/Converter.java @@ -30,8 +30,9 @@ /** * Generic converter, thanks to Java8 features not only provides a way of generic bidirectional - * conversion between corresponding types, but also a common way of converting a collection of objects - * of the same type, reducing boilerplate code to the absolute minimum. + * conversion between corresponding types, but also a common way of converting a collection of + * objects of the same type, reducing boilerplate code to the absolute minimum. + * * @param DTO representation's type * @param Domain representation's type */ @@ -41,7 +42,9 @@ public class Converter { private final Function fromEntity; /** - * @param fromDto Function that converts given dto entity into the domain entity. + * Constructor. + * + * @param fromDto Function that converts given dto entity into the domain entity. * @param fromEntity Function that converts given domain entity into the dto entity. */ public Converter(final Function fromDto, final Function fromEntity) { @@ -50,34 +53,44 @@ public Converter(final Function fromDto, final Function fromEntity) } /** + * Converts DTO to Entity. + * * @param dto DTO entity - * @return The domain representation - the result of the converting function application on dto entity. + * @return The domain representation - the result of the converting function application on dto + * entity. */ public final U convertFromDto(final T dto) { return fromDto.apply(dto); } /** + * Converts Entity to DTO. + * * @param entity domain entity - * @return The DTO representation - the result of the converting function application on domain entity. + * @return The DTO representation - the result of the converting function application on domain + * entity. */ public final T convertFromEntity(final U entity) { return fromEntity.apply(entity); } /** + * Converts list of DTOs to list of Entities. + * * @param dtos collection of DTO entities - * @return List of domain representation of provided entities retrieved by - * mapping each of them with the conversion function + * @return List of domain representation of provided entities retrieved by mapping each of them + * with the conversion function */ public final List createFromDtos(final Collection dtos) { return dtos.stream().map(this::convertFromDto).collect(Collectors.toList()); } /** + * Converts list of Entities to list of DTOs. + * * @param entities collection of domain entities - * @return List of domain representation of provided entities retrieved by - * mapping each of them with the conversion function + * @return List of domain representation of provided entities retrieved by mapping each of them + * with the conversion function */ public final List createFromEntities(final Collection entities) { return entities.stream().map(this::convertFromEntity).collect(Collectors.toList()); diff --git a/converter/src/main/java/com/iluwatar/converter/User.java b/converter/src/main/java/com/iluwatar/converter/User.java index 05d7313e000a..ae5e89f7c9a1 100644 --- a/converter/src/main/java/com/iluwatar/converter/User.java +++ b/converter/src/main/java/com/iluwatar/converter/User.java @@ -26,7 +26,7 @@ import java.util.Objects; /** - * User class + * User class. */ public class User { private String firstName; @@ -35,10 +35,12 @@ public class User { private String userId; /** + * Constructor. + * * @param firstName user's first name * @param lastName user's last name * @param isActive flag indicating whether the user is active - * @param userId user's identificator + * @param userId user's identificator */ public User(String firstName, String lastName, boolean isActive, String userId) { this.firstName = firstName; @@ -63,7 +65,8 @@ public String getUserId() { return userId; } - @Override public boolean equals(Object o) { + @Override + public boolean equals(Object o) { if (this == o) { return true; } @@ -72,15 +75,17 @@ public String getUserId() { } User user = (User) o; return isActive == user.isActive && Objects.equals(firstName, user.firstName) && Objects - .equals(lastName, user.lastName) && Objects.equals(userId, user.userId); + .equals(lastName, user.lastName) && Objects.equals(userId, user.userId); } - @Override public int hashCode() { + @Override + public int hashCode() { return Objects.hash(firstName, lastName, isActive, userId); } - @Override public String toString() { + @Override + public String toString() { return "User{" + "firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' - + ", isActive=" + isActive + ", userId='" + userId + '\'' + '}'; + + ", isActive=" + isActive + ", userId='" + userId + '\'' + '}'; } } diff --git a/converter/src/main/java/com/iluwatar/converter/UserConverter.java b/converter/src/main/java/com/iluwatar/converter/UserConverter.java index d26703cc2c63..8637c042d48f 100644 --- a/converter/src/main/java/com/iluwatar/converter/UserConverter.java +++ b/converter/src/main/java/com/iluwatar/converter/UserConverter.java @@ -33,8 +33,8 @@ public class UserConverter extends Converter { */ public UserConverter() { super(userDto -> new User(userDto.getFirstName(), userDto.getLastName(), userDto.isActive(), - userDto.getEmail()), + userDto.getEmail()), user -> new UserDto(user.getFirstName(), user.getLastName(), user.isActive(), - user.getUserId())); + user.getUserId())); } } diff --git a/converter/src/main/java/com/iluwatar/converter/UserDto.java b/converter/src/main/java/com/iluwatar/converter/UserDto.java index 11413d2cb61b..eae77e90130e 100644 --- a/converter/src/main/java/com/iluwatar/converter/UserDto.java +++ b/converter/src/main/java/com/iluwatar/converter/UserDto.java @@ -23,11 +23,10 @@ package com.iluwatar.converter; - import java.util.Objects; /** - * User DTO class + * User DTO class. */ public class UserDto { @@ -37,6 +36,8 @@ public class UserDto { private String email; /** + * Constructor. + * * @param firstName user's first name * @param lastName user's last name * @param isActive flag indicating whether the user is active @@ -65,7 +66,8 @@ public String getEmail() { return email; } - @Override public boolean equals(Object o) { + @Override + public boolean equals(Object o) { if (this == o) { return true; } @@ -74,15 +76,17 @@ public String getEmail() { } UserDto userDto = (UserDto) o; return isActive == userDto.isActive && Objects.equals(firstName, userDto.firstName) && Objects - .equals(lastName, userDto.lastName) && Objects.equals(email, userDto.email); + .equals(lastName, userDto.lastName) && Objects.equals(email, userDto.email); } - @Override public int hashCode() { + @Override + public int hashCode() { return Objects.hash(firstName, lastName, isActive, email); } - @Override public String toString() { + @Override + public String toString() { return "UserDto{" + "firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' - + ", isActive=" + isActive + ", email='" + email + '\'' + '}'; + + ", isActive=" + isActive + ", email='" + email + '\'' + '}'; } } diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/app/App.java b/cqrs/src/main/java/com/iluwatar/cqrs/app/App.java index 0a805679f2b8..b1b0ddeac9ea 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/app/App.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/app/App.java @@ -23,12 +23,6 @@ package com.iluwatar.cqrs.app; -import java.math.BigInteger; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.iluwatar.cqrs.commandes.CommandServiceImpl; import com.iluwatar.cqrs.commandes.ICommandService; import com.iluwatar.cqrs.constants.AppConstants; @@ -37,32 +31,35 @@ import com.iluwatar.cqrs.queries.IQueryService; import com.iluwatar.cqrs.queries.QueryServiceImpl; import com.iluwatar.cqrs.util.HibernateUtil; +import java.math.BigInteger; +import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * CQRS : Command Query Responsibility Segregation. A pattern used to separate query services from commands or writes - * services. The pattern is very simple but it has many consequences. For example, it can be used to tackle down a - * complex domain, or to use other architectures that were hard to implement with the classical way. - * - * This implementation is an example of managing books and authors in a library. The persistence of books and authors is - * done according to the CQRS architecture. A command side that deals with a data model to persist(insert,update,delete) - * objects to a database. And a query side that uses native queries to get data from the database and return objects as - * DTOs (Data transfer Objects). + * CQRS : Command Query Responsibility Segregation. A pattern used to separate query services from + * commands or writes services. The pattern is very simple but it has many consequences. For + * example, it can be used to tackle down a complex domain, or to use other architectures that were + * hard to implement with the classical way. * + *

    This implementation is an example of managing books and authors in a library. The persistence + * of books and authors is done according to the CQRS architecture. A command side that deals with a + * data model to persist(insert,update,delete) objects to a database. And a query side that uses + * native queries to get data from the database and return objects as DTOs (Data transfer Objects). */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point - * - * @param args - * command line args + * Program entry point. + * + * @param args command line args */ public static void main(String[] args) { ICommandService commands = new CommandServiceImpl(); // Create Authors and Books using CommandService - commands.authorCreated(AppConstants.E_EVANS, "Eric Evans", "eEvans@email.com"); + commands.authorCreated(AppConstants.E_EVANS, "Eric Evans", "evans@email.com"); commands.authorCreated(AppConstants.J_BLOCH, "Joshua Bloch", "jBloch@email.com"); commands.authorCreated(AppConstants.M_FOWLER, "Martin Fowler", "mFowler@email.com"); @@ -70,7 +67,8 @@ public static void main(String[] args) { commands.bookAddedToAuthor("Effective Java", 40.54, AppConstants.J_BLOCH); commands.bookAddedToAuthor("Java Puzzlers", 39.99, AppConstants.J_BLOCH); commands.bookAddedToAuthor("Java Concurrency in Practice", 29.40, AppConstants.J_BLOCH); - commands.bookAddedToAuthor("Patterns of Enterprise Application Architecture", 54.01, AppConstants.M_FOWLER); + commands.bookAddedToAuthor("Patterns of Enterprise" + + " Application Architecture", 54.01, AppConstants.M_FOWLER); commands.bookAddedToAuthor("Domain Specific Languages", 48.89, AppConstants.M_FOWLER); commands.authorNameUpdated(AppConstants.E_EVANS, "Eric J. Evans"); @@ -78,18 +76,18 @@ public static void main(String[] args) { // Query the database using QueryService Author nullAuthor = queries.getAuthorByUsername("username"); - Author eEvans = queries.getAuthorByUsername(AppConstants.E_EVANS); - BigInteger jBlochBooksCount = queries.getAuthorBooksCount(AppConstants.J_BLOCH); + Author evans = queries.getAuthorByUsername(AppConstants.E_EVANS); + BigInteger blochBooksCount = queries.getAuthorBooksCount(AppConstants.J_BLOCH); BigInteger authorsCount = queries.getAuthorsCount(); Book dddBook = queries.getBook("Domain-Driven Design"); - List jBlochBooks = queries.getAuthorBooks(AppConstants.J_BLOCH); + List blochBooks = queries.getAuthorBooks(AppConstants.J_BLOCH); LOGGER.info("Author username : {}", nullAuthor); - LOGGER.info("Author eEvans : {}", eEvans); - LOGGER.info("jBloch number of books : {}", jBlochBooksCount); + LOGGER.info("Author evans : {}", evans); + LOGGER.info("jBloch number of books : {}", blochBooksCount); LOGGER.info("Number of authors : {}", authorsCount); LOGGER.info("DDD book : {}", dddBook); - LOGGER.info("jBloch books : {}", jBlochBooks); + LOGGER.info("jBloch books : {}", blochBooks); HibernateUtil.getSessionFactory().close(); } diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/commandes/CommandServiceImpl.java b/cqrs/src/main/java/com/iluwatar/cqrs/commandes/CommandServiceImpl.java index e491e8990a7a..c8146845e33b 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/commandes/CommandServiceImpl.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/commandes/CommandServiceImpl.java @@ -23,17 +23,16 @@ package com.iluwatar.cqrs.commandes; -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.SessionFactory; - import com.iluwatar.cqrs.domain.model.Author; import com.iluwatar.cqrs.domain.model.Book; import com.iluwatar.cqrs.util.HibernateUtil; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; /** - * This class is an implementation of {@link ICommandService} interface. It uses Hibernate as an api for persistence. - * + * This class is an implementation of {@link ICommandService} interface. It uses Hibernate as an api + * for persistence. */ public class CommandServiceImpl implements ICommandService { diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/commandes/ICommandService.java b/cqrs/src/main/java/com/iluwatar/cqrs/commandes/ICommandService.java index 7e0a47bc3150..b81d24c7c580 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/commandes/ICommandService.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/commandes/ICommandService.java @@ -24,8 +24,7 @@ package com.iluwatar.cqrs.commandes; /** - * This interface represents the commands of the CQRS pattern - * + * This interface represents the commands of the CQRS pattern. */ public interface ICommandService { diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java b/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java index c52a71401205..0a8971729ef5 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/constants/AppConstants.java @@ -24,9 +24,7 @@ package com.iluwatar.cqrs.constants; /** - * - * Class to define the constants - * + * Class to define the constants. */ public class AppConstants { diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Author.java b/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Author.java index 0c0d4b65b285..9f2b73e486fd 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Author.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Author.java @@ -30,7 +30,6 @@ /** * This is an Author entity. It is used by Hibernate for persistence. - * */ @Entity public class Author { @@ -42,13 +41,11 @@ public class Author { private String email; /** - * - * @param username - * username of the author - * @param name - * name of the author - * @param email - * email of the author + * Constructor. + * + * @param username username of the author + * @param name name of the author + * @param email email of the author */ public Author(String username, String name, String email) { this.username = username; diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java b/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java index 0524991f80a6..8b87bdbf4301 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java @@ -30,8 +30,8 @@ import javax.persistence.ManyToOne; /** - * This is a Book entity. It is used by Hibernate for persistence. Many books can be written by one {@link Author} - * + * This is a Book entity. It is used by Hibernate for persistence. Many books can be written by one + * {@link Author} */ @Entity public class Book { @@ -44,13 +44,11 @@ public class Book { private Author author; /** + * Constructor. * - * @param title - * title of the book - * @param price - * price of the book - * @param author - * author of the book + * @param title title of the book + * @param price price of the book + * @param author author of the book */ public Book(String title, double price, Author author) { this.title = title; diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/dto/Author.java b/cqrs/src/main/java/com/iluwatar/cqrs/dto/Author.java index f20627ba9dea..8318c4a951f3 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/dto/Author.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/dto/Author.java @@ -26,9 +26,7 @@ import java.util.Objects; /** - * - * This is a DTO (Data Transfer Object) author, contains only useful information to be returned - * + * This is a DTO (Data Transfer Object) author, contains only useful information to be returned. */ public class Author { @@ -37,13 +35,11 @@ public class Author { private String username; /** - * - * @param name - * name of the author - * @param email - * email of the author - * @param username - * username of the author + * Constructor. + * + * @param name name of the author + * @param email email of the author + * @param username username of the author */ public Author(String name, String email, String username) { this.name = name; @@ -85,7 +81,8 @@ public boolean equals(Object obj) { return false; } Author other = (Author) obj; - return username.equals(other.getUsername()) && email.equals(other.getEmail()) && name.equals(other.getName()); + return username.equals(other.getUsername()) && email.equals(other.getEmail()) && name + .equals(other.getName()); } diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/dto/Book.java b/cqrs/src/main/java/com/iluwatar/cqrs/dto/Book.java index 47ee03581020..c859b0c769dd 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/dto/Book.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/dto/Book.java @@ -26,9 +26,7 @@ import java.util.Objects; /** - * - * This is a DTO (Data Transfer Object) book, contains only useful information to be returned - * + * This is a DTO (Data Transfer Object) book, contains only useful information to be returned. */ public class Book { @@ -36,11 +34,10 @@ public class Book { private double price; /** - * - * @param title - * title of the book - * @param price - * price of the book + * Constructor. + * + * @param title title of the book + * @param price price of the book */ public Book(String title, double price) { this.title = title; diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/queries/IQueryService.java b/cqrs/src/main/java/com/iluwatar/cqrs/queries/IQueryService.java index 303b69e7c322..e67371bc723a 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/queries/IQueryService.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/queries/IQueryService.java @@ -23,16 +23,13 @@ package com.iluwatar.cqrs.queries; -import java.math.BigInteger; -import java.util.List; - import com.iluwatar.cqrs.dto.Author; import com.iluwatar.cqrs.dto.Book; +import java.math.BigInteger; +import java.util.List; /** - * - * This interface represents the query methods of the CQRS pattern - * + * This interface represents the query methods of the CQRS pattern. */ public interface IQueryService { diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/queries/QueryServiceImpl.java b/cqrs/src/main/java/com/iluwatar/cqrs/queries/QueryServiceImpl.java index 57895c945436..24532515d412 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/queries/QueryServiceImpl.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/queries/QueryServiceImpl.java @@ -23,23 +23,20 @@ package com.iluwatar.cqrs.queries; +import com.iluwatar.cqrs.constants.AppConstants; +import com.iluwatar.cqrs.dto.Author; +import com.iluwatar.cqrs.dto.Book; +import com.iluwatar.cqrs.util.HibernateUtil; import java.math.BigInteger; import java.util.List; - import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.transform.Transformers; -import com.iluwatar.cqrs.constants.AppConstants; -import com.iluwatar.cqrs.dto.Author; -import com.iluwatar.cqrs.dto.Book; -import com.iluwatar.cqrs.util.HibernateUtil; - /** - * This class is an implementation of {@link IQueryService}. It uses Hibernate native queries to return DTOs from the - * database. - * + * This class is an implementation of {@link IQueryService}. It uses Hibernate native queries to + * return DTOs from the database. */ public class QueryServiceImpl implements IQueryService { @@ -49,11 +46,12 @@ public class QueryServiceImpl implements IQueryService { public Author getAuthorByUsername(String username) { Author authorDTo = null; try (Session session = sessionFactory.openSession()) { - SQLQuery sqlQuery = session - .createSQLQuery("SELECT a.username as \"username\", a.name as \"name\", a.email as \"email\"" - + "FROM Author a where a.username=:username"); + SQLQuery sqlQuery = session.createSQLQuery("SELECT a.username as \"username\"," + + " a.name as \"name\", a.email as \"email\"" + + "FROM Author a where a.username=:username"); sqlQuery.setParameter(AppConstants.USER_NAME, username); - authorDTo = (Author) sqlQuery.setResultTransformer(Transformers.aliasToBean(Author.class)).uniqueResult(); + authorDTo = (Author) sqlQuery.setResultTransformer(Transformers.aliasToBean(Author.class)) + .uniqueResult(); } return authorDTo; } @@ -62,10 +60,11 @@ public Author getAuthorByUsername(String username) { public Book getBook(String title) { Book bookDTo = null; try (Session session = sessionFactory.openSession()) { - SQLQuery sqlQuery = session - .createSQLQuery("SELECT b.title as \"title\", b.price as \"price\"" + " FROM Book b where b.title=:title"); + SQLQuery sqlQuery = session.createSQLQuery("SELECT b.title as \"title\"," + + " b.price as \"price\"" + " FROM Book b where b.title=:title"); sqlQuery.setParameter("title", title); - bookDTo = (Book) sqlQuery.setResultTransformer(Transformers.aliasToBean(Book.class)).uniqueResult(); + bookDTo = + (Book) sqlQuery.setResultTransformer(Transformers.aliasToBean(Book.class)).uniqueResult(); } return bookDTo; } @@ -87,7 +86,8 @@ public BigInteger getAuthorBooksCount(String username) { BigInteger bookcount = null; try (Session session = sessionFactory.openSession()) { SQLQuery sqlQuery = session.createSQLQuery( - "SELECT count(b.title)" + " FROM Book b, Author a where b.author_id = a.id and a.username=:username"); + "SELECT count(b.title)" + " FROM Book b, Author a" + + " where b.author_id = a.id and a.username=:username"); sqlQuery.setParameter(AppConstants.USER_NAME, username); bookcount = (BigInteger) sqlQuery.uniqueResult(); } diff --git a/cqrs/src/main/java/com/iluwatar/cqrs/util/HibernateUtil.java b/cqrs/src/main/java/com/iluwatar/cqrs/util/HibernateUtil.java index 7737ded33e9d..6d9788a5efe0 100644 --- a/cqrs/src/main/java/com/iluwatar/cqrs/util/HibernateUtil.java +++ b/cqrs/src/main/java/com/iluwatar/cqrs/util/HibernateUtil.java @@ -31,8 +31,8 @@ import org.slf4j.LoggerFactory; /** - * This class simply returns one instance of {@link SessionFactory} initialized when the application is started - * + * This class simply returns one instance of {@link SessionFactory} initialized when the application + * is started. */ public class HibernateUtil { @@ -42,7 +42,8 @@ public class HibernateUtil { private static SessionFactory buildSessionFactory() { // configures settings from hibernate.cfg.xml - final StandardServiceRegistry registry = new StandardServiceRegistryBuilder().configure().build(); + final StandardServiceRegistry registry = + new StandardServiceRegistryBuilder().configure().build(); try { return new MetadataSources(registry).buildMetadata().buildSessionFactory(); } catch (Exception ex) { From dda09535e657ef6b4e2fde8f0c72e1f93b1429ac Mon Sep 17 00:00:00 2001 From: Anurag Agarwal Date: Sun, 10 Nov 2019 22:31:32 +0530 Subject: [PATCH 141/197] Resolves checkstyle errors for guarded-suspension, half-sync-half-async, hexagonal (#1064) * Reduces checkstyle errors in guarded-suspension * Reduces checkstyle errors in half-sync-half-async * Reduces checkstyle errors in hexagonal --- .../com/iluwatar/guarded/suspension/App.java | 25 +++-- .../guarded/suspension/GuardedQueue.java | 16 ++- .../com/iluwatar/halfsynchalfasync/App.java | 64 +++++------ .../iluwatar/halfsynchalfasync/AsyncTask.java | 4 +- .../AsynchronousService.java | 20 ++-- .../main/java/com/iluwatar/hexagonal/App.java | 57 +++++----- .../administration/ConsoleAdministration.java | 10 +- .../ConsoleAdministrationSrv.java | 8 +- .../ConsoleAdministrationSrvImpl.java | 7 +- .../hexagonal/banking/InMemoryBank.java | 22 ++-- .../iluwatar/hexagonal/banking/MongoBank.java | 30 ++--- .../hexagonal/banking/WireTransfers.java | 10 +- .../database/InMemoryTicketRepository.java | 9 +- .../database/LotteryTicketRepository.java | 17 ++- .../database/MongoTicketRepository.java | 22 ++-- .../domain/LotteryAdministration.java | 22 ++-- .../hexagonal/domain/LotteryConstants.java | 6 +- .../hexagonal/domain/LotteryNumbers.java | 32 +++--- .../hexagonal/domain/LotteryService.java | 16 +-- .../hexagonal/domain/LotteryTicket.java | 12 +- .../domain/LotteryTicketCheckResult.java | 14 ++- .../hexagonal/domain/LotteryTicketId.java | 6 +- .../hexagonal/domain/LotteryUtils.java | 19 ++-- .../hexagonal/domain/PlayerDetails.java | 12 +- .../hexagonal/eventlog/LotteryEventLog.java | 14 +-- .../hexagonal/eventlog/MongoEventLog.java | 29 +++-- .../hexagonal/eventlog/StdOutEventLog.java | 17 +-- .../hexagonal/module/LotteryModule.java | 2 +- .../module/LotteryTestingModule.java | 2 +- .../MongoConnectionPropertiesLoader.java | 5 +- .../hexagonal/sampledata/SampleData.java | 83 +++++++------- .../hexagonal/service/ConsoleLottery.java | 9 +- .../service/LotteryConsoleService.java | 15 ++- .../service/LotteryConsoleServiceImpl.java | 105 ++++++++++-------- 34 files changed, 382 insertions(+), 359 deletions(-) diff --git a/guarded-suspension/src/main/java/com/iluwatar/guarded/suspension/App.java b/guarded-suspension/src/main/java/com/iluwatar/guarded/suspension/App.java index 922e366029a6..7c9bc1429c4b 100644 --- a/guarded-suspension/src/main/java/com/iluwatar/guarded/suspension/App.java +++ b/guarded-suspension/src/main/java/com/iluwatar/guarded/suspension/App.java @@ -21,15 +21,6 @@ * THE SOFTWARE. */ -/** - * Guarded-suspension is a concurrent design pattern for handling situation when to execute some action we need - * condition to be satisfied. - *

    - * Implementation is based on GuardedQueue, which has two methods: get and put, - * the condition is that we cannot get from empty queue so when thread attempt - * to break the condition we invoke Object's wait method on him and when other thread put an element - * to the queue he notify the waiting one that now he can get from queue. - */ package com.iluwatar.guarded.suspension; import java.util.concurrent.ExecutorService; @@ -38,10 +29,18 @@ /** * Created by robertt240 on 1/26/17. + * + *

    Guarded-suspension is a concurrent design pattern for handling situation when to execute some + * action we need condition to be satisfied. + * + *

    - * PROBLEM
    + * This application demonstrates Half-Sync/Half-Async pattern. Key parts of the pattern are {@link + * AsyncTask} and {@link AsynchronousService}. + * + *

    PROBLEM
    * A concurrent system have a mixture of short duration, mid duration and long duration tasks. Mid * or long duration tasks should be performed asynchronously to meet quality of service * requirements. - * - *

    - * INTENT
    + * + *

    INTENT
    * The intent of this pattern is to separate the the synchronous and asynchronous processing in the * concurrent application by introducing two intercommunicating layers - one for sync and one for * async. This simplifies the programming without unduly affecting the performance. - * - *

    - * APPLICABILITY
    - * UNIX network subsystems - In operating systems network operations are carried out - * asynchronously with help of hardware level interrupts.
    - * CORBA - At the asynchronous layer one thread is associated with each socket that is connected - * to the client. Thread blocks waiting for CORBA requests from the client. On receiving request it - * is inserted in the queuing layer which is then picked up by synchronous layer which processes the - * request and sends response back to the client.
    - * Android AsyncTask framework - Framework provides a way to execute long running blocking - * calls, such as downloading a file, in background threads so that the UI thread remains free to - * respond to user inputs.
    - * - *

    - * IMPLEMENTATION
    + * + *

    APPLICABILITY
    + * UNIX network subsystems - In operating systems network operations are carried out asynchronously + * with help of hardware level interrupts.
    CORBA - At the asynchronous layer one thread is + * associated with each socket that is connected to the client. Thread blocks waiting for CORBA + * requests from the client. On receiving request it is inserted in the queuing layer which is then + * picked up by synchronous layer which processes the request and sends response back to the + * client.
    Android AsyncTask framework - Framework provides a way to execute long running + * blocking calls, such as downloading a file, in background threads so that the UI thread remains + * free to respond to user inputs.
    + * + *

    IMPLEMENTATION
    * The main method creates an asynchronous service which does not block the main thread while the * task is being performed. The main thread continues its work which is similar to Async Method * Invocation pattern. The difference between them is that there is a queuing layer between @@ -66,15 +59,14 @@ * between both layers. Such as Priority Queue can be used as queuing layer to prioritize the way * tasks are executed. Our implementation is just one simple way of implementing this pattern, there * are many variants possible as described in its applications. - * */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point - * + * Program entry point. + * * @param args command line args */ public static void main(String[] args) { @@ -100,15 +92,13 @@ public static void main(String[] args) { } /** - * - * ArithmeticSumTask - * + * ArithmeticSumTask. */ static class ArithmeticSumTask implements AsyncTask { - private long n; + private long numberOfElements; - public ArithmeticSumTask(long n) { - this.n = n; + public ArithmeticSumTask(long numberOfElements) { + this.numberOfElements = numberOfElements; } /* @@ -117,7 +107,7 @@ public ArithmeticSumTask(long n) { */ @Override public Long call() throws Exception { - return ap(n); + return ap(numberOfElements); } /* @@ -128,7 +118,7 @@ public Long call() throws Exception { */ @Override public void onPreCall() { - if (n < 0) { + if (numberOfElements < 0) { throw new IllegalArgumentException("n is less than 0"); } } diff --git a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsyncTask.java b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsyncTask.java index 0e2701a60578..c310d801503f 100644 --- a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsyncTask.java +++ b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsyncTask.java @@ -30,7 +30,7 @@ * typically done is background threads and the result is posted back in form of callback. The * callback does not implement {@code isComplete}, {@code cancel} as it is out of scope of this * pattern. - * + * * @param type of result */ public interface AsyncTask extends Callable { @@ -53,7 +53,7 @@ public interface AsyncTask extends Callable { /** * A callback called if computing the task resulted in some exception. This method is called when * either of {@link #call()} or {@link #onPreCall()} throw any exception. - * + * * @param throwable error cause */ void onError(Throwable throwable); diff --git a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsynchronousService.java b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsynchronousService.java index 1a6dc04491f1..3a3bb474c219 100644 --- a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsynchronousService.java +++ b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/AsynchronousService.java @@ -23,15 +23,14 @@ package com.iluwatar.halfsynchalfasync; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.FutureTask; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This is the asynchronous layer which does not block when a new request arrives. It just passes @@ -63,13 +62,14 @@ public AsynchronousService(BlockingQueue workQueue) { /** * A non-blocking method which performs the task provided in background and returns immediately. - *

    - * On successful completion of task the result is posted back using callback method - * {@link AsyncTask#onPostCall(Object)}, if task execution is unable to complete normally due to - * some exception then the reason for error is posted back using callback method - * {@link AsyncTask#onError(Throwable)}. - *

    - * NOTE: The results are posted back in the context of background thread in this implementation. + * + *

    On successful completion of task the result is posted back using callback method {@link + * AsyncTask#onPostCall(Object)}, if task execution is unable to complete normally due to some + * exception then the reason for error is posted back using callback method {@link + * AsyncTask#onError(Throwable)}. + * + *

    NOTE: The results are posted back in the context of background thread in this + * implementation. */ public void execute(final AsyncTask task) { try { diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/App.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/App.java index f61b3c2bdeab..4255b3359283 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/App.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/App.java @@ -31,40 +31,35 @@ import com.iluwatar.hexagonal.sampledata.SampleData; /** - * - * Hexagonal Architecture pattern decouples the application core from the - * services it uses. This allows the services to be plugged in and the - * application will run with or without the services.

    - * - * The core logic, or business logic, of an application consists of the - * algorithms that are essential to its purpose. They implement the use - * cases that are the heart of the application. When you change them, you - * change the essence of the application.

    - * - * The services are not essential. They can be replaced without changing - * the purpose of the application. Examples: database access and other - * types of storage, user interface components, e-mail and other - * communication components, hardware devices.

    - * - * This example demonstrates Hexagonal Architecture with a lottery system. - * The application core is separate from the services that drive it and - * from the services it uses.

    - * - * The primary ports for the application are console interfaces - * {@link com.iluwatar.hexagonal.administration.ConsoleAdministration} through which the lottery round is - * initiated and run and {@link com.iluwatar.hexagonal.service.ConsoleLottery} that allows players to - * submit lottery tickets for the draw.

    - * - * The secondary ports that application core uses are {@link com.iluwatar.hexagonal.banking.WireTransfers} - * which is a banking service, {@link com.iluwatar.hexagonal.eventlog.LotteryEventLog} that delivers - * eventlog as lottery events occur and {@link com.iluwatar.hexagonal.database.LotteryTicketRepository} - * that is the storage for the lottery tickets. + * Hexagonal Architecture pattern decouples the application core from the services it uses. This + * allows the services to be plugged in and the application will run with or without the services. * + *

    The core logic, or business logic, of an application consists of the algorithms that are + * essential to its purpose. They implement the use cases that are the heart of the application. + * When you change them, you change the essence of the application. + * + *

    The services are not essential. They can be replaced without changing the purpose of the + * application. Examples: database access and other types of storage, user interface components, + * e-mail and other communication components, hardware devices. + * + *

    This example demonstrates Hexagonal Architecture with a lottery system. The application core + * is separate from the services that drive it and from the services it uses. + * + *

    The primary ports for the application are console interfaces {@link + * com.iluwatar.hexagonal.administration.ConsoleAdministration} through which the lottery round is + * initiated and run and {@link com.iluwatar.hexagonal.service.ConsoleLottery} that allows players + * to submit lottery tickets for the draw. + * + *

    The secondary ports that application core uses are{@link + * com.iluwatar.hexagonal.banking.WireTransfers} which is a banking service, {@link + * com.iluwatar.hexagonal.eventlog.LotteryEventLog} that delivers eventlog as lottery events occur + * and {@link com.iluwatar.hexagonal.database.LotteryTicketRepository} that is the storage for the + * lottery tickets. */ public class App { /** - * Program entry point + * Program entry point. */ public static void main(String[] args) { @@ -73,11 +68,11 @@ public static void main(String[] args) { // start new lottery round LotteryAdministration administration = injector.getInstance(LotteryAdministration.class); administration.resetLottery(); - + // submit some lottery tickets LotteryService service = injector.getInstance(LotteryService.class); SampleData.submitTickets(service, 20); - + // perform lottery administration.performLottery(); } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministration.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministration.java index 5db49263697d..ca61b7649c5b 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministration.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministration.java @@ -30,20 +30,19 @@ import com.iluwatar.hexagonal.module.LotteryModule; import com.iluwatar.hexagonal.mongo.MongoConnectionPropertiesLoader; import com.iluwatar.hexagonal.sampledata.SampleData; +import java.util.Scanner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Scanner; - /** - * Console interface for lottery administration + * Console interface for lottery administration. */ public class ConsoleAdministration { private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleAdministration.class); /** - * Program entry point + * Program entry point. */ public static void main(String[] args) { MongoConnectionPropertiesLoader.load(); @@ -51,7 +50,8 @@ public static void main(String[] args) { LotteryAdministration administration = injector.getInstance(LotteryAdministration.class); LotteryService service = injector.getInstance(LotteryService.class); SampleData.submitTickets(service, 20); - ConsoleAdministrationSrv consoleAdministration = new ConsoleAdministrationSrvImpl(administration, LOGGER); + ConsoleAdministrationSrv consoleAdministration = + new ConsoleAdministrationSrvImpl(administration, LOGGER); try (Scanner scanner = new Scanner(System.in)) { boolean exit = false; while (!exit) { diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministrationSrv.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministrationSrv.java index 70f24739f79c..ec6f815c307a 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministrationSrv.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministrationSrv.java @@ -24,22 +24,22 @@ package com.iluwatar.hexagonal.administration; /** - * Console interface for lottery administration + * Console interface for lottery administration. */ public interface ConsoleAdministrationSrv { /** - * Get all submitted tickets + * Get all submitted tickets. */ void getAllSubmittedTickets(); /** - * Draw lottery numbers + * Draw lottery numbers. */ void performLottery(); /** - * Begin new lottery round + * Begin new lottery round. */ void resetLottery(); } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministrationSrvImpl.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministrationSrvImpl.java index d4c154797b8e..fbd00aa1f829 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministrationSrvImpl.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministrationSrvImpl.java @@ -28,14 +28,14 @@ import org.slf4j.Logger; /** - * Console implementation for lottery administration + * Console implementation for lottery administration. */ public class ConsoleAdministrationSrvImpl implements ConsoleAdministrationSrv { private final LotteryAdministration administration; private final Logger logger; /** - * Constructor + * Constructor. */ public ConsoleAdministrationSrvImpl(LotteryAdministration administration, Logger logger) { this.administration = administration; @@ -44,7 +44,8 @@ public ConsoleAdministrationSrvImpl(LotteryAdministration administration, Logger @Override public void getAllSubmittedTickets() { - administration.getAllSubmittedTickets().forEach((k, v) -> logger.info("Key: {}, Value: {}", k, v)); + administration.getAllSubmittedTickets() + .forEach((k, v) -> logger.info("Key: {}, Value: {}", k, v)); } @Override diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/InMemoryBank.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/InMemoryBank.java index 94ad542ff2bd..1a0fdb6b0b9f 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/InMemoryBank.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/InMemoryBank.java @@ -23,24 +23,22 @@ package com.iluwatar.hexagonal.banking; +import com.iluwatar.hexagonal.domain.LotteryConstants; import java.util.HashMap; import java.util.Map; -import com.iluwatar.hexagonal.domain.LotteryConstants; - /** - * - * Banking implementation - * + * Banking implementation. */ public class InMemoryBank implements WireTransfers { private static Map accounts = new HashMap<>(); - + static { - accounts.put(LotteryConstants.SERVICE_BANK_ACCOUNT, LotteryConstants.SERVICE_BANK_ACCOUNT_BALANCE); + accounts + .put(LotteryConstants.SERVICE_BANK_ACCOUNT, LotteryConstants.SERVICE_BANK_ACCOUNT_BALANCE); } - + @Override public void setFunds(String bankAccount, int amount) { accounts.put(bankAccount, amount); @@ -52,10 +50,10 @@ public int getFunds(String bankAccount) { } @Override - public boolean transferFunds(int amount, String sourceBackAccount, String destinationBankAccount) { - if (accounts.getOrDefault(sourceBackAccount, 0) >= amount) { - accounts.put(sourceBackAccount, accounts.get(sourceBackAccount) - amount); - accounts.put(destinationBankAccount, accounts.get(destinationBankAccount) + amount); + public boolean transferFunds(int amount, String sourceAccount, String destinationAccount) { + if (accounts.getOrDefault(sourceAccount, 0) >= amount) { + accounts.put(sourceAccount, accounts.get(sourceAccount) - amount); + accounts.put(destinationAccount, accounts.get(destinationAccount) + amount); return true; } else { return false; diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/MongoBank.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/MongoBank.java index 4cdb431f357c..e1c720c115e5 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/MongoBank.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/MongoBank.java @@ -27,13 +27,12 @@ import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoDatabase; import com.mongodb.client.model.UpdateOptions; -import org.bson.Document; - import java.util.ArrayList; import java.util.List; +import org.bson.Document; /** - * Mongo based banking adapter + * Mongo based banking adapter. */ public class MongoBank implements WireTransfers { @@ -45,28 +44,28 @@ public class MongoBank implements WireTransfers { private MongoCollection accountsCollection; /** - * Constructor + * Constructor. */ public MongoBank() { connect(); } /** - * Constructor accepting parameters + * Constructor accepting parameters. */ public MongoBank(String dbName, String accountsCollectionName) { connect(dbName, accountsCollectionName); } /** - * Connect to database with default parameters + * Connect to database with default parameters. */ public void connect() { connect(DEFAULT_DB, DEFAULT_ACCOUNTS_COLLECTION); } /** - * Connect to database with given parameters + * Connect to database with given parameters. */ public void connect(String dbName, String accountsCollectionName) { if (mongoClient != null) { @@ -79,6 +78,8 @@ public void connect(String dbName, String accountsCollectionName) { } /** + * Get mongo client. + * * @return mongo client */ public MongoClient getMongoClient() { @@ -86,6 +87,7 @@ public MongoClient getMongoClient() { } /** + * Get mongo database. * * @return mongo database */ @@ -94,6 +96,7 @@ public MongoDatabase getMongoDatabase() { } /** + * Get accounts collection. * * @return accounts collection */ @@ -106,7 +109,8 @@ public MongoCollection getAccountsCollection() { public void setFunds(String bankAccount, int amount) { Document search = new Document("_id", bankAccount); Document update = new Document("_id", bankAccount).append("funds", amount); - accountsCollection.updateOne(search, new Document("$set", update), new UpdateOptions().upsert(true)); + accountsCollection + .updateOne(search, new Document("$set", update), new UpdateOptions().upsert(true)); } @Override @@ -121,14 +125,14 @@ public int getFunds(String bankAccount) { } @Override - public boolean transferFunds(int amount, String sourceBackAccount, String destinationBankAccount) { - int sourceFunds = getFunds(sourceBackAccount); + public boolean transferFunds(int amount, String sourceAccount, String destinationAccount) { + int sourceFunds = getFunds(sourceAccount); if (sourceFunds < amount) { return false; } else { - int destFunds = getFunds(destinationBankAccount); - setFunds(sourceBackAccount, sourceFunds - amount); - setFunds(destinationBankAccount, destFunds + amount); + int destFunds = getFunds(destinationAccount); + setFunds(sourceAccount, sourceFunds - amount); + setFunds(destinationAccount, destFunds + amount); return true; } } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/WireTransfers.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/WireTransfers.java index 4283c6ef27e3..fad455b9b93b 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/WireTransfers.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/WireTransfers.java @@ -24,25 +24,23 @@ package com.iluwatar.hexagonal.banking; /** - * * Interface to bank accounts. - * */ public interface WireTransfers { /** - * Set amount of funds for bank account + * Set amount of funds for bank account. */ void setFunds(String bankAccount, int amount); /** - * Get amount of funds for bank account + * Get amount of funds for bank account. */ int getFunds(String bankAccount); /** - * Transfer funds from one bank account to another + * Transfer funds from one bank account to another. */ boolean transferFunds(int amount, String sourceBackAccount, String destinationBankAccount); - + } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/database/InMemoryTicketRepository.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/database/InMemoryTicketRepository.java index b5cd526f3b64..a580a7cf51bb 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/database/InMemoryTicketRepository.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/database/InMemoryTicketRepository.java @@ -23,20 +23,17 @@ package com.iluwatar.hexagonal.database; +import com.iluwatar.hexagonal.domain.LotteryTicket; +import com.iluwatar.hexagonal.domain.LotteryTicketId; import java.util.HashMap; import java.util.Map; import java.util.Optional; -import com.iluwatar.hexagonal.domain.LotteryTicket; -import com.iluwatar.hexagonal.domain.LotteryTicketId; - /** - * * Mock database for lottery tickets. - * */ public class InMemoryTicketRepository implements LotteryTicketRepository { - + private static Map tickets = new HashMap<>(); @Override diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/database/LotteryTicketRepository.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/database/LotteryTicketRepository.java index 1beef3cd7ce2..e307004ed345 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/database/LotteryTicketRepository.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/database/LotteryTicketRepository.java @@ -23,37 +23,34 @@ package com.iluwatar.hexagonal.database; -import java.util.Map; -import java.util.Optional; - import com.iluwatar.hexagonal.domain.LotteryTicket; import com.iluwatar.hexagonal.domain.LotteryTicketId; +import java.util.Map; +import java.util.Optional; /** - * * Interface for accessing lottery tickets in database. - * */ public interface LotteryTicketRepository { /** - * Find lottery ticket by id + * Find lottery ticket by id. */ Optional findById(LotteryTicketId id); /** - * Save lottery ticket + * Save lottery ticket. */ Optional save(LotteryTicket ticket); /** - * Get all lottery tickets + * Get all lottery tickets. */ Map findAll(); /** - * Delete all lottery tickets + * Delete all lottery tickets. */ void deleteAll(); - + } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/database/MongoTicketRepository.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/database/MongoTicketRepository.java index 91cf0c2a8eaf..794cd363fdb6 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/database/MongoTicketRepository.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/database/MongoTicketRepository.java @@ -30,8 +30,6 @@ import com.mongodb.MongoClient; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoDatabase; -import org.bson.Document; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -40,9 +38,10 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; +import org.bson.Document; /** - * Mongo lottery ticket database + * Mongo lottery ticket database. */ public class MongoTicketRepository implements LotteryTicketRepository { @@ -56,14 +55,14 @@ public class MongoTicketRepository implements LotteryTicketRepository { private MongoCollection countersCollection; /** - * Constructor + * Constructor. */ public MongoTicketRepository() { connect(); } /** - * Constructor accepting parameters + * Constructor accepting parameters. */ public MongoTicketRepository(String dbName, String ticketsCollectionName, String countersCollectionName) { @@ -71,14 +70,14 @@ public MongoTicketRepository(String dbName, String ticketsCollectionName, } /** - * Connect to database with default parameters + * Connect to database with default parameters. */ public void connect() { connect(DEFAULT_DB, DEFAULT_TICKETS_COLLECTION, DEFAULT_COUNTERS_COLLECTION); } /** - * Connect to database with given parameters + * Connect to database with given parameters. */ public void connect(String dbName, String ticketsCollectionName, String countersCollectionName) { @@ -101,6 +100,8 @@ private void initCounters() { } /** + * Get next ticket id. + * * @return next ticket id */ public int getNextId() { @@ -112,6 +113,7 @@ public int getNextId() { } /** + * Get tickets collection. * * @return tickets collection */ @@ -120,6 +122,7 @@ public MongoCollection getTicketsCollection() { } /** + * Get counters collection. * * @return counters collection */ @@ -155,7 +158,7 @@ public Optional save(LotteryTicket ticket) { public Map findAll() { Map map = new HashMap<>(); List docs = ticketsCollection.find(new Document()).into(new ArrayList<>()); - for (Document doc: docs) { + for (Document doc : docs) { LotteryTicket lotteryTicket = docToTicket(doc); map.put(lotteryTicket.getId(), lotteryTicket); } @@ -174,6 +177,7 @@ private LotteryTicket docToTicket(Document doc) { .map(Integer::parseInt) .collect(Collectors.toSet()); LotteryNumbers lotteryNumbers = LotteryNumbers.create(numbers); - return new LotteryTicket(new LotteryTicketId(doc.getInteger("ticketId")), playerDetails, lotteryNumbers); + return new LotteryTicket(new LotteryTicketId(doc + .getInteger("ticketId")), playerDetails, lotteryNumbers); } } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryAdministration.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryAdministration.java index 965f1fc7229d..b9ebff446899 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryAdministration.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryAdministration.java @@ -27,13 +27,10 @@ import com.iluwatar.hexagonal.banking.WireTransfers; import com.iluwatar.hexagonal.database.LotteryTicketRepository; import com.iluwatar.hexagonal.eventlog.LotteryEventLog; - import java.util.Map; /** - * - * Lottery administration implementation - * + * Lottery administration implementation. */ public class LotteryAdministration { @@ -42,7 +39,7 @@ public class LotteryAdministration { private final WireTransfers wireTransfers; /** - * Constructor + * Constructor. */ @Inject public LotteryAdministration(LotteryTicketRepository repository, LotteryEventLog notifications, @@ -53,14 +50,14 @@ public LotteryAdministration(LotteryTicketRepository repository, LotteryEventLog } /** - * Get all the lottery tickets submitted for lottery + * Get all the lottery tickets submitted for lottery. */ public Map getAllSubmittedTickets() { return repository.findAll(); } /** - * Draw lottery numbers + * Draw lottery numbers. */ public LotteryNumbers performLottery() { LotteryNumbers numbers = LotteryNumbers.createRandom(); @@ -69,11 +66,14 @@ public LotteryNumbers performLottery() { LotteryTicketCheckResult result = LotteryUtils.checkTicketForPrize(repository, id, numbers); if (result.getResult().equals(LotteryTicketCheckResult.CheckResult.WIN_PRIZE)) { boolean transferred = wireTransfers.transferFunds(LotteryConstants.PRIZE_AMOUNT, - LotteryConstants.SERVICE_BANK_ACCOUNT, tickets.get(id).getPlayerDetails().getBankAccount()); + LotteryConstants.SERVICE_BANK_ACCOUNT, tickets.get(id).getPlayerDetails() + .getBankAccount()); if (transferred) { - notifications.ticketWon(tickets.get(id).getPlayerDetails(), LotteryConstants.PRIZE_AMOUNT); + notifications + .ticketWon(tickets.get(id).getPlayerDetails(), LotteryConstants.PRIZE_AMOUNT); } else { - notifications.prizeError(tickets.get(id).getPlayerDetails(), LotteryConstants.PRIZE_AMOUNT); + notifications + .prizeError(tickets.get(id).getPlayerDetails(), LotteryConstants.PRIZE_AMOUNT); } } else if (result.getResult().equals(LotteryTicketCheckResult.CheckResult.NO_PRIZE)) { notifications.ticketDidNotWin(tickets.get(id).getPlayerDetails()); @@ -83,7 +83,7 @@ public LotteryNumbers performLottery() { } /** - * Begin new lottery round + * Begin new lottery round. */ public void resetLottery() { repository.deleteAll(); diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryConstants.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryConstants.java index f33aa9ad801c..06bf294eeb21 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryConstants.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryConstants.java @@ -24,9 +24,7 @@ package com.iluwatar.hexagonal.domain; /** - * - * Lottery domain constants - * + * Lottery domain constants. */ public class LotteryConstants { @@ -38,5 +36,5 @@ private LotteryConstants() { public static final int TICKET_PRIZE = 3; public static final int SERVICE_BANK_ACCOUNT_BALANCE = 150000; public static final int PLAYER_MAX_BALANCE = 100; - + } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryNumbers.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryNumbers.java index 32f39e4cf0df..9dc00ec7695b 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryNumbers.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryNumbers.java @@ -24,7 +24,6 @@ package com.iluwatar.hexagonal.domain; import com.google.common.base.Joiner; - import java.util.Collections; import java.util.HashSet; import java.util.PrimitiveIterator; @@ -32,15 +31,13 @@ import java.util.Set; /** - * - * Value object representing lottery numbers. This lottery uses sets of 4 numbers. The numbers must be unique and - * between 1 and 20. - * + * Value object representing lottery numbers. This lottery uses sets of 4 numbers. The numbers must + * be unique and between 1 and 20. */ public class LotteryNumbers { private final Set numbers; - + public static final int MIN_NUMBER = 1; public static final int MAX_NUMBER = 20; public static final int NUM_NUMBERS = 4; @@ -62,6 +59,8 @@ private LotteryNumbers(Set givenNumbers) { } /** + * Creates a random lottery number. + * * @return random LotteryNumbers */ public static LotteryNumbers createRandom() { @@ -69,13 +68,17 @@ public static LotteryNumbers createRandom() { } /** + * Creates lottery number from given set of numbers. + * * @return given LotteryNumbers */ public static LotteryNumbers create(Set givenNumbers) { return new LotteryNumbers(givenNumbers); } - + /** + * Get numbers. + * * @return lottery numbers */ public Set getNumbers() { @@ -83,12 +86,14 @@ public Set getNumbers() { } /** + * Get numbers as string. + * * @return numbers as comma separated string */ public String getNumbersAsString() { return Joiner.on(',').join(numbers); } - + /** * Generates 4 unique random numbers between 1-20 into numbers set. */ @@ -107,17 +112,16 @@ public String toString() { } /** - * * Helper class for generating random numbers. - * */ private static class RandomNumberGenerator { private PrimitiveIterator.OfInt randomIterator; /** - * Initialize a new random number generator that generates random numbers in the range [min, max] - * + * Initialize a new random number generator that generates random numbers in the range [min, + * max]. + * * @param min the min value (inclusive) * @param max the max value (inclusive) */ @@ -126,13 +130,15 @@ public RandomNumberGenerator(int min, int max) { } /** + * Gets next random integer in [min, max] range. + * * @return a random number in the range (min, max) */ public int nextInt() { return randomIterator.nextInt(); } } - + @Override public int hashCode() { final int prime = 31; diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryService.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryService.java index 8839ccc969ba..212671d77740 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryService.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryService.java @@ -27,13 +27,10 @@ import com.iluwatar.hexagonal.banking.WireTransfers; import com.iluwatar.hexagonal.database.LotteryTicketRepository; import com.iluwatar.hexagonal.eventlog.LotteryEventLog; - import java.util.Optional; /** - * - * Implementation for lottery service - * + * Implementation for lottery service. */ public class LotteryService { @@ -42,7 +39,7 @@ public class LotteryService { private final WireTransfers wireTransfers; /** - * Constructor + * Constructor. */ @Inject public LotteryService(LotteryTicketRepository repository, LotteryEventLog notifications, @@ -53,7 +50,7 @@ public LotteryService(LotteryTicketRepository repository, LotteryEventLog notifi } /** - * Submit lottery ticket to participate in the lottery + * Submit lottery ticket to participate in the lottery. */ public Optional submitTicket(LotteryTicket ticket) { boolean result = wireTransfers.transferFunds(LotteryConstants.TICKET_PRIZE, @@ -70,9 +67,12 @@ public Optional submitTicket(LotteryTicket ticket) { } /** - * Check if lottery ticket has won + * Check if lottery ticket has won. */ - public LotteryTicketCheckResult checkTicketForPrize(LotteryTicketId id, LotteryNumbers winningNumbers) { + public LotteryTicketCheckResult checkTicketForPrize( + LotteryTicketId id, + LotteryNumbers winningNumbers + ) { return LotteryUtils.checkTicketForPrize(repository, id, winningNumbers); } } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicket.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicket.java index fbac5bff3576..91c041273fbf 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicket.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicket.java @@ -24,9 +24,7 @@ package com.iluwatar.hexagonal.domain; /** - * * Immutable value object representing lottery ticket. - * */ public class LotteryTicket { @@ -44,13 +42,17 @@ public LotteryTicket(LotteryTicketId id, PlayerDetails details, LotteryNumbers n } /** + * Get player details. + * * @return player details */ public PlayerDetails getPlayerDetails() { return playerDetails; } - + /** + * Get lottery numbers. + * * @return lottery numbers */ public LotteryNumbers getNumbers() { @@ -58,6 +60,8 @@ public LotteryNumbers getNumbers() { } /** + * Get ticket id. + * * @return id */ public LotteryTicketId getId() { @@ -65,7 +69,7 @@ public LotteryTicketId getId() { } /** - * set id + * Set ticket id. */ public void setId(LotteryTicketId id) { this.id = id; diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketCheckResult.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketCheckResult.java index e5c05301c5e1..c7f07c1df960 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketCheckResult.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketCheckResult.java @@ -24,16 +24,18 @@ package com.iluwatar.hexagonal.domain; /** - * * Represents lottery ticket check result. - * */ public class LotteryTicketCheckResult { /** - * Enumeration of Type of Outcomes of a Lottery + * Enumeration of Type of Outcomes of a Lottery. */ - public enum CheckResult { WIN_PRIZE, NO_PRIZE, TICKET_NOT_SUBMITTED } + public enum CheckResult { + WIN_PRIZE, + NO_PRIZE, + TICKET_NOT_SUBMITTED + } private final CheckResult checkResult; private final int prizeAmount; @@ -55,6 +57,8 @@ public LotteryTicketCheckResult(CheckResult result, int amount) { } /** + * Get result. + * * @return check result */ public CheckResult getResult() { @@ -62,6 +66,8 @@ public CheckResult getResult() { } /** + * Get prize amount. + * * @return prize amount */ public int getPrizeAmount() { diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketId.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketId.java index 29fd6b14599d..d4c036ece127 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketId.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketId.java @@ -26,13 +26,13 @@ import java.util.concurrent.atomic.AtomicInteger; /** - * Lottery ticked id + * Lottery ticked id. */ public class LotteryTicketId { private static AtomicInteger numAllocated = new AtomicInteger(0); private final int id; - + public LotteryTicketId() { this.id = numAllocated.incrementAndGet(); } @@ -40,7 +40,7 @@ public LotteryTicketId() { public LotteryTicketId(int id) { this.id = id; } - + public int getId() { return id; } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryUtils.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryUtils.java index ec070429d198..84f9af9e8b3c 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryUtils.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryUtils.java @@ -24,11 +24,11 @@ package com.iluwatar.hexagonal.domain; import com.iluwatar.hexagonal.database.LotteryTicketRepository; - +import com.iluwatar.hexagonal.domain.LotteryTicketCheckResult.CheckResult; import java.util.Optional; /** - * Lottery utilities + * Lottery utilities. */ public class LotteryUtils { @@ -36,19 +36,22 @@ private LotteryUtils() { } /** - * Checks if lottery ticket has won + * Checks if lottery ticket has won. */ - public static LotteryTicketCheckResult checkTicketForPrize(LotteryTicketRepository repository, LotteryTicketId id, - LotteryNumbers winningNumbers) { + public static LotteryTicketCheckResult checkTicketForPrize( + LotteryTicketRepository repository, + LotteryTicketId id, + LotteryNumbers winningNumbers + ) { Optional optional = repository.findById(id); if (optional.isPresent()) { if (optional.get().getNumbers().equals(winningNumbers)) { - return new LotteryTicketCheckResult(LotteryTicketCheckResult.CheckResult.WIN_PRIZE, 1000); + return new LotteryTicketCheckResult(CheckResult.WIN_PRIZE, 1000); } else { - return new LotteryTicketCheckResult(LotteryTicketCheckResult.CheckResult.NO_PRIZE); + return new LotteryTicketCheckResult(CheckResult.NO_PRIZE); } } else { - return new LotteryTicketCheckResult(LotteryTicketCheckResult.CheckResult.TICKET_NOT_SUBMITTED); + return new LotteryTicketCheckResult(CheckResult.TICKET_NOT_SUBMITTED); } } } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/PlayerDetails.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/PlayerDetails.java index 67b925e73cbf..f2c09744c178 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/PlayerDetails.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/PlayerDetails.java @@ -24,9 +24,7 @@ package com.iluwatar.hexagonal.domain; /** - * * Immutable value object containing lottery player details. - * */ public class PlayerDetails { @@ -44,20 +42,26 @@ public PlayerDetails(String email, String bankAccount, String phone) { } /** + * Get email. + * * @return email */ public String getEmail() { return emailAddress; } - + /** + * Get back account number. + * * @return bank account number */ public String getBankAccount() { return bankAccountNumber; } - + /** + * Get phone number. + * * @return phone number */ public String getPhoneNumber() { diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/eventlog/LotteryEventLog.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/eventlog/LotteryEventLog.java index e13dbfab5ffa..993f2a344691 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/eventlog/LotteryEventLog.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/eventlog/LotteryEventLog.java @@ -26,34 +26,32 @@ import com.iluwatar.hexagonal.domain.PlayerDetails; /** - * - * Event log for lottery events - * + * Event log for lottery events. */ public interface LotteryEventLog { /** - * lottery ticket submitted + * lottery ticket submitted. */ void ticketSubmitted(PlayerDetails details); /** - * error submitting lottery ticket + * error submitting lottery ticket. */ void ticketSubmitError(PlayerDetails details); /** - * lottery ticket did not win + * lottery ticket did not win. */ void ticketDidNotWin(PlayerDetails details); /** - * lottery ticket won + * lottery ticket won. */ void ticketWon(PlayerDetails details, int prizeAmount); /** - * error paying the prize + * error paying the prize. */ void prizeError(PlayerDetails details, int prizeAmount); diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/eventlog/MongoEventLog.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/eventlog/MongoEventLog.java index 1eda775c0c68..f979506e4e3f 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/eventlog/MongoEventLog.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/eventlog/MongoEventLog.java @@ -30,7 +30,7 @@ import org.bson.Document; /** - * Mongo based event log + * Mongo based event log. */ public class MongoEventLog implements LotteryEventLog { @@ -44,28 +44,28 @@ public class MongoEventLog implements LotteryEventLog { private StdOutEventLog stdOutEventLog = new StdOutEventLog(); /** - * Constructor + * Constructor. */ public MongoEventLog() { connect(); } /** - * Constructor accepting parameters + * Constructor accepting parameters. */ public MongoEventLog(String dbName, String eventsCollectionName) { connect(dbName, eventsCollectionName); } /** - * Connect to database with default parameters + * Connect to database with default parameters. */ public void connect() { connect(DEFAULT_DB, DEFAULT_EVENTS_COLLECTION); } /** - * Connect to database with given parameters + * Connect to database with given parameters. */ public void connect(String dbName, String eventsCollectionName) { if (mongoClient != null) { @@ -78,6 +78,8 @@ public void connect(String dbName, String eventsCollectionName) { } /** + * Get mongo client. + * * @return mongo client */ public MongoClient getMongoClient() { @@ -85,6 +87,7 @@ public MongoClient getMongoClient() { } /** + * Get mongo database. * * @return mongo database */ @@ -93,8 +96,9 @@ public MongoDatabase getMongoDatabase() { } /** + * Get events collection. * - * @return accounts collection + * @return events collection */ public MongoCollection getEventsCollection() { return eventsCollection; @@ -106,7 +110,8 @@ public void ticketSubmitted(PlayerDetails details) { Document document = new Document("email", details.getEmail()); document.put("phone", details.getPhoneNumber()); document.put("bank", details.getBankAccount()); - document.put("message", "Lottery ticket was submitted and bank account was charged for 3 credits."); + document + .put("message", "Lottery ticket was submitted and bank account was charged for 3 credits."); eventsCollection.insertOne(document); stdOutEventLog.ticketSubmitted(details); } @@ -136,8 +141,9 @@ public void ticketWon(PlayerDetails details, int prizeAmount) { Document document = new Document("email", details.getEmail()); document.put("phone", details.getPhoneNumber()); document.put("bank", details.getBankAccount()); - document.put("message", String.format("Lottery ticket won! The bank account was deposited with %d credits.", - prizeAmount)); + document.put("message", String + .format("Lottery ticket won! The bank account was deposited with %d credits.", + prizeAmount)); eventsCollection.insertOne(document); stdOutEventLog.ticketWon(details, prizeAmount); } @@ -147,8 +153,9 @@ public void prizeError(PlayerDetails details, int prizeAmount) { Document document = new Document("email", details.getEmail()); document.put("phone", details.getPhoneNumber()); document.put("bank", details.getBankAccount()); - document.put("message", String.format("Lottery ticket won! Unfortunately the bank credit transfer of %d failed.", - prizeAmount)); + document.put("message", String + .format("Lottery ticket won! Unfortunately the bank credit transfer of %d failed.", + prizeAmount)); eventsCollection.insertOne(document); stdOutEventLog.prizeError(details, prizeAmount); } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/eventlog/StdOutEventLog.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/eventlog/StdOutEventLog.java index e236acf69762..284fc4d1cccd 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/eventlog/StdOutEventLog.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/eventlog/StdOutEventLog.java @@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory; /** - * Standard output event log + * Standard output event log. */ public class StdOutEventLog implements LotteryEventLog { @@ -42,24 +42,27 @@ public void ticketSubmitted(PlayerDetails details) { @Override public void ticketDidNotWin(PlayerDetails details) { - LOGGER.info("Lottery ticket for {} was checked and unfortunately did not win this time.", details.getEmail()); + LOGGER + .info("Lottery ticket for {} was checked and unfortunately did not win this time.", details + .getEmail()); } @Override public void ticketWon(PlayerDetails details, int prizeAmount) { LOGGER.info("Lottery ticket for {} has won! The bank account {} was deposited with {} credits.", - details.getEmail(), details.getBankAccount(), prizeAmount); + details.getEmail(), details.getBankAccount(), prizeAmount); } @Override public void prizeError(PlayerDetails details, int prizeAmount) { - LOGGER.error("Lottery ticket for {} has won! Unfortunately the bank credit transfer of {} failed.", - details.getEmail(), prizeAmount); + LOGGER + .error("Lottery ticket for {} has won! Unfortunately the bank credit transfer of" + + " {} failed.", details.getEmail(), prizeAmount); } @Override public void ticketSubmitError(PlayerDetails details) { - LOGGER.error("Lottery ticket for {} could not be submitted because the credit transfer of 3 credits failed.", - details.getEmail()); + LOGGER.error("Lottery ticket for {} could not be submitted because the credit transfer" + + " of 3 credits failed.", details.getEmail()); } } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/module/LotteryModule.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/module/LotteryModule.java index a8a10b69cf6e..73cf16805524 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/module/LotteryModule.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/module/LotteryModule.java @@ -32,7 +32,7 @@ import com.iluwatar.hexagonal.eventlog.MongoEventLog; /** - * Guice module for binding production dependencies + * Guice module for binding production dependencies. */ public class LotteryModule extends AbstractModule { @Override diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/module/LotteryTestingModule.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/module/LotteryTestingModule.java index 4fd8262de662..f416ffcc2af6 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/module/LotteryTestingModule.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/module/LotteryTestingModule.java @@ -32,7 +32,7 @@ import com.iluwatar.hexagonal.eventlog.StdOutEventLog; /** - * Guice module for testing dependencies + * Guice module for testing dependencies. */ public class LotteryTestingModule extends AbstractModule { @Override diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/mongo/MongoConnectionPropertiesLoader.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/mongo/MongoConnectionPropertiesLoader.java index f9edbad995d2..2d8463f7f50f 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/mongo/MongoConnectionPropertiesLoader.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/mongo/MongoConnectionPropertiesLoader.java @@ -27,7 +27,7 @@ import java.util.Properties; /** - * Mongo connection properties loader + * Mongo connection properties loader. */ public class MongoConnectionPropertiesLoader { @@ -35,8 +35,7 @@ public class MongoConnectionPropertiesLoader { private static final int DEFAULT_PORT = 27017; /** - * Try to load connection properties from file. - * Fall back to default connection properties. + * Try to load connection properties from file. Fall back to default connection properties. */ public static void load() { String host = DEFAULT_HOST; diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java index 8189303eb04a..ccda4a2086c0 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/sampledata/SampleData.java @@ -30,12 +30,11 @@ import com.iluwatar.hexagonal.domain.LotteryTicket; import com.iluwatar.hexagonal.domain.LotteryTicketId; import com.iluwatar.hexagonal.domain.PlayerDetails; - import java.util.List; import java.util.Random; /** - * Utilities for creating sample lottery tickets + * Utilities for creating sample lottery tickets. */ public class SampleData { @@ -44,45 +43,45 @@ public class SampleData { static { PLAYERS = List.of( - new PlayerDetails("john@google.com", "312-342", "+3242434242"), - new PlayerDetails("mary@google.com", "234-987", "+23452346"), - new PlayerDetails("steve@google.com", "833-836", "+63457543"), - new PlayerDetails("wayne@google.com", "319-826", "+24626"), - new PlayerDetails("johnie@google.com", "983-322", "+3635635"), - new PlayerDetails("andy@google.com", "934-734", "+0898245"), - new PlayerDetails("richard@google.com", "536-738", "+09845325"), - new PlayerDetails("kevin@google.com", "453-936", "+2423532"), - new PlayerDetails("arnold@google.com", "114-988", "+5646346524"), - new PlayerDetails("ian@google.com", "663-765", "+928394235"), - new PlayerDetails("robin@google.com", "334-763", "+35448"), - new PlayerDetails("ted@google.com", "735-964", "+98752345"), - new PlayerDetails("larry@google.com", "734-853", "+043842423"), - new PlayerDetails("calvin@google.com", "334-746", "+73294135"), - new PlayerDetails("jacob@google.com", "444-766", "+358042354"), - new PlayerDetails("edwin@google.com", "895-345", "+9752435"), - new PlayerDetails("mary@google.com", "760-009", "+34203542"), - new PlayerDetails("lolita@google.com", "425-907", "+9872342"), - new PlayerDetails("bruno@google.com", "023-638", "+673824122"), - new PlayerDetails("peter@google.com", "335-886", "+5432503945"), - new PlayerDetails("warren@google.com", "225-946", "+9872341324"), - new PlayerDetails("monica@google.com", "265-748", "+134124"), - new PlayerDetails("ollie@google.com", "190-045", "+34453452"), - new PlayerDetails("yngwie@google.com", "241-465", "+9897641231"), - new PlayerDetails("lars@google.com", "746-936", "+42345298345"), - new PlayerDetails("bobbie@google.com", "946-384", "+79831742"), - new PlayerDetails("tyron@google.com", "310-992", "+0498837412"), - new PlayerDetails("tyrell@google.com", "032-045", "+67834134"), - new PlayerDetails("nadja@google.com", "000-346", "+498723"), - new PlayerDetails("wendy@google.com", "994-989", "+987324454"), - new PlayerDetails("luke@google.com", "546-634", "+987642435"), - new PlayerDetails("bjorn@google.com", "342-874", "+7834325"), - new PlayerDetails("lisa@google.com", "024-653", "+980742154"), - new PlayerDetails("anton@google.com", "834-935", "+876423145"), - new PlayerDetails("bruce@google.com", "284-936", "+09843212345"), - new PlayerDetails("ray@google.com", "843-073", "+678324123"), - new PlayerDetails("ron@google.com", "637-738", "+09842354"), - new PlayerDetails("xavier@google.com", "143-947", "+375245"), - new PlayerDetails("harriet@google.com", "842-404", "+131243252") + new PlayerDetails("john@google.com", "312-342", "+3242434242"), + new PlayerDetails("mary@google.com", "234-987", "+23452346"), + new PlayerDetails("steve@google.com", "833-836", "+63457543"), + new PlayerDetails("wayne@google.com", "319-826", "+24626"), + new PlayerDetails("johnie@google.com", "983-322", "+3635635"), + new PlayerDetails("andy@google.com", "934-734", "+0898245"), + new PlayerDetails("richard@google.com", "536-738", "+09845325"), + new PlayerDetails("kevin@google.com", "453-936", "+2423532"), + new PlayerDetails("arnold@google.com", "114-988", "+5646346524"), + new PlayerDetails("ian@google.com", "663-765", "+928394235"), + new PlayerDetails("robin@google.com", "334-763", "+35448"), + new PlayerDetails("ted@google.com", "735-964", "+98752345"), + new PlayerDetails("larry@google.com", "734-853", "+043842423"), + new PlayerDetails("calvin@google.com", "334-746", "+73294135"), + new PlayerDetails("jacob@google.com", "444-766", "+358042354"), + new PlayerDetails("edwin@google.com", "895-345", "+9752435"), + new PlayerDetails("mary@google.com", "760-009", "+34203542"), + new PlayerDetails("lolita@google.com", "425-907", "+9872342"), + new PlayerDetails("bruno@google.com", "023-638", "+673824122"), + new PlayerDetails("peter@google.com", "335-886", "+5432503945"), + new PlayerDetails("warren@google.com", "225-946", "+9872341324"), + new PlayerDetails("monica@google.com", "265-748", "+134124"), + new PlayerDetails("ollie@google.com", "190-045", "+34453452"), + new PlayerDetails("yngwie@google.com", "241-465", "+9897641231"), + new PlayerDetails("lars@google.com", "746-936", "+42345298345"), + new PlayerDetails("bobbie@google.com", "946-384", "+79831742"), + new PlayerDetails("tyron@google.com", "310-992", "+0498837412"), + new PlayerDetails("tyrell@google.com", "032-045", "+67834134"), + new PlayerDetails("nadja@google.com", "000-346", "+498723"), + new PlayerDetails("wendy@google.com", "994-989", "+987324454"), + new PlayerDetails("luke@google.com", "546-634", "+987642435"), + new PlayerDetails("bjorn@google.com", "342-874", "+7834325"), + new PlayerDetails("lisa@google.com", "024-653", "+980742154"), + new PlayerDetails("anton@google.com", "834-935", "+876423145"), + new PlayerDetails("bruce@google.com", "284-936", "+09843212345"), + new PlayerDetails("ray@google.com", "843-073", "+678324123"), + new PlayerDetails("ron@google.com", "637-738", "+09842354"), + new PlayerDetails("xavier@google.com", "143-947", "+375245"), + new PlayerDetails("harriet@google.com", "842-404", "+131243252") ); InMemoryBank wireTransfers = new InMemoryBank(); for (PlayerDetails player : PLAYERS) { @@ -92,7 +91,7 @@ public class SampleData { } /** - * Inserts lottery tickets into the database based on the sample data + * Inserts lottery tickets into the database based on the sample data. */ public static void submitTickets(LotteryService lotteryService, int numTickets) { for (int i = 0; i < numTickets; i++) { diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java index b452a4f5dab8..dccbf68ebf4b 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java @@ -29,25 +29,24 @@ import com.iluwatar.hexagonal.domain.LotteryService; import com.iluwatar.hexagonal.module.LotteryModule; import com.iluwatar.hexagonal.mongo.MongoConnectionPropertiesLoader; +import java.util.Scanner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Scanner; - /** - * Console interface for lottery players + * Console interface for lottery players. */ public class ConsoleLottery { private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleLottery.class); /** - * Program entry point + * Program entry point. */ public static void main(String[] args) { MongoConnectionPropertiesLoader.load(); Injector injector = Guice.createInjector(new LotteryModule()); - LotteryService service = injector.getInstance( LotteryService.class); + LotteryService service = injector.getInstance(LotteryService.class); WireTransfers bank = injector.getInstance(WireTransfers.class); try (Scanner scanner = new Scanner(System.in)) { boolean exit = false; diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleService.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleService.java index dec414ee40fb..b5bd01a663cf 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleService.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleService.java @@ -25,31 +25,30 @@ import com.iluwatar.hexagonal.banking.WireTransfers; import com.iluwatar.hexagonal.domain.LotteryService; - import java.util.Scanner; /** - * Console interface for lottery service + * Console interface for lottery service. */ public interface LotteryConsoleService { void checkTicket(LotteryService service, Scanner scanner); /** - * Submit lottery ticket to participate in the lottery - */ + * Submit lottery ticket to participate in the lottery. + */ void submitTicket(LotteryService service, Scanner scanner); /** - * Add funds to lottery account - */ + * Add funds to lottery account. + */ void addFundsToLotteryAccount(WireTransfers bank, Scanner scanner); /** - * Recovery funds from lottery account - */ + * Recovery funds from lottery account. + */ void queryLotteryAccountFunds(WireTransfers bank, Scanner scanner); } diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleServiceImpl.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleServiceImpl.java index 3641b9a5c50c..d100dba03c83 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleServiceImpl.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryConsoleServiceImpl.java @@ -24,22 +24,29 @@ package com.iluwatar.hexagonal.service; import com.iluwatar.hexagonal.banking.WireTransfers; -import com.iluwatar.hexagonal.domain.*; -import org.slf4j.Logger; - -import java.util.*; +import com.iluwatar.hexagonal.domain.LotteryNumbers; +import com.iluwatar.hexagonal.domain.LotteryService; +import com.iluwatar.hexagonal.domain.LotteryTicket; +import com.iluwatar.hexagonal.domain.LotteryTicketCheckResult; +import com.iluwatar.hexagonal.domain.LotteryTicketId; +import com.iluwatar.hexagonal.domain.PlayerDetails; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Optional; +import java.util.Scanner; +import java.util.Set; import java.util.stream.Collectors; -import java.util.stream.IntStream; +import org.slf4j.Logger; /** - * Console implementation for lottery console service + * Console implementation for lottery console service. */ public class LotteryConsoleServiceImpl implements LotteryConsoleService { private final Logger logger; /** - * Constructor + * Constructor. */ public LotteryConsoleServiceImpl(Logger logger) { this.logger = logger; @@ -47,79 +54,81 @@ public LotteryConsoleServiceImpl(Logger logger) { @Override public void checkTicket(LotteryService service, Scanner scanner) { - logger.info( "What is the ID of the lottery ticket?" ); - String id = readString( scanner ); - logger.info( "Give the 4 comma separated winning numbers?" ); - String numbers = readString( scanner ); + logger.info("What is the ID of the lottery ticket?"); + String id = readString(scanner); + logger.info("Give the 4 comma separated winning numbers?"); + String numbers = readString(scanner); try { - String[] parts = numbers.split( "," ); + String[] parts = numbers.split(","); Set winningNumbers = new HashSet<>(); for (int i = 0; i < 4; i++) { - winningNumbers.add( Integer.parseInt( parts[i] ) ); + winningNumbers.add(Integer.parseInt(parts[i])); } - final LotteryTicketId lotteryTicketId = new LotteryTicketId( Integer.parseInt( id ) ); - final LotteryNumbers lotteryNumbers = LotteryNumbers.create( winningNumbers ); - LotteryTicketCheckResult result = service.checkTicketForPrize( lotteryTicketId, lotteryNumbers ); + final LotteryTicketId lotteryTicketId = new LotteryTicketId(Integer.parseInt(id)); + final LotteryNumbers lotteryNumbers = LotteryNumbers.create(winningNumbers); + LotteryTicketCheckResult result = + service.checkTicketForPrize(lotteryTicketId, lotteryNumbers); - if (result.getResult().equals( LotteryTicketCheckResult.CheckResult.WIN_PRIZE )) { - logger.info( "Congratulations! The lottery ticket has won!" ); - } else if (result.getResult().equals( LotteryTicketCheckResult.CheckResult.NO_PRIZE )) { - logger.info( "Unfortunately the lottery ticket did not win." ); + if (result.getResult().equals(LotteryTicketCheckResult.CheckResult.WIN_PRIZE)) { + logger.info("Congratulations! The lottery ticket has won!"); + } else if (result.getResult().equals(LotteryTicketCheckResult.CheckResult.NO_PRIZE)) { + logger.info("Unfortunately the lottery ticket did not win."); } else { - logger.info( "Such lottery ticket has not been submitted." ); + logger.info("Such lottery ticket has not been submitted."); } } catch (Exception e) { - logger.info( "Failed checking the lottery ticket - please try again." ); + logger.info("Failed checking the lottery ticket - please try again."); } } @Override public void submitTicket(LotteryService service, Scanner scanner) { - logger.info( "What is your email address?" ); - String email = readString( scanner ); - logger.info( "What is your bank account number?" ); - String account = readString( scanner ); - logger.info( "What is your phone number?" ); - String phone = readString( scanner ); - PlayerDetails details = new PlayerDetails( email, account, phone ); - logger.info( "Give 4 comma separated lottery numbers?" ); - String numbers = readString( scanner ); + logger.info("What is your email address?"); + String email = readString(scanner); + logger.info("What is your bank account number?"); + String account = readString(scanner); + logger.info("What is your phone number?"); + String phone = readString(scanner); + PlayerDetails details = new PlayerDetails(email, account, phone); + logger.info("Give 4 comma separated lottery numbers?"); + String numbers = readString(scanner); try { - String[] parts = numbers.split( "," ); + String[] parts = numbers.split(","); Set chosen = Arrays.stream(parts).map(Integer::parseInt).collect(Collectors.toSet()); - LotteryNumbers lotteryNumbers = LotteryNumbers.create( chosen ); - LotteryTicket lotteryTicket = new LotteryTicket( new LotteryTicketId(), details, lotteryNumbers ); - Optional id = service.submitTicket( lotteryTicket ); + LotteryNumbers lotteryNumbers = LotteryNumbers.create(chosen); + LotteryTicket lotteryTicket = + new LotteryTicket(new LotteryTicketId(), details, lotteryNumbers); + Optional id = service.submitTicket(lotteryTicket); if (id.isPresent()) { - logger.info( "Submitted lottery ticket with id: {}", id.get() ); + logger.info("Submitted lottery ticket with id: {}", id.get()); } else { - logger.info( "Failed submitting lottery ticket - please try again." ); + logger.info("Failed submitting lottery ticket - please try again."); } } catch (Exception e) { - logger.info( "Failed submitting lottery ticket - please try again." ); + logger.info("Failed submitting lottery ticket - please try again."); } } @Override public void addFundsToLotteryAccount(WireTransfers bank, Scanner scanner) { - logger.info( "What is the account number?" ); - String account = readString( scanner ); - logger.info( "How many credits do you want to deposit?" ); - String amount = readString( scanner ); - bank.setFunds( account, Integer.parseInt( amount ) ); - logger.info( "The account {} now has {} credits.", account, bank.getFunds( account ) ); + logger.info("What is the account number?"); + String account = readString(scanner); + logger.info("How many credits do you want to deposit?"); + String amount = readString(scanner); + bank.setFunds(account, Integer.parseInt(amount)); + logger.info("The account {} now has {} credits.", account, bank.getFunds(account)); } @Override public void queryLotteryAccountFunds(WireTransfers bank, Scanner scanner) { - logger.info( "What is the account number?" ); - String account = readString( scanner ); - logger.info( "The account {} has {} credits.", account, bank.getFunds( account ) ); + logger.info("What is the account number?"); + String account = readString(scanner); + logger.info("The account {} has {} credits.", account, bank.getFunds(account)); } private String readString(Scanner scanner) { - logger.info( "> " ); + logger.info("> "); return scanner.next(); } } From 7f06f3b78c9e6cb900606d2fb5bb3af2cac93978 Mon Sep 17 00:00:00 2001 From: Anurag Agarwal Date: Sun, 10 Nov 2019 22:35:05 +0530 Subject: [PATCH 142/197] Resolves checkstyle errors for intercepting-filter, interpreter, iterator (#1065) * Reduces checkstyle errors in intercepting-filter * Reduces checkstyle errors in interpreter * Reduces checkstyle errors in iterator --- .../intercepting/filter/AbstractFilter.java | 4 +-- .../intercepting/filter/AddressFilter.java | 3 +- .../com/iluwatar/intercepting/filter/App.java | 29 +++++++++---------- .../iluwatar/intercepting/filter/Client.java | 24 ++++++++------- .../intercepting/filter/ContactFilter.java | 5 ++-- .../intercepting/filter/DepositFilter.java | 5 ++-- .../iluwatar/intercepting/filter/Filter.java | 3 +- .../intercepting/filter/FilterChain.java | 6 ++-- .../intercepting/filter/FilterManager.java | 3 +- .../intercepting/filter/NameFilter.java | 3 +- .../iluwatar/intercepting/filter/Order.java | 11 ++++--- .../intercepting/filter/OrderFilter.java | 3 +- .../iluwatar/intercepting/filter/Target.java | 18 ++++++------ .../java/com/iluwatar/interpreter/App.java | 23 ++++++--------- .../com/iluwatar/interpreter/Expression.java | 4 +-- .../iluwatar/interpreter/MinusExpression.java | 4 +-- .../interpreter/MultiplyExpression.java | 4 +-- .../interpreter/NumberExpression.java | 4 +-- .../iluwatar/interpreter/PlusExpression.java | 4 +-- .../main/java/com/iluwatar/iterator/App.java | 6 ++-- .../java/com/iluwatar/iterator/Iterator.java | 3 +- .../iluwatar/iterator/bst/BstIterator.java | 8 +++-- .../com/iluwatar/iterator/bst/TreeNode.java | 4 +-- .../java/com/iluwatar/iterator/list/Item.java | 4 +-- .../com/iluwatar/iterator/list/ItemType.java | 4 +-- .../iluwatar/iterator/list/TreasureChest.java | 26 ++++++++--------- .../list/TreasureChestItemIterator.java | 6 ++-- 27 files changed, 99 insertions(+), 122 deletions(-) diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/AbstractFilter.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/AbstractFilter.java index a51bfba6fc50..aa20365f6ada 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/AbstractFilter.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/AbstractFilter.java @@ -25,13 +25,13 @@ /** * Base class for order processing filters. Handles chain management. - * */ public abstract class AbstractFilter implements Filter { private Filter next; - public AbstractFilter() {} + public AbstractFilter() { + } public AbstractFilter(Filter next) { this.next = next; diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/AddressFilter.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/AddressFilter.java index 791cb8ea6a47..6b9a15382b8e 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/AddressFilter.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/AddressFilter.java @@ -26,9 +26,8 @@ /** * Concrete implementation of filter This filter is responsible for checking/filtering the input in * the address field. - * - * @author joshzambales * + * @author joshzambales */ public class AddressFilter extends AbstractFilter { diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/App.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/App.java index 822fae13fc35..b81f1e229284 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/App.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/App.java @@ -24,7 +24,6 @@ package com.iluwatar.intercepting.filter; /** - * * When a request enters a Web application, it often must pass several entrance tests prior to the * main processing stage. For example, - Has the client been authenticated? - Does the client have a * valid session? - Is the client's IP address from a trusted network? - Does the request path @@ -32,28 +31,26 @@ * the browser type of the client? Some of these checks are tests, resulting in a yes or no answer * that determines whether processing will continue. Other checks manipulate the incoming data * stream into a form suitable for processing. - *

    - * The classic solution consists of a series of conditional checks, with any failed check aborting - * the request. Nested if/else statements are a standard strategy, but this solution leads to code - * fragility and a copy-and-paste style of programming, because the flow of the filtering and the - * action of the filters is compiled into the application. - *

    - * The key to solving this problem in a flexible and unobtrusive manner is to have a simple + * + *

    The classic solution consists of a series of conditional checks, with any failed check + * aborting the request. Nested if/else statements are a standard strategy, but this solution leads + * to code fragility and a copy-and-paste style of programming, because the flow of the filtering + * and the action of the filters is compiled into the application. + * + *

    The key to solving this problem in a flexible and unobtrusive manner is to have a simple * mechanism for adding and removing processing components, in which each component completes a * specific filtering action. This is the Intercepting Filter pattern in action. - *

    - * In this example we check whether the order request is valid through pre-processing done via - * {@link Filter}. Each field has its own corresponding {@link Filter} - *

    - * - * @author joshzambales * + *

    In this example we check whether the order request is valid through pre-processing done via + * {@link Filter}. Each field has its own corresponding {@link Filter}. + * + * @author joshzambales */ public class App { /** - * Program entry point - * + * Program entry point. + * * @param args command line args */ public static void main(String[] args) { diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Client.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Client.java index 109f3ab02ed5..865dbbb381da 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Client.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Client.java @@ -23,6 +23,9 @@ package com.iluwatar.intercepting.filter; +import java.awt.BorderLayout; +import java.awt.GridLayout; + import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; @@ -32,18 +35,15 @@ import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; -import java.awt.BorderLayout; -import java.awt.GridLayout; /** - * The Client class is responsible for handling the input and running them through filters inside the - * {@link FilterManager}. + * The Client class is responsible for handling the input and running them through filters inside + * the {@link FilterManager}. * - * This is where {@link Filter}s come to play as the client pre-processes the request before being displayed in the - * {@link Target}. - * - * @author joshzambales + *

    This is where {@link Filter}s come to play as the client pre-processes the request before + * being displayed in the {@link Target}. * + * @author joshzambales */ public class Client extends JFrame { // NOSONAR @@ -57,7 +57,7 @@ public class Client extends JFrame { // NOSONAR private JButton processButton; /** - * Constructor + * Constructor. */ public Client() { super("Client System"); @@ -107,8 +107,10 @@ private void setup() { }); processButton.addActionListener(e -> { - Order order = new Order(jtFields[0].getText(), jtFields[1].getText(), jtAreas[0].getText(), jtFields[2].getText(), - jtAreas[1].getText()); + Order order = + new Order(jtFields[0].getText(), jtFields[1].getText(), jtAreas[0].getText(), jtFields[2] + .getText(), + jtAreas[1].getText()); jl.setText(sendRequest(order)); }); diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/ContactFilter.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/ContactFilter.java index 84425cd72b55..9acdec31966b 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/ContactFilter.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/ContactFilter.java @@ -26,10 +26,9 @@ /** * Concrete implementation of filter This filter checks for the contact field in which it checks if * the input consist of numbers and it also checks if the input follows the length constraint (11 - * digits) - * - * @author joshzambales + * digits). * + * @author joshzambales */ public class ContactFilter extends AbstractFilter { diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/DepositFilter.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/DepositFilter.java index e2e68083bbff..e7457c9bec5b 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/DepositFilter.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/DepositFilter.java @@ -24,10 +24,9 @@ package com.iluwatar.intercepting.filter; /** - * Concrete implementation of filter This checks for the deposit code - * - * @author joshzambales + * Concrete implementation of filter This checks for the deposit code. * + * @author joshzambales */ public class DepositFilter extends AbstractFilter { diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Filter.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Filter.java index 5c9fe325a758..76afdedbded3 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Filter.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Filter.java @@ -26,9 +26,8 @@ /** * Filters perform certain tasks prior or after execution of request by request handler. In this * case, before the request is handled by the target, the request undergoes through each Filter - * - * @author joshzambales * + * @author joshzambales */ public interface Filter { diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/FilterChain.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/FilterChain.java index bfd88f61d78b..07429ca5f708 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/FilterChain.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/FilterChain.java @@ -26,7 +26,7 @@ /** * Filter Chain carries multiple filters and help to execute them in defined order on target. - * + * * @author joshzambales */ public class FilterChain { @@ -35,7 +35,7 @@ public class FilterChain { /** - * Adds filter + * Adds filter. */ public void addFilter(Filter filter) { if (chain == null) { @@ -46,7 +46,7 @@ public void addFilter(Filter filter) { } /** - * Execute filter chain + * Execute filter chain. */ public String execute(Order order) { if (chain != null) { diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/FilterManager.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/FilterManager.java index cef868dcc4b8..e8f3b941faa1 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/FilterManager.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/FilterManager.java @@ -25,9 +25,8 @@ /** * Filter Manager manages the filters and {@link FilterChain}. - * - * @author joshzambales * + * @author joshzambales */ public class FilterManager { diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/NameFilter.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/NameFilter.java index d06b24ca9892..95ef54fe1d82 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/NameFilter.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/NameFilter.java @@ -26,9 +26,8 @@ /** * Concrete implementation of filter. This filter checks if the input in the Name field is valid. * (alphanumeric) - * - * @author joshzambales * + * @author joshzambales */ public class NameFilter extends AbstractFilter { diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Order.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Order.java index 988464aec41a..a75911578161 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Order.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Order.java @@ -25,7 +25,6 @@ /** * Order class carries the order data. - * */ public class Order { @@ -35,12 +34,16 @@ public class Order { private String depositNumber; private String orderItem; - public Order() {} + public Order() { + } /** - * Constructor + * Constructor. */ - public Order(String name, String contactNumber, String address, String depositNumber, String order) { + public Order( + String name, String contactNumber, String address, + String depositNumber, String order + ) { this.name = name; this.contactNumber = contactNumber; this.address = address; diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/OrderFilter.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/OrderFilter.java index 8669cd2e7d6c..de91386f3f57 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/OrderFilter.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/OrderFilter.java @@ -25,9 +25,8 @@ /** * Concrete implementation of filter. This checks for the order field. - * - * @author joshzambales * + * @author joshzambales */ public class OrderFilter extends AbstractFilter { diff --git a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Target.java b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Target.java index 415d3b2b645c..9ded355c757a 100644 --- a/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Target.java +++ b/intercepting-filter/src/main/java/com/iluwatar/intercepting/filter/Target.java @@ -23,6 +23,11 @@ package com.iluwatar.intercepting.filter; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; @@ -32,16 +37,11 @@ import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import javax.swing.table.DefaultTableModel; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; /** * This is where the requests are displayed after being validated by filters. - * - * @author mjoshzambales * + * @author mjoshzambales */ public class Target extends JFrame { //NOSONAR @@ -52,14 +52,14 @@ public class Target extends JFrame { //NOSONAR private JButton del; /** - * Constructor + * Constructor. */ public Target() { super("Order System"); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setSize(640, 480); dtm = - new DefaultTableModel(new Object[] {"Name", "Contact Number", "Address", "Deposit Number", + new DefaultTableModel(new Object[]{"Name", "Contact Number", "Address", "Deposit Number", "Order"}, 0); jt = new JTable(dtm); del = new JButton("Delete"); @@ -85,7 +85,7 @@ private void setup() { } public void execute(String[] request) { - dtm.addRow(new Object[] {request[0], request[1], request[2], request[3], request[4]}); + dtm.addRow(new Object[]{request[0], request[1], request[2], request[3], request[4]}); } class DListener implements ActionListener { diff --git a/interpreter/src/main/java/com/iluwatar/interpreter/App.java b/interpreter/src/main/java/com/iluwatar/interpreter/App.java index 5dcd3b81d7b8..d63c78506014 100644 --- a/interpreter/src/main/java/com/iluwatar/interpreter/App.java +++ b/interpreter/src/main/java/com/iluwatar/interpreter/App.java @@ -23,35 +23,30 @@ package com.iluwatar.interpreter; +import java.util.Stack; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Stack; - /** - * * The Interpreter pattern is a design pattern that specifies how to evaluate sentences in a * language. The basic idea is to have a class for each symbol (terminal or nonterminal) in a * specialized computer language. The syntax tree of a sentence in the language is an instance of * the composite pattern and is used to evaluate (interpret) the sentence for a client. - *

    - * In this example we use the Interpreter pattern to break sentences into expressions ( - * {@link Expression}) that can be evaluated and as a whole form the result. - * + * + *

    In this example we use the Interpreter pattern to break sentences into expressions ({@link + * Expression}) that can be evaluated and as a whole form the result. */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * * Program entry point. - *

    - * Expressions can be evaluated using prefix, infix or postfix notations This sample uses postfix, - * where operator comes after the operands - * + * + *

    Expressions can be evaluated using prefix, infix or postfix notations This sample uses + * postfix, where operator comes after the operands. + * * @param args command line args - * */ public static void main(String[] args) { String tokenString = "4 3 2 - 1 + *"; @@ -84,7 +79,7 @@ public static boolean isOperator(String s) { } /** - * Get expression for string + * Get expression for string. */ public static Expression getOperatorInstance(String s, Expression left, Expression right) { switch (s) { diff --git a/interpreter/src/main/java/com/iluwatar/interpreter/Expression.java b/interpreter/src/main/java/com/iluwatar/interpreter/Expression.java index dc9da1177211..dee43b57fb2e 100644 --- a/interpreter/src/main/java/com/iluwatar/interpreter/Expression.java +++ b/interpreter/src/main/java/com/iluwatar/interpreter/Expression.java @@ -24,9 +24,7 @@ package com.iluwatar.interpreter; /** - * - * Expression - * + * Expression. */ public abstract class Expression { diff --git a/interpreter/src/main/java/com/iluwatar/interpreter/MinusExpression.java b/interpreter/src/main/java/com/iluwatar/interpreter/MinusExpression.java index 74ca47bf3610..24ef7914e569 100644 --- a/interpreter/src/main/java/com/iluwatar/interpreter/MinusExpression.java +++ b/interpreter/src/main/java/com/iluwatar/interpreter/MinusExpression.java @@ -24,9 +24,7 @@ package com.iluwatar.interpreter; /** - * - * MinusExpression - * + * MinusExpression. */ public class MinusExpression extends Expression { diff --git a/interpreter/src/main/java/com/iluwatar/interpreter/MultiplyExpression.java b/interpreter/src/main/java/com/iluwatar/interpreter/MultiplyExpression.java index 4ff9d280500d..606937e0bb3a 100644 --- a/interpreter/src/main/java/com/iluwatar/interpreter/MultiplyExpression.java +++ b/interpreter/src/main/java/com/iluwatar/interpreter/MultiplyExpression.java @@ -24,9 +24,7 @@ package com.iluwatar.interpreter; /** - * - * MultiplyExpression - * + * MultiplyExpression. */ public class MultiplyExpression extends Expression { diff --git a/interpreter/src/main/java/com/iluwatar/interpreter/NumberExpression.java b/interpreter/src/main/java/com/iluwatar/interpreter/NumberExpression.java index 035b8a70c406..6b957f6aa104 100644 --- a/interpreter/src/main/java/com/iluwatar/interpreter/NumberExpression.java +++ b/interpreter/src/main/java/com/iluwatar/interpreter/NumberExpression.java @@ -24,9 +24,7 @@ package com.iluwatar.interpreter; /** - * - * NumberExpression - * + * NumberExpression. */ public class NumberExpression extends Expression { diff --git a/interpreter/src/main/java/com/iluwatar/interpreter/PlusExpression.java b/interpreter/src/main/java/com/iluwatar/interpreter/PlusExpression.java index d494a0d68b90..1ce0802599c2 100644 --- a/interpreter/src/main/java/com/iluwatar/interpreter/PlusExpression.java +++ b/interpreter/src/main/java/com/iluwatar/interpreter/PlusExpression.java @@ -24,9 +24,7 @@ package com.iluwatar.interpreter; /** - * - * PlusExpression - * + * PlusExpression. */ public class PlusExpression extends Expression { diff --git a/iterator/src/main/java/com/iluwatar/iterator/App.java b/iterator/src/main/java/com/iluwatar/iterator/App.java index 13f02f2d72b6..6e72b4ae991d 100644 --- a/iterator/src/main/java/com/iluwatar/iterator/App.java +++ b/iterator/src/main/java/com/iluwatar/iterator/App.java @@ -39,8 +39,8 @@ /** * The Iterator pattern is a design pattern in which an iterator is used to traverse a container and * access the container's elements. The Iterator pattern decouples algorithms from containers. - *

    - * In this example the Iterator ({@link Iterator}) adds abstraction layer on top of a collection + * + *

    In this example the Iterator ({@link Iterator}) adds abstraction layer on top of a collection * ({@link TreasureChest}). This way the collection can change its internal implementation without * affecting its clients. */ @@ -85,7 +85,7 @@ private static TreeNode buildIntegerBst() { } /** - * Program entry point + * Program entry point. * * @param args command line args */ diff --git a/iterator/src/main/java/com/iluwatar/iterator/Iterator.java b/iterator/src/main/java/com/iluwatar/iterator/Iterator.java index 389d81e93acb..5f399c5b8f7c 100644 --- a/iterator/src/main/java/com/iluwatar/iterator/Iterator.java +++ b/iterator/src/main/java/com/iluwatar/iterator/Iterator.java @@ -24,7 +24,8 @@ package com.iluwatar.iterator; /** - * Iterator interface to be implemented by iterators over various data structures + * Iterator interface to be implemented by iterators over various data structures. + * * @param generically typed for various objects */ public interface Iterator { diff --git a/iterator/src/main/java/com/iluwatar/iterator/bst/BstIterator.java b/iterator/src/main/java/com/iluwatar/iterator/bst/BstIterator.java index 231c750c25c3..87511c7eaad3 100644 --- a/iterator/src/main/java/com/iluwatar/iterator/bst/BstIterator.java +++ b/iterator/src/main/java/com/iluwatar/iterator/bst/BstIterator.java @@ -32,7 +32,7 @@ * expect to retrieve TreeNodes according to the Integer's natural ordering (1, 2, 3...) * * @param This Iterator has been implemented with generic typing to allow for TreeNodes of - * different value types + * different value types */ public class BstIterator> implements Iterator> { @@ -46,7 +46,7 @@ public BstIterator(TreeNode root) { /** * This BstIterator manages to use O(h) extra space, where h is the height of the tree It achieves * this by maintaining a stack of the nodes to handle (pushing all left nodes first), before - * handling self or right node + * handling self or right node. * * @param node TreeNode that acts as root of the subtree we're interested in. */ @@ -58,6 +58,8 @@ private void pushPathToNextSmallest(TreeNode node) { } /** + * Checks if there exists next element. + * * @return true if this iterator has a "next" element */ @Override @@ -66,6 +68,8 @@ public boolean hasNext() { } /** + * Gets the next element. + * * @return TreeNode next. The next element according to our in-order traversal of the given BST * @throws NoSuchElementException if this iterator does not have a next element */ diff --git a/iterator/src/main/java/com/iluwatar/iterator/bst/TreeNode.java b/iterator/src/main/java/com/iluwatar/iterator/bst/TreeNode.java index 87e9fee0b5aa..9d03fdf86743 100644 --- a/iterator/src/main/java/com/iluwatar/iterator/bst/TreeNode.java +++ b/iterator/src/main/java/com/iluwatar/iterator/bst/TreeNode.java @@ -36,7 +36,7 @@ public class TreeNode> { private TreeNode right; /** - * Creates a TreeNode with a given value, and null children + * Creates a TreeNode with a given value, and null children. * * @param val The value of the given node */ @@ -67,7 +67,7 @@ private void setRight(TreeNode right) { } /** - * Inserts new TreeNode based on a given value into the subtree represented by self + * Inserts new TreeNode based on a given value into the subtree represented by self. * * @param valToInsert The value to insert as a new TreeNode */ diff --git a/iterator/src/main/java/com/iluwatar/iterator/list/Item.java b/iterator/src/main/java/com/iluwatar/iterator/list/Item.java index bd934e9f85fc..82e66eb30115 100644 --- a/iterator/src/main/java/com/iluwatar/iterator/list/Item.java +++ b/iterator/src/main/java/com/iluwatar/iterator/list/Item.java @@ -24,9 +24,7 @@ package com.iluwatar.iterator.list; /** - * - * Item - * + * Item. */ public class Item { diff --git a/iterator/src/main/java/com/iluwatar/iterator/list/ItemType.java b/iterator/src/main/java/com/iluwatar/iterator/list/ItemType.java index abb8e0fbb109..fc38046f79ec 100644 --- a/iterator/src/main/java/com/iluwatar/iterator/list/ItemType.java +++ b/iterator/src/main/java/com/iluwatar/iterator/list/ItemType.java @@ -24,9 +24,7 @@ package com.iluwatar.iterator.list; /** - * - * ItemType enumeration - * + * ItemType enumeration. */ public enum ItemType { diff --git a/iterator/src/main/java/com/iluwatar/iterator/list/TreasureChest.java b/iterator/src/main/java/com/iluwatar/iterator/list/TreasureChest.java index 3fb93f5af804..f390c760f356 100644 --- a/iterator/src/main/java/com/iluwatar/iterator/list/TreasureChest.java +++ b/iterator/src/main/java/com/iluwatar/iterator/list/TreasureChest.java @@ -28,29 +28,27 @@ import java.util.List; /** - * * TreasureChest, the collection class. - * */ public class TreasureChest { private List items; /** - * Constructor + * Constructor. */ public TreasureChest() { items = List.of( - new Item(ItemType.POTION, "Potion of courage"), - new Item(ItemType.RING, "Ring of shadows"), - new Item(ItemType.POTION, "Potion of wisdom"), - new Item(ItemType.POTION, "Potion of blood"), - new Item(ItemType.WEAPON, "Sword of silver +1"), - new Item(ItemType.POTION, "Potion of rust"), - new Item(ItemType.POTION, "Potion of healing"), - new Item(ItemType.RING, "Ring of armor"), - new Item(ItemType.WEAPON, "Steel halberd"), - new Item(ItemType.WEAPON, "Dagger of poison")); + new Item(ItemType.POTION, "Potion of courage"), + new Item(ItemType.RING, "Ring of shadows"), + new Item(ItemType.POTION, "Potion of wisdom"), + new Item(ItemType.POTION, "Potion of blood"), + new Item(ItemType.WEAPON, "Sword of silver +1"), + new Item(ItemType.POTION, "Potion of rust"), + new Item(ItemType.POTION, "Potion of healing"), + new Item(ItemType.RING, "Ring of armor"), + new Item(ItemType.WEAPON, "Steel halberd"), + new Item(ItemType.WEAPON, "Dagger of poison")); } public Iterator iterator(ItemType itemType) { @@ -58,7 +56,7 @@ public Iterator iterator(ItemType itemType) { } /** - * Get all items + * Get all items. */ public List getItems() { return new ArrayList<>(items); diff --git a/iterator/src/main/java/com/iluwatar/iterator/list/TreasureChestItemIterator.java b/iterator/src/main/java/com/iluwatar/iterator/list/TreasureChestItemIterator.java index 9ae31e4274c1..43dbc82fa3b0 100644 --- a/iterator/src/main/java/com/iluwatar/iterator/list/TreasureChestItemIterator.java +++ b/iterator/src/main/java/com/iluwatar/iterator/list/TreasureChestItemIterator.java @@ -27,9 +27,7 @@ import java.util.List; /** - * - * TreasureChestItemIterator - * + * TreasureChestItemIterator. */ public class TreasureChestItemIterator implements Iterator { @@ -38,7 +36,7 @@ public class TreasureChestItemIterator implements Iterator { private ItemType type; /** - * Constructor + * Constructor. */ public TreasureChestItemIterator(TreasureChest chest, ItemType type) { this.chest = chest; From eae09fc07eb96e66b8227a23b9a09b3382943c95 Mon Sep 17 00:00:00 2001 From: Anurag Agarwal Date: Sun, 10 Nov 2019 22:43:40 +0530 Subject: [PATCH 143/197] Resolves checkstyle errors for api-gateway, lazy-loading, leader-election (#1066) * Reduces checkstyle errors in lazy-loading * Reduces checkstyle errors in leader-election * Reduces checkstyle errors in api-gateway --- .../com/iluwatar/api/gateway/ApiGateway.java | 9 ++-- .../java/com/iluwatar/api/gateway/App.java | 47 ++++++++--------- .../iluwatar/api/gateway/DesktopProduct.java | 4 +- .../com/iluwatar/api/gateway/ImageClient.java | 2 +- .../iluwatar/api/gateway/ImageClientImpl.java | 10 ++-- .../iluwatar/api/gateway/MobileProduct.java | 2 +- .../com/iluwatar/api/gateway/PriceClient.java | 2 +- .../iluwatar/api/gateway/PriceClientImpl.java | 10 ++-- .../src/main/resources/application.properties | 1 - .../image/microservice/ImageApplication.java | 10 ++-- .../image/microservice/ImageController.java | 5 +- .../price/microservice/PriceApplication.java | 10 ++-- .../price/microservice/PriceController.java | 5 +- .../java/com/iluwatar/lazy/loading/App.java | 14 +++-- .../java/com/iluwatar/lazy/loading/Heavy.java | 4 +- .../iluwatar/lazy/loading/HolderNaive.java | 6 +-- .../lazy/loading/HolderThreadSafe.java | 6 +-- .../iluwatar/lazy/loading/Java8Holder.java | 7 ++- .../leaderelection/AbstractInstance.java | 16 +++--- .../AbstractMessageManager.java | 11 ++-- .../com/iluwatar/leaderelection/Instance.java | 5 +- .../com/iluwatar/leaderelection/Message.java | 5 +- .../leaderelection/MessageManager.java | 10 ++-- .../iluwatar/leaderelection/MessageType.java | 2 +- .../leaderelection/bully/BullyApp.java | 17 +++---- .../leaderelection/bully/BullyInstance.java | 34 +++++++------ .../bully/BullyMessageManager.java | 26 ++++++---- .../iluwatar/leaderelection/ring/RingApp.java | 17 +++---- .../leaderelection/ring/RingInstance.java | 51 ++++++++++--------- .../ring/RingMessageManager.java | 12 +++-- 30 files changed, 188 insertions(+), 172 deletions(-) diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ApiGateway.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ApiGateway.java index 25c201521578..18a071c09f8a 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ApiGateway.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ApiGateway.java @@ -23,12 +23,11 @@ package com.iluwatar.api.gateway; +import javax.annotation.Resource; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -import javax.annotation.Resource; - /** * The ApiGateway aggregates calls to microservices based on the needs of the individual clients. */ @@ -42,7 +41,8 @@ public class ApiGateway { private PriceClient priceClient; /** - * Retrieves product information that desktop clients need + * Retrieves product information that desktop clients need. + * * @return Product information for clients on a desktop */ @RequestMapping(path = "/desktop", method = RequestMethod.GET) @@ -54,7 +54,8 @@ public DesktopProduct getProductDesktop() { } /** - * Retrieves product information that mobile clients need + * Retrieves product information that mobile clients need. + * * @return Product information for clients on a mobile device */ @RequestMapping(path = "/mobile", method = RequestMethod.GET) diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/App.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/App.java index b92e3a7d0d36..1d72aaaece37 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/App.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/App.java @@ -27,39 +27,36 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; /** - * With the Microservices pattern, a client may need data from multiple different microservices. - * If the client called each microservice directly, that could contribute to longer load times, - * since the client would have to make a network request for each microservice called. Moreover, - * having the client call each microservice directly ties the client to that microservice - if the - * internal implementations of the microservices change (for example, if two microservices are - * combined sometime in the future) or if the location (host and port) of a microservice changes, - * then every client that makes use of those microservices must be updated. + * With the Microservices pattern, a client may need data from multiple different microservices. If + * the client called each microservice directly, that could contribute to longer load times, since + * the client would have to make a network request for each microservice called. Moreover, having + * the client call each microservice directly ties the client to that microservice - if the internal + * implementations of the microservices change (for example, if two microservices are combined + * sometime in the future) or if the location (host and port) of a microservice changes, then every + * client that makes use of those microservices must be updated. * - *

    - * The intent of the API Gateway pattern is to alleviate some of these issues. In the API Gateway - * pattern, an additional entity (the API Gateway) is placed between the client and the - * microservices. The job of the API Gateway is to aggregate the calls to the microservices. - * Rather than the client calling each microservice individually, the client calls the API Gateway - * a single time. The API Gateway then calls each of the microservices that the client needs. + *

    The intent of the API Gateway pattern is to alleviate some of these issues. In the API + * Gateway pattern, an additional entity (the API Gateway) is placed between the client and the + * microservices. The job of the API Gateway is to aggregate the calls to the microservices. Rather + * than the client calling each microservice individually, the client calls the API Gateway a single + * time. The API Gateway then calls each of the microservices that the client needs. * - *

    - * This implementation shows what the API Gateway pattern could look like for an e-commerce site. - * The {@link ApiGateway} makes calls to the Image and Price microservices using the - * {@link ImageClientImpl} and {@link PriceClientImpl} respectively. Customers viewing the site on a - * desktop device can see both price information and an image of a product, so the {@link ApiGateway} - * calls both of the microservices and aggregates the data in the {@link DesktopProduct} model. - * However, mobile users only see price information; they do not see a product image. For mobile - * users, the {@link ApiGateway} only retrieves price information, which it uses to populate the - * {@link MobileProduct}. + *

    This implementation shows what the API Gateway pattern could look like for an e-commerce + * site. The {@link ApiGateway} makes calls to the Image and Price microservices using the {@link + * ImageClientImpl} and {@link PriceClientImpl} respectively. Customers viewing the site on a + * desktop device can see both price information and an image of a product, so the {@link + * ApiGateway} calls both of the microservices and aggregates the data in the {@link DesktopProduct} + * model. However, mobile users only see price information; they do not see a product image. For + * mobile users, the {@link ApiGateway} only retrieves price information, which it uses to populate + * the {@link MobileProduct}. */ @SpringBootApplication public class App { /** - * Program entry point + * Program entry point. * - * @param args - * command line args + * @param args command line args */ public static void main(String[] args) { SpringApplication.run(App.class, args); diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/DesktopProduct.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/DesktopProduct.java index 06b9e949533d..2f790bef5d07 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/DesktopProduct.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/DesktopProduct.java @@ -28,12 +28,12 @@ */ public class DesktopProduct { /** - * The price of the product + * The price of the product. */ private String price; /** - * The path to the image of the product + * The path to the image of the product. */ private String imagePath; diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClient.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClient.java index 9c8c341ccd84..33e212b07050 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClient.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClient.java @@ -24,7 +24,7 @@ package com.iluwatar.api.gateway; /** - * An interface used to communicate with the Image microservice + * An interface used to communicate with the Image microservice. */ public interface ImageClient { String getImagePath(); diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClientImpl.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClientImpl.java index d2f80858cc49..6aa9698ef6d7 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClientImpl.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/ImageClientImpl.java @@ -29,17 +29,16 @@ import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; - import org.springframework.stereotype.Component; /** - * An adapter to communicate with the Image microservice + * An adapter to communicate with the Image microservice. */ @Component public class ImageClientImpl implements ImageClient { /** - * Makes a simple HTTP Get request to the Image microservice - * + * Makes a simple HTTP Get request to the Image microservice. + * * @return The path to the image */ @Override @@ -47,7 +46,8 @@ public String getImagePath() { String response = null; HttpClient httpClient = HttpClient.newHttpClient(); - HttpRequest httpGet = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:50005/image-path")).build(); + HttpRequest httpGet = + HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:50005/image-path")).build(); try { HttpResponse httpResponse = httpClient.send(httpGet, BodyHandlers.ofString()); diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/MobileProduct.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/MobileProduct.java index b7edb1047275..45fa4e4863e4 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/MobileProduct.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/MobileProduct.java @@ -28,7 +28,7 @@ */ public class MobileProduct { /** - * The price of the product + * The price of the product. */ private String price; diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClient.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClient.java index 74c564132939..ebe5150ba85a 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClient.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClient.java @@ -24,7 +24,7 @@ package com.iluwatar.api.gateway; /** - * An interface used to communicate with the Price microservice + * An interface used to communicate with the Price microservice. */ public interface PriceClient { String getPrice(); diff --git a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClientImpl.java b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClientImpl.java index 0a43c4b1fcfe..0c63e57f4789 100644 --- a/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClientImpl.java +++ b/api-gateway/api-gateway-service/src/main/java/com/iluwatar/api/gateway/PriceClientImpl.java @@ -29,17 +29,16 @@ import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; - import org.springframework.stereotype.Component; /** - * An adapter to communicate with the Price microservice + * An adapter to communicate with the Price microservice. */ @Component public class PriceClientImpl implements PriceClient { /** - * Makes a simple HTTP Get request to the Price microservice - * + * Makes a simple HTTP Get request to the Price microservice. + * * @return The price of the product */ @Override @@ -48,7 +47,8 @@ public String getPrice() { String response = null; HttpClient httpClient = HttpClient.newHttpClient(); - HttpRequest httpGet = HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:50006/price")).build(); + HttpRequest httpGet = + HttpRequest.newBuilder().GET().uri(URI.create("http://localhost:50006/price")).build(); try { HttpResponse httpResponse = httpClient.send(httpGet, BodyHandlers.ofString()); diff --git a/api-gateway/api-gateway-service/src/main/resources/application.properties b/api-gateway/api-gateway-service/src/main/resources/application.properties index 35bbf3471cc2..f9e29f5a7234 100644 --- a/api-gateway/api-gateway-service/src/main/resources/application.properties +++ b/api-gateway/api-gateway-service/src/main/resources/application.properties @@ -20,5 +20,4 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # - server.port=50004 \ No newline at end of file diff --git a/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageApplication.java b/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageApplication.java index bb551ac31ecb..12c00197605d 100644 --- a/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageApplication.java +++ b/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageApplication.java @@ -27,16 +27,16 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; /** - * ImageApplication starts up Spring Boot, exposing endpoints for the Image microservice through - * the {@link ImageController}. + * ImageApplication starts up Spring Boot, exposing endpoints for the Image microservice through the + * {@link ImageController}. */ @SpringBootApplication public class ImageApplication { /** - * Microservice entry point - * @param args - * command line args + * Microservice entry point. + * + * @param args command line args */ public static void main(String[] args) { SpringApplication.run(ImageApplication.class, args); diff --git a/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageController.java b/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageController.java index 9781dbc011aa..b1f6dd3f7eb6 100644 --- a/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageController.java +++ b/api-gateway/image-microservice/src/main/java/com/iluwatar/image/microservice/ImageController.java @@ -28,13 +28,14 @@ import org.springframework.web.bind.annotation.RestController; /** - * Exposes the Image microservice's endpoints + * Exposes the Image microservice's endpoints. */ @RestController public class ImageController { /** - * An endpoint for a user to retrieve an image path + * An endpoint for a user to retrieve an image path. + * * @return An image path */ @RequestMapping(value = "/image-path", method = RequestMethod.GET) diff --git a/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceApplication.java b/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceApplication.java index 1a29e53c9e98..5fc6a0f96cc2 100644 --- a/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceApplication.java +++ b/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceApplication.java @@ -27,16 +27,16 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; /** - * PriceApplication starts up Spring Boot, exposing endpoints for the Price microservice through - * the {@link PriceController}. + * PriceApplication starts up Spring Boot, exposing endpoints for the Price microservice through the + * {@link PriceController}. */ @SpringBootApplication public class PriceApplication { /** - * Microservice entry point - * @param args - * command line args + * Microservice entry point. + * + * @param args command line args */ public static void main(String[] args) { SpringApplication.run(PriceApplication.class, args); diff --git a/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceController.java b/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceController.java index efb982253417..cf2f5eb4f83b 100644 --- a/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceController.java +++ b/api-gateway/price-microservice/src/main/java/com/iluwatar/price/microservice/PriceController.java @@ -28,13 +28,14 @@ import org.springframework.web.bind.annotation.RestController; /** - * Exposes the Price microservice's endpoints + * Exposes the Price microservice's endpoints. */ @RestController public class PriceController { /** - * An endpoint for a user to retrieve a product's price + * An endpoint for a user to retrieve a product's price. + * * @return A product's price */ @RequestMapping(value = "/price", method = RequestMethod.GET) diff --git a/lazy-loading/src/main/java/com/iluwatar/lazy/loading/App.java b/lazy-loading/src/main/java/com/iluwatar/lazy/loading/App.java index ec795b40fe5d..ace157154082 100644 --- a/lazy-loading/src/main/java/com/iluwatar/lazy/loading/App.java +++ b/lazy-loading/src/main/java/com/iluwatar/lazy/loading/App.java @@ -27,22 +27,20 @@ import org.slf4j.LoggerFactory; /** - * * Lazy loading idiom defers object creation until needed. - *

    - * This example shows different implementations of the pattern with increasing sophistication. - *

    - * Additional information and lazy loading flavours are described in - * http://martinfowler.com/eaaCatalog/lazyLoad.html * + *

    This example shows different implementations of the pattern with increasing sophistication. + * + *

    Additional information and lazy loading flavours are described in + * http://martinfowler.com/eaaCatalog/lazyLoad.html */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point - * + * Program entry point. + * * @param args command line args */ public static void main(String[] args) { diff --git a/lazy-loading/src/main/java/com/iluwatar/lazy/loading/Heavy.java b/lazy-loading/src/main/java/com/iluwatar/lazy/loading/Heavy.java index 1e2dd8ae7fec..dea2d6341c22 100644 --- a/lazy-loading/src/main/java/com/iluwatar/lazy/loading/Heavy.java +++ b/lazy-loading/src/main/java/com/iluwatar/lazy/loading/Heavy.java @@ -27,16 +27,14 @@ import org.slf4j.LoggerFactory; /** - * * Heavy objects are expensive to create. - * */ public class Heavy { private static final Logger LOGGER = LoggerFactory.getLogger(Heavy.class); /** - * Constructor + * Constructor. */ public Heavy() { LOGGER.info("Creating Heavy ..."); diff --git a/lazy-loading/src/main/java/com/iluwatar/lazy/loading/HolderNaive.java b/lazy-loading/src/main/java/com/iluwatar/lazy/loading/HolderNaive.java index a23f70fb7321..c18ced6d492f 100644 --- a/lazy-loading/src/main/java/com/iluwatar/lazy/loading/HolderNaive.java +++ b/lazy-loading/src/main/java/com/iluwatar/lazy/loading/HolderNaive.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * * Simple implementation of the lazy loading idiom. However, this is not thread safe. - * */ public class HolderNaive { @@ -38,14 +36,14 @@ public class HolderNaive { private Heavy heavy; /** - * Constructor + * Constructor. */ public HolderNaive() { LOGGER.info("HolderNaive created"); } /** - * Get heavy object + * Get heavy object. */ public Heavy getHeavy() { if (heavy == null) { diff --git a/lazy-loading/src/main/java/com/iluwatar/lazy/loading/HolderThreadSafe.java b/lazy-loading/src/main/java/com/iluwatar/lazy/loading/HolderThreadSafe.java index b7c72e14c10c..ef6d5e663311 100644 --- a/lazy-loading/src/main/java/com/iluwatar/lazy/loading/HolderThreadSafe.java +++ b/lazy-loading/src/main/java/com/iluwatar/lazy/loading/HolderThreadSafe.java @@ -27,10 +27,8 @@ import org.slf4j.LoggerFactory; /** - * * Same as HolderNaive but with added synchronization. This implementation is thread safe, but each * {@link #getHeavy()} call costs additional synchronization overhead. - * */ public class HolderThreadSafe { @@ -39,14 +37,14 @@ public class HolderThreadSafe { private Heavy heavy; /** - * Constructor + * Constructor. */ public HolderThreadSafe() { LOGGER.info("HolderThreadSafe created"); } /** - * Get heavy object + * Get heavy object. */ public synchronized Heavy getHeavy() { if (heavy == null) { diff --git a/lazy-loading/src/main/java/com/iluwatar/lazy/loading/Java8Holder.java b/lazy-loading/src/main/java/com/iluwatar/lazy/loading/Java8Holder.java index 5066b54792e7..2854a78228a3 100644 --- a/lazy-loading/src/main/java/com/iluwatar/lazy/loading/Java8Holder.java +++ b/lazy-loading/src/main/java/com/iluwatar/lazy/loading/Java8Holder.java @@ -23,16 +23,13 @@ package com.iluwatar.lazy.loading; +import java.util.function.Supplier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.function.Supplier; - /** - * * This lazy loader is thread safe and more efficient than {@link HolderThreadSafe}. It utilizes * Java 8 functional interface {@link Supplier} as {@link Heavy} factory. - * */ public class Java8Holder { @@ -57,9 +54,11 @@ public Heavy get() { return heavyInstance; } } + if (!HeavyFactory.class.isInstance(heavy)) { heavy = new HeavyFactory(); } + return heavy.get(); } } diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractInstance.java b/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractInstance.java index d69a1f134bc1..f30610597b18 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractInstance.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractInstance.java @@ -23,11 +23,10 @@ package com.iluwatar.leaderelection; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Abstract class of all the instance implementation classes. @@ -69,7 +68,9 @@ public void run() { } /** - * Once messages are sent to the certain instance, it will firstly be added to the queue and wait to be executed. + * Once messages are sent to the certain instance, it will firstly be added to the queue and wait + * to be executed. + * * @param message Message sent by other instances */ @Override @@ -79,6 +80,7 @@ public void onMessage(Message message) { /** * Check if the instance is alive or not. + * * @return {@code true} if the instance is alive. */ @Override @@ -88,6 +90,7 @@ public boolean isAlive() { /** * Set the health status of the certain instance. + * * @param alive {@code true} for alive. */ @Override @@ -97,6 +100,7 @@ public void setAlive(boolean alive) { /** * Process the message according to its type. + * * @param message Message polled from queue. */ private void processMessage(Message message) { @@ -131,8 +135,8 @@ private void processMessage(Message message) { } /** - * Abstract methods to handle different types of message. These methods need to be implemented in concrete instance - * class to implement corresponding leader-selection pattern. + * Abstract methods to handle different types of message. These methods need to be implemented in + * concrete instance class to implement corresponding leader-selection pattern. */ protected abstract void handleElectionMessage(Message message); diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractMessageManager.java b/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractMessageManager.java index c7e4fa598cb6..ae2c2f380108 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractMessageManager.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractMessageManager.java @@ -38,7 +38,7 @@ public abstract class AbstractMessageManager implements MessageManager { protected Map instanceMap; /** - * Construtor of AbstractMessageManager + * Construtor of AbstractMessageManager. */ public AbstractMessageManager(Map instanceMap) { this.instanceMap = instanceMap; @@ -46,15 +46,16 @@ public AbstractMessageManager(Map instanceMap) { /** * Find the next instance with smallest ID. + * * @return The next instance. */ protected Instance findNextInstance(int currentId) { Instance result = null; List candidateList = instanceMap.keySet() - .stream() - .filter((i) -> i > currentId && instanceMap.get(i).isAlive()) - .sorted() - .collect(Collectors.toList()); + .stream() + .filter((i) -> i > currentId && instanceMap.get(i).isAlive()) + .sorted() + .collect(Collectors.toList()); if (candidateList.isEmpty()) { int index = instanceMap.keySet() .stream() diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/Instance.java b/leader-election/src/main/java/com/iluwatar/leaderelection/Instance.java index 1b39dff834f5..3ea57c04b0dc 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/Instance.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/Instance.java @@ -24,24 +24,27 @@ package com.iluwatar.leaderelection; /** - * Instance interface + * Instance interface. */ public interface Instance { /** * Check if the instance is alive or not. + * * @return {@code true} if the instance is alive. */ boolean isAlive(); /** * Set the health status of the certain instance. + * * @param alive {@code true} for alive. */ void setAlive(boolean alive); /** * Consume messages from other instances. + * * @param message Message sent by other instances */ void onMessage(Message message); diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/Message.java b/leader-election/src/main/java/com/iluwatar/leaderelection/Message.java index 1302d558857d..21f021aff900 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/Message.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/Message.java @@ -26,7 +26,7 @@ import java.util.Objects; /** - * Message used to transport data between instances. + * Message used to transport data between instances. */ public class Message { @@ -34,7 +34,8 @@ public class Message { private String content; - public Message() {} + public Message() { + } public Message(MessageType type, String content) { this.type = type; diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/MessageManager.java b/leader-election/src/main/java/com/iluwatar/leaderelection/MessageManager.java index fbd41cac970c..9f10de22e55c 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/MessageManager.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/MessageManager.java @@ -24,12 +24,13 @@ package com.iluwatar.leaderelection; /** - * MessageManager interface + * MessageManager interface. */ public interface MessageManager { /** * Send heartbeat message to leader instance to check whether the leader instance is alive. + * * @param leaderId Instance ID of leader instance. * @return {@code true} if leader instance is alive, or {@code false} if not. */ @@ -37,22 +38,25 @@ public interface MessageManager { /** * Send election message to other instances. + * * @param currentId Instance ID of which sends this message. - * @param content Election message content. + * @param content Election message content. * @return {@code true} if the message is accepted by the target instances. */ boolean sendElectionMessage(int currentId, String content); /** * Send new leader notification message to other instances. + * * @param currentId Instance ID of which sends this message. - * @param leaderId Leader message content. + * @param leaderId Leader message content. * @return {@code true} if the message is accepted by the target instances. */ boolean sendLeaderMessage(int currentId, int leaderId); /** * Send heartbeat invoke message. This will invoke heartbeat task in the target instance. + * * @param currentId Instance ID of which sends this message. */ void sendHeartbeatInvokeMessage(int currentId); diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/MessageType.java b/leader-election/src/main/java/com/iluwatar/leaderelection/MessageType.java index 1749ca15c66f..a82bfa38f15d 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/MessageType.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/MessageType.java @@ -24,7 +24,7 @@ package com.iluwatar.leaderelection; /** - * Message Type enum + * Message Type enum. */ public enum MessageType { diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyApp.java b/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyApp.java index c111f442e7ad..34231b3d5a66 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyApp.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyApp.java @@ -27,19 +27,18 @@ import com.iluwatar.leaderelection.Message; import com.iluwatar.leaderelection.MessageManager; import com.iluwatar.leaderelection.MessageType; - import java.util.HashMap; import java.util.Map; /** * Example of how to use bully leader election. Initially 5 instances is created in the clould - * system, and the instance with ID 1 is set as leader. After the system is started stop the - * leader instance, and the new leader will be elected. + * system, and the instance with ID 1 is set as leader. After the system is started stop the leader + * instance, and the new leader will be elected. */ public class BullyApp { /** - * Program entry point + * Program entry point. */ public static void main(String[] args) { @@ -60,11 +59,11 @@ public static void main(String[] args) { instance4.onMessage(new Message(MessageType.HEARTBEAT_INVOKE, "")); - Thread thread1 = new Thread(instance1); - Thread thread2 = new Thread(instance2); - Thread thread3 = new Thread(instance3); - Thread thread4 = new Thread(instance4); - Thread thread5 = new Thread(instance5); + final Thread thread1 = new Thread(instance1); + final Thread thread2 = new Thread(instance2); + final Thread thread3 = new Thread(instance3); + final Thread thread4 = new Thread(instance4); + final Thread thread5 = new Thread(instance5); thread1.start(); thread2.start(); diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyInstance.java b/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyInstance.java index c2c497339536..92cb18ab40b7 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyInstance.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyInstance.java @@ -32,11 +32,11 @@ /** * Impelemetation with bully algorithm. Each instance should have a sequential id and is able to * communicate with other instances in the system. Initially the instance with smallest (or largest) - * ID is selected to be the leader. All the other instances send heartbeat message to leader periodically - * to check its health. If one certain instance finds the server done, it will send an election message - * to all the instances of which the ID is larger. If the target instance is alive, it will return an - * alive message (in this sample return true) and then send election message with its ID. If not, - * the original instance will send leader message to all the other instances. + * ID is selected to be the leader. All the other instances send heartbeat message to leader + * periodically to check its health. If one certain instance finds the server done, it will send an + * election message to all the instances of which the ID is larger. If the target instance is alive, + * it will return an alive message (in this sample return true) and then send election message with + * its ID. If not, the original instance will send leader message to all the other instances. */ public class BullyInstance extends AbstractInstance { @@ -50,9 +50,9 @@ public BullyInstance(MessageManager messageManager, int localId, int leaderId) { } /** - * Process the heartbeat invoke message. After receiving the message, the instance will send a heartbeat - * to leader to check its health. If alive, it will inform the next instance to do the heartbeat. If not, - * it will start the election process. + * Process the heartbeat invoke message. After receiving the message, the instance will send a + * heartbeat to leader to check its health. If alive, it will inform the next instance to do the + * heartbeat. If not, it will start the election process. */ @Override protected void handleHeartbeatInvokeMessage() { @@ -64,7 +64,8 @@ protected void handleHeartbeatInvokeMessage() { messageManager.sendHeartbeatInvokeMessage(localId); } else { LOGGER.info("Instance " + localId + "- Leader is not alive. Start election."); - boolean electionResult = messageManager.sendElectionMessage(localId, String.valueOf(localId)); + boolean electionResult = + messageManager.sendElectionMessage(localId, String.valueOf(localId)); if (electionResult) { LOGGER.info("Instance " + localId + "- Succeed in election. Start leader notification."); messageManager.sendLeaderMessage(localId, localId); @@ -76,9 +77,9 @@ protected void handleHeartbeatInvokeMessage() { } /** - * Process election invoke message. Send election message to all the instances with smaller ID. If any - * one of them is alive, do nothing. If no instance alive, send leader message to all the alive instance - * and restart heartbeat. + * Process election invoke message. Send election message to all the instances with smaller ID. If + * any one of them is alive, do nothing. If no instance alive, send leader message to all the + * alive instance and restart heartbeat. */ @Override protected void handleElectionInvokeMessage() { @@ -111,11 +112,14 @@ private boolean isLeader() { * Not used in Bully instance. */ @Override - protected void handleLeaderInvokeMessage() {} + protected void handleLeaderInvokeMessage() { + } @Override - protected void handleHeartbeatMessage(Message message) {} + protected void handleHeartbeatMessage(Message message) { + } @Override - protected void handleElectionMessage(Message message) {} + protected void handleElectionMessage(Message message) { + } } diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyMessageManager.java b/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyMessageManager.java index 907098f6b379..d1e4c7db13e8 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyMessageManager.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/bully/BullyMessageManager.java @@ -27,13 +27,12 @@ import com.iluwatar.leaderelection.Instance; import com.iluwatar.leaderelection.Message; import com.iluwatar.leaderelection.MessageType; - import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** - * Implementation of BullyMessageManager + * Implementation of BullyMessageManager. */ public class BullyMessageManager extends AbstractMessageManager { @@ -46,6 +45,7 @@ public BullyMessageManager(Map instanceMap) { /** * Send heartbeat message to current leader instance to check the health. + * * @param leaderId leaderID * @return {@code true} if the leader is alive. */ @@ -58,8 +58,9 @@ public boolean sendHeartbeatMessage(int leaderId) { /** * Send election message to all the instances with smaller ID. + * * @param currentId Instance ID of which sends this message. - * @param content Election message content. + * @param content Election message content. * @return {@code true} if no alive instance has smaller ID, so that the election is accepted. */ @Override @@ -70,29 +71,31 @@ public boolean sendElectionMessage(int currentId, String content) { } else { Message electionMessage = new Message(MessageType.ELECTION_INVOKE, ""); candidateList.stream() - .forEach((i) -> instanceMap.get(i).onMessage(electionMessage)); + .forEach((i) -> instanceMap.get(i).onMessage(electionMessage)); return false; } } /** * Send leader message to all the instances to notify the new leader. + * * @param currentId Instance ID of which sends this message. - * @param leaderId Leader message content. + * @param leaderId Leader message content. * @return {@code true} if the message is accepted. */ @Override public boolean sendLeaderMessage(int currentId, int leaderId) { Message leaderMessage = new Message(MessageType.LEADER, String.valueOf(leaderId)); instanceMap.keySet() - .stream() - .filter((i) -> i != currentId) - .forEach((i) -> instanceMap.get(i).onMessage(leaderMessage)); + .stream() + .filter((i) -> i != currentId) + .forEach((i) -> instanceMap.get(i).onMessage(leaderMessage)); return false; } /** * Send heartbeat invoke message to the next instance. + * * @param currentId Instance ID of which sends this message. */ @Override @@ -104,14 +107,15 @@ public void sendHeartbeatInvokeMessage(int currentId) { /** * Find all the alive instances with smaller ID than current instance. + * * @param currentId ID of current instance. * @return ID list of all the candidate instance. */ private List findElectionCandidateInstanceList(int currentId) { return instanceMap.keySet() - .stream() - .filter((i) -> i < currentId && instanceMap.get(i).isAlive()) - .collect(Collectors.toList()); + .stream() + .filter((i) -> i < currentId && instanceMap.get(i).isAlive()) + .collect(Collectors.toList()); } } diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingApp.java b/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingApp.java index a8a6271eae15..096beb56641b 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingApp.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingApp.java @@ -27,19 +27,18 @@ import com.iluwatar.leaderelection.Message; import com.iluwatar.leaderelection.MessageManager; import com.iluwatar.leaderelection.MessageType; - import java.util.HashMap; import java.util.Map; /** * Example of how to use ring leader election. Initially 5 instances is created in the clould - * system, and the instance with ID 1 is set as leader. After the system is started stop the - * leader instance, and the new leader will be elected. + * system, and the instance with ID 1 is set as leader. After the system is started stop the leader + * instance, and the new leader will be elected. */ public class RingApp { /** - * Program entry point + * Program entry point. */ public static void main(String[] args) { @@ -60,11 +59,11 @@ public static void main(String[] args) { instance2.onMessage(new Message(MessageType.HEARTBEAT_INVOKE, "")); - Thread thread1 = new Thread(instance1); - Thread thread2 = new Thread(instance2); - Thread thread3 = new Thread(instance3); - Thread thread4 = new Thread(instance4); - Thread thread5 = new Thread(instance5); + final Thread thread1 = new Thread(instance1); + final Thread thread2 = new Thread(instance2); + final Thread thread3 = new Thread(instance3); + final Thread thread4 = new Thread(instance4); + final Thread thread5 = new Thread(instance5); thread1.start(); thread2.start(); diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingInstance.java b/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingInstance.java index 4cdbb57090d8..903ac15ce4b1 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingInstance.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingInstance.java @@ -26,23 +26,22 @@ import com.iluwatar.leaderelection.AbstractInstance; import com.iluwatar.leaderelection.Message; import com.iluwatar.leaderelection.MessageManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Implementation with token ring algorithm. The instances in the system are organized as a ring. * Each instance should have a sequential id and the instance with smallest (or largest) id should - * be the initial leader. All the other instances send heartbeat message to leader periodically - * to check its health. If one certain instance finds the server done, it will send an election - * message to the next alive instance in the ring, which contains its own ID. Then the next instance - * add its ID into the message and pass it to the next. After all the alive instances' ID are add - * to the message, the message is send back to the first instance and it will choose the instance - * with smallest ID to be the new leader, and then send a leader message to other instances to - * inform the result. + * be the initial leader. All the other instances send heartbeat message to leader periodically to + * check its health. If one certain instance finds the server done, it will send an election message + * to the next alive instance in the ring, which contains its own ID. Then the next instance add its + * ID into the message and pass it to the next. After all the alive instances' ID are add to the + * message, the message is send back to the first instance and it will choose the instance with + * smallest ID to be the new leader, and then send a leader message to other instances to inform the + * result. */ public class RingInstance extends AbstractInstance { @@ -56,9 +55,9 @@ public RingInstance(MessageManager messageManager, int localId, int leaderId) { } /** - * Process the heartbeat invoke message. After receiving the message, the instance will send a heartbeat - * to leader to check its health. If alive, it will inform the next instance to do the heartbeat. If not, - * it will start the election process. + * Process the heartbeat invoke message. After receiving the message, the instance will send a + * heartbeat to leader to check its health. If alive, it will inform the next instance to do the + * heartbeat. If not, it will start the election process. */ @Override protected void handleHeartbeatInvokeMessage() { @@ -78,9 +77,10 @@ protected void handleHeartbeatInvokeMessage() { } /** - * Process election message. If the local ID is contained in the ID list, the instance will select the - * alive instance with smallest ID to be the new leader, and send the leader inform message. If not, - * it will add its local ID to the list and send the message to the next instance in the ring. + * Process election message. If the local ID is contained in the ID list, the instance will select + * the alive instance with smallest ID to be the new leader, and send the leader inform message. + * If not, it will add its local ID to the list and send the message to the next instance in the + * ring. */ @Override protected void handleElectionMessage(Message message) { @@ -88,9 +88,9 @@ protected void handleElectionMessage(Message message) { LOGGER.info("Instance " + localId + " - Election Message: " + content); List candidateList = Arrays.stream(content.trim().split(",")) - .map(Integer::valueOf) - .sorted() - .collect(Collectors.toList()); + .map(Integer::valueOf) + .sorted() + .collect(Collectors.toList()); if (candidateList.contains(localId)) { int newLeaderId = candidateList.get(0); LOGGER.info("Instance " + localId + " - New leader should be " + newLeaderId + "."); @@ -102,8 +102,8 @@ protected void handleElectionMessage(Message message) { } /** - * Process leader Message. The instance will set the leader ID to be the new one and send the message to - * the next instance until all the alive instance in the ring is informed. + * Process leader Message. The instance will set the leader ID to be the new one and send the + * message to the next instance until all the alive instance in the ring is informed. */ @Override protected void handleLeaderMessage(Message message) { @@ -122,12 +122,15 @@ protected void handleLeaderMessage(Message message) { * Not used in Ring instance. */ @Override - protected void handleLeaderInvokeMessage() {} + protected void handleLeaderInvokeMessage() { + } @Override - protected void handleHeartbeatMessage(Message message) {} + protected void handleHeartbeatMessage(Message message) { + } @Override - protected void handleElectionInvokeMessage() {} + protected void handleElectionInvokeMessage() { + } } diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingMessageManager.java b/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingMessageManager.java index 34496363372f..6cbadf184a2c 100644 --- a/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingMessageManager.java +++ b/leader-election/src/main/java/com/iluwatar/leaderelection/ring/RingMessageManager.java @@ -27,11 +27,10 @@ import com.iluwatar.leaderelection.Instance; import com.iluwatar.leaderelection.Message; import com.iluwatar.leaderelection.MessageType; - import java.util.Map; /** - * Implementation of RingMessageManager + * Implementation of RingMessageManager. */ public class RingMessageManager extends AbstractMessageManager { @@ -44,6 +43,7 @@ public RingMessageManager(Map instanceMap) { /** * Send heartbeat message to current leader instance to check the health. + * * @param leaderId leaderID * @return {@code true} if the leader is alive. */ @@ -56,8 +56,10 @@ public boolean sendHeartbeatMessage(int leaderId) { /** * Send election message to the next instance. + * * @param currentId currentID - * @param content list contains all the IDs of instances which have received this election message. + * @param content list contains all the IDs of instances which have received this election + * message. * @return {@code true} if the election message is accepted by the target instance. */ @Override @@ -70,8 +72,9 @@ public boolean sendElectionMessage(int currentId, String content) { /** * Send leader message to the next instance. + * * @param currentId Instance ID of which sends this message. - * @param leaderId Leader message content. + * @param leaderId Leader message content. * @return {@code true} if the leader message is accepted by the target instance. */ @Override @@ -84,6 +87,7 @@ public boolean sendLeaderMessage(int currentId, int leaderId) { /** * Send heartbeat invoke message to the next instance. + * * @param currentId Instance ID of which sends this message. */ @Override From 01e489c77bbe992a29455c50d898272ac65dfa5b Mon Sep 17 00:00:00 2001 From: Anurag Agarwal Date: Sun, 10 Nov 2019 22:57:09 +0530 Subject: [PATCH 144/197] Resolves checkstyle errors for dao data-bus data-locality data-mapper data-transfer-object decorator (#1067) * Reduces checkstyle errors in dao * Reduces checkstyle errors in data-bus * Reduces checkstyle errors in data-locality * Reduces checkstyle errors in data-mapper * Reduces checkstyle errors in data-transfer-object * Reduces checkstyle errors in decorator --- dao/src/main/java/com/iluwatar/dao/App.java | 23 ++++----- .../com/iluwatar/dao/CustomException.java | 9 ++-- .../main/java/com/iluwatar/dao/Customer.java | 1 - .../java/com/iluwatar/dao/CustomerDao.java | 38 +++++++++------ .../com/iluwatar/dao/CustomerSchemaSql.java | 10 ++-- .../java/com/iluwatar/dao/DbCustomerDao.java | 47 ++++++++++--------- .../com/iluwatar/dao/InMemoryCustomerDao.java | 6 +-- .../main/java/com/iluwatar/databus/App.java | 46 +++++++++--------- .../iluwatar/databus/data/StartingData.java | 1 - .../iluwatar/databus/data/StoppingData.java | 1 - .../members/MessageCollectorMember.java | 1 - .../databus/members/StatusMember.java | 1 - .../iluwatar/data/locality/Application.java | 15 +++--- .../data/locality/game/GameEntity.java | 18 +++---- .../locality/game/component/AiComponent.java | 6 +-- .../locality/game/component/Component.java | 2 +- .../game/component/PhysicsComponent.java | 5 +- .../game/component/RenderComponent.java | 4 +- .../component/manager/AiComponentManager.java | 6 +-- .../manager/PhysicsComponentManager.java | 4 +- .../manager/RenderComponentManager.java | 6 +-- .../java/com/iluwatar/datamapper/App.java | 15 +++--- .../datamapper/DataMapperException.java | 5 +- .../java/com/iluwatar/datamapper/Student.java | 42 ++--------------- .../datamapper/StudentDataMapper.java | 2 +- .../datamapper/StudentDataMapperImpl.java | 5 +- .../datatransfer/CustomerClientApp.java | 21 ++++----- .../iluwatar/datatransfer/CustomerDto.java | 10 ++-- .../datatransfer/CustomerResource.java | 12 ++++- .../main/java/com/iluwatar/decorator/App.java | 14 +++--- .../com/iluwatar/decorator/ClubbedTroll.java | 2 +- .../com/iluwatar/decorator/SimpleTroll.java | 2 - .../java/com/iluwatar/decorator/Troll.java | 4 +- 33 files changed, 176 insertions(+), 208 deletions(-) diff --git a/dao/src/main/java/com/iluwatar/dao/App.java b/dao/src/main/java/com/iluwatar/dao/App.java index 78406208a77e..9faa8577a9ba 100644 --- a/dao/src/main/java/com/iluwatar/dao/App.java +++ b/dao/src/main/java/com/iluwatar/dao/App.java @@ -26,12 +26,9 @@ import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; -import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; - import javax.sql.DataSource; - import org.h2.jdbcx.JdbcDataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,27 +41,25 @@ * application needs, in terms of domain-specific objects and data types (the public interface of * the DAO), from how these needs can be satisfied with a specific DBMS. * - *

    With the DAO pattern, we can use various method calls to retrieve/add/delete/update data - * without directly interacting with the data source. The below example demonstrates basic CRUD + *

    With the DAO pattern, we can use various method calls to retrieve/add/delete/update data + * without directly interacting with the data source. The below example demonstrates basic CRUD * operations: select, add, update, and delete. - * - * */ public class App { private static final String DB_URL = "jdbc:h2:~/dao"; private static Logger log = LoggerFactory.getLogger(App.class); private static final String ALL_CUSTOMERS = "customerDao.getAllCustomers(): "; - + /** * Program entry point. - * + * * @param args command line args. - * @throws Exception if any error occurs. + * @throws Exception if any error occurs. */ public static void main(final String[] args) throws Exception { final CustomerDao inMemoryDao = new InMemoryCustomerDao(); performOperationsUsing(inMemoryDao); - + final DataSource dataSource = createDataSource(); createSchema(dataSource); final CustomerDao dbDao = new DbCustomerDao(dataSource); @@ -74,14 +69,14 @@ public static void main(final String[] args) throws Exception { private static void deleteSchema(DataSource dataSource) throws SQLException { try (Connection connection = dataSource.getConnection(); - Statement statement = connection.createStatement()) { + Statement statement = connection.createStatement()) { statement.execute(CustomerSchemaSql.DELETE_SCHEMA_SQL); } } private static void createSchema(DataSource dataSource) throws SQLException { try (Connection connection = dataSource.getConnection(); - Statement statement = connection.createStatement()) { + Statement statement = connection.createStatement()) { statement.execute(CustomerSchemaSql.CREATE_SCHEMA_SQL); } } @@ -121,7 +116,7 @@ private static void addCustomers(CustomerDao customerDao) throws Exception { /** * Generate customers. - * + * * @return list of customers. */ public static List generateSampleCustomers() { diff --git a/dao/src/main/java/com/iluwatar/dao/CustomException.java b/dao/src/main/java/com/iluwatar/dao/CustomException.java index 3c1ec7373869..3da6ab20e7a1 100644 --- a/dao/src/main/java/com/iluwatar/dao/CustomException.java +++ b/dao/src/main/java/com/iluwatar/dao/CustomException.java @@ -24,20 +24,19 @@ package com.iluwatar.dao; /** - * - * Custom exception - * + * Custom exception. */ public class CustomException extends Exception { private static final long serialVersionUID = 1L; - public CustomException() {} + public CustomException() { + } public CustomException(String message) { super(message); } - + public CustomException(String message, Throwable cause) { super(message, cause); } diff --git a/dao/src/main/java/com/iluwatar/dao/Customer.java b/dao/src/main/java/com/iluwatar/dao/Customer.java index 593aacaf359c..dd84426eb19e 100644 --- a/dao/src/main/java/com/iluwatar/dao/Customer.java +++ b/dao/src/main/java/com/iluwatar/dao/Customer.java @@ -25,7 +25,6 @@ /** * A customer POJO that represents the data that will be read from the data source. - * */ public class Customer { diff --git a/dao/src/main/java/com/iluwatar/dao/CustomerDao.java b/dao/src/main/java/com/iluwatar/dao/CustomerDao.java index 7ff9a8e4e9cd..f5dc573ba008 100644 --- a/dao/src/main/java/com/iluwatar/dao/CustomerDao.java +++ b/dao/src/main/java/com/iluwatar/dao/CustomerDao.java @@ -28,37 +28,43 @@ /** * In an application the Data Access Object (DAO) is a part of Data access layer. It is an object - * that provides an interface to some type of persistence mechanism. By mapping application calls - * to the persistence layer, DAO provides some specific data operations without exposing details - * of the database. This isolation supports the Single responsibility principle. It separates what - * data accesses the application needs, in terms of domain-specific objects and data types - * (the public interface of the DAO), from how these needs can be satisfied with a specific DBMS, - * database schema, etc. - * - *

    Any change in the way data is stored and retrieved will not change the client code as the + * that provides an interface to some type of persistence mechanism. By mapping application calls to + * the persistence layer, DAO provides some specific data operations without exposing details of the + * database. This isolation supports the Single responsibility principle. It separates what data + * accesses the application needs, in terms of domain-specific objects and data types (the public + * interface of the DAO), from how these needs can be satisfied with a specific DBMS, database + * schema, etc. + * + *

    Any change in the way data is stored and retrieved will not change the client code as the * client will be using interface and need not worry about exact source. - * + * * @see InMemoryCustomerDao * @see DbCustomerDao */ public interface CustomerDao { /** - * @return all the customers as a stream. The stream may be lazily or eagerly evaluated based - * on the implementation. The stream must be closed after use. + * Get all customers. + * + * @return all the customers as a stream. The stream may be lazily or eagerly evaluated based on + * the implementation. The stream must be closed after use. * @throws Exception if any error occurs. */ Stream getAll() throws Exception; - + /** + * Get customer as Optional by id. + * * @param id unique identifier of the customer. - * @return an optional with customer if a customer with unique identifier id - * exists, empty optional otherwise. + * @return an optional with customer if a customer with unique identifier id exists, + * empty optional otherwise. * @throws Exception if any error occurs. */ Optional getById(int id) throws Exception; /** + * Add a customer. + * * @param customer the customer to be added. * @return true if customer is successfully added, false if customer already exists. * @throws Exception if any error occurs. @@ -66,6 +72,8 @@ public interface CustomerDao { boolean add(Customer customer) throws Exception; /** + * Update a customer. + * * @param customer the customer to be updated. * @return true if customer exists and is successfully updated, false otherwise. * @throws Exception if any error occurs. @@ -73,6 +81,8 @@ public interface CustomerDao { boolean update(Customer customer) throws Exception; /** + * Delete a customer. + * * @param customer the customer to be deleted. * @return true if customer exists and is successfully deleted, false otherwise. * @throws Exception if any error occurs. diff --git a/dao/src/main/java/com/iluwatar/dao/CustomerSchemaSql.java b/dao/src/main/java/com/iluwatar/dao/CustomerSchemaSql.java index f05b9de217f7..633a65860ab7 100644 --- a/dao/src/main/java/com/iluwatar/dao/CustomerSchemaSql.java +++ b/dao/src/main/java/com/iluwatar/dao/CustomerSchemaSql.java @@ -24,14 +24,16 @@ package com.iluwatar.dao; /** - * Customer Schema SQL Class + * Customer Schema SQL Class. */ public final class CustomerSchemaSql { - private CustomerSchemaSql() {} + private CustomerSchemaSql() { + } - public static final String CREATE_SCHEMA_SQL = "CREATE TABLE CUSTOMERS (ID NUMBER, FNAME VARCHAR(100), " - + "LNAME VARCHAR(100))"; + public static final String CREATE_SCHEMA_SQL = + "CREATE TABLE CUSTOMERS (ID NUMBER, FNAME VARCHAR(100), " + + "LNAME VARCHAR(100))"; public static final String DELETE_SCHEMA_SQL = "DROP TABLE CUSTOMERS"; diff --git a/dao/src/main/java/com/iluwatar/dao/DbCustomerDao.java b/dao/src/main/java/com/iluwatar/dao/DbCustomerDao.java index 12e3acb20ac4..689a889fda76 100644 --- a/dao/src/main/java/com/iluwatar/dao/DbCustomerDao.java +++ b/dao/src/main/java/com/iluwatar/dao/DbCustomerDao.java @@ -23,9 +23,6 @@ package com.iluwatar.dao; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -36,12 +33,12 @@ import java.util.function.Consumer; import java.util.stream.Stream; import java.util.stream.StreamSupport; - import javax.sql.DataSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * An implementation of {@link CustomerDao} that persists customers in RDBMS. - * */ public class DbCustomerDao implements CustomerDao { @@ -50,9 +47,9 @@ public class DbCustomerDao implements CustomerDao { private final DataSource dataSource; /** - * Creates an instance of {@link DbCustomerDao} which uses provided dataSource - * to store and retrieve customer information. - * + * Creates an instance of {@link DbCustomerDao} which uses provided dataSource to + * store and retrieve customer information. + * * @param dataSource a non-null dataSource. */ public DbCustomerDao(DataSource dataSource) { @@ -60,9 +57,11 @@ public DbCustomerDao(DataSource dataSource) { } /** - * @return a lazily populated stream of customers. Note the stream returned must be closed to - * free all the acquired resources. The stream keeps an open connection to the database till - * it is complete or is closed manually. + * Get all customers as Java Stream. + * + * @return a lazily populated stream of customers. Note the stream returned must be closed to free + * all the acquired resources. The stream keeps an open connection to the database till it is + * complete or is closed manually. */ @Override public Stream getAll() throws Exception { @@ -70,9 +69,10 @@ public Stream getAll() throws Exception { Connection connection; try { connection = getConnection(); - PreparedStatement statement = connection.prepareStatement("SELECT * FROM CUSTOMERS"); // NOSONAR + PreparedStatement statement = + connection.prepareStatement("SELECT * FROM CUSTOMERS"); // NOSONAR ResultSet resultSet = statement.executeQuery(); // NOSONAR - return StreamSupport.stream(new Spliterators.AbstractSpliterator(Long.MAX_VALUE, + return StreamSupport.stream(new Spliterators.AbstractSpliterator(Long.MAX_VALUE, Spliterator.ORDERED) { @Override @@ -108,8 +108,8 @@ private void mutedClose(Connection connection, PreparedStatement statement, Resu } private Customer createCustomer(ResultSet resultSet) throws SQLException { - return new Customer(resultSet.getInt("ID"), - resultSet.getString("FNAME"), + return new Customer(resultSet.getInt("ID"), + resultSet.getString("FNAME"), resultSet.getString("LNAME")); } @@ -122,8 +122,8 @@ public Optional getById(int id) throws Exception { ResultSet resultSet = null; try (Connection connection = getConnection(); - PreparedStatement statement = - connection.prepareStatement("SELECT * FROM CUSTOMERS WHERE ID = ?")) { + PreparedStatement statement = + connection.prepareStatement("SELECT * FROM CUSTOMERS WHERE ID = ?")) { statement.setInt(1, id); resultSet = statement.executeQuery(); @@ -151,8 +151,8 @@ public boolean add(Customer customer) throws Exception { } try (Connection connection = getConnection(); - PreparedStatement statement = - connection.prepareStatement("INSERT INTO CUSTOMERS VALUES (?,?,?)")) { + PreparedStatement statement = + connection.prepareStatement("INSERT INTO CUSTOMERS VALUES (?,?,?)")) { statement.setInt(1, customer.getId()); statement.setString(2, customer.getFirstName()); statement.setString(3, customer.getLastName()); @@ -169,8 +169,9 @@ public boolean add(Customer customer) throws Exception { @Override public boolean update(Customer customer) throws Exception { try (Connection connection = getConnection(); - PreparedStatement statement = - connection.prepareStatement("UPDATE CUSTOMERS SET FNAME = ?, LNAME = ? WHERE ID = ?")) { + PreparedStatement statement = + connection + .prepareStatement("UPDATE CUSTOMERS SET FNAME = ?, LNAME = ? WHERE ID = ?")) { statement.setString(1, customer.getFirstName()); statement.setString(2, customer.getLastName()); statement.setInt(3, customer.getId()); @@ -186,8 +187,8 @@ public boolean update(Customer customer) throws Exception { @Override public boolean delete(Customer customer) throws Exception { try (Connection connection = getConnection(); - PreparedStatement statement = - connection.prepareStatement("DELETE FROM CUSTOMERS WHERE ID = ?")) { + PreparedStatement statement = + connection.prepareStatement("DELETE FROM CUSTOMERS WHERE ID = ?")) { statement.setInt(1, customer.getId()); return statement.executeUpdate() > 0; } catch (SQLException ex) { diff --git a/dao/src/main/java/com/iluwatar/dao/InMemoryCustomerDao.java b/dao/src/main/java/com/iluwatar/dao/InMemoryCustomerDao.java index b6621ba392da..6dbfa367a9fe 100644 --- a/dao/src/main/java/com/iluwatar/dao/InMemoryCustomerDao.java +++ b/dao/src/main/java/com/iluwatar/dao/InMemoryCustomerDao.java @@ -29,8 +29,8 @@ import java.util.stream.Stream; /** - * An in memory implementation of {@link CustomerDao}, which stores the customers in JVM memory - * and data is lost when the application exits. + * An in memory implementation of {@link CustomerDao}, which stores the customers in JVM memory and + * data is lost when the application exits. *
    * This implementation is useful as temporary database or for testing. */ @@ -56,7 +56,7 @@ public boolean add(final Customer customer) { if (getById(customer.getId()).isPresent()) { return false; } - + idToCustomer.put(customer.getId(), customer); return true; } diff --git a/data-bus/src/main/java/com/iluwatar/databus/App.java b/data-bus/src/main/java/com/iluwatar/databus/App.java index b645dbd34888..da4c6f07e726 100644 --- a/data-bus/src/main/java/com/iluwatar/databus/App.java +++ b/data-bus/src/main/java/com/iluwatar/databus/App.java @@ -28,35 +28,33 @@ import com.iluwatar.databus.data.StoppingData; import com.iluwatar.databus.members.MessageCollectorMember; import com.iluwatar.databus.members.StatusMember; - import java.time.LocalDateTime; /** - * The Data Bus pattern - *

    - * @see http://wiki.c2.com/?DataBusPattern - *

    The Data-Bus pattern provides a method where different parts of an application may - * pass messages between each other without needing to be aware of the other's existence.

    - *

    Similar to the {@code ObserverPattern}, members register themselves with the {@link DataBus} - * and may then receive each piece of data that is published to the Data-Bus. The member - * may react to any given message or not.

    - *

    It allows for Many-to-Many distribution of data, as there may be any number of - * publishers to a Data-Bus, and any number of members receiving the data. All members - * will receive the same data, the order each receives a given piece of data, is an - * implementation detail.

    - *

    Members may unsubscribe from the Data-Bus to stop receiving data.

    - *

    This example of the pattern implements a Synchronous Data-Bus, meaning that - * when data is published to the Data-Bus, the publish method will not return until - * all members have received the data and returned.

    - *

    The {@link DataBus} class is a Singleton.

    - *

    Members of the Data-Bus must implement the {@link Member} interface.

    - *

    Data to be published via the Data-Bus must implement the {@link DataType} interface.

    - *

    The {@code data} package contains example {@link DataType} implementations.

    - *

    The {@code members} package contains example {@link Member} implementations.

    - *

    The {@link StatusMember} demonstrates using the DataBus to publish a message - * to the Data-Bus when it receives a message.

    + * The Data Bus pattern. * * @author Paul Campbell (pcampbell@kemitix.net) + * @see http://wiki.c2.com/?DataBusPattern + *

    The Data-Bus pattern provides a method where different parts of an application may + * pass messages between each other without needing to be aware of the other's existence.

    + *

    Similar to the {@code ObserverPattern}, members register themselves with the {@link + * DataBus} and may then receive each piece of data that is published to the Data-Bus. The + * member may react to any given message or not.

    + *

    It allows for Many-to-Many distribution of data, as there may be any number of + * publishers to a Data-Bus, and any number of members receiving the data. All members will + * receive the same data, the order each receives a given piece of data, is an implementation + * detail.

    + *

    Members may unsubscribe from the Data-Bus to stop receiving data.

    + *

    This example of the pattern implements a Synchronous Data-Bus, meaning that + * when data is published to the Data-Bus, the publish method will not return until all members + * have received the data and returned.

    + *

    The {@link DataBus} class is a Singleton.

    + *

    Members of the Data-Bus must implement the {@link Member} interface.

    + *

    Data to be published via the Data-Bus must implement the {@link DataType} interface.

    + *

    The {@code data} package contains example {@link DataType} implementations.

    + *

    The {@code members} package contains example {@link Member} implementations.

    + *

    The {@link StatusMember} demonstrates using the DataBus to publish a message + * to the Data-Bus when it receives a message.

    */ class App { diff --git a/data-bus/src/main/java/com/iluwatar/databus/data/StartingData.java b/data-bus/src/main/java/com/iluwatar/databus/data/StartingData.java index 52de8b1f2d61..bd1f4c20f3d2 100644 --- a/data-bus/src/main/java/com/iluwatar/databus/data/StartingData.java +++ b/data-bus/src/main/java/com/iluwatar/databus/data/StartingData.java @@ -25,7 +25,6 @@ import com.iluwatar.databus.AbstractDataType; import com.iluwatar.databus.DataType; - import java.time.LocalDateTime; /** diff --git a/data-bus/src/main/java/com/iluwatar/databus/data/StoppingData.java b/data-bus/src/main/java/com/iluwatar/databus/data/StoppingData.java index 5ca66743bbb1..41bb67482ce7 100644 --- a/data-bus/src/main/java/com/iluwatar/databus/data/StoppingData.java +++ b/data-bus/src/main/java/com/iluwatar/databus/data/StoppingData.java @@ -25,7 +25,6 @@ import com.iluwatar.databus.AbstractDataType; import com.iluwatar.databus.DataType; - import java.time.LocalDateTime; /** diff --git a/data-bus/src/main/java/com/iluwatar/databus/members/MessageCollectorMember.java b/data-bus/src/main/java/com/iluwatar/databus/members/MessageCollectorMember.java index d242eedb81e0..332f6f935508 100644 --- a/data-bus/src/main/java/com/iluwatar/databus/members/MessageCollectorMember.java +++ b/data-bus/src/main/java/com/iluwatar/databus/members/MessageCollectorMember.java @@ -26,7 +26,6 @@ import com.iluwatar.databus.DataType; import com.iluwatar.databus.Member; import com.iluwatar.databus.data.MessageData; - import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/data-bus/src/main/java/com/iluwatar/databus/members/StatusMember.java b/data-bus/src/main/java/com/iluwatar/databus/members/StatusMember.java index cc0f6851b7db..fffcde9c685f 100644 --- a/data-bus/src/main/java/com/iluwatar/databus/members/StatusMember.java +++ b/data-bus/src/main/java/com/iluwatar/databus/members/StatusMember.java @@ -28,7 +28,6 @@ import com.iluwatar.databus.data.MessageData; import com.iluwatar.databus.data.StartingData; import com.iluwatar.databus.data.StoppingData; - import java.time.LocalDateTime; import java.util.logging.Logger; diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/Application.java b/data-locality/src/main/java/com/iluwatar/data/locality/Application.java index 53abb0f4b5bb..064465fc7d00 100644 --- a/data-locality/src/main/java/com/iluwatar/data/locality/Application.java +++ b/data-locality/src/main/java/com/iluwatar/data/locality/Application.java @@ -28,22 +28,21 @@ import org.slf4j.LoggerFactory; /** - * Use the Data Locality pattern is when you have a performance problem. - * Take advantage of that to improve performance by increasing data locality — keeping data in - * contiguous memory in the order that you process it. - * - * Example: Game loop that processes a bunch of game entities. - * Those entities are decomposed into different domains  - * — AI, physics, and rendering — using the Component pattern. + * Use the Data Locality pattern is when you have a performance problem. Take advantage of that to + * improve performance by increasing data locality — keeping data in contiguous memory in the order + * that you process it. * + *

    Example: Game loop that processes a bunch of game entities. Those entities are decomposed + * into different domains  — AI, physics, and rendering — using the Component pattern. */ public class Application { private static final Logger LOGGER = LoggerFactory.getLogger(Application.class); private static final int NUM_ENTITIES = 5; + /** - * Start game loop with each component have NUM_ENTITIES instance + * Start game loop with each component have NUM_ENTITIES instance. */ public static void main(String[] args) { LOGGER.info("Start Game Application using Data-Locality pattern"); diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/GameEntity.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/GameEntity.java index 33f139948522..337532175dc5 100644 --- a/data-locality/src/main/java/com/iluwatar/data/locality/game/GameEntity.java +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/GameEntity.java @@ -30,14 +30,14 @@ import org.slf4j.LoggerFactory; /** - * The game Entity maintains a big array of pointers . - * Each spin of the game loop, we need to run the following: + * The game Entity maintains a big array of pointers . Each spin of the game loop, we need to run + * the following: * - * Update the AI components . + *

    Update the AI components. * - * Update the physics components for them. + *

    Update the physics components for them. * - * Render them using their render components. + *

    Render them using their render components. */ public class GameEntity { private static final Logger LOGGER = LoggerFactory.getLogger(GameEntity.class); @@ -47,7 +47,7 @@ public class GameEntity { private final RenderComponentManager renderComponentManager; /** - * Init components + * Init components. */ public GameEntity(int numEntities) { LOGGER.info("Init Game with #Entity : {}", numEntities); @@ -57,7 +57,7 @@ public GameEntity(int numEntities) { } /** - * start all component + * start all component. */ public void start() { LOGGER.info("Start Game"); @@ -67,7 +67,7 @@ public void start() { } /** - * update all component + * update all component. */ public void update() { LOGGER.info("Update Game Component"); @@ -80,5 +80,5 @@ public void update() { // Draw to screen. renderComponentManager.render(); } - + } diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/AiComponent.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/AiComponent.java index c31f2ce662f2..5b1be9e35cc7 100644 --- a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/AiComponent.java +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/AiComponent.java @@ -27,14 +27,14 @@ import org.slf4j.LoggerFactory; /** - * Implementation of AI component for Game + * Implementation of AI component for Game. */ public class AiComponent implements Component { - + private static final Logger LOGGER = LoggerFactory.getLogger(AiComponent.class); /** - * Update ai component + * Update ai component. */ @Override public void update() { diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/Component.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/Component.java index c877fbe01e97..f159df4f651a 100644 --- a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/Component.java +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/Component.java @@ -24,7 +24,7 @@ package com.iluwatar.data.locality.game.component; /** - * Implement different Game component update and render process + * Implement different Game component update and render process. */ public interface Component { diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/PhysicsComponent.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/PhysicsComponent.java index 3c5f0950e37d..89c6f1503009 100644 --- a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/PhysicsComponent.java +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/PhysicsComponent.java @@ -27,13 +27,14 @@ import org.slf4j.LoggerFactory; /** - * Implementation of Physics Component of Game + * Implementation of Physics Component of Game. */ public class PhysicsComponent implements Component { private static final Logger LOGGER = LoggerFactory.getLogger(PhysicsComponent.class); + /** - * update physics component of game + * update physics component of game. */ @Override public void update() { diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/RenderComponent.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/RenderComponent.java index 0f3e0ca1ac40..0b49da056394 100644 --- a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/RenderComponent.java +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/RenderComponent.java @@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory; /** - * Implementation of Render Component of Game + * Implementation of Render Component of Game. */ public class RenderComponent implements Component { @@ -39,7 +39,7 @@ public void update() { } /** - * render + * render. */ @Override public void render() { diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/AiComponentManager.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/AiComponentManager.java index 1fc5419cc2d2..20fac010720a 100644 --- a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/AiComponentManager.java +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/AiComponentManager.java @@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory; /** - * AI component manager for Game + * AI component manager for Game. */ public class AiComponentManager { @@ -46,7 +46,7 @@ public AiComponentManager(int numEntities) { } /** - * start AI component of Game + * start AI component of Game. */ public void start() { LOGGER.info("Start AI Game Component"); @@ -56,7 +56,7 @@ public void start() { } /** - * Update AI component of Game + * Update AI component of Game. */ public void update() { LOGGER.info("Update AI Game Component"); diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/PhysicsComponentManager.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/PhysicsComponentManager.java index 6ac6f5c095eb..36f762587984 100644 --- a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/PhysicsComponentManager.java +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/PhysicsComponentManager.java @@ -46,7 +46,7 @@ public PhysicsComponentManager(int numEntities) { } /** - * Start physics component of Game + * Start physics component of Game. */ public void start() { LOGGER.info("Start Physics Game Component "); @@ -57,7 +57,7 @@ public void start() { /** - * Update physics component of Game + * Update physics component of Game. */ public void update() { LOGGER.info("Update Physics Game Component "); diff --git a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/RenderComponentManager.java b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/RenderComponentManager.java index 7360f208b84d..fd6ef9640154 100644 --- a/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/RenderComponentManager.java +++ b/data-locality/src/main/java/com/iluwatar/data/locality/game/component/manager/RenderComponentManager.java @@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory; /** - * Render component manager for Game + * Render component manager for Game. */ public class RenderComponentManager { @@ -46,7 +46,7 @@ public RenderComponentManager(int numEntities) { } /** - * Start render component + * Start render component. */ public void start() { LOGGER.info("Start Render Game Component "); @@ -57,7 +57,7 @@ public void start() { /** - * render component + * render component. */ public void render() { LOGGER.info("Update Render Game Component "); diff --git a/data-mapper/src/main/java/com/iluwatar/datamapper/App.java b/data-mapper/src/main/java/com/iluwatar/datamapper/App.java index 50857729a49c..49d6c63d39df 100644 --- a/data-mapper/src/main/java/com/iluwatar/datamapper/App.java +++ b/data-mapper/src/main/java/com/iluwatar/datamapper/App.java @@ -23,11 +23,10 @@ package com.iluwatar.datamapper; +import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Optional; - /** * The Data Mapper (DM) is a layer of software that separates the in-memory objects from the * database. Its responsibility is to transfer data between the two and also to isolate them from @@ -35,19 +34,18 @@ * present; they need no SQL interface code, and certainly no knowledge of the database schema. (The * database schema is always ignorant of the objects that use it.) Since it's a form of Mapper , * Data Mapper itself is even unknown to the domain layer. - *

    - * The below example demonstrates basic CRUD operations: Create, Read, Update, and Delete. - * + * + *

    The below example demonstrates basic CRUD operations: Create, Read, Update, and Delete. */ public final class App { private static Logger log = LoggerFactory.getLogger(App.class); private static final String STUDENT_STRING = "App.main(), student : "; - + /** * Program entry point. - * + * * @param args command line args. */ public static void main(final String... args) { @@ -81,5 +79,6 @@ public static void main(final String... args) { mapper.delete(student); } - private App() {} + private App() { + } } diff --git a/data-mapper/src/main/java/com/iluwatar/datamapper/DataMapperException.java b/data-mapper/src/main/java/com/iluwatar/datamapper/DataMapperException.java index 57aec04a85cc..4f354c7ebd10 100644 --- a/data-mapper/src/main/java/com/iluwatar/datamapper/DataMapperException.java +++ b/data-mapper/src/main/java/com/iluwatar/datamapper/DataMapperException.java @@ -26,9 +26,8 @@ /** * Using Runtime Exception for avoiding dependancy on implementation exceptions. This helps in * decoupling. - * - * @author amit.dixit * + * @author amit.dixit */ public final class DataMapperException extends RuntimeException { @@ -39,7 +38,7 @@ public final class DataMapperException extends RuntimeException { * initialized, and may subsequently be initialized by a call to {@link #initCause}. * * @param message the detail message. The detail message is saved for later retrieval by the - * {@link #getMessage()} method. + * {@link #getMessage()} method. */ public DataMapperException(final String message) { super(message); diff --git a/data-mapper/src/main/java/com/iluwatar/datamapper/Student.java b/data-mapper/src/main/java/com/iluwatar/datamapper/Student.java index e52d293ced99..5a368f9ce768 100644 --- a/data-mapper/src/main/java/com/iluwatar/datamapper/Student.java +++ b/data-mapper/src/main/java/com/iluwatar/datamapper/Student.java @@ -23,11 +23,10 @@ package com.iluwatar.datamapper; - import java.io.Serializable; /** - * Class defining Student + * Class defining Student. */ public final class Student implements Serializable { @@ -39,11 +38,11 @@ public final class Student implements Serializable { /** - * Use this constructor to create a Student with all details + * Use this constructor to create a Student with all details. * * @param studentId as unique student id - * @param name as student name - * @param grade as respective grade of student + * @param name as student name + * @param grade as respective grade of student */ public Student(final int studentId, final String name, final char grade) { this.studentId = studentId; @@ -51,57 +50,30 @@ public Student(final int studentId, final String name, final char grade) { this.grade = grade; } - /** - * - * @return the student id - */ public int getStudentId() { return studentId; } - /** - * - * @param studentId as unique student id - */ public void setStudentId(final int studentId) { this.studentId = studentId; } - /** - * - * @return name of student - */ public String getName() { return name; } - /** - * - * @param name as 'name' of student - */ public void setName(final String name) { this.name = name; } - /** - * - * @return grade of student - */ public char getGrade() { return grade; } - /** - * - * @param grade as 'grade of student' - */ public void setGrade(final char grade) { this.grade = grade; } - /** - * - */ @Override public boolean equals(final Object inputObject) { @@ -125,9 +97,6 @@ public boolean equals(final Object inputObject) { return isEqual; } - /** - * - */ @Override public int hashCode() { @@ -135,9 +104,6 @@ public int hashCode() { return this.getStudentId(); } - /** - * - */ @Override public String toString() { return "Student [studentId=" + studentId + ", name=" + name + ", grade=" + grade + "]"; diff --git a/data-mapper/src/main/java/com/iluwatar/datamapper/StudentDataMapper.java b/data-mapper/src/main/java/com/iluwatar/datamapper/StudentDataMapper.java index 18ce1685c11e..3dfe4787fb9d 100644 --- a/data-mapper/src/main/java/com/iluwatar/datamapper/StudentDataMapper.java +++ b/data-mapper/src/main/java/com/iluwatar/datamapper/StudentDataMapper.java @@ -26,7 +26,7 @@ import java.util.Optional; /** - * Interface lists out the possible behaviour for all possible student mappers + * Interface lists out the possible behaviour for all possible student mappers. */ public interface StudentDataMapper { diff --git a/data-mapper/src/main/java/com/iluwatar/datamapper/StudentDataMapperImpl.java b/data-mapper/src/main/java/com/iluwatar/datamapper/StudentDataMapperImpl.java index 117015f0020e..cc92ab81e7f9 100644 --- a/data-mapper/src/main/java/com/iluwatar/datamapper/StudentDataMapperImpl.java +++ b/data-mapper/src/main/java/com/iluwatar/datamapper/StudentDataMapperImpl.java @@ -28,7 +28,7 @@ import java.util.Optional; /** - * Implementation of Actions on Students Data + * Implementation of Actions on Students Data. */ public final class StudentDataMapperImpl implements StudentDataMapper { @@ -84,7 +84,8 @@ public void insert(Student studentToBeInserted) throws DataMapperException { } else { /* Throw user error after wrapping in a runtime exception */ - throw new DataMapperException("Student already [" + studentToBeInserted.getName() + "] exists"); + throw new DataMapperException("Student already [" + studentToBeInserted + .getName() + "] exists"); } } diff --git a/data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerClientApp.java b/data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerClientApp.java index 7a660705a05f..860faf478da0 100644 --- a/data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerClientApp.java +++ b/data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerClientApp.java @@ -23,21 +23,20 @@ package com.iluwatar.datatransfer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.ArrayList; import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * The Data Transfer Object pattern is a design pattern in which an data transfer object is used to serve related - * information together to avoid multiple call for each piece of information. - *

    - * In this example, ({@link CustomerClientApp}) as as customer details consumer i.e. client to request for - * customer details to server. - *

    - * CustomerResource ({@link CustomerResource}) act as server to serve customer information. - * And The CustomerDto ({@link CustomerDto} is data transfer object to share customer information. + * The Data Transfer Object pattern is a design pattern in which an data transfer object is used to + * serve related information together to avoid multiple call for each piece of information. + * + *

    In this example, ({@link CustomerClientApp}) as as customer details consumer i.e. client to + * request for customer details to server. + * + *

    CustomerResource ({@link CustomerResource}) act as server to serve customer information. And + * The CustomerDto ({@link CustomerDto} is data transfer object to share customer information. */ public class CustomerClientApp { diff --git a/data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerDto.java b/data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerDto.java index d05d970d29e8..a77eb8702774 100644 --- a/data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerDto.java +++ b/data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerDto.java @@ -24,10 +24,10 @@ package com.iluwatar.datatransfer; /** - * {@link CustomerDto} is a data transfer object POJO. Instead of sending individual information to client - * We can send related information together in POJO. - *

    - * Dto will not have any business logic in it. + * {@link CustomerDto} is a data transfer object POJO. Instead of sending individual information to + * client We can send related information together in POJO. + * + *

    Dto will not have any business logic in it. */ public class CustomerDto { private final String id; @@ -35,6 +35,8 @@ public class CustomerDto { private final String lastName; /** + * Constructor. + * * @param id customer id * @param firstName customer first name * @param lastName customer last name diff --git a/data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerResource.java b/data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerResource.java index 5dee3c8f8d5e..7e4b8340d1e5 100644 --- a/data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerResource.java +++ b/data-transfer-object/src/main/java/com/iluwatar/datatransfer/CustomerResource.java @@ -26,13 +26,15 @@ import java.util.List; /** - * The resource class which serves customer information. - * This class act as server in the demo. Which has all customer details. + * The resource class which serves customer information. This class act as server in the demo. Which + * has all customer details. */ public class CustomerResource { private List customers; /** + * Initialise resource with existing customers. + * * @param customers initialize resource with existing customers. Act as database. */ public CustomerResource(List customers) { @@ -40,6 +42,8 @@ public CustomerResource(List customers) { } /** + * Get all customers. + * * @return : all customers in list. */ public List getAllCustomers() { @@ -47,6 +51,8 @@ public List getAllCustomers() { } /** + * Save new customer. + * * @param customer save new customer to list. */ public void save(CustomerDto customer) { @@ -54,6 +60,8 @@ public void save(CustomerDto customer) { } /** + * Delete customer with given id. + * * @param customerId delete customer with id {@code customerId} */ public void delete(String customerId) { diff --git a/decorator/src/main/java/com/iluwatar/decorator/App.java b/decorator/src/main/java/com/iluwatar/decorator/App.java index 82a44bc1158d..348e5623d4c3 100644 --- a/decorator/src/main/java/com/iluwatar/decorator/App.java +++ b/decorator/src/main/java/com/iluwatar/decorator/App.java @@ -27,24 +27,22 @@ import org.slf4j.LoggerFactory; /** - * * The Decorator pattern is a more flexible alternative to subclassing. The Decorator class * implements the same interface as the target and uses aggregation to "decorate" calls to the * target. Using the Decorator pattern it is possible to change the behavior of the class during * runtime. - *

    - * In this example we show how the simple {@link SimpleTroll} first attacks and then flees the battle. - * Then we decorate the {@link SimpleTroll} with a {@link ClubbedTroll} and perform the attack again. You - * can see how the behavior changes after the decoration. - * + * + *

    In this example we show how the simple {@link SimpleTroll} first attacks and then flees the + * battle. Then we decorate the {@link SimpleTroll} with a {@link ClubbedTroll} and perform the + * attack again. You can see how the behavior changes after the decoration. */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point - * + * Program entry point. + * * @param args command line args */ public static void main(String[] args) { diff --git a/decorator/src/main/java/com/iluwatar/decorator/ClubbedTroll.java b/decorator/src/main/java/com/iluwatar/decorator/ClubbedTroll.java index 90eb893a7ab5..70fd15489e30 100644 --- a/decorator/src/main/java/com/iluwatar/decorator/ClubbedTroll.java +++ b/decorator/src/main/java/com/iluwatar/decorator/ClubbedTroll.java @@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory; /** - * Decorator that adds a club for the troll + * Decorator that adds a club for the troll. */ public class ClubbedTroll implements Troll { diff --git a/decorator/src/main/java/com/iluwatar/decorator/SimpleTroll.java b/decorator/src/main/java/com/iluwatar/decorator/SimpleTroll.java index e2095a2adca9..08eed94fc5c4 100644 --- a/decorator/src/main/java/com/iluwatar/decorator/SimpleTroll.java +++ b/decorator/src/main/java/com/iluwatar/decorator/SimpleTroll.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * * SimpleTroll implements {@link Troll} interface directly. - * */ public class SimpleTroll implements Troll { diff --git a/decorator/src/main/java/com/iluwatar/decorator/Troll.java b/decorator/src/main/java/com/iluwatar/decorator/Troll.java index faeca11c93c9..43f9ac916072 100644 --- a/decorator/src/main/java/com/iluwatar/decorator/Troll.java +++ b/decorator/src/main/java/com/iluwatar/decorator/Troll.java @@ -24,9 +24,7 @@ package com.iluwatar.decorator; /** - * - * Interface for trolls - * + * Interface for trolls. */ public interface Troll { From f2c91eb8364655caf9f595e5ddde449107a6ea96 Mon Sep 17 00:00:00 2001 From: Anurag Agarwal Date: Sun, 10 Nov 2019 23:01:20 +0530 Subject: [PATCH 145/197] Resolves checkstyle errors for delegation dependency-injection dirty-flag double-buffer double-checked-locking double-dispatch (#1068) * Reduces checkstyle errors in delegation * Reduces checkstyle errors in dependency-injection * Reduces checkstyle errors in dirty-flag * Reduces checkstyle errors in double-buffer * Reduces checkstyle errors in double-checked-locking * Reduces checkstyle errors in double-dispatch --- .../com/iluwatar/delegation/simple/App.java | 22 ++++---- .../iluwatar/delegation/simple/Printer.java | 3 +- .../delegation/simple/PrinterController.java | 16 +++--- .../simple/printers/CanonPrinter.java | 4 +- .../simple/printers/EpsonPrinter.java | 4 +- .../delegation/simple/printers/HpPrinter.java | 4 +- .../injection/AdvancedSorceress.java | 24 --------- .../dependency/injection/AdvancedWizard.java | 2 - .../iluwatar/dependency/injection/App.java | 25 ++++----- .../dependency/injection/GuiceWizard.java | 2 - .../dependency/injection/OldTobyTobacco.java | 4 +- .../injection/RivendellTobacco.java | 4 +- .../injection/SecondBreakfastTobacco.java | 4 +- .../dependency/injection/SimpleWizard.java | 2 - .../dependency/injection/Tobacco.java | 4 +- .../dependency/injection/TobaccoModule.java | 2 - .../iluwatar/dependency/injection/Wizard.java | 4 +- .../main/java/com/iluwatar/dirtyflag/App.java | 51 ++++++++++--------- .../com/iluwatar/dirtyflag/DataFetcher.java | 11 ++-- .../java/com/iluwatar/dirtyflag/World.java | 7 +-- .../java/com/iluwatar/doublebuffer/App.java | 19 ++++--- .../com/iluwatar/doublebuffer/Buffer.java | 3 ++ .../iluwatar/doublebuffer/FrameBuffer.java | 3 -- .../java/com/iluwatar/doublebuffer/Scene.java | 4 +- .../iluwatar/doublechecked/locking/App.java | 20 ++++---- .../doublechecked/locking/Inventory.java | 18 +++---- .../iluwatar/doublechecked/locking/Item.java | 4 +- .../java/com/iluwatar/doubledispatch/App.java | 49 +++++++++--------- .../doubledispatch/FlamingAsteroid.java | 4 +- .../iluwatar/doubledispatch/GameObject.java | 2 - .../iluwatar/doubledispatch/Meteoroid.java | 13 +++-- .../iluwatar/doubledispatch/Rectangle.java | 4 +- .../doubledispatch/SpaceStationIss.java | 4 +- .../doubledispatch/SpaceStationMir.java | 19 ++++--- .../constants/AppConstants.java | 4 +- 35 files changed, 154 insertions(+), 215 deletions(-) diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/App.java b/delegation/src/main/java/com/iluwatar/delegation/simple/App.java index af734bb41449..b568c836f668 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/App.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/App.java @@ -28,23 +28,25 @@ import com.iluwatar.delegation.simple.printers.HpPrinter; /** - * The delegate pattern provides a mechanism to abstract away the implementation and control of the desired action. - * The class being called in this case {@link PrinterController} is not responsible for the actual desired action, - * but is actually delegated to a helper class either {@link CanonPrinter}, {@link EpsonPrinter} or {@link HpPrinter}. - * The consumer does not have or require knowledge of the actual class carrying out the action, only the - * container on which they are calling. + * The delegate pattern provides a mechanism to abstract away the implementation and control of the + * desired action. The class being called in this case {@link PrinterController} is not responsible + * for the actual desired action, but is actually delegated to a helper class either {@link + * CanonPrinter}, {@link EpsonPrinter} or {@link HpPrinter}. The consumer does not have or require + * knowledge of the actual class carrying out the action, only the container on which they are + * calling. * - * In this example the delegates are {@link EpsonPrinter}, {@link HpPrinter} and {@link CanonPrinter} they all implement - * {@link Printer}. The {@link PrinterController} class also implements {@link Printer}. However neither provide the - * functionality of {@link Printer} by printing to the screen, they actually call upon the instance of {@link Printer} - * that they were instantiated with. Therefore delegating the behaviour to another class. + *

    In this example the delegates are {@link EpsonPrinter}, {@link HpPrinter} and {@link + * CanonPrinter} they all implement {@link Printer}. The {@link PrinterController} class also + * implements {@link Printer}. However neither provide the functionality of {@link Printer} by + * printing to the screen, they actually call upon the instance of {@link Printer} that they were + * instantiated with. Therefore delegating the behaviour to another class. */ public class App { private static final String MESSAGE_TO_PRINT = "hello world"; /** - * Program entry point + * Program entry point. * * @param args command line args */ diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/Printer.java b/delegation/src/main/java/com/iluwatar/delegation/simple/Printer.java index bc6f50879798..f3f434adb478 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/Printer.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/Printer.java @@ -38,7 +38,8 @@ public interface Printer { /** * Method that takes a String to print to the screen. This will be implemented on both the - * controller and the delegate allowing the controller to call the same method on the delegate class. + * controller and the delegate allowing the controller to call the same method on the delegate + * class. * * @param message to be printed to the screen */ diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/PrinterController.java b/delegation/src/main/java/com/iluwatar/delegation/simple/PrinterController.java index 315b6ee585a3..add1d71e6a11 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/PrinterController.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/PrinterController.java @@ -24,10 +24,10 @@ package com.iluwatar.delegation.simple; /** - * Delegator Class to delegate the implementation of the Printer. - * This ensures two things: - * - when the actual implementation of the Printer class changes the delegation will still be operational - * - the actual benefit is observed when there are more than one implementors and they share a delegation control + * Delegator Class to delegate the implementation of the Printer. This ensures two things: - when + * the actual implementation of the Printer class changes the delegation will still be operational - + * the actual benefit is observed when there are more than one implementors and they share a + * delegation control */ public class PrinterController implements Printer { @@ -38,10 +38,10 @@ public PrinterController(Printer printer) { } /** - * This method is implemented from {@link Printer} however instead on providing an - * implementation, it instead calls upon the class passed through the constructor. This is the delegate, - * hence the pattern. Therefore meaning that the caller does not care of the implementing class only the owning - * controller. + * This method is implemented from {@link Printer} however instead on providing an implementation, + * it instead calls upon the class passed through the constructor. This is the delegate, hence the + * pattern. Therefore meaning that the caller does not care of the implementing class only the + * owning controller. * * @param message to be printed to the screen */ diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/printers/CanonPrinter.java b/delegation/src/main/java/com/iluwatar/delegation/simple/printers/CanonPrinter.java index 9188fc988509..5d7c59c863c7 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/printers/CanonPrinter.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/printers/CanonPrinter.java @@ -28,8 +28,8 @@ import org.slf4j.LoggerFactory; /** - * Specialised Implementation of {@link Printer} for a Canon Printer, in - * this case the message to be printed is appended to "Canon Printer : " + * Specialised Implementation of {@link Printer} for a Canon Printer, in this case the message to be + * printed is appended to "Canon Printer : ". * * @see Printer */ diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/printers/EpsonPrinter.java b/delegation/src/main/java/com/iluwatar/delegation/simple/printers/EpsonPrinter.java index a29c0b224644..67bd00ac8881 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/printers/EpsonPrinter.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/printers/EpsonPrinter.java @@ -28,8 +28,8 @@ import org.slf4j.LoggerFactory; /** - * Specialised Implementation of {@link Printer} for a Epson Printer, in - * this case the message to be printed is appended to "Epson Printer : " + * Specialised Implementation of {@link Printer} for a Epson Printer, in this case the message to be + * printed is appended to "Epson Printer : ". * * @see Printer */ diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/printers/HpPrinter.java b/delegation/src/main/java/com/iluwatar/delegation/simple/printers/HpPrinter.java index cb0a8068d9ce..082e0054a2f1 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/printers/HpPrinter.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/printers/HpPrinter.java @@ -28,8 +28,8 @@ import org.slf4j.LoggerFactory; /** - * Specialised Implementation of {@link Printer} for a HP Printer, in - * this case the message to be printed is appended to "HP Printer : " + * Specialised Implementation of {@link Printer} for a HP Printer, in this case the message to be + * printed is appended to "HP Printer : ". * * @see Printer */ diff --git a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/AdvancedSorceress.java b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/AdvancedSorceress.java index 0009cfadccf8..31f4e78bfc29 100644 --- a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/AdvancedSorceress.java +++ b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/AdvancedSorceress.java @@ -23,30 +23,6 @@ package com.iluwatar.dependency.injection; -/** - * The MIT License - * Copyright (c) 2014-2017 Ilkka Seppälä - *

    - * 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 NONINFRINGEMENT. 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. - */ - - /** * AdvancedSorceress implements inversion of control. It depends on abstraction that can be injected * through its setter. diff --git a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/AdvancedWizard.java b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/AdvancedWizard.java index e57222b1994f..e0c952186830 100644 --- a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/AdvancedWizard.java +++ b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/AdvancedWizard.java @@ -24,10 +24,8 @@ package com.iluwatar.dependency.injection; /** - * * AdvancedWizard implements inversion of control. It depends on abstraction that can be injected * through its constructor. - * */ public class AdvancedWizard implements Wizard { diff --git a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/App.java b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/App.java index 0c829b98ba8b..79c6400b12f9 100644 --- a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/App.java +++ b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/App.java @@ -31,25 +31,26 @@ * implements so called inversion of control principle. Inversion of control has two specific rules: * - High-level modules should not depend on low-level modules. Both should depend on abstractions. * - Abstractions should not depend on details. Details should depend on abstractions. - *

    - * In this example we show you three different wizards. The first one ({@link SimpleWizard}) is a - * naive implementation violating the inversion of control principle. It depends directly on a + * + *

    In this example we show you three different wizards. The first one ({@link SimpleWizard}) is + * a naive implementation violating the inversion of control principle. It depends directly on a * concrete implementation which cannot be changed. - *

    - * The second and third wizards({@link AdvancedWizard} and {@link AdvancedSorceress}) are more flexible. - * They do not depend on any concrete implementation but abstraction. They utilizes Dependency Injection - * pattern allowing their {@link Tobacco} dependency to be injected through constructor ({@link AdvancedWizard}) - * or setter ({@link AdvancedSorceress}). This way, handling the dependency is no longer the wizard's - * responsibility. It is resolved outside the wizard class. - *

    - * The fourth example takes the pattern a step further. It uses Guice framework for Dependency + * + *

    The second and third wizards({@link AdvancedWizard} and {@link AdvancedSorceress}) are more + * flexible. They do not depend on any concrete implementation but abstraction. They utilizes + * Dependency Injection pattern allowing their {@link Tobacco} dependency to be injected through + * constructor ({@link AdvancedWizard}) or setter ({@link AdvancedSorceress}). This way, handling + * the dependency is no longer the wizard's responsibility. It is resolved outside the wizard + * class. + * + *

    The fourth example takes the pattern a step further. It uses Guice framework for Dependency * Injection. {@link TobaccoModule} binds a concrete implementation to abstraction. Injector is then * used to create {@link GuiceWizard} object with correct dependencies. */ public class App { /** - * Program entry point + * Program entry point. * * @param args command line args */ diff --git a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/GuiceWizard.java b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/GuiceWizard.java index 33776ed1d61e..319a635eb41e 100644 --- a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/GuiceWizard.java +++ b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/GuiceWizard.java @@ -26,10 +26,8 @@ import javax.inject.Inject; /** - * * GuiceWizard implements inversion of control. Its dependencies are injected through its * constructor by Guice framework. - * */ public class GuiceWizard implements Wizard { diff --git a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/OldTobyTobacco.java b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/OldTobyTobacco.java index b198a4c5013f..3f242ea60744 100644 --- a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/OldTobyTobacco.java +++ b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/OldTobyTobacco.java @@ -24,9 +24,7 @@ package com.iluwatar.dependency.injection; /** - * - * OldTobyTobacco concrete {@link Tobacco} implementation - * + * OldTobyTobacco concrete {@link Tobacco} implementation. */ public class OldTobyTobacco extends Tobacco { } diff --git a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/RivendellTobacco.java b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/RivendellTobacco.java index 37c17fbfd19a..50ef5e2c5d86 100644 --- a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/RivendellTobacco.java +++ b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/RivendellTobacco.java @@ -24,9 +24,7 @@ package com.iluwatar.dependency.injection; /** - * - * RivendellTobacco concrete {@link Tobacco} implementation - * + * RivendellTobacco concrete {@link Tobacco} implementation. */ public class RivendellTobacco extends Tobacco { } diff --git a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/SecondBreakfastTobacco.java b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/SecondBreakfastTobacco.java index 9845c0381b4c..622958615ae3 100644 --- a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/SecondBreakfastTobacco.java +++ b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/SecondBreakfastTobacco.java @@ -24,9 +24,7 @@ package com.iluwatar.dependency.injection; /** - * - * SecondBreakfastTobacco concrete {@link Tobacco} implementation - * + * SecondBreakfastTobacco concrete {@link Tobacco} implementation. */ public class SecondBreakfastTobacco extends Tobacco { } diff --git a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/SimpleWizard.java b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/SimpleWizard.java index ef7dbd144f72..40bca0ffb65c 100644 --- a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/SimpleWizard.java +++ b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/SimpleWizard.java @@ -24,10 +24,8 @@ package com.iluwatar.dependency.injection; /** - * * Naive Wizard implementation violating the inversion of control principle. It should depend on * abstraction instead. - * */ public class SimpleWizard implements Wizard { diff --git a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/Tobacco.java b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/Tobacco.java index c3549b6a09d9..aaef6ba2aa92 100644 --- a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/Tobacco.java +++ b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/Tobacco.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * - * Tobacco abstraction - * + * Tobacco abstraction. */ public abstract class Tobacco { diff --git a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/TobaccoModule.java b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/TobaccoModule.java index 78b43ffa9803..43cadc071fb9 100644 --- a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/TobaccoModule.java +++ b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/TobaccoModule.java @@ -26,9 +26,7 @@ import com.google.inject.AbstractModule; /** - * * Guice module for binding certain concrete {@link Tobacco} implementation. - * */ public class TobaccoModule extends AbstractModule { diff --git a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/Wizard.java b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/Wizard.java index 6bdca74156e2..0575118a517b 100644 --- a/dependency-injection/src/main/java/com/iluwatar/dependency/injection/Wizard.java +++ b/dependency-injection/src/main/java/com/iluwatar/dependency/injection/Wizard.java @@ -24,9 +24,7 @@ package com.iluwatar.dependency.injection; /** - * - * Wizard interface - * + * Wizard interface. */ public interface Wizard { diff --git a/dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java b/dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java index 7caaca5618ae..cc9a6940692a 100644 --- a/dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java +++ b/dirty-flag/src/main/java/com/iluwatar/dirtyflag/App.java @@ -23,45 +23,49 @@ package com.iluwatar.dirtyflag; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** + * This application demonstrates the Dirty Flag pattern. The dirty flag behavioral pattern + * allows you to avoid expensive operations that would just need to be done again anyway. This is a + * simple pattern that really just explains how to add a bool value to your class that you can set + * anytime a property changes. This will let your class know that any results it may have previously + * calculated will need to be calculated again when they’re requested. Once the results are + * re-calculated, then the bool value can be cleared. * - * This application demonstrates the Dirty Flag pattern. The dirty flag behavioral pattern allows you to avoid - * expensive operations that would just need to be done again anyway. This is a simple pattern that really just explains - * how to add a bool value to your class that you can set anytime a property changes. This will let your class know that - * any results it may have previously calculated will need to be calculated again when they’re requested. Once the - * results are re-calculated, then the bool value can be cleared. - * - * There are some points that need to be considered before diving into using this pattern:- there are some things you’ll - * need to consider:- (1) Do you need it? This design pattern works well when the results to be calculated are difficult - * or resource intensive to compute. You want to save them. You also don’t want to be calculating them several times in - * a row when only the last one counts. (2) When do you set the dirty flag? Make sure that you set the dirty flag within - * the class itself whenever an important property changes. This property should affect the result of the calculated - * result and by changing the property, that makes the last result invalid. (3) When do you clear the dirty flag? It - * might seem obvious that the dirty flag should be cleared whenever the result is calculated with up-to-date - * information but there are other times when you might want to clear the flag. + *

    There are some points that need to be considered before diving into using this pattern:- + * there are some things you’ll need to consider:- (1) Do you need it? This design pattern works + * well when the results to be calculated are difficult or resource intensive to compute. You want + * to save them. You also don’t want to be calculating them several times in a row when only the + * last one counts. (2) When do you set the dirty flag? Make sure that you set the dirty flag within + * the class itself whenever an important property changes. This property should affect the result + * of the calculated result and by changing the property, that makes the last result invalid. (3) + * When do you clear the dirty flag? It might seem obvious that the dirty flag should be cleared + * whenever the result is calculated with up-to-date information but there are other times when you + * might want to clear the flag. * - * In this example, the {@link DataFetcher} holds the dirty flag. It fetches and re-fetches from world.txt - * when needed. {@link World} mainly serves the data to the front-end. + *

    In this example, the {@link DataFetcher} holds the dirty flag. It fetches and + * re-fetches from world.txt when needed. {@link World} mainly serves the data to the + * front-end. */ public class App { - + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); + /** - * Program execution point + * Program execution point. */ public void run() { final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); executorService.scheduleAtFixedRate(new Runnable() { final World world = new World(); + @Override public void run() { List countries = world.fetch(); @@ -74,10 +78,9 @@ public void run() { } /** - * Program entry point + * Program entry point. * - * @param args - * command line args + * @param args command line args */ public static void main(String[] args) { App app = new App(); diff --git a/dirty-flag/src/main/java/com/iluwatar/dirtyflag/DataFetcher.java b/dirty-flag/src/main/java/com/iluwatar/dirtyflag/DataFetcher.java index d9b303b0bc4c..cc9f2aa83813 100644 --- a/dirty-flag/src/main/java/com/iluwatar/dirtyflag/DataFetcher.java +++ b/dirty-flag/src/main/java/com/iluwatar/dirtyflag/DataFetcher.java @@ -23,22 +23,19 @@ package com.iluwatar.dirtyflag; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.xml.crypto.Data; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A mock database manager -- Fetches data from a raw file. - * - * @author swaisuan * + * @author swaisuan */ public class DataFetcher { @@ -61,7 +58,7 @@ private boolean isDirty(long fileLastModified) { /** * Fetches data/content from raw file. - * + * * @return List of strings */ public List fetch() { diff --git a/dirty-flag/src/main/java/com/iluwatar/dirtyflag/World.java b/dirty-flag/src/main/java/com/iluwatar/dirtyflag/World.java index 56255a505cd5..189657703e42 100644 --- a/dirty-flag/src/main/java/com/iluwatar/dirtyflag/World.java +++ b/dirty-flag/src/main/java/com/iluwatar/dirtyflag/World.java @@ -27,11 +27,9 @@ import java.util.List; /** - * * A middle-layer app that calls/passes along data from the back-end. - * - * @author swaisuan * + * @author swaisuan */ public class World { @@ -44,9 +42,8 @@ public World() { } /** - * * Calls {@link DataFetcher} to fetch data from back-end. - * + * * @return List of strings */ public List fetch() { diff --git a/double-buffer/src/main/java/com/iluwatar/doublebuffer/App.java b/double-buffer/src/main/java/com/iluwatar/doublebuffer/App.java index 2e69e6eb4e98..636da3eb1d26 100644 --- a/double-buffer/src/main/java/com/iluwatar/doublebuffer/App.java +++ b/double-buffer/src/main/java/com/iluwatar/doublebuffer/App.java @@ -23,21 +23,19 @@ package com.iluwatar.doublebuffer; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.List; - /** - * Double buffering is a term used to describe a device that has two buffers. - * The usage of multiple buffers increases the overall throughput of a device - * and helps prevents bottlenecks. This example shows using double buffer pattern - * on graphics. It is used to show one image or frame while a separate frame - * is being buffered to be shown next. This method makes animations and games - * look more realistic than the same done in a single buffer mode. + * Double buffering is a term used to describe a device that has two buffers. The usage of multiple + * buffers increases the overall throughput of a device and helps prevents bottlenecks. This example + * shows using double buffer pattern on graphics. It is used to show one image or frame while a + * separate frame is being buffered to be shown next. This method makes animations and games look + * more realistic than the same done in a single buffer mode. */ public class App { @@ -45,10 +43,11 @@ public class App { /** * Program main entry point. + * * @param args runtime arguments */ public static void main(String[] args) { - var scene = new Scene(); + final var scene = new Scene(); List> drawPixels = new ArrayList<>(); Pair pixel1 = new MutablePair<>(1, 1); Pair pixel2 = new MutablePair<>(5, 6); diff --git a/double-buffer/src/main/java/com/iluwatar/doublebuffer/Buffer.java b/double-buffer/src/main/java/com/iluwatar/doublebuffer/Buffer.java index b0c7d998b2b5..78877c3d9f32 100644 --- a/double-buffer/src/main/java/com/iluwatar/doublebuffer/Buffer.java +++ b/double-buffer/src/main/java/com/iluwatar/doublebuffer/Buffer.java @@ -30,6 +30,7 @@ public interface Buffer { /** * Clear the pixel in (x, y). + * * @param x X coordinate * @param y Y coordinate */ @@ -37,6 +38,7 @@ public interface Buffer { /** * Draw the pixel in (x, y). + * * @param x X coordinate * @param y Y coordinate */ @@ -49,6 +51,7 @@ public interface Buffer { /** * Get all the pixels. + * * @return pixel list */ Pixel[] getPixels(); diff --git a/double-buffer/src/main/java/com/iluwatar/doublebuffer/FrameBuffer.java b/double-buffer/src/main/java/com/iluwatar/doublebuffer/FrameBuffer.java index 95925808ba1e..aea4144dc4f7 100644 --- a/double-buffer/src/main/java/com/iluwatar/doublebuffer/FrameBuffer.java +++ b/double-buffer/src/main/java/com/iluwatar/doublebuffer/FrameBuffer.java @@ -23,9 +23,6 @@ package com.iluwatar.doublebuffer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - /** * FrameBuffer implementation class. */ diff --git a/double-buffer/src/main/java/com/iluwatar/doublebuffer/Scene.java b/double-buffer/src/main/java/com/iluwatar/doublebuffer/Scene.java index fe4a63fbfade..412b63b0c9ae 100644 --- a/double-buffer/src/main/java/com/iluwatar/doublebuffer/Scene.java +++ b/double-buffer/src/main/java/com/iluwatar/doublebuffer/Scene.java @@ -23,12 +23,11 @@ package com.iluwatar.doublebuffer; +import java.util.List; import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - /** * Scene class. Render the output frame. */ @@ -55,6 +54,7 @@ public Scene() { /** * Draw the next frame. + * * @param coordinateList list of pixels of which the color should be black */ public void draw(List> coordinateList) { diff --git a/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java b/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java index 92186fc22da2..745654796abd 100644 --- a/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java +++ b/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java @@ -23,32 +23,30 @@ package com.iluwatar.doublechecked.locking; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * * Double Checked Locking is a concurrency design pattern used to reduce the overhead of acquiring a * lock by first testing the locking criterion (the "lock hint") without actually acquiring the * lock. Only if the locking criterion check indicates that locking is required does the actual * locking logic proceed. - *

    - * In {@link Inventory} we store the items with a given size. However, we do not store more items - * than the inventory size. To address concurrent access problems we use double checked locking to - * add item to inventory. In this method, the thread which gets the lock first adds the item. - * + * + *

    In {@link Inventory} we store the items with a given size. However, we do not store more + * items than the inventory size. To address concurrent access problems we use double checked + * locking to add item to inventory. In this method, the thread which gets the lock first adds the + * item. */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point - * + * Program entry point. + * * @param args command line args */ public static void main(String[] args) { diff --git a/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/Inventory.java b/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/Inventory.java index c13908b193fd..17b47fa430d5 100644 --- a/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/Inventory.java +++ b/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/Inventory.java @@ -23,19 +23,16 @@ package com.iluwatar.doublechecked.locking; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * - * Inventory - * + * Inventory. */ public class Inventory { @@ -46,7 +43,7 @@ public class Inventory { private final Lock lock; /** - * Constructor + * Constructor. */ public Inventory(int inventorySize) { this.inventorySize = inventorySize; @@ -55,7 +52,7 @@ public Inventory(int inventorySize) { } /** - * Add item + * Add item. */ public boolean addItem(Item item) { if (items.size() < inventorySize) { @@ -63,7 +60,8 @@ public boolean addItem(Item item) { try { if (items.size() < inventorySize) { items.add(item); - LOGGER.info("{}: items.size()={}, inventorySize={}", Thread.currentThread(), items.size(), inventorySize); + LOGGER.info("{}: items.size()={}, inventorySize={}", Thread.currentThread(), items + .size(), inventorySize); return true; } } finally { @@ -74,7 +72,7 @@ public boolean addItem(Item item) { } /** - * Get all the items in the inventory + * Get all the items in the inventory. * * @return All the items of the inventory, as an unmodifiable list */ diff --git a/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/Item.java b/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/Item.java index c2c5559d05a2..ecedc535fde5 100644 --- a/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/Item.java +++ b/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/Item.java @@ -24,9 +24,7 @@ package com.iluwatar.doublechecked.locking; /** - * - * Item - * + * Item. */ public class Item { } diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/App.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/App.java index e6b670a6d524..9117ede47af9 100644 --- a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/App.java +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/App.java @@ -23,46 +23,45 @@ package com.iluwatar.doubledispatch; +import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - /** - * - * When a message with a parameter is sent to an object, the resultant behaviour is defined by the implementation of - * that method in the receiver. Sometimes the behaviour must also be determined by the type of the parameter. - *

    - * One way to implement this would be to create multiple instanceof-checks for the methods parameter. However, this - * creates a maintenance issue. When new types are added we would also need to change the method's implementation and - * add a new instanceof-check. This violates the single responsibility principle - a class should have only one reason - * to change. - *

    - * Instead of the instanceof-checks a better way is to make another virtual call on the parameter object. This way new - * functionality can be easily added without the need to modify existing implementation (open-closed principle). - *

    - * In this example we have hierarchy of objects ({@link GameObject}) that can collide to each other. Each object has its - * own coordinates which are checked against the other objects' coordinates. If there is an overlap, then the objects - * collide utilizing the Double Dispatch pattern. + * When a message with a parameter is sent to an object, the resultant behaviour is defined by the + * implementation of that method in the receiver. Sometimes the behaviour must also be determined by + * the type of the parameter. + * + *

    One way to implement this would be to create multiple instanceof-checks for the methods + * parameter. However, this creates a maintenance issue. When new types are added we would also need + * to change the method's implementation and add a new instanceof-check. This violates the single + * responsibility principle - a class should have only one reason to change. + * + *

    Instead of the instanceof-checks a better way is to make another virtual call on the + * parameter object. This way new functionality can be easily added without the need to modify + * existing implementation (open-closed principle). * + *

    In this example we have hierarchy of objects ({@link GameObject}) that can collide to each + * other. Each object has its own coordinates which are checked against the other objects' + * coordinates. If there is an overlap, then the objects collide utilizing the Double Dispatch + * pattern. */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point - * - * @param args - * command line args + * Program entry point. + * + * @param args command line args */ public static void main(String[] args) { // initialize game objects and print their status List objects = List.of( - new FlamingAsteroid(0, 0, 5, 5), - new SpaceStationMir(1, 1, 2, 2), - new Meteoroid(10, 10, 15, 15), - new SpaceStationIss(12, 12, 14, 14)); + new FlamingAsteroid(0, 0, 5, 5), + new SpaceStationMir(1, 1, 2, 2), + new Meteoroid(10, 10, 15, 15), + new SpaceStationIss(12, 12, 14, 14)); objects.stream().forEach(o -> LOGGER.info(o.toString())); LOGGER.info(""); diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/FlamingAsteroid.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/FlamingAsteroid.java index ed089c3587e0..c603abcac023 100644 --- a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/FlamingAsteroid.java +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/FlamingAsteroid.java @@ -24,9 +24,7 @@ package com.iluwatar.doubledispatch; /** - * - * Flaming asteroid game object - * + * Flaming asteroid game object. */ public class FlamingAsteroid extends Meteoroid { diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/GameObject.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/GameObject.java index d04a9c404673..3dcfd5015b43 100644 --- a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/GameObject.java +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/GameObject.java @@ -24,9 +24,7 @@ package com.iluwatar.doubledispatch; /** - * * Game objects have coordinates and some other status information. - * */ public abstract class GameObject extends Rectangle { diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/Meteoroid.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/Meteoroid.java index 1f2aa441eb35..de9c59f215b2 100644 --- a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/Meteoroid.java +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/Meteoroid.java @@ -23,15 +23,12 @@ package com.iluwatar.doubledispatch; +import com.iluwatar.doubledispatch.constants.AppConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.iluwatar.doubledispatch.constants.AppConstants; - /** - * - * Meteoroid game object - * + * Meteoroid game object. */ public class Meteoroid extends GameObject { @@ -48,12 +45,14 @@ public void collision(GameObject gameObject) { @Override public void collisionResolve(FlamingAsteroid asteroid) { - LOGGER.info(AppConstants.HITS, asteroid.getClass().getSimpleName(), this.getClass().getSimpleName()); + LOGGER.info(AppConstants.HITS, asteroid.getClass().getSimpleName(), this.getClass() + .getSimpleName()); } @Override public void collisionResolve(Meteoroid meteoroid) { - LOGGER.info(AppConstants.HITS, meteoroid.getClass().getSimpleName(), this.getClass().getSimpleName()); + LOGGER.info(AppConstants.HITS, meteoroid.getClass().getSimpleName(), this.getClass() + .getSimpleName()); } @Override diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/Rectangle.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/Rectangle.java index f7646add5975..bd832287cd68 100644 --- a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/Rectangle.java +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/Rectangle.java @@ -24,9 +24,7 @@ package com.iluwatar.doubledispatch; /** - * * Rectangle has coordinates and can be checked for overlap against other Rectangles. - * */ public class Rectangle { @@ -36,7 +34,7 @@ public class Rectangle { private int bottom; /** - * Constructor + * Constructor. */ public Rectangle(int left, int top, int right, int bottom) { this.left = left; diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/SpaceStationIss.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/SpaceStationIss.java index f893b0c2795b..fecdd6b5154b 100644 --- a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/SpaceStationIss.java +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/SpaceStationIss.java @@ -24,9 +24,7 @@ package com.iluwatar.doubledispatch; /** - * - * Space station ISS game object - * + * Space station ISS game object. */ public class SpaceStationIss extends SpaceStationMir { diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/SpaceStationMir.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/SpaceStationMir.java index 0759645344d7..cc61edcdcd1a 100644 --- a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/SpaceStationMir.java +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/SpaceStationMir.java @@ -23,15 +23,12 @@ package com.iluwatar.doubledispatch; +import com.iluwatar.doubledispatch.constants.AppConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.iluwatar.doubledispatch.constants.AppConstants; - /** - * - * Space station Mir game object - * + * Space station Mir game object. */ public class SpaceStationMir extends GameObject { @@ -48,29 +45,31 @@ public void collision(GameObject gameObject) { @Override public void collisionResolve(FlamingAsteroid asteroid) { - LOGGER.info(AppConstants.HITS," {} is damaged! {} is set on fire!", asteroid.getClass().getSimpleName(), - this.getClass().getSimpleName(), this.getClass().getSimpleName(), this.getClass().getSimpleName()); + LOGGER.info(AppConstants.HITS, " {} is damaged! {} is set on fire!", asteroid.getClass() + .getSimpleName(), + this.getClass().getSimpleName(), this.getClass().getSimpleName(), this.getClass() + .getSimpleName()); setDamaged(true); setOnFire(true); } @Override public void collisionResolve(Meteoroid meteoroid) { - LOGGER.info(AppConstants.HITS," {} is damaged!", meteoroid.getClass().getSimpleName(), + LOGGER.info(AppConstants.HITS, " {} is damaged!", meteoroid.getClass().getSimpleName(), this.getClass().getSimpleName(), this.getClass().getSimpleName()); setDamaged(true); } @Override public void collisionResolve(SpaceStationMir mir) { - LOGGER.info(AppConstants.HITS," {} is damaged!", mir.getClass().getSimpleName(), + LOGGER.info(AppConstants.HITS, " {} is damaged!", mir.getClass().getSimpleName(), this.getClass().getSimpleName(), this.getClass().getSimpleName()); setDamaged(true); } @Override public void collisionResolve(SpaceStationIss iss) { - LOGGER.info(AppConstants.HITS," {} is damaged!", iss.getClass().getSimpleName(), + LOGGER.info(AppConstants.HITS, " {} is damaged!", iss.getClass().getSimpleName(), this.getClass().getSimpleName(), this.getClass().getSimpleName()); setDamaged(true); } diff --git a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/constants/AppConstants.java b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/constants/AppConstants.java index cc4c312d5a4b..77f6dde4db52 100644 --- a/double-dispatch/src/main/java/com/iluwatar/doubledispatch/constants/AppConstants.java +++ b/double-dispatch/src/main/java/com/iluwatar/doubledispatch/constants/AppConstants.java @@ -24,9 +24,7 @@ package com.iluwatar.doubledispatch.constants; /** - * - * Constants class to define all constants - * + * Constants class to define all constants. */ public class AppConstants { From 7c888e88864be0ced3e704c039fa8159b255c04a Mon Sep 17 00:00:00 2001 From: Anurag Agarwal Date: Sun, 10 Nov 2019 23:04:42 +0530 Subject: [PATCH 146/197] Resolves checkstyle errors for eip-* (#1069) * Reduces checkstyle errors in eip-aggregator * Reduces checkstyle errors in eip-message-channel * Reduces checkstyle errors in eip-publish-subscribe * Reduces checkstyle errors in eip-splitter * Reduces checkstyle errors in eip-wire-tap --- .../java/com/iluwatar/eip/aggregator/App.java | 17 ++++++++--------- .../aggregator/routes/AggregatorRoute.java | 18 +++++++++--------- .../routes/MessageAggregationStrategy.java | 4 ++-- .../com/iluwatar/eip/message/channel/App.java | 18 ++++++++---------- .../iluwatar/eip/publish/subscribe/App.java | 18 ++++++++---------- .../java/com/iluwatar/eip/splitter/App.java | 19 ++++++++++--------- .../eip/splitter/routes/SplitterRoute.java | 14 +++++++------- .../java/com/iluwatar/eip/wiretap/App.java | 16 +++++++++------- .../eip/wiretap/routes/WireTapRoute.java | 13 +++++++------ 9 files changed, 68 insertions(+), 69 deletions(-) diff --git a/eip-aggregator/src/main/java/com/iluwatar/eip/aggregator/App.java b/eip-aggregator/src/main/java/com/iluwatar/eip/aggregator/App.java index f8fec8121b37..491ddaf0b339 100644 --- a/eip-aggregator/src/main/java/com/iluwatar/eip/aggregator/App.java +++ b/eip-aggregator/src/main/java/com/iluwatar/eip/aggregator/App.java @@ -30,21 +30,20 @@ import org.springframework.context.ConfigurableApplicationContext; /** - * Sometimes in enterprise systems there is a need to group incoming data in order to process it as a whole. For example - * you may need to gather offers and after defined number of offers has been received you would like to choose the one - * with the best parameters. - * - *

    - * Aggregator allows you to merge messages based on defined criteria and parameters. It gathers original messages, - * applies aggregation strategy and upon fulfilling given criteria, releasing merged messages. - *

    + * Sometimes in enterprise systems there is a need to group incoming data in order to process it as + * a whole. For example you may need to gather offers and after defined number of offers has been + * received you would like to choose the one with the best parameters. * + *

    Aggregator allows you to merge messages based on defined criteria and parameters. It gathers + * original messages, applies aggregation strategy and upon fulfilling given criteria, releasing + * merged messages. */ @SpringBootApplication public class App { /** - * Program entry point. It starts Spring Boot application and using Apache Camel it auto-configures routes. + * Program entry point. It starts Spring Boot application and using Apache Camel it + * auto-configures routes. * * @param args command line args */ diff --git a/eip-aggregator/src/main/java/com/iluwatar/eip/aggregator/routes/AggregatorRoute.java b/eip-aggregator/src/main/java/com/iluwatar/eip/aggregator/routes/AggregatorRoute.java index 652ddbb199c1..60499e1b8183 100644 --- a/eip-aggregator/src/main/java/com/iluwatar/eip/aggregator/routes/AggregatorRoute.java +++ b/eip-aggregator/src/main/java/com/iluwatar/eip/aggregator/routes/AggregatorRoute.java @@ -30,16 +30,15 @@ /** * Sample aggregator route definition. * - *

    - * It consumes messages out of the direct:entry entry point and forwards them to direct:endpoint. - * Route accepts messages containing String as a body, it aggregates the messages based on the settings and forwards - * them as CSV to the output chanel. + *

    It consumes messages out of the direct:entry entry point and forwards them to + * direct:endpoint. Route accepts messages containing String as a body, it aggregates the + * messages based on the settings and forwards them as CSV to the output chanel. * - * Settings for the aggregation are: aggregate until 3 messages are bundled or wait 2000ms before sending bundled - * messages further. - *

    + *

    Settings for the aggregation are: aggregate until 3 messages are bundled or wait 2000ms + * before sending bundled messages further. * - * In this example input/output endpoints names are stored in application.properties file. + *

    In this example input/output endpoints names are stored in application.properties + * file. */ @Component public class AggregatorRoute extends RouteBuilder { @@ -48,7 +47,8 @@ public class AggregatorRoute extends RouteBuilder { private MessageAggregationStrategy aggregator; /** - * Configures the route + * Configures the route. + * * @throws Exception in case of exception during configuration */ @Override diff --git a/eip-aggregator/src/main/java/com/iluwatar/eip/aggregator/routes/MessageAggregationStrategy.java b/eip-aggregator/src/main/java/com/iluwatar/eip/aggregator/routes/MessageAggregationStrategy.java index f8f2822a9dd6..d38923ecc939 100644 --- a/eip-aggregator/src/main/java/com/iluwatar/eip/aggregator/routes/MessageAggregationStrategy.java +++ b/eip-aggregator/src/main/java/com/iluwatar/eip/aggregator/routes/MessageAggregationStrategy.java @@ -28,8 +28,8 @@ import org.springframework.stereotype.Component; /** - * Aggregation strategy joining bodies of messages. If message is first one oldMessage is null. All changes are - * made on IN messages. + * Aggregation strategy joining bodies of messages. If message is first one oldMessage is + * null. All changes are made on IN messages. */ @Component public class MessageAggregationStrategy implements AggregationStrategy { diff --git a/eip-message-channel/src/main/java/com/iluwatar/eip/message/channel/App.java b/eip-message-channel/src/main/java/com/iluwatar/eip/message/channel/App.java index bb9b26d10903..78a23bdd34a0 100644 --- a/eip-message-channel/src/main/java/com/iluwatar/eip/message/channel/App.java +++ b/eip-message-channel/src/main/java/com/iluwatar/eip/message/channel/App.java @@ -30,12 +30,11 @@ import org.slf4j.LoggerFactory; /** - * * When two applications communicate with each other using a messaging system they first need to * establish a communication channel that will carry the data. Message Channel decouples Message * producers and consumers. - *

    - * The sending application doesn't necessarily know what particular application will end up + * + *

    The sending application doesn't necessarily know what particular application will end up * retrieving it, but it can be assured that the application that retrieves the information is * interested in that information. This is because the messaging system has different Message * Channels for different types of information the applications want to communicate. When an @@ -44,19 +43,18 @@ * Likewise, an application that wants to receive particular information doesn't pull info off some * random channel; it selects what channel to get information from based on what type of information * it wants. - *

    - * In this example we use Apache Camel to establish two different Message Channels. The first one - * reads from standard input and delivers messages to Direct endpoint. The second Message Channel is - * established from the Direct component to console output. No actual messages are sent, only the - * established routes are printed to standard output. - * + * + *

    In this example we use Apache Camel to establish two different Message Channels. The first + * one reads from standard input and delivers messages to Direct endpoint. The second Message + * Channel is established from the Direct component to console output. No actual messages are sent, + * only the established routes are printed to standard output. */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point + * Program entry point. */ public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); diff --git a/eip-publish-subscribe/src/main/java/com/iluwatar/eip/publish/subscribe/App.java b/eip-publish-subscribe/src/main/java/com/iluwatar/eip/publish/subscribe/App.java index e9081ebbb4d0..c8a311374734 100644 --- a/eip-publish-subscribe/src/main/java/com/iluwatar/eip/publish/subscribe/App.java +++ b/eip-publish-subscribe/src/main/java/com/iluwatar/eip/publish/subscribe/App.java @@ -31,30 +31,28 @@ import org.slf4j.LoggerFactory; /** - * * There are well-established patterns for implementing broadcasting. The Observer pattern describes * the need to decouple observers from their subject (that is, the originator of the event) so that * the subject can easily provide event notification to all interested observers no matter how many * observers there are (even none). The Publish-Subscribe pattern expands upon Observer by adding * the notion of an event channel for communicating event notifications. - *

    - * A Publish-Subscribe Channel works like this: It has one input channel that splits into multiple - * output channels, one for each subscriber. When an event is published into the channel, the - * Publish-Subscribe Channel delivers a copy of the message to each of the output channels. Each + * + *

    A Publish-Subscribe Channel works like this: It has one input channel that splits into + * multiple output channels, one for each subscriber. When an event is published into the channel, + * the Publish-Subscribe Channel delivers a copy of the message to each of the output channels. Each * output end of the channel has only one subscriber, which is allowed to consume a message only * once. In this way, each subscriber gets the message only once, and consumed copies disappear from * their channels. - *

    - * In this example we use Apache Camel to establish a Publish-Subscribe Channel from "direct-origin" - * to "mock:foo", "mock:bar" and "stream:out". - * + * + *

    In this example we use Apache Camel to establish a Publish-Subscribe Channel from + * "direct-origin" to "mock:foo", "mock:bar" and "stream:out". */ public class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** - * Program entry point + * Program entry point. */ public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); diff --git a/eip-splitter/src/main/java/com/iluwatar/eip/splitter/App.java b/eip-splitter/src/main/java/com/iluwatar/eip/splitter/App.java index e2df6f7e9254..b0e338f27a51 100644 --- a/eip-splitter/src/main/java/com/iluwatar/eip/splitter/App.java +++ b/eip-splitter/src/main/java/com/iluwatar/eip/splitter/App.java @@ -30,23 +30,24 @@ import org.springframework.context.ConfigurableApplicationContext; /** - * It is very common in integration systems that incoming messages consists of many items bundled together. For example - * an invoice document contains multiple invoice lines describing transaction (quantity, name of provided - * service/sold goods, price etc.). Such bundled messages may not be accepted by other systems. This is where splitter - * pattern comes in handy. It will take the whole document, split it based on given criteria and send individual - * items to the endpoint. + * It is very common in integration systems that incoming messages consists of many items bundled + * together. For example an invoice document contains multiple invoice lines describing transaction + * (quantity, name of provided service/sold goods, price etc.). Such bundled messages may not be + * accepted by other systems. This is where splitter pattern comes in handy. It will take the whole + * document, split it based on given criteria and send individual items to the endpoint. * *

    - * Splitter allows you to split messages based on defined criteria. It takes original message, process it and send - * multiple parts to the output channel. It is not defined if it should keep the order of items though. + * Splitter allows you to split messages based on defined criteria. It takes original message, + * process it and send multiple parts to the output channel. It is not defined if it should keep the + * order of items though. *

    - * */ @SpringBootApplication public class App { /** - * Program entry point. It starts Spring Boot application and using Apache Camel it auto-configures routes. + * Program entry point. It starts Spring Boot application and using Apache Camel it + * auto-configures routes. * * @param args command line args */ diff --git a/eip-splitter/src/main/java/com/iluwatar/eip/splitter/routes/SplitterRoute.java b/eip-splitter/src/main/java/com/iluwatar/eip/splitter/routes/SplitterRoute.java index 1efd8401c26b..4d2cb3efb0ab 100644 --- a/eip-splitter/src/main/java/com/iluwatar/eip/splitter/routes/SplitterRoute.java +++ b/eip-splitter/src/main/java/com/iluwatar/eip/splitter/routes/SplitterRoute.java @@ -29,19 +29,19 @@ /** * Sample splitter route definition. * - *

    - * It consumes messages out of the direct:entry entry point and forwards them to direct:endpoint. - * Route accepts messages having body of array or collection of objects. Splitter component split message body and - * forwards single objects to the endpoint. - *

    + *

    It consumes messages out of the direct:entry entry point and forwards them to + * direct:endpoint. Route accepts messages having body of array or collection of objects. + * Splitter component split message body and forwards single objects to the endpoint. * - * In this example input/output endpoints names are stored in application.properties file. + *

    In this example input/output endpoints names are stored in application.properties + * file. */ @Component public class SplitterRoute extends RouteBuilder { /** - * Configures the route + * Configures the route. + * * @throws Exception in case of exception during configuration */ @Override diff --git a/eip-wire-tap/src/main/java/com/iluwatar/eip/wiretap/App.java b/eip-wire-tap/src/main/java/com/iluwatar/eip/wiretap/App.java index 5db2e88281b3..36407fbf715a 100644 --- a/eip-wire-tap/src/main/java/com/iluwatar/eip/wiretap/App.java +++ b/eip-wire-tap/src/main/java/com/iluwatar/eip/wiretap/App.java @@ -30,21 +30,23 @@ import org.springframework.context.ConfigurableApplicationContext; /** - * In most integration cases there is a need to monitor the messages flowing through the system. It is usually achieved - * by intercepting the message and redirecting it to a different location like console, filesystem or the database. - * It is important that such functionality should not modify the original message and influence the processing path. + * In most integration cases there is a need to monitor the messages flowing through the system. It + * is usually achieved by intercepting the message and redirecting it to a different location like + * console, filesystem or the database. It is important that such functionality should not modify + * the original message and influence the processing path. * *

    - * Wire Tap allows you to route messages to a separate location while they are being forwarded to the ultimate - * destination. It basically consumes messages of the input channel and publishes the unmodified message to both - * output channels. + * Wire Tap allows you to route messages to a separate location while they are being forwarded to + * the ultimate destination. It basically consumes messages of the input channel and publishes the + * unmodified message to both output channels. *

    */ @SpringBootApplication public class App { /** - * Program entry point. It starts Spring Boot application and using Apache Camel it auto-configures routes. + * Program entry point. It starts Spring Boot application and using Apache Camel it + * auto-configures routes. * * @param args command line args */ diff --git a/eip-wire-tap/src/main/java/com/iluwatar/eip/wiretap/routes/WireTapRoute.java b/eip-wire-tap/src/main/java/com/iluwatar/eip/wiretap/routes/WireTapRoute.java index 4cb91e162c8e..8eea7adbd2bb 100644 --- a/eip-wire-tap/src/main/java/com/iluwatar/eip/wiretap/routes/WireTapRoute.java +++ b/eip-wire-tap/src/main/java/com/iluwatar/eip/wiretap/routes/WireTapRoute.java @@ -29,19 +29,20 @@ /** * Sample wire tap route definition. * - *

    - * It consumes messages out of the direct:entry entry point and forwards them to direct:endpoint. - * Wire Tap intercepts the message and sends it to direct:wireTap, which in turn forwards it to + *

    It consumes messages out of the direct:entry entry point and forwards them to + * direct:endpoint. Wire Tap intercepts the message and sends it to direct:wireTap, + * which in turn forwards it to * direct:wireTapEndpoint. - *

    * - * In this example input/output endpoints names are stored in application.properties file. + *

    In this example input/output endpoints names are stored in application.properties + * file. */ @Component public class WireTapRoute extends RouteBuilder { /** - * Configures the route + * Configures the route. + * * @throws Exception in case of exception during configuration */ @Override From 5ae2ce6e2eb09c6f0c6768eea9d04aecdb4f3076 Mon Sep 17 00:00:00 2001 From: Anurag Agarwal Date: Sun, 10 Nov 2019 23:07:10 +0530 Subject: [PATCH 147/197] Resolves checkstyle errors for event-* (#1070) * Reduces checkstyle errors in event-aggregator * Reduces checkstyle errors in event-asynchronous * Reduces checkstyle errors in event-driven-architecture * Reduces checkstyle errors in event-queue * Reduces checkstyle errors in event-sourcing --- .../com/iluwatar/event/aggregator/App.java | 18 ++-- .../com/iluwatar/event/aggregator/Event.java | 2 - .../event/aggregator/EventEmitter.java | 2 - .../event/aggregator/EventObserver.java | 2 - .../event/aggregator/KingJoffrey.java | 2 - .../iluwatar/event/aggregator/KingsHand.java | 2 - .../event/aggregator/LordBaelish.java | 2 - .../iluwatar/event/aggregator/LordVarys.java | 2 - .../com/iluwatar/event/aggregator/Scout.java | 2 - .../iluwatar/event/aggregator/Weekday.java | 4 +- .../com/iluwatar/event/asynchronous/App.java | 85 ++++++++++--------- .../iluwatar/event/asynchronous/Event.java | 7 +- .../EventDoesNotExistException.java | 2 +- .../event/asynchronous/EventManager.java | 39 +++++---- .../iluwatar/event/asynchronous/IEvent.java | 3 +- .../InvalidOperationException.java | 2 +- .../LongRunningEventException.java | 2 +- .../MaxNumOfEventsAllowedException.java | 2 +- .../src/main/java/com/iluwatar/eda/App.java | 13 ++- .../com/iluwatar/eda/event/AbstractEvent.java | 11 ++- .../iluwatar/eda/event/UserCreatedEvent.java | 6 +- .../iluwatar/eda/event/UserUpdatedEvent.java | 6 +- .../com/iluwatar/eda/framework/Event.java | 9 +- .../eda/framework/EventDispatcher.java | 4 +- .../com/iluwatar/eda/framework/Handler.java | 12 +-- .../java/com/iluwatar/eda/model/User.java | 4 +- .../java/com/iluwatar/event/queue/App.java | 32 +++---- .../java/com/iluwatar/event/queue/Audio.java | 37 ++++---- .../com/iluwatar/event/queue/PlayMessage.java | 8 +- .../com/iluwatar/event/sourcing/app/App.java | 10 +-- .../event/sourcing/domain/Account.java | 15 ++-- .../sourcing/event/AccountCreateEvent.java | 15 ++-- .../event/sourcing/event/DomainEvent.java | 6 +- .../sourcing/event/MoneyDepositEvent.java | 15 ++-- .../sourcing/event/MoneyTransferEvent.java | 19 ++--- .../processor/DomainEventProcessor.java | 7 +- .../sourcing/processor/JsonFileJournal.java | 23 +++-- .../sourcing/state/AccountAggregate.java | 5 +- 38 files changed, 208 insertions(+), 229 deletions(-) diff --git a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/App.java b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/App.java index 421cf47b31f7..9e459c7a9ff5 100644 --- a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/App.java +++ b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/App.java @@ -27,24 +27,22 @@ import java.util.List; /** - * * A system with lots of objects can lead to complexities when a client wants to subscribe to * events. The client has to find and register for each object individually, if each object has * multiple events then each event requires a separate subscription. - *

    - * An Event Aggregator acts as a single source of events for many objects. It registers for all the - * events of the many objects allowing clients to register with just the aggregator. - *

    - * In the example {@link LordBaelish}, {@link LordVarys} and {@link Scout} deliver events to - * {@link KingsHand}. {@link KingsHand}, the event aggregator, then delivers the events to - * {@link KingJoffrey}. * + *

    An Event Aggregator acts as a single source of events for many objects. It registers for all + * the events of the many objects allowing clients to register with just the aggregator. + * + *

    In the example {@link LordBaelish}, {@link LordVarys} and {@link Scout} deliver events to + * {@link KingsHand}. {@link KingsHand}, the event aggregator, then delivers the events to {@link + * KingJoffrey}. */ public class App { /** - * Program entry point - * + * Program entry point. + * * @param args command line args */ public static void main(String[] args) { diff --git a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/Event.java b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/Event.java index 4227571b1547..7a125c042093 100644 --- a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/Event.java +++ b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/Event.java @@ -24,9 +24,7 @@ package com.iluwatar.event.aggregator; /** - * * Event enumeration. - * */ public enum Event { diff --git a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/EventEmitter.java b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/EventEmitter.java index 209d959281f7..eef64af1a740 100644 --- a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/EventEmitter.java +++ b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/EventEmitter.java @@ -27,9 +27,7 @@ import java.util.List; /** - * * EventEmitter is the base class for event producers that can be observed. - * */ public abstract class EventEmitter { diff --git a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/EventObserver.java b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/EventObserver.java index 45abc3217f90..db436b50c6f5 100644 --- a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/EventObserver.java +++ b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/EventObserver.java @@ -24,9 +24,7 @@ package com.iluwatar.event.aggregator; /** - * * Observers of events implement this interface. - * */ public interface EventObserver { diff --git a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/KingJoffrey.java b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/KingJoffrey.java index cc76eeb73f88..23940c0a2029 100644 --- a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/KingJoffrey.java +++ b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/KingJoffrey.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * * KingJoffrey observes events from {@link KingsHand}. - * */ public class KingJoffrey implements EventObserver { diff --git a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/KingsHand.java b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/KingsHand.java index e5c77d8df78f..e6e05cb8d8fe 100644 --- a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/KingsHand.java +++ b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/KingsHand.java @@ -24,9 +24,7 @@ package com.iluwatar.event.aggregator; /** - * * KingsHand observes events from multiple sources and delivers them to listeners. - * */ public class KingsHand extends EventEmitter implements EventObserver { diff --git a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/LordBaelish.java b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/LordBaelish.java index 216092c22b4d..dcc01c7df93f 100644 --- a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/LordBaelish.java +++ b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/LordBaelish.java @@ -24,9 +24,7 @@ package com.iluwatar.event.aggregator; /** - * * LordBaelish produces events. - * */ public class LordBaelish extends EventEmitter { diff --git a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/LordVarys.java b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/LordVarys.java index 2d87051ff205..c39080fa5810 100644 --- a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/LordVarys.java +++ b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/LordVarys.java @@ -24,9 +24,7 @@ package com.iluwatar.event.aggregator; /** - * * LordVarys produces events. - * */ public class LordVarys extends EventEmitter { diff --git a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/Scout.java b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/Scout.java index 5dd82848a457..24d6f232886d 100644 --- a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/Scout.java +++ b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/Scout.java @@ -24,9 +24,7 @@ package com.iluwatar.event.aggregator; /** - * * Scout produces events. - * */ public class Scout extends EventEmitter { diff --git a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/Weekday.java b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/Weekday.java index 9c89ac34304d..730977bdb42f 100644 --- a/event-aggregator/src/main/java/com/iluwatar/event/aggregator/Weekday.java +++ b/event-aggregator/src/main/java/com/iluwatar/event/aggregator/Weekday.java @@ -24,9 +24,7 @@ package com.iluwatar.event.aggregator; /** - * - * Weekday enumeration - * + * Weekday enumeration. */ public enum Weekday { diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/App.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/App.java index bb6f1d6adb2b..42b7b3391fb2 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/App.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/App.java @@ -23,38 +23,38 @@ package com.iluwatar.event.asynchronous; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.IOException; import java.io.InputStream; import java.util.Properties; import java.util.Scanner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** + * This application demonstrates the Event-based Asynchronous pattern. Essentially, users (of + * the pattern) may choose to run events in an Asynchronous or Synchronous mode. There can be + * multiple Asynchronous events running at once but only one Synchronous event can run at a time. + * Asynchronous events are synonymous to multi-threads. The key point here is that the threads run + * in the background and the user is free to carry on with other processes. Once an event is + * complete, the appropriate listener/callback method will be called. The listener then proceeds to + * carry out further processing depending on the needs of the user. * - * This application demonstrates the Event-based Asynchronous pattern. Essentially, users (of the pattern) may - * choose to run events in an Asynchronous or Synchronous mode. There can be multiple Asynchronous events running at - * once but only one Synchronous event can run at a time. Asynchronous events are synonymous to multi-threads. The key - * point here is that the threads run in the background and the user is free to carry on with other processes. Once an - * event is complete, the appropriate listener/callback method will be called. The listener then proceeds to carry out - * further processing depending on the needs of the user. + *

    The {@link EventManager} manages the events/threads that the user creates. Currently, the + * supported event operations are: start, stop, getStatus. + * For Synchronous events, the user is unable to start another (Synchronous) event if one is already + * running at the time. The running event would have to either be stopped or completed before a new + * event can be started. * - * The {@link EventManager} manages the events/threads that the user creates. Currently, the supported event operations - * are: start, stop, getStatus. For Synchronous events, the user is unable to - * start another (Synchronous) event if one is already running at the time. The running event would have to either be - * stopped or completed before a new event can be started. - * - * The Event-based Asynchronous Pattern makes available the advantages of multithreaded applications while hiding many - * of the complex issues inherent in multithreaded design. Using a class that supports this pattern can allow you to:- - * (1) Perform time-consuming tasks, such as downloads and database operations, "in the background," without - * interrupting your application. (2) Execute multiple operations simultaneously, receiving notifications when each - * completes. (3) Wait for resources to become available without stopping ("hanging") your application. (4) Communicate - * with pending asynchronous operations using the familiar events-and-delegates model. + *

    The Event-based Asynchronous Pattern makes available the advantages of multithreaded + * applications while hiding many of the complex issues inherent in multithreaded design. Using a + * class that supports this pattern can allow you to:- (1) Perform time-consuming tasks, such as + * downloads and database operations, "in the background," without interrupting your application. + * (2) Execute multiple operations simultaneously, receiving notifications when each completes. (3) + * Wait for resources to become available without stopping ("hanging") your application. (4) + * Communicate with pending asynchronous operations using the familiar events-and-delegates model. * * @see EventManager * @see Event - * */ public class App { @@ -67,8 +67,7 @@ public class App { /** * Program entry point. * - * @param args - * command line args + * @param args command line args */ public static void main(String[] args) { App app = new App(); @@ -78,8 +77,9 @@ public static void main(String[] args) { } /** - * App can run in interactive mode or not. Interactive mode == Allow user interaction with command line. - * Non-interactive is a quick sequential run through the available {@link EventManager} operations. + * App can run in interactive mode or not. Interactive mode == Allow user interaction with command + * line. Non-interactive is a quick sequential run through the available {@link EventManager} + * operations. */ public void setUp() { Properties prop = new Properties(); @@ -118,24 +118,24 @@ public void quickRun() { try { // Create an Asynchronous event. - int aEventId = eventManager.createAsync(60); - LOGGER.info("Async Event [{}] has been created.", aEventId); - eventManager.start(aEventId); - LOGGER.info("Async Event [{}] has been started.", aEventId); + int asyncEventId = eventManager.createAsync(60); + LOGGER.info("Async Event [{}] has been created.", asyncEventId); + eventManager.start(asyncEventId); + LOGGER.info("Async Event [{}] has been started.", asyncEventId); // Create a Synchronous event. - int sEventId = eventManager.create(60); - LOGGER.info("Sync Event [{}] has been created.", sEventId); - eventManager.start(sEventId); - LOGGER.info("Sync Event [{}] has been started.", sEventId); + int syncEventId = eventManager.create(60); + LOGGER.info("Sync Event [{}] has been created.", syncEventId); + eventManager.start(syncEventId); + LOGGER.info("Sync Event [{}] has been started.", syncEventId); - eventManager.status(aEventId); - eventManager.status(sEventId); + eventManager.status(asyncEventId); + eventManager.status(syncEventId); - eventManager.cancel(aEventId); - LOGGER.info("Async Event [{}] has been stopped.", aEventId); - eventManager.cancel(sEventId); - LOGGER.info("Sync Event [{}] has been stopped.", sEventId); + eventManager.cancel(asyncEventId); + LOGGER.info("Async Event [{}] has been stopped.", asyncEventId); + eventManager.cancel(syncEventId); + LOGGER.info("Sync Event [{}] has been stopped.", syncEventId); } catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException | InvalidOperationException e) { @@ -211,7 +211,8 @@ private void processOption1(EventManager eventManager, Scanner s) { int eventId = eventManager.createAsync(eventTime); eventManager.start(eventId); LOGGER.info("Egg [{}] is being boiled.", eventId); - } catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException e) { + } catch (MaxNumOfEventsAllowedException | LongRunningEventException + | EventDoesNotExistException e) { LOGGER.error(e.getMessage()); } } else if (eventType.equalsIgnoreCase("S")) { @@ -219,8 +220,8 @@ private void processOption1(EventManager eventManager, Scanner s) { int eventId = eventManager.create(eventTime); eventManager.start(eventId); LOGGER.info("Egg [{}] is being boiled.", eventId); - } catch (MaxNumOfEventsAllowedException | InvalidOperationException | LongRunningEventException - | EventDoesNotExistException e) { + } catch (MaxNumOfEventsAllowedException | InvalidOperationException + | LongRunningEventException | EventDoesNotExistException e) { LOGGER.error(e.getMessage()); } } else { diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java index 5c224fdacbe7..b275b16a2325 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java @@ -27,9 +27,7 @@ import org.slf4j.LoggerFactory; /** - * * Each Event runs as a separate/individual thread. - * */ public class Event implements IEvent, Runnable { @@ -43,9 +41,10 @@ public class Event implements IEvent, Runnable { private ThreadCompleteListener eventListener; /** + * Constructor. * - * @param eventId event ID - * @param eventTime event time + * @param eventId event ID + * @param eventTime event time * @param isSynchronous is of synchronous type */ public Event(final int eventId, final int eventTime, final boolean isSynchronous) { diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/EventDoesNotExistException.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/EventDoesNotExistException.java index ed68ccfe989e..fdd075d7b634 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/EventDoesNotExistException.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/EventDoesNotExistException.java @@ -24,7 +24,7 @@ package com.iluwatar.event.asynchronous; /** - * Custom Exception Class for Non Existent Event + * Custom Exception Class for Non Existent Event. */ public class EventDoesNotExistException extends Exception { diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/EventManager.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/EventManager.java index 486030e5f490..2201394d9e23 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/EventManager.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/EventManager.java @@ -29,29 +29,28 @@ import java.util.concurrent.ConcurrentHashMap; /** - * - * EventManager handles and maintains a pool of event threads. {@link Event} threads are created upon user request. Thre - * are two types of events; Asynchronous and Synchronous. There can be multiple Asynchronous events running at once but - * only one Synchronous event running at a time. Currently supported event operations are: start, stop, and getStatus. - * Once an event is complete, it then notifies EventManager through a listener. The EventManager then takes the event - * out of the pool. - * + * EventManager handles and maintains a pool of event threads. {@link Event} threads are created + * upon user request. Thre are two types of events; Asynchronous and Synchronous. There can be + * multiple Asynchronous events running at once but only one Synchronous event running at a time. + * Currently supported event operations are: start, stop, and getStatus. Once an event is complete, + * it then notifies EventManager through a listener. The EventManager then takes the event out of + * the pool. */ public class EventManager implements ThreadCompleteListener { - public static final int MAX_RUNNING_EVENTS = 1000; // Just don't wanna have too many running events. :) + public static final int MAX_RUNNING_EVENTS = 1000; + // Just don't wanna have too many running events. :) public static final int MIN_ID = 1; public static final int MAX_ID = MAX_RUNNING_EVENTS; public static final int MAX_EVENT_TIME = 1800; // in seconds / 30 minutes. private int currentlyRunningSyncEvent = -1; private Random rand; private Map eventPool; - + private static final String DOES_NOT_EXIST = " does not exist."; /** * EventManager constructor. - * */ public EventManager() { rand = new Random(1); @@ -65,14 +64,15 @@ public EventManager() { * @param eventTime Time an event should run for. * @return eventId * @throws MaxNumOfEventsAllowedException When too many events are running at a time. - * @throws InvalidOperationException No new synchronous events can be created when one is already running. - * @throws LongRunningEventException Long running events are not allowed in the app. + * @throws InvalidOperationException No new synchronous events can be created when one is + * already running. + * @throws LongRunningEventException Long running events are not allowed in the app. */ public int create(int eventTime) throws MaxNumOfEventsAllowedException, InvalidOperationException, LongRunningEventException { if (currentlyRunningSyncEvent != -1) { - throw new InvalidOperationException( - "Event [" + currentlyRunningSyncEvent + "] is still running. Please wait until it finishes and try again."); + throw new InvalidOperationException("Event [" + currentlyRunningSyncEvent + "] is still" + + " running. Please wait until it finishes and try again."); } int eventId = createEvent(eventTime, true); @@ -87,16 +87,18 @@ public int create(int eventTime) * @param eventTime Time an event should run for. * @return eventId * @throws MaxNumOfEventsAllowedException When too many events are running at a time. - * @throws LongRunningEventException Long running events are not allowed in the app. + * @throws LongRunningEventException Long running events are not allowed in the app. */ - public int createAsync(int eventTime) throws MaxNumOfEventsAllowedException, LongRunningEventException { + public int createAsync(int eventTime) throws MaxNumOfEventsAllowedException, + LongRunningEventException { return createEvent(eventTime, false); } private int createEvent(int eventTime, boolean isSynchronous) throws MaxNumOfEventsAllowedException, LongRunningEventException { if (eventPool.size() == MAX_RUNNING_EVENTS) { - throw new MaxNumOfEventsAllowedException("Too many events are running at the moment. Please try again later."); + throw new MaxNumOfEventsAllowedException("Too many events are running at the moment." + + " Please try again later."); } if (eventTime >= MAX_EVENT_TIME) { @@ -185,7 +187,8 @@ public void shutdown() { } /** - * Returns a pseudo-random number between min and max, inclusive. The difference between min and max can be at most + * Returns a pseudo-random number between min and max, inclusive. The difference between min and + * max can be at most * Integer.MAX_VALUE - 1. */ private int generateId() { diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/IEvent.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/IEvent.java index 1d451ef74f97..37cce70b49ef 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/IEvent.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/IEvent.java @@ -24,8 +24,7 @@ package com.iluwatar.event.asynchronous; /** - * Events that fulfill the start stop and list out current status behaviour - * follow this interface + * Events that fulfill the start stop and list out current status behaviour follow this interface. */ public interface IEvent { diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/InvalidOperationException.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/InvalidOperationException.java index f439b53a8b50..6c016785066d 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/InvalidOperationException.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/InvalidOperationException.java @@ -24,7 +24,7 @@ package com.iluwatar.event.asynchronous; /** - * Type of Exception raised when the Operation being invoked is Invalid + * Type of Exception raised when the Operation being invoked is Invalid. */ public class InvalidOperationException extends Exception { diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/LongRunningEventException.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/LongRunningEventException.java index 76a3ecc85156..aac69e312e77 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/LongRunningEventException.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/LongRunningEventException.java @@ -24,7 +24,7 @@ package com.iluwatar.event.asynchronous; /** - * Type of Exception raised when the Operation being invoked is Long Running + * Type of Exception raised when the Operation being invoked is Long Running. */ public class LongRunningEventException extends Exception { diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/MaxNumOfEventsAllowedException.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/MaxNumOfEventsAllowedException.java index 4e1417802b31..204f07dd6a95 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/MaxNumOfEventsAllowedException.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/MaxNumOfEventsAllowedException.java @@ -24,7 +24,7 @@ package com.iluwatar.event.asynchronous; /** - * Type of Exception raised when the max number of allowed events is exceeded + * Type of Exception raised when the max number of allowed events is exceeded. */ public class MaxNumOfEventsAllowedException extends Exception { diff --git a/event-driven-architecture/src/main/java/com/iluwatar/eda/App.java b/event-driven-architecture/src/main/java/com/iluwatar/eda/App.java index 809bfffab853..6e328e04032f 100644 --- a/event-driven-architecture/src/main/java/com/iluwatar/eda/App.java +++ b/event-driven-architecture/src/main/java/com/iluwatar/eda/App.java @@ -34,11 +34,11 @@ /** * An event-driven architecture (EDA) is a framework that orchestrates behavior around the * production, detection and consumption of events as well as the responses they evoke. An event is - * any identifiable occurrence that has significance for system hardware or software.

    The - * example below uses an {@link EventDispatcher} to link/register {@link Event} objects to their - * respective handlers once an {@link Event} is dispatched, it's respective handler is invoked and - * the {@link Event} is handled accordingly. + * any identifiable occurrence that has significance for system hardware or software. * + *

    The example below uses an {@link EventDispatcher} to link/register {@link Event} objects to + * their respective handlers once an {@link Event} is dispatched, it's respective handler is invoked + * and the {@link Event} is handled accordingly. */ public class App { @@ -47,9 +47,8 @@ public class App { * made known to the dispatcher by registering them. In this case the {@link UserCreatedEvent} is * bound to the UserCreatedEventHandler, whilst the {@link UserUpdatedEvent} is bound to the * {@link UserUpdatedEventHandler}. The dispatcher can now be called to dispatch specific events. - * When a user is saved, the {@link UserCreatedEvent} can be dispatched. - * On the other hand, when a user is updated, {@link UserUpdatedEvent} can be dispatched. - * + * When a user is saved, the {@link UserCreatedEvent} can be dispatched. On the other hand, when a + * user is updated, {@link UserUpdatedEvent} can be dispatched. */ public static void main(String[] args) { diff --git a/event-driven-architecture/src/main/java/com/iluwatar/eda/event/AbstractEvent.java b/event-driven-architecture/src/main/java/com/iluwatar/eda/event/AbstractEvent.java index 5218f4baddca..011cfc3f1ed6 100644 --- a/event-driven-architecture/src/main/java/com/iluwatar/eda/event/AbstractEvent.java +++ b/event-driven-architecture/src/main/java/com/iluwatar/eda/event/AbstractEvent.java @@ -23,12 +23,12 @@ package com.iluwatar.eda.event; -import com.iluwatar.eda.framework.EventDispatcher; import com.iluwatar.eda.framework.Event; +import com.iluwatar.eda.framework.EventDispatcher; /** - * The {@link AbstractEvent} class serves as a base class for defining custom events happening with your - * system. In this example we have two types of events defined. + * The {@link AbstractEvent} class serves as a base class for defining custom events happening with + * your system. In this example we have two types of events defined. *

    Implementation is based on GuardedQueue, which has two methods: get and put, the condition is + * that we cannot get from empty queue so when thread attempt to break the condition we invoke + * Object's wait method on him and when other thread put an element to the queue he notify the + * waiting one that now he can get from queue. */ public class App { /** - * Example pattern execution + * Example pattern execution. * * @param args - command line args */ @@ -55,13 +54,15 @@ public static void main(String[] args) { } ); - //here we wait two seconds to show that the thread which is trying to get from guardedQueue will be waiting + // here we wait two seconds to show that the thread which is trying + // to get from guardedQueue will be waiting try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } - //now we execute second thread which will put number to guardedQueue and notify first thread that it could get + // now we execute second thread which will put number to guardedQueue + // and notify first thread that it could get executorService.execute(() -> { guardedQueue.put(20); } diff --git a/guarded-suspension/src/main/java/com/iluwatar/guarded/suspension/GuardedQueue.java b/guarded-suspension/src/main/java/com/iluwatar/guarded/suspension/GuardedQueue.java index e516a8699aea..0102c5253f36 100644 --- a/guarded-suspension/src/main/java/com/iluwatar/guarded/suspension/GuardedQueue.java +++ b/guarded-suspension/src/main/java/com/iluwatar/guarded/suspension/GuardedQueue.java @@ -23,16 +23,16 @@ package com.iluwatar.guarded.suspension; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.LinkedList; import java.util.Queue; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * Guarded Queue is an implementation for Guarded Suspension Pattern - * Guarded suspension pattern is used to handle a situation when you want to execute a method - * on an object which is not in a proper state. + * Guarded Queue is an implementation for Guarded Suspension Pattern Guarded suspension pattern is + * used to handle a situation when you want to execute a method on an object which is not in a + * proper state. + * * @see http://java-design-patterns.com/patterns/guarded-suspension/ */ public class GuardedQueue { @@ -44,6 +44,8 @@ public GuardedQueue() { } /** + * Get the last element of the queue is exists. + * * @return last element of a queue if queue is not empty */ public synchronized Integer get() { @@ -60,6 +62,8 @@ public synchronized Integer get() { } /** + * Put a value in the queue. + * * @param e number which we want to put to our queue */ public synchronized void put(Integer e) { diff --git a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/App.java b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/App.java index 6287cf9bf5e6..c559fca59411 100644 --- a/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/App.java +++ b/half-sync-half-async/src/main/java/com/iluwatar/halfsynchalfasync/App.java @@ -23,42 +23,35 @@ package com.iluwatar.halfsynchalfasync; +import java.util.concurrent.LinkedBlockingQueue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.LinkedBlockingQueue; - /** - * - * This application demonstrates Half-Sync/Half-Async pattern. Key parts of the pattern are - * {@link AsyncTask} and {@link AsynchronousService}. - * - *