From d80edd1ed3c913b5d9003884b20928329fcced44 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 15 Dec 2016 18:08:12 +0100 Subject: [PATCH 01/67] Create test --- tls/test | 1 + 1 file changed, 1 insertion(+) create mode 100644 tls/test diff --git a/tls/test b/tls/test new file mode 100644 index 000000000..e8689b24f --- /dev/null +++ b/tls/test @@ -0,0 +1 @@ +hh From 7067d1ae568daa0f2acf60b1b8add09f3a87d1e6 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 15 Dec 2016 18:24:03 +0100 Subject: [PATCH 02/67] Create test --- tls/src/main/java/com/iluwatar/tls/test | 1 + 1 file changed, 1 insertion(+) create mode 100644 tls/src/main/java/com/iluwatar/tls/test diff --git a/tls/src/main/java/com/iluwatar/tls/test b/tls/src/main/java/com/iluwatar/tls/test new file mode 100644 index 000000000..1df28a22d --- /dev/null +++ b/tls/src/main/java/com/iluwatar/tls/test @@ -0,0 +1 @@ +ss From c4eb198a8d7c2fbb492342e7724bb336dcb789eb Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 15 Dec 2016 18:27:28 +0100 Subject: [PATCH 03/67] Upload code files --- tls/src/main/java/com/iluwatar/tls/App.java | 108 +++++++++++++++++ .../main/java/com/iluwatar/tls/AppUgly.java | 112 ++++++++++++++++++ .../com/iluwatar/tls/DateFormatRunnable.java | 84 +++++++++++++ .../iluwatar/tls/DateFormatUglyRunnable.java | 76 ++++++++++++ 4 files changed, 380 insertions(+) create mode 100644 tls/src/main/java/com/iluwatar/tls/App.java create mode 100644 tls/src/main/java/com/iluwatar/tls/AppUgly.java create mode 100644 tls/src/main/java/com/iluwatar/tls/DateFormatRunnable.java create mode 100644 tls/src/main/java/com/iluwatar/tls/DateFormatUglyRunnable.java diff --git a/tls/src/main/java/com/iluwatar/tls/App.java b/tls/src/main/java/com/iluwatar/tls/App.java new file mode 100644 index 000000000..b16aa1fc6 --- /dev/null +++ b/tls/src/main/java/com/iluwatar/tls/App.java @@ -0,0 +1,108 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +/** + * ThreadLocal pattern + *

+ * This App shows how to create an isolated space per each thread. In this + * example the usage of SimpleDateFormat is made to be thread-safe. This is an + * example of the ThreadLocal pattern. + *

+ * By applying the ThreadLocal pattern you can keep track of application + * instances or locale settings throughout the handling of a request. The + * ThreadLocal class works like a static variable, with the exception that it is + * only bound to the current thread! This allows us to use static variables in a + * thread-safe way. + *

+ * In Java, thread-local variables are implemented by the ThreadLocal class + * object. ThreadLocal holds variable of type T, which is accessible via get/set + * methods. + *

+ * SimpleDateFormat is one of the basic Java classes and is not thread-safe. If + * you do not isolate the instance of SimpleDateFormat per each thread then + * problems arise. These problems are described with the example {@link AppUgly} + * + */ +public class App { + // A list to collect the date values created in the the threads + static List dateList = Collections.synchronizedList(new ArrayList()); + + // A list to collect Exceptions thrown in the threads (should be none in + // this example) + static List exceptionList = Collections.synchronizedList(new ArrayList()); + + /** + * Program entry point + * + * @param args + * command line args + */ + public static void main(String[] args) { + int counterDateValues = 0; + int counterExceptions = 0; + + // Create a runnable + DateFormatRunnable runnableDf = new DateFormatRunnable("dd/MM/yyyy", "15/12/2015"); + // start 4 threads, each using the same Runnable instance + Thread t1 = new Thread(runnableDf); + Thread t2 = new Thread(runnableDf); + Thread t3 = new Thread(runnableDf); + Thread t4 = new Thread(runnableDf); + t1.start(); + t2.start(); + t3.start(); + t4.start(); + try { + t1.join(); + t2.join(); + t3.join(); + t4.join(); + } catch (InterruptedException e) { + // Action not coded here + } + for (Date dt : dateList) { + // a correct run should deliver 20 times 15.12.2015 + counterDateValues++; + Calendar cal = Calendar.getInstance(); + cal.setTime(dt); + // Formatted output of the date value: DD.MM.YYYY + System.out.println( + cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + +cal.get(Calendar.YEAR)); + } + for (String ex : exceptionList) { + // a correct run shouldn't deliver any exception + counterExceptions++; + System.out.println(ex); + } + System.out.println("The List dateList contains " + counterDateValues + " date values"); + System.out.println("The List exceptionList contains " + counterExceptions + " exceptions"); + } +} diff --git a/tls/src/main/java/com/iluwatar/tls/AppUgly.java b/tls/src/main/java/com/iluwatar/tls/AppUgly.java new file mode 100644 index 000000000..7025d42b7 --- /dev/null +++ b/tls/src/main/java/com/iluwatar/tls/AppUgly.java @@ -0,0 +1,112 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +/** + * + * This App shows an example for problems with global thread variables. A global + * thread variable is a variable defined as class variable of a + * XyzRunnable-Class. In this example in the class + * {@link DateFormatUglyRunnable} + *

+ * Example use case: A well known problem with threads are non thread-safe Java + * classes. One example is the class SimpleDateFormat. + *

+ * In the example an instance of SimpleDateFormat is created in the constructor + * of the Runnable. The constructor initializes a class variable with the + * instance. The Runnable only does convert a string date to a date format using + * the instance of SimpleDateFormat. It does this 5 times. + *

+ * In the example 4 threads are started to do the same. If you are lucky + * everything works well. But if you try more often you will happen to see + * Exceptions. And these Exceptions arise on arbitrary points of the run. + *

+ * The reason for this exceptions is: The threads try to use internal instance + * variables of the SimpleDateFormat instance at the same time (the date is + * stored internal as member variable during parsing and may be overwritten by + * another thread during a parse is still running) + *

+ * And even without Exceptions the run may not deliver the correct results. + * All date values should be the same after the run. Check it + * + */ +public class AppUgly { + // A list to collect the date values created in the the threads + static List dateList = Collections.synchronizedList(new ArrayList()); + // A list to collect Exceptions thrown in the threads + static List exceptionList = Collections.synchronizedList(new ArrayList()); + + /** + * Program entry point + * + * @param args + * command line args + */ + public static void main(String[] args) { + int counterDateValues = 0; + int counterExceptions = 0; + + // Prepare the Runnable + DateFormatUglyRunnable runnableDf = new DateFormatUglyRunnable("dd/MM/yyyy", "15/12/2015"); + + // 4 threads using the same Runnable + Thread t1 = new Thread(runnableDf); + Thread t2 = new Thread(runnableDf); + Thread t3 = new Thread(runnableDf); + Thread t4 = new Thread(runnableDf); + t1.start(); + t2.start(); + t3.start(); + t4.start(); + try { + t1.join(); + t2.join(); + t3.join(); + t4.join(); + } catch (InterruptedException e) { + // Action not coded here + } + for (Date dt : dateList) { + // a correct run should deliver 20 times 15.12.2015 + counterDateValues++; + Calendar cal = Calendar.getInstance(); + cal.setTime(dt); + // Formatted output of the date value: DD.MM.YYYY + System.out.println(cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + cal.get(Calendar.YEAR)); + } + for (String ex : exceptionList) { + // a correct run shouldn't deliver any exception + counterExceptions++; + System.out.println(ex); + } + System.out.println("The List dateList contains " + counterDateValues + " date values"); + System.out.println("The List exceptionList contains " + counterExceptions + " exceptions"); + } +} diff --git a/tls/src/main/java/com/iluwatar/tls/DateFormatRunnable.java b/tls/src/main/java/com/iluwatar/tls/DateFormatRunnable.java new file mode 100644 index 000000000..d2009d21b --- /dev/null +++ b/tls/src/main/java/com/iluwatar/tls/DateFormatRunnable.java @@ -0,0 +1,84 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; + +/** + * DateFormatRunnable converts string dates to a date format using + * SimpleDateFormat The date format and the date value will be passed to the + * Runnable by the constructor. The constructor creates a instance of + * SimpleDateFormat and stores it in a ThreadLocal class variable. For the + * complete description of the example see {@link App} + * + */ +public class DateFormatRunnable implements Runnable { + // class variables (members) + private ThreadLocal df; + private String dateValue; // for date Value Thread Local not needed + + /** + * The date format and the date value are passed to the constructor + * + * @param inDateFormat + * string date format string, e.g. "dd/MM/yyyy" + * @param inDateValue + * string date value, e.g. "21/06/2016" + */ + public DateFormatRunnable(String inDateFormat, String inDateValue) { + final String idf = inDateFormat; + this.df = new ThreadLocal() { + @Override + protected DateFormat initialValue() { + return new SimpleDateFormat(idf); + } + }; + this.dateValue = inDateValue; + } + + /** + * @see java.lang.Runnable#run() + */ + @Override + public void run() { + System.out.println(Thread.currentThread() + " started executing..."); + + // Convert date value to date 5 times + for (int i = 1; i <= 5; i++) { + try { + // this is the statement where it is important to have the + // instance of SimpleDateFormat locally + // Create the date value and store it in dateList + App.dateList.add(this.df.get().parse(this.dateValue)); + } catch (Exception e) { + // write the Exception to a list and continue work + App.exceptionList.add(e.getClass() + ": " + e.getMessage()); + } + + } + + System.out.println(Thread.currentThread() + " finished executing"); + } +} diff --git a/tls/src/main/java/com/iluwatar/tls/DateFormatUglyRunnable.java b/tls/src/main/java/com/iluwatar/tls/DateFormatUglyRunnable.java new file mode 100644 index 000000000..ca883a913 --- /dev/null +++ b/tls/src/main/java/com/iluwatar/tls/DateFormatUglyRunnable.java @@ -0,0 +1,76 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; + +/** + * DateFormatUglyRunnable converts string dates to a date format using + * SimpleDateFormat. The date value and the date format will be passed to the + * Runnable by the constructor. The constructor creates an instance of + * SimpleDateFormat and stores it in a class variable. For the complete + * description of the example see {@link AppUgly} + * + */ +public class DateFormatUglyRunnable implements Runnable { + // class variables (members) + private DateFormat df; + private String dateValue; + + /** + * The date format and the date value are passed to the constructor + * + * @param inDateFormat + * string date format string, e.g. "dd/MM/yyyy" + * @param inDateValue + * string date value, e.g. "21/06/2016" + */ + public DateFormatUglyRunnable(String inDateFormat, String inDateValue) { + this.df = new SimpleDateFormat(inDateFormat); + this.dateValue = inDateValue; + } + + /** + * @see java.lang.Runnable#run() + */ + @Override + public void run() { + System.out.println(Thread.currentThread() + " started executing..."); + + // Convert date value to date 5 times + for (int i = 1; i <= 5; i++) { + try { + // Create the date value and store it in dateList + AppUgly.dateList.add(this.df.parse(this.dateValue)); + } catch (Exception e) { + // write the Exception to a list and continue work + AppUgly.exceptionList.add(e.getClass() + ": " + e.getMessage()); + } + + } + + System.out.println(Thread.currentThread() + " finished executing"); + } +} From 544f7fb6d1be97409cc193cad6010a7478550a27 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 15 Dec 2016 18:28:02 +0100 Subject: [PATCH 04/67] delete empty file --- tls/src/main/java/com/iluwatar/tls/test | 1 - 1 file changed, 1 deletion(-) delete mode 100644 tls/src/main/java/com/iluwatar/tls/test diff --git a/tls/src/main/java/com/iluwatar/tls/test b/tls/src/main/java/com/iluwatar/tls/test deleted file mode 100644 index 1df28a22d..000000000 --- a/tls/src/main/java/com/iluwatar/tls/test +++ /dev/null @@ -1 +0,0 @@ -ss From 15d660b117d3ad6cdac4c7ebd221e6d611527841 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 15 Dec 2016 18:30:22 +0100 Subject: [PATCH 05/67] empty file to create folder --- tls/src/test/java/com/iluwatar/tls/test | 1 + 1 file changed, 1 insertion(+) create mode 100644 tls/src/test/java/com/iluwatar/tls/test diff --git a/tls/src/test/java/com/iluwatar/tls/test b/tls/src/test/java/com/iluwatar/tls/test new file mode 100644 index 000000000..a302060fe --- /dev/null +++ b/tls/src/test/java/com/iluwatar/tls/test @@ -0,0 +1 @@ +kk From e64f7faa3fabd17e6451fabde709f41de0f9f981 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 15 Dec 2016 18:31:20 +0100 Subject: [PATCH 06/67] upload junit test --- .../test/java/com/iluwatar/tls/AppTest.java | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 tls/src/test/java/com/iluwatar/tls/AppTest.java diff --git a/tls/src/test/java/com/iluwatar/tls/AppTest.java b/tls/src/test/java/com/iluwatar/tls/AppTest.java new file mode 100644 index 000000000..09bb72c93 --- /dev/null +++ b/tls/src/test/java/com/iluwatar/tls/AppTest.java @@ -0,0 +1,134 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +/** + * + * Application test + * + * In this test {@link App} is executed. After the run of App the converted Data is available in + * the static lists created by the run of the app. + *

+ * After a successful run 20 date values should be in the date value list. All dates should have + * the same value (15.11.2015). To avoid problems with time zone not the date instances themselve + * are compared in the test. For the test the dates are converted in a string format DD.MM.YYY + *

+ * Additionally the number of list entries are tested for both the list with the date values + * and the list with the exceptions + * + */ +public class AppTest { + + // Class variables used in setup() have to be static because the Compiler wants the + // setup() method to be static + /** + * Number of date values in the list created by the run of App. Will be set in setup() + */ + static int actualCounterDateValues = 0; + + /** + * Number of exceptions in the list created by the run of App. Will be set in setup() + */ + static int actualCounterExceptions = 0; + + /** + * The date values created by the run of App. List will be filled in the setup() method + */ + static List actualDateValues = new ArrayList(); + + /** + * Expected number of date values in the date value list created by the run of App + */ + int expectedCounterDateValues = 20; + + /** + * Expected number of exceptions in the exception list created by the run of App. + */ + int expectedCounterExceptions = 0; + + /** + * Expected content of the list containing the date values created by the run of App + */ + List expectedDateValues = Arrays.asList("15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", + "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", + "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015"); + + /** + * Run App. After this run the result is available in the static lists + */ + @BeforeClass + public static void setup() { + String[] args = {}; + App.main(args); + + // Prepare data created by the run of App for the tests + for (Date dt : App.dateList) { + actualCounterDateValues++; + // a correct run should deliver 20 times 15.12.2015 + Calendar cal = Calendar.getInstance(); + cal.setTime(dt); + // Convert date value to string format DD.MM.YYYY + actualDateValues.add( + cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + +cal.get(Calendar.YEAR)); + } + for (@SuppressWarnings("unused") String exc : App.exceptionList) { + actualCounterExceptions++; + // a correct run should no exceptions + } + } + + /** + * Test date values after run of App. A correct run should deliver 20 times 15.12.2015 + */ + @Test + public void testDateValues() { + assertEquals(expectedDateValues, actualDateValues); + } + + /** + * Test number of dates in list after und of App. A correct run should deliver 20 date values + */ + @Test + public void testCounterDateValues() { + assertEquals(expectedCounterDateValues, actualCounterDateValues); + } + + /** + * Test number of Exceptions in list after und of App. A correct run should deliver no exceptions + */ + @Test + public void testCounterExceptions() { + assertEquals(expectedCounterExceptions, actualCounterExceptions); + } +} From 803a97237cc140fee4ac327a7af341d56d8f28a1 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 15 Dec 2016 18:31:53 +0100 Subject: [PATCH 07/67] delete empty file --- tls/test | 1 - 1 file changed, 1 deletion(-) delete mode 100644 tls/test diff --git a/tls/test b/tls/test deleted file mode 100644 index e8689b24f..000000000 --- a/tls/test +++ /dev/null @@ -1 +0,0 @@ -hh From 937a1e269d131532b37275678cc09d5a4827d280 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 15 Dec 2016 18:32:13 +0100 Subject: [PATCH 08/67] delete empty file --- tls/src/test/java/com/iluwatar/tls/test | 1 - 1 file changed, 1 deletion(-) delete mode 100644 tls/src/test/java/com/iluwatar/tls/test diff --git a/tls/src/test/java/com/iluwatar/tls/test b/tls/src/test/java/com/iluwatar/tls/test deleted file mode 100644 index a302060fe..000000000 --- a/tls/src/test/java/com/iluwatar/tls/test +++ /dev/null @@ -1 +0,0 @@ -kk From e17cf27e5ae25cbc44b6eb48b9bac239f1352e80 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 15 Dec 2016 18:33:52 +0100 Subject: [PATCH 09/67] upload pom.xml --- tls/pom.xml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tls/pom.xml diff --git a/tls/pom.xml b/tls/pom.xml new file mode 100644 index 000000000..68ebcdbf1 --- /dev/null +++ b/tls/pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.14.0-SNAPSHOT + + tls + + + junit + junit + test + + + From 9b7ce556e3339e2976d44efa20640c1440636886 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 16 Dec 2016 09:35:19 +0100 Subject: [PATCH 10/67] Create emptyfile --- tls/etc/emptyfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 tls/etc/emptyfile diff --git a/tls/etc/emptyfile b/tls/etc/emptyfile new file mode 100644 index 000000000..aa2fc61b2 --- /dev/null +++ b/tls/etc/emptyfile @@ -0,0 +1 @@ +jj From 487f9ddc80f20dc93e69c86ea866845b95f70e36 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 16 Dec 2016 09:42:08 +0100 Subject: [PATCH 11/67] Add files via upload --- tls/etc/tls.urm.puml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tls/etc/tls.urm.puml diff --git a/tls/etc/tls.urm.puml b/tls/etc/tls.urm.puml new file mode 100644 index 000000000..6425b7d33 --- /dev/null +++ b/tls/etc/tls.urm.puml @@ -0,0 +1,28 @@ +@startuml +package com.iluwatar.tls { + class App { + ~ dateList : List {static} + ~ exceptionList : List {static} + + App() + + main(args : String[]) {static} + } + class AppUgly { + ~ dateList : List {static} + ~ exceptionList : List {static} + + AppUgly() + + main(args : String[]) {static} + } + class DateFormatRunnable { + - dateValue : String + - df : ThreadLocal + + DateFormatRunnable(inDateFormat : String, inDateValue : String) + + run() + } + class DateFormatUglyRunnable { + - dateValue : String + - df : DateFormat + + DateFormatUglyRunnable(inDateFormat : String, inDateValue : String) + + run() + } +} +@enduml \ No newline at end of file From 61b135697652d056bd0c6704d1b5ff0206964bcb Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 16 Dec 2016 09:42:46 +0100 Subject: [PATCH 12/67] Delete emptyfile --- tls/etc/emptyfile | 1 - 1 file changed, 1 deletion(-) delete mode 100644 tls/etc/emptyfile diff --git a/tls/etc/emptyfile b/tls/etc/emptyfile deleted file mode 100644 index aa2fc61b2..000000000 --- a/tls/etc/emptyfile +++ /dev/null @@ -1 +0,0 @@ -jj From c8b3c773c787fc143e60415de35eca49502e1cad Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 16 Dec 2016 09:43:16 +0100 Subject: [PATCH 13/67] Add files via upload --- tls/etc/tls.ucls | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tls/etc/tls.ucls diff --git a/tls/etc/tls.ucls b/tls/etc/tls.ucls new file mode 100644 index 000000000..5e21929e2 --- /dev/null +++ b/tls/etc/tls.ucls @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From fb98da86c4a3984415e88f3154e291725219ddbb Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 16 Dec 2016 11:12:43 +0100 Subject: [PATCH 14/67] Add files via upload --- tls/etc/tls.png | Bin 0 -> 10307 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tls/etc/tls.png diff --git a/tls/etc/tls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~bwTnN5Yq zUtmsWC~lQG1L9&Wh(Z@nA-4U#`Q9pRkpcNL`-$9Qx0S@$mJrkMkKMx;%_Vrjd zf2Z30xxu3o-1WgMcjlv0)r+=s2<4y7!^QmvLv$4BQt#I$C8NlRWeE@9Mh~U2n1{w% zk1_6RTEIP9YVMCW+E7o`BF<28^a`u-m`Sm+B2IV9e{Sa5m>An~CPvXYz`L=^kcUe)DBt?}v?H3th+-)Y@q|v1vOcKV>hS7u>p)A&(Rv=RjEF3k;22q8LJ_9BTvDjmW`7qL}dGMj;C( zzHCK=a*9S#3IyH9t==t$&I{LOG#ewq%Z-PwRZoBFVJ$%Lv7jW<-ab04ufH6w?rh2N zwQm2GMoOIzW920;S*Q+{_=tTm`wT9h0VQG4Fj{(v(*Cm0-Ae!nI=8KzR($L|JoynF zn);%oifJsRjhCm)SyW{46N9l74Dl-1LCxZ=6?j35a_Pp)jpbhUbK26gA1g>aJui=Y zc1}keDQ+-asTrUJi+q16UK{8xNs>VuRZ>f=vbTkyI?+VKbNkT*`dH?Ak8=TEQ1{-K z01cPNm^XvW#f#(l!aSzie@~MoTbzx%N2j^{jHf&<)Hb&BU28!yvF$!z^s#$>oet_X z@qraUa*vVW=GU*?@i7eR2425S)+k!Ir4br7ICxEo4r$lqKIuu1QlIlW1<9cE>x1pC zPS&1l37H~AhwgGjPn{^uS-n1(RB~&94!dSXhJ~^3R^KGI!%{1!buvL53=s@w8tC07G`ZiY9LZMwKT6#tz`dS)$UhnnAkgV` h;-8y2P}=&5h~Lkq-7_h2z@Gy_DvBBkr4OG4{Re5AEiM26 literal 0 HcmV?d00001 From e210e4ed627468d19652cc8c195ca503917ee86c Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 16 Dec 2016 11:17:27 +0100 Subject: [PATCH 15/67] Add files via upload --- tls/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tls/README.md diff --git a/tls/README.md b/tls/README.md new file mode 100644 index 000000000..53db18400 --- /dev/null +++ b/tls/README.md @@ -0,0 +1,22 @@ +--- +layout: pattern +title: Thread Local Storage +folder: tls +permalink: /patterns/tls/ +pumlid: 5Sd13OGm30NHLg00uZlTc62HeCI9x6-s_ONJF6dMghd5AM5jAS3qdSZubwwA4aUuM1uAKQGyEg6CpZxSwUQ7jrEyNhfD1iJKwNql2Cr9aB-ci9vczFO7 +categories: Concurrency +tags: + - Java + - Difficulty-Intermediate +--- + +## Intent +Securing variables global to a thread, i.e. class variables of the Runnable object, +against being spoiled by other threads using the same instance of the Runnable object + +![alt text](./etc/tls.png "Thread Local Storage") + +## Applicability +Use the Thread Local Storage in any of the following situations + +* when you use class variables in your Runnable Object that are not read-only From 26b79a5382dfa22f7ffb22eb7acdf71918e75e6f Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:16:45 +0100 Subject: [PATCH 16/67] Update README.md Some additonal description, deleted wrong pumlid --- tls/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tls/README.md b/tls/README.md index 53db18400..9503267df 100644 --- a/tls/README.md +++ b/tls/README.md @@ -3,7 +3,7 @@ layout: pattern title: Thread Local Storage folder: tls permalink: /patterns/tls/ -pumlid: 5Sd13OGm30NHLg00uZlTc62HeCI9x6-s_ONJF6dMghd5AM5jAS3qdSZubwwA4aUuM1uAKQGyEg6CpZxSwUQ7jrEyNhfD1iJKwNql2Cr9aB-ci9vczFO7 +pumlid: categories: Concurrency tags: - Java @@ -11,12 +11,13 @@ tags: --- ## Intent -Securing variables global to a thread, i.e. class variables of the Runnable object, -against being spoiled by other threads using the same instance of the Runnable object +Securing variables global to a thread, i.e. class variables if a Callable object, +against being spoiled by other threads using the same instance of the Callable object ![alt text](./etc/tls.png "Thread Local Storage") ## Applicability Use the Thread Local Storage in any of the following situations -* when you use class variables in your Runnable Object that are not read-only +* when you use class variables in your Callable Object that are not read-only and you use the same Callable instance in more than one thread running in parallel +* when you use static variables in your Callable Object that are not read-only and more than one instances of the Callable may run in parallel threads. From e8fc3427c6b982d4b670024ea5ee70bb254db84b Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:23:33 +0100 Subject: [PATCH 17/67] Update README.md no change of content. Improved text --- tls/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tls/README.md b/tls/README.md index 9503267df..904d7ee05 100644 --- a/tls/README.md +++ b/tls/README.md @@ -11,13 +11,12 @@ tags: --- ## Intent -Securing variables global to a thread, i.e. class variables if a Callable object, -against being spoiled by other threads using the same instance of the Callable object +Securing variables global to a thread against being spoiled by other threads. That is needed if you use class variables or static variables in your Callable object or Runnable object that are not read-only. ![alt text](./etc/tls.png "Thread Local Storage") ## Applicability Use the Thread Local Storage in any of the following situations -* when you use class variables in your Callable Object that are not read-only and you use the same Callable instance in more than one thread running in parallel -* when you use static variables in your Callable Object that are not read-only and more than one instances of the Callable may run in parallel threads. +* when you use class variables in your Callable / Runnalbe object that are not read-only and you use the same Callable instance in more than one thread running in parallel +* when you use static variables in your Callable / Runnable object that are not read-only and more than one instances of the Callable / Runnalbe may run in parallel threads. From c167f87ce5eeb3060ee708a160d15b9878e211bc Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:27:46 +0100 Subject: [PATCH 18/67] Delete tls.png --- tls/etc/tls.png | Bin 10307 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tls/etc/tls.png diff --git a/tls/etc/tls.png b/tls/etc/tls.png deleted file mode 100644 index bedea6cc8bc4eaff9f9f6d32f7b696f3123a756b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10307 zcmd6NXFyZk(r$baQ4tZ5E+C?G1gQ!kh%`ZZlO{+fRA~}QK&b)=5fG3TdM6+tp@SfV zCcP*{Py$4XVCbE12j6qgcgs2VyZ8RN|8~~iYu3y&v!0nXD-l{6%2XGbFM>cIDwRhH zIv~(rJRr~+(er-+BX1L289*SOiz*6oda%@AY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RjEF3k;22q8LJ_9BTvDjmW`7qL}dGMj;C( zzHCK=a*9S#3IyH9t==t$&I{LOG#ewq%Z-PwRZoBFVJ$%Lv7jW<-ab04ufH6w?rh2N zwQm2GMoOIzW920;S*Q+{_=tTm`wT9h0VQG4Fj{(v(*Cm0-Ae!nI=8KzR($L|JoynF zn);%oifJsRjhCm)SyW{46N9l74Dl-1LCxZ=6?j35a_Pp)jpbhUbK26gA1g>aJui=Y zc1}keDQ+-asTrUJi+q16UK{8xNs>VuRZ>f=vbTkyI?+VKbNkT*`dH?Ak8=TEQ1{-K z01cPNm^XvW#f#(l!aSzie@~MoTbzx%N2j^{jHf&<)Hb&BU28!yvF$!z^s#$>oet_X z@qraUa*vVW=GU*?@i7eR2425S)+k!Ir4br7ICxEo4r$lqKIuu1QlIlW1<9cE>x1pC zPS&1l37H~AhwgGjPn{^uS-n1(RB~&94!dSXhJ~^3R^KGI!%{1!buvL53=s@w8tC07G`ZiY9LZMwKT6#tz`dS)$UhnnAkgV` h;-8y2P}=&5h~Lkq-7_h2z@Gy_DvBBkr4OG4{Re5AEiM26 From 3342851005e337be6f0a2e69495ab62ab788034d Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:28:17 +0100 Subject: [PATCH 19/67] Delete tls.ucls --- tls/etc/tls.ucls | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 tls/etc/tls.ucls diff --git a/tls/etc/tls.ucls b/tls/etc/tls.ucls deleted file mode 100644 index 5e21929e2..000000000 --- a/tls/etc/tls.ucls +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From c529e35791dce7c4dc78799928f24a67982eb2b1 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:28:27 +0100 Subject: [PATCH 20/67] Delete tls.urm.puml --- tls/etc/tls.urm.puml | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 tls/etc/tls.urm.puml diff --git a/tls/etc/tls.urm.puml b/tls/etc/tls.urm.puml deleted file mode 100644 index 6425b7d33..000000000 --- a/tls/etc/tls.urm.puml +++ /dev/null @@ -1,28 +0,0 @@ -@startuml -package com.iluwatar.tls { - class App { - ~ dateList : List {static} - ~ exceptionList : List {static} - + App() - + main(args : String[]) {static} - } - class AppUgly { - ~ dateList : List {static} - ~ exceptionList : List {static} - + AppUgly() - + main(args : String[]) {static} - } - class DateFormatRunnable { - - dateValue : String - - df : ThreadLocal - + DateFormatRunnable(inDateFormat : String, inDateValue : String) - + run() - } - class DateFormatUglyRunnable { - - dateValue : String - - df : DateFormat - + DateFormatUglyRunnable(inDateFormat : String, inDateValue : String) - + run() - } -} -@enduml \ No newline at end of file From 65e047974c0bdaad2f93f89bb6d3994424f85f51 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:29:19 +0100 Subject: [PATCH 21/67] Create empty --- tls/etc/empty | 1 + 1 file changed, 1 insertion(+) create mode 100644 tls/etc/empty diff --git a/tls/etc/empty b/tls/etc/empty new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/tls/etc/empty @@ -0,0 +1 @@ + From 15913d6382d8baada2349e5dad1041ef4826c962 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:31:06 +0100 Subject: [PATCH 22/67] Add files via upload new uml diagramm after changes to the java classes --- tls/etc/tls.png | Bin 0 -> 34509 bytes tls/etc/tls.ucls | 79 +++++++++++++++++++++++++++++++++++++++++++ tls/etc/tls.urm.puml | 23 +++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 tls/etc/tls.png create mode 100644 tls/etc/tls.ucls create mode 100644 tls/etc/tls.urm.puml diff --git a/tls/etc/tls.png b/tls/etc/tls.png new file mode 100644 index 0000000000000000000000000000000000000000..442f39a0c730b6db350e1a2e0bffba1a2a60e8da GIT binary patch literal 34509 zcmbrmbyQT{+c!SI2#mA?Dvi`2At8;VNHc^qN_Tf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#KXv}qYjJ5lg;_&f_w;jE4*Dh7n&R>h`l0R(_a^=oEJ+=qQDQZ_KL-00svX2@ z7OxN_K1TG!*Owb3UP~QUOj;L-s>|%`UoF1h8vJ(`3HTUW)jFT^~2jNcS z`jY)@s}Y4aT3^wkBb1MtX|#bZVBV#zZR)mIPEbnzM9OE8aWBD(Erl@1K$Bvo>uT#53x2b@DJfC)R?MU+yw!R<^dB6vC zY|UkqMy?dAOiubWGO_XNLOItGIPGOj42^6Y*B-vO7ZT#b^~h~qM}+2*gEzH_=iQ5k zH*&H#v*YF~Zr#tgX=-T znVz2~24Oh4CjUZ|8bVY}@3pdIxv>8g-9TD(o(-|<9bhUSk?RE#>w`%dw`=dE zrgv|gX(XVyul)j;{dyucNzw&+1Ja7QUOzt=|2QDA%X>A4({V|x3TP3e)>8i5a{kyc z_3e71!-3{$rNu|_Byc|b9|!$#I?Zal*S+CcTH@;v&c1N;@$%{lSEXb30!=*un(o-2DQLV=$i4e`|0fwpa1hFaH8mQuQ#V8ta9fC6?4>|7wMr=#E%ER5fL%UV;8c z24cFLmKuXT|IW;=k#a{n=is`?rvRlMERN??J^>(=@f@TQ96h`}l2Qi(42SA7UW%nT zN_{usZ+{KtU-ugC{M+N7CDgOM$$UY~y7c_WCRZ@2Uc#*OJ=MSRLT@W92wVM?^420w ztQ{fe3#9w_zlQI{D-UR(;m_=OfAfGIccf2|7Jd74$q)^+SC{`^2Ax{hD~=D8rT+vZ z%);E?2=|}w1RR#BzP?F>c%;S-+mzWqQ~|U<%pU@CnmqWczl%Af9{gEfK0xf!3^5*@ Su=8Tx-<3k&DUf*V`+op$;IV=L literal 0 HcmV?d00001 diff --git a/tls/etc/tls.ucls b/tls/etc/tls.ucls new file mode 100644 index 000000000..bd238346d --- /dev/null +++ b/tls/etc/tls.ucls @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tls/etc/tls.urm.puml b/tls/etc/tls.urm.puml new file mode 100644 index 000000000..d2eedb371 --- /dev/null +++ b/tls/etc/tls.urm.puml @@ -0,0 +1,23 @@ +@startuml +package com.iluwatar.tls { + class App { + + App() + + main(args : String[]) {static} + - printAndCountDates(res : Result) : int {static} + - printAndCountExceptions(res : Result) : int {static} + } + class DateFormatCallable { + - dateValue : String + - df : ThreadLocal + + DateFormatCallable(inDateFormat : String, inDateValue : String) + + call() : Result + } + class Result { + - dateList : List + - exceptionList : List + + Result() + + getDateList() : List + + getExceptionList() : List + } +} +@enduml \ No newline at end of file From 283f198ba89b7c003ce54ba7f49c95f751731bd6 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:32:26 +0100 Subject: [PATCH 23/67] Delete empty --- tls/etc/empty | 1 - 1 file changed, 1 deletion(-) delete mode 100644 tls/etc/empty diff --git a/tls/etc/empty b/tls/etc/empty deleted file mode 100644 index 8b1378917..000000000 --- a/tls/etc/empty +++ /dev/null @@ -1 +0,0 @@ - From ed11c4c4f94a24b7ded3fdc22f79bc843516800a Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:33:40 +0100 Subject: [PATCH 24/67] Delete App.java --- tls/src/main/java/com/iluwatar/tls/App.java | 108 -------------------- 1 file changed, 108 deletions(-) delete mode 100644 tls/src/main/java/com/iluwatar/tls/App.java diff --git a/tls/src/main/java/com/iluwatar/tls/App.java b/tls/src/main/java/com/iluwatar/tls/App.java deleted file mode 100644 index b16aa1fc6..000000000 --- a/tls/src/main/java/com/iluwatar/tls/App.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * The MIT License - * Copyright (c) 2016 Thomas Bauer - * - * 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.tls; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -/** - * ThreadLocal pattern - *

- * This App shows how to create an isolated space per each thread. In this - * example the usage of SimpleDateFormat is made to be thread-safe. This is an - * example of the ThreadLocal pattern. - *

- * By applying the ThreadLocal pattern you can keep track of application - * instances or locale settings throughout the handling of a request. The - * ThreadLocal class works like a static variable, with the exception that it is - * only bound to the current thread! This allows us to use static variables in a - * thread-safe way. - *

- * In Java, thread-local variables are implemented by the ThreadLocal class - * object. ThreadLocal holds variable of type T, which is accessible via get/set - * methods. - *

- * SimpleDateFormat is one of the basic Java classes and is not thread-safe. If - * you do not isolate the instance of SimpleDateFormat per each thread then - * problems arise. These problems are described with the example {@link AppUgly} - * - */ -public class App { - // A list to collect the date values created in the the threads - static List dateList = Collections.synchronizedList(new ArrayList()); - - // A list to collect Exceptions thrown in the threads (should be none in - // this example) - static List exceptionList = Collections.synchronizedList(new ArrayList()); - - /** - * Program entry point - * - * @param args - * command line args - */ - public static void main(String[] args) { - int counterDateValues = 0; - int counterExceptions = 0; - - // Create a runnable - DateFormatRunnable runnableDf = new DateFormatRunnable("dd/MM/yyyy", "15/12/2015"); - // start 4 threads, each using the same Runnable instance - Thread t1 = new Thread(runnableDf); - Thread t2 = new Thread(runnableDf); - Thread t3 = new Thread(runnableDf); - Thread t4 = new Thread(runnableDf); - t1.start(); - t2.start(); - t3.start(); - t4.start(); - try { - t1.join(); - t2.join(); - t3.join(); - t4.join(); - } catch (InterruptedException e) { - // Action not coded here - } - for (Date dt : dateList) { - // a correct run should deliver 20 times 15.12.2015 - counterDateValues++; - Calendar cal = Calendar.getInstance(); - cal.setTime(dt); - // Formatted output of the date value: DD.MM.YYYY - System.out.println( - cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + +cal.get(Calendar.YEAR)); - } - for (String ex : exceptionList) { - // a correct run shouldn't deliver any exception - counterExceptions++; - System.out.println(ex); - } - System.out.println("The List dateList contains " + counterDateValues + " date values"); - System.out.println("The List exceptionList contains " + counterExceptions + " exceptions"); - } -} From c5987485498a17998b97c4083323e11cb6a9a40a Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:33:59 +0100 Subject: [PATCH 25/67] Delete AppUgly.java --- .../main/java/com/iluwatar/tls/AppUgly.java | 112 ------------------ 1 file changed, 112 deletions(-) delete mode 100644 tls/src/main/java/com/iluwatar/tls/AppUgly.java diff --git a/tls/src/main/java/com/iluwatar/tls/AppUgly.java b/tls/src/main/java/com/iluwatar/tls/AppUgly.java deleted file mode 100644 index 7025d42b7..000000000 --- a/tls/src/main/java/com/iluwatar/tls/AppUgly.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * The MIT License - * Copyright (c) 2016 Thomas Bauer - * - * 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.tls; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -/** - * - * This App shows an example for problems with global thread variables. A global - * thread variable is a variable defined as class variable of a - * XyzRunnable-Class. In this example in the class - * {@link DateFormatUglyRunnable} - *

- * Example use case: A well known problem with threads are non thread-safe Java - * classes. One example is the class SimpleDateFormat. - *

- * In the example an instance of SimpleDateFormat is created in the constructor - * of the Runnable. The constructor initializes a class variable with the - * instance. The Runnable only does convert a string date to a date format using - * the instance of SimpleDateFormat. It does this 5 times. - *

- * In the example 4 threads are started to do the same. If you are lucky - * everything works well. But if you try more often you will happen to see - * Exceptions. And these Exceptions arise on arbitrary points of the run. - *

- * The reason for this exceptions is: The threads try to use internal instance - * variables of the SimpleDateFormat instance at the same time (the date is - * stored internal as member variable during parsing and may be overwritten by - * another thread during a parse is still running) - *

- * And even without Exceptions the run may not deliver the correct results. - * All date values should be the same after the run. Check it - * - */ -public class AppUgly { - // A list to collect the date values created in the the threads - static List dateList = Collections.synchronizedList(new ArrayList()); - // A list to collect Exceptions thrown in the threads - static List exceptionList = Collections.synchronizedList(new ArrayList()); - - /** - * Program entry point - * - * @param args - * command line args - */ - public static void main(String[] args) { - int counterDateValues = 0; - int counterExceptions = 0; - - // Prepare the Runnable - DateFormatUglyRunnable runnableDf = new DateFormatUglyRunnable("dd/MM/yyyy", "15/12/2015"); - - // 4 threads using the same Runnable - Thread t1 = new Thread(runnableDf); - Thread t2 = new Thread(runnableDf); - Thread t3 = new Thread(runnableDf); - Thread t4 = new Thread(runnableDf); - t1.start(); - t2.start(); - t3.start(); - t4.start(); - try { - t1.join(); - t2.join(); - t3.join(); - t4.join(); - } catch (InterruptedException e) { - // Action not coded here - } - for (Date dt : dateList) { - // a correct run should deliver 20 times 15.12.2015 - counterDateValues++; - Calendar cal = Calendar.getInstance(); - cal.setTime(dt); - // Formatted output of the date value: DD.MM.YYYY - System.out.println(cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + cal.get(Calendar.YEAR)); - } - for (String ex : exceptionList) { - // a correct run shouldn't deliver any exception - counterExceptions++; - System.out.println(ex); - } - System.out.println("The List dateList contains " + counterDateValues + " date values"); - System.out.println("The List exceptionList contains " + counterExceptions + " exceptions"); - } -} From f170aaa42b2fafb9e6162810a3f529b5b114c499 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:34:12 +0100 Subject: [PATCH 26/67] Delete DateFormatRunnable.java --- .../com/iluwatar/tls/DateFormatRunnable.java | 84 ------------------- 1 file changed, 84 deletions(-) delete mode 100644 tls/src/main/java/com/iluwatar/tls/DateFormatRunnable.java diff --git a/tls/src/main/java/com/iluwatar/tls/DateFormatRunnable.java b/tls/src/main/java/com/iluwatar/tls/DateFormatRunnable.java deleted file mode 100644 index d2009d21b..000000000 --- a/tls/src/main/java/com/iluwatar/tls/DateFormatRunnable.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * The MIT License - * Copyright (c) 2016 Thomas Bauer - * - * 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.tls; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; - -/** - * DateFormatRunnable converts string dates to a date format using - * SimpleDateFormat The date format and the date value will be passed to the - * Runnable by the constructor. The constructor creates a instance of - * SimpleDateFormat and stores it in a ThreadLocal class variable. For the - * complete description of the example see {@link App} - * - */ -public class DateFormatRunnable implements Runnable { - // class variables (members) - private ThreadLocal df; - private String dateValue; // for date Value Thread Local not needed - - /** - * The date format and the date value are passed to the constructor - * - * @param inDateFormat - * string date format string, e.g. "dd/MM/yyyy" - * @param inDateValue - * string date value, e.g. "21/06/2016" - */ - public DateFormatRunnable(String inDateFormat, String inDateValue) { - final String idf = inDateFormat; - this.df = new ThreadLocal() { - @Override - protected DateFormat initialValue() { - return new SimpleDateFormat(idf); - } - }; - this.dateValue = inDateValue; - } - - /** - * @see java.lang.Runnable#run() - */ - @Override - public void run() { - System.out.println(Thread.currentThread() + " started executing..."); - - // Convert date value to date 5 times - for (int i = 1; i <= 5; i++) { - try { - // this is the statement where it is important to have the - // instance of SimpleDateFormat locally - // Create the date value and store it in dateList - App.dateList.add(this.df.get().parse(this.dateValue)); - } catch (Exception e) { - // write the Exception to a list and continue work - App.exceptionList.add(e.getClass() + ": " + e.getMessage()); - } - - } - - System.out.println(Thread.currentThread() + " finished executing"); - } -} From 7200329a6b05d1c54ec7f4cd89235199d29c4e5e Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:38:20 +0100 Subject: [PATCH 27/67] Add files via upload Rework replaces previous version completely. Using ExecutorService. Use of result object instead of static variables. Ugly example is left out. --- tls/src/main/java/com/iluwatar/tls/App.java | 146 ++++++++++++++++++ .../com/iluwatar/tls/DateFormatCallable.java | 98 ++++++++++++ .../main/java/com/iluwatar/tls/Result.java | 40 +++++ 3 files changed, 284 insertions(+) create mode 100644 tls/src/main/java/com/iluwatar/tls/App.java create mode 100644 tls/src/main/java/com/iluwatar/tls/DateFormatCallable.java create mode 100644 tls/src/main/java/com/iluwatar/tls/Result.java diff --git a/tls/src/main/java/com/iluwatar/tls/App.java b/tls/src/main/java/com/iluwatar/tls/App.java new file mode 100644 index 000000000..80e87042c --- /dev/null +++ b/tls/src/main/java/com/iluwatar/tls/App.java @@ -0,0 +1,146 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +import java.util.Calendar; +import java.util.Date; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +/** + * ThreadLocal pattern + *

+ * This App shows how to create an isolated space per each thread. In this + * example the usage of SimpleDateFormat is made to be thread-safe. This is an + * example of the ThreadLocal pattern. + *

+ * By applying the ThreadLocal pattern you can keep track of application + * instances or locale settings throughout the handling of a request. The + * ThreadLocal class works like a static variable, with the exception that it is + * only bound to the current thread! This allows us to use static variables in a + * thread-safe way. + *

+ * In Java, thread-local variables are implemented by the ThreadLocal class + * object. ThreadLocal holds a variable of type T, which is accessible via get/set + * methods. + *

+ * SimpleDateFormat is one of the basic Java classes and is not thread-safe. If + * you do not isolate the instance of SimpleDateFormat per each thread then + * problems arise. + *

+ * App converts the String date value 15/12/2015 to the Date format using the + * Java class SimpleDateFormat. It does this 20 times using 4 threads, each doing + * it 5 times. With the usage of as ThreadLocal in DateFormatCallable everything + * runs well. But if you comment out the ThreadLocal variant (marked with "//TLTL") + * and comment in the non ThreadLocal variant (marked with "//NTLNTL") you can + * see what will happen without the ThreadLocal. Most likely you will get incorrect + * date values and / or exceptions. + *

+ * This example clearly show what will happen when using non thread-safe classes + * in a thread. In real life this may happen one in of 1.000 or 10.000 conversions + * and those are really hard to find errors. + * + * @author Thomas Bauer, 2017 + */ +public class App { + /** + * Program entry point + * + * @param args + * command line args + */ + public static void main(String[] args) { + int counterDateValues = 0; + int counterExceptions = 0; + + // Create a callable + DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15/12/2015"); + // start 4 threads, each using the same Callable instance + ExecutorService executor = Executors.newCachedThreadPool(); + + Future futureResult1 = executor.submit(callableDf); + Future futureResult2 = executor.submit(callableDf); + Future futureResult3 = executor.submit(callableDf); + Future futureResult4 = executor.submit(callableDf); + try { + Result[] result = new Result[4]; + result[0] = futureResult1.get(); + result[1] = futureResult2.get(); + result[2] = futureResult3.get(); + result[3] = futureResult4.get(); + + // Print results of thread executions (converted dates and raised exceptions) + // and count them + for (int i = 0; i < result.length; i++) { + counterDateValues = counterDateValues + printAndCountDates(result[i]); + counterExceptions = counterExceptions + printAndCountExceptions(result[i]); + } + + // 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"); + + } catch (Exception e) { + // no action here + } + executor.shutdown(); + } + + /** + * Print result (date values) of a thread execution and count dates + * + * @param res contains results of a thread execution + */ + private static int printAndCountDates(Result res) { + // a correct run should deliver 5 times 15.12.2015 per each thread + int counter = 0; + for (Date dt : res.getDateList()) { + counter++; + Calendar cal = Calendar.getInstance(); + cal.setTime(dt); + // Formatted output of the date value: DD.MM.YYYY + System.out.println( + cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + +cal.get(Calendar.YEAR)); + } + return counter; + } + + /** + * Print result (exceptions) of a thread execution and count exceptions + * + * @param res contains results of a thread execution + * @return number of dates + */ + private static int printAndCountExceptions(Result res) { + // a correct run shouldn't deliver any exception + int counter = 0; + for (String ex : res.getExceptionList()) { + counter++; + System.out.println(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 new file mode 100644 index 000000000..a28e24d4e --- /dev/null +++ b/tls/src/main/java/com/iluwatar/tls/DateFormatCallable.java @@ -0,0 +1,98 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.concurrent.Callable; + +/** + * DateFormatCallable converts string dates to a date format using + * SimpleDateFormat. The date format and the date value will be passed to the + * Callable by the constructor. The constructor creates a instance of + * SimpleDateFormat and stores it in a ThreadLocal class variable. For the + * complete description of the example see {@link App} + * + * You can comment out the code marked with //TLTL and comment in the + * code marked //NTLNTL. Then you can see what will happen if you do not + * use the ThreadLocal. For details see the description of {@link App} + * + * @author Thomas Bauer, 2017 + */ +public class DateFormatCallable implements Callable { + // class variables (members) + private ThreadLocal df; //TLTL + // private DateFormat df; //NTLNTL + + private String dateValue; // for dateValue Thread Local not needed + + + /** + * The date format and the date value are passed to the constructor + * + * @param inDateFormat + * string date format string, e.g. "dd/MM/yyyy" + * @param inDateValue + * string date value, e.g. "21/06/2016" + */ + public DateFormatCallable(String inDateFormat, String inDateValue) { + final String idf = inDateFormat; //TLTL + this.df = new ThreadLocal() { //TLTL + @Override //TLTL + protected DateFormat initialValue() { //TLTL + return new SimpleDateFormat(idf); //TLTL + } //TLTL + }; //TLTL + // this.df = new SimpleDateFormat(inDateFormat); //NTLNTL + this.dateValue = inDateValue; + } + + /** + * @see java.util.concurrent.Callable#call() + */ + @Override + public Result call() { + System.out.println(Thread.currentThread() + " started executing..."); + Result result = new Result(); + + // Convert date value to date 5 times + for (int i = 1; i <= 5; i++) { + try { + // this is the statement where it is important to have the + // instance of SimpleDateFormat locally + // Create the date value and store it in dateList + result.getDateList().add(this.df.get().parse(this.dateValue)); //TLTL +// result.getDateList().add(this.df.parse(this.dateValue)); //NTLNTL + } catch (Exception e) { + // write the Exception to a list and continue work + result.getExceptionList().add(e.getClass() + ": " + e.getMessage()); + } + + } + + System.out.println(Thread.currentThread() + " finished processing part of the thread"); + + return result; + } +} diff --git a/tls/src/main/java/com/iluwatar/tls/Result.java b/tls/src/main/java/com/iluwatar/tls/Result.java new file mode 100644 index 000000000..951a02a2f --- /dev/null +++ b/tls/src/main/java/com/iluwatar/tls/Result.java @@ -0,0 +1,40 @@ +/* + * Fiducia IT AG, All rights reserved. Use is subject to license terms. + */ + +package com.iluwatar.tls; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * Result object that will be returned by the Callable {@link DateFormatCallable} + * used in {@link App} + * + * @author Thomas Bauer, 2017 + */ +public class Result { + // A list to collect the date values created in one thread + private List dateList = new ArrayList(); + + // A list to collect Exceptions thrown in one threads (should be none in + // this example) + private List exceptionList = new ArrayList(); + + /** + * + * @return List of date values collected within an thread execution + */ + public List getDateList() { + return dateList; + } + + /** + * + * @return List of exceptions thrown within an thread execution + */ + public List getExceptionList() { + return exceptionList; + } +} From 080965fb176f3156744fad4f3ab004e562bb1615 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:38:49 +0100 Subject: [PATCH 28/67] Delete DateFormatUglyRunnable.java --- .../iluwatar/tls/DateFormatUglyRunnable.java | 76 ------------------- 1 file changed, 76 deletions(-) delete mode 100644 tls/src/main/java/com/iluwatar/tls/DateFormatUglyRunnable.java diff --git a/tls/src/main/java/com/iluwatar/tls/DateFormatUglyRunnable.java b/tls/src/main/java/com/iluwatar/tls/DateFormatUglyRunnable.java deleted file mode 100644 index ca883a913..000000000 --- a/tls/src/main/java/com/iluwatar/tls/DateFormatUglyRunnable.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * The MIT License - * Copyright (c) 2016 Thomas Bauer - * - * 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.tls; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; - -/** - * DateFormatUglyRunnable converts string dates to a date format using - * SimpleDateFormat. The date value and the date format will be passed to the - * Runnable by the constructor. The constructor creates an instance of - * SimpleDateFormat and stores it in a class variable. For the complete - * description of the example see {@link AppUgly} - * - */ -public class DateFormatUglyRunnable implements Runnable { - // class variables (members) - private DateFormat df; - private String dateValue; - - /** - * The date format and the date value are passed to the constructor - * - * @param inDateFormat - * string date format string, e.g. "dd/MM/yyyy" - * @param inDateValue - * string date value, e.g. "21/06/2016" - */ - public DateFormatUglyRunnable(String inDateFormat, String inDateValue) { - this.df = new SimpleDateFormat(inDateFormat); - this.dateValue = inDateValue; - } - - /** - * @see java.lang.Runnable#run() - */ - @Override - public void run() { - System.out.println(Thread.currentThread() + " started executing..."); - - // Convert date value to date 5 times - for (int i = 1; i <= 5; i++) { - try { - // Create the date value and store it in dateList - AppUgly.dateList.add(this.df.parse(this.dateValue)); - } catch (Exception e) { - // write the Exception to a list and continue work - AppUgly.exceptionList.add(e.getClass() + ": " + e.getMessage()); - } - - } - - System.out.println(Thread.currentThread() + " finished executing"); - } -} From a8e2c157ded06ef6d149fa617e6cd4e9a1ce6a8f Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:41:13 +0100 Subject: [PATCH 29/67] Add files via upload Test reworked completely. AppTest seperated. --- .../iluwatar/tls/DateFormatRunnableTest.java | 144 +++++++++++++++ ...FormatRunnableTestIncorrectDateFormat.java | 127 ++++++++++++++ .../DateFormatRunnableTestMultiThread.java | 164 ++++++++++++++++++ 3 files changed, 435 insertions(+) create mode 100644 tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTest.java create mode 100644 tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestIncorrectDateFormat.java create mode 100644 tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestMultiThread.java diff --git a/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTest.java b/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTest.java new file mode 100644 index 000000000..d6105dc98 --- /dev/null +++ b/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTest.java @@ -0,0 +1,144 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +/** + * + * Test of the Callable + * + * In this test {@link DateFormatCallable} is tested with only one thread (i.e. without concurrency situation) + *

+ * After a successful run 5 date values should be in the result object. All dates should have + * the same value (15.11.2015). To avoid problems with time zone not the date instances themselves + * are compared by the test. For the test the dates are converted into string format DD.MM.YYY + *

+ * Additionally the number of list entries are tested for both the list with the date values + * and the list with the exceptions + * + * @author Thomas Bauer, January 2017 + * + */ +public class DateFormatRunnableTest { + + // Class variables used in setup() have to be static because setup() has to be static + /** + * Result object given back by DateFormatCallable + * -- Array with converted date values + * -- Array with thrown exceptions + */ + static Result result; + + /** + * The date values created by the run of of DateFormatRunnalbe. List will be filled in the setup() method + */ + static List createdDateValues = new ArrayList(); + + /** + * Expected number of date values in the date value list created by the run of DateFormatRunnalbe + */ + int expectedCounterDateValues = 5; + + /** + * Expected number of exceptions in the exception list created by the run of DateFormatRunnalbe. + */ + int expectedCounterExceptions = 0; + + /** + * 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"); + + /** + * Run Callable and prepare results for usage in the test methods + */ + @BeforeClass + public static void setup() { + // Create a callable + DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15/12/2015"); + // start thread using the Callable instance + ExecutorService executor = Executors.newCachedThreadPool(); + Future futureResult = executor.submit(callableDf); + try { + result = futureResult.get(); + createdDateValues = convertDatesToString(result); + } catch (Exception e) { + fail("Setup failed: " + e); + } + executor.shutdown(); + } + + private static List convertDatesToString(Result res) { + // Format date value as DD.MM.YYYY + if (res == null || res.getDateList() == null || res.getDateList().size() == 0) { + return null; + } + List returnList = new ArrayList(); + + for (Date dt : res.getDateList()) { + Calendar cal = Calendar.getInstance(); + cal.setTime(dt); + returnList.add(cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + cal.get(Calendar.YEAR)); + } + return returnList; + } + + /** + * Test date values after the run of DateFormatRunnalbe. A correct run should deliver 5 times 15.12.2015 + */ + @Test + public void testDateValues() { + assertEquals(expectedDateValues, createdDateValues); + } + + /** + * Test number of dates in the list after the run of DateFormatRunnalbe. A correct run should deliver 5 date values + */ + @Test + public void testCounterDateValues() { + assertEquals(expectedCounterDateValues, result.getDateList().size()); + } + + /** + * Test number of Exceptions in the list after the run of DateFormatRunnalbe. A correct run should deliver + * no exceptions + */ + @Test + public void testCounterExceptions() { + assertEquals(expectedCounterExceptions, result.getExceptionList().size()); + } +} diff --git a/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestIncorrectDateFormat.java b/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestIncorrectDateFormat.java new file mode 100644 index 000000000..bae89f160 --- /dev/null +++ b/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestIncorrectDateFormat.java @@ -0,0 +1,127 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +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.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +/** + * + * Test of the Callable + * + * In this test {@link DateFormatCallable} is tested with only one thread (i.e. without concurrency situation) + *

+ * An incorrect formatted date is passed to the Callable + * After a successful run 0 date values and 5 exceptions should be in the result object. + * + * @author Thomas Bauer, January 2017 + * + */ +public class DateFormatRunnableTestIncorrectDateFormat { + + // Class variables used in setup() have to be static because setup() has to be static + /** + * Result object given back by DateFormatCallable + * -- Array with converted date values + * -- Array with thrown exceptions + */ + static Result result; + + /** + * The date values created by the run of DateFormatRunnalbe. List will be filled in the setup() method + */ + static List createdExceptions = new ArrayList(); + + /** + * Expected number of date values in the date value list created by the run of DateFormatRunnalbe + */ + int expectedCounterDateValues = 0; + + /** + * Expected number of exceptions in the exception list created by the run of DateFormatRunnalbe. + */ + int expectedCounterExceptions = 5; + + /** + * 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\"", + "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\""); + + /** + * Run Callable and prepare results for usage in the test methods + */ + @BeforeClass + public static void setup() { + // Create a callable. Pass a string date value not matching the format string + DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15.12.2015"); + // start thread using the Callable instance + ExecutorService executor = Executors.newCachedThreadPool(); + Future futureResult = executor.submit(callableDf); + try { + result = futureResult.get(); + } catch (Exception e) { + fail("Setup failed: " + e); + } + executor.shutdown(); + } + + /** + * Test Exceptions after the run of DateFormatRunnalbe. A correct run should deliver 5 times the + * same exception + */ + @Test + public void testExecptions() { + assertEquals(expectedExceptions, result.getExceptionList()); + } + + /** + * Test number of dates in the list after the run of DateFormatRunnalbe. A correct run should deliver no date values + */ + @Test + public void testCounterDateValues() { + assertEquals(expectedCounterDateValues, result.getDateList().size()); + } + + /** + * Test number of Exceptions in the list after the run of DateFormatRunnalbe. A correct run should + * deliver 5 exceptions + */ + @Test + public void testCounterExceptions() { + assertEquals(expectedCounterExceptions, result.getExceptionList().size()); + } +} diff --git a/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestMultiThread.java b/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestMultiThread.java new file mode 100644 index 000000000..354915209 --- /dev/null +++ b/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestMultiThread.java @@ -0,0 +1,164 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +/** + * + * Test of the Callable + * + * In this test {@link DateFormatCallable} is used by 4 threads in parallel + *

+ * After a successful run 5 date values should be in the result object of each thread. All dates + * should have the same value (15.11.2015). To avoid problems with time zone not the date instances + * themselves are compared by the test. For the test the dates are converted into string format DD.MM.YYY + *

+ * Additionally the number of list entries are tested for both the list with the date values + * and the list with the exceptions + * + * @author Thomas Bauer, January 2017 + * + */ +public class DateFormatRunnableTestMultiThread { + + // Class variables used in setup() have to be static because setup() has to be static + /** + * Result object given back by DateFormatCallable, one for each thread + * -- Array with converted date values + * -- Array with thrown exceptions + */ + static Result[] result = new Result[4]; + + /** + * The date values created by the run of of DateFormatRunnalbe. List will be filled in the setup() method + */ + @SuppressWarnings("serial") + static class StringArrayList extends ArrayList { + /* nothing needed here */ + } + static List[] createdDateValues = new StringArrayList[4]; + + /** + * Expected number of date values in the date value list created by each thread + */ + int expectedCounterDateValues = 5; + + /** + * Expected number of exceptions in the exception list created by each thread + */ + int expectedCounterExceptions = 0; + + /** + * 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"); + + /** + * Run Callable and prepare results for usage in the test methods + */ + @BeforeClass + public static void setup() { + // Create a callable + DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15/12/2015"); + // start thread using the Callable instance + ExecutorService executor = Executors.newCachedThreadPool(); + Future futureResult1 = executor.submit(callableDf); + Future futureResult2 = executor.submit(callableDf); + Future futureResult3 = executor.submit(callableDf); + Future futureResult4 = executor.submit(callableDf); + try { + result[0] = futureResult1.get(); + result[1] = futureResult2.get(); + result[2] = futureResult3.get(); + result[3] = futureResult4.get(); + for (int i = 0; i < result.length; i++) { + createdDateValues[i] = convertDatesToString(result[i]); + } + } catch (Exception e) { + fail("Setup failed: " + e); + } + executor.shutdown(); + } + + private static List convertDatesToString(Result res) { + // Format date value as DD.MM.YYYY + if (res == null || res.getDateList() == null || res.getDateList().size() == 0) { + return null; + } + List returnList = new StringArrayList(); + + for (Date dt : res.getDateList()) { + Calendar cal = Calendar.getInstance(); + cal.setTime(dt); + returnList.add(cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + cal.get(Calendar.YEAR)); + } + return returnList; + } + + /** + * Test date values after the run of DateFormatRunnalbe. A correct run should deliver 5 times 15.12.2015 + * by each thread + */ + @Test + public void testDateValues() { + for (int i = 0; i < createdDateValues.length; i++) { + assertEquals(expectedDateValues, createdDateValues[i]); + } + } + + /** + * Test number of dates in the list after the run of DateFormatRunnalbe. A correct run should + * deliver 5 date values by each thread + */ + @Test + public void testCounterDateValues() { + for (int i = 0; i < result.length; i++) { + assertEquals(expectedCounterDateValues, result[i].getDateList().size()); + } + } + + /** + * Test number of Exceptions in the list after the run of DateFormatRunnalbe. A correct run should + * deliver no exceptions + */ + @Test + public void testCounterExceptions() { + for (int i = 0; i < result.length; i++) { + assertEquals(expectedCounterExceptions, result[i].getExceptionList().size()); + } + } +} From 453862cfc258539447568ad6459059e09829502e Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:41:46 +0100 Subject: [PATCH 30/67] Delete AppTest.java --- .../test/java/com/iluwatar/tls/AppTest.java | 134 ------------------ 1 file changed, 134 deletions(-) delete mode 100644 tls/src/test/java/com/iluwatar/tls/AppTest.java diff --git a/tls/src/test/java/com/iluwatar/tls/AppTest.java b/tls/src/test/java/com/iluwatar/tls/AppTest.java deleted file mode 100644 index 09bb72c93..000000000 --- a/tls/src/test/java/com/iluwatar/tls/AppTest.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * The MIT License - * Copyright (c) 2016 Thomas Bauer - * - * 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.tls; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import org.junit.BeforeClass; -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -/** - * - * Application test - * - * In this test {@link App} is executed. After the run of App the converted Data is available in - * the static lists created by the run of the app. - *

- * After a successful run 20 date values should be in the date value list. All dates should have - * the same value (15.11.2015). To avoid problems with time zone not the date instances themselve - * are compared in the test. For the test the dates are converted in a string format DD.MM.YYY - *

- * Additionally the number of list entries are tested for both the list with the date values - * and the list with the exceptions - * - */ -public class AppTest { - - // Class variables used in setup() have to be static because the Compiler wants the - // setup() method to be static - /** - * Number of date values in the list created by the run of App. Will be set in setup() - */ - static int actualCounterDateValues = 0; - - /** - * Number of exceptions in the list created by the run of App. Will be set in setup() - */ - static int actualCounterExceptions = 0; - - /** - * The date values created by the run of App. List will be filled in the setup() method - */ - static List actualDateValues = new ArrayList(); - - /** - * Expected number of date values in the date value list created by the run of App - */ - int expectedCounterDateValues = 20; - - /** - * Expected number of exceptions in the exception list created by the run of App. - */ - int expectedCounterExceptions = 0; - - /** - * Expected content of the list containing the date values created by the run of App - */ - List expectedDateValues = Arrays.asList("15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", - "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", - "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015", "15.11.2015"); - - /** - * Run App. After this run the result is available in the static lists - */ - @BeforeClass - public static void setup() { - String[] args = {}; - App.main(args); - - // Prepare data created by the run of App for the tests - for (Date dt : App.dateList) { - actualCounterDateValues++; - // a correct run should deliver 20 times 15.12.2015 - Calendar cal = Calendar.getInstance(); - cal.setTime(dt); - // Convert date value to string format DD.MM.YYYY - actualDateValues.add( - cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + +cal.get(Calendar.YEAR)); - } - for (@SuppressWarnings("unused") String exc : App.exceptionList) { - actualCounterExceptions++; - // a correct run should no exceptions - } - } - - /** - * Test date values after run of App. A correct run should deliver 20 times 15.12.2015 - */ - @Test - public void testDateValues() { - assertEquals(expectedDateValues, actualDateValues); - } - - /** - * Test number of dates in list after und of App. A correct run should deliver 20 date values - */ - @Test - public void testCounterDateValues() { - assertEquals(expectedCounterDateValues, actualCounterDateValues); - } - - /** - * Test number of Exceptions in list after und of App. A correct run should deliver no exceptions - */ - @Test - public void testCounterExceptions() { - assertEquals(expectedCounterExceptions, actualCounterExceptions); - } -} From 6202f3ab44700355f4bb7862ecaa74dd90acee33 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 11:42:16 +0100 Subject: [PATCH 31/67] Add files via upload --- .../test/java/com/iluwatar/tls/AppTest.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tls/src/test/java/com/iluwatar/tls/AppTest.java diff --git a/tls/src/test/java/com/iluwatar/tls/AppTest.java b/tls/src/test/java/com/iluwatar/tls/AppTest.java new file mode 100644 index 000000000..073c0988a --- /dev/null +++ b/tls/src/test/java/com/iluwatar/tls/AppTest.java @@ -0,0 +1,40 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +import org.junit.Test; + +/** + * Tests that thread local storage example runs without errors. + * + * @author Thomas Bauer, January 2017 + * + */ +public class AppTest { + @Test + public void test() throws Exception { + String[] args = {}; + App.main(args); + } +} From 3324e1bc432867766182c7bb743af938093aa81f Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 12:01:32 +0100 Subject: [PATCH 32/67] Update pom.xml added tls --- pom.xml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 52f24a500..12b4c3a06 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 4.0.0 com.iluwatar java-design-patterns - 1.14.0-SNAPSHOT + 1.15.0-SNAPSHOT pom 2014 @@ -50,7 +50,8 @@ abstract-factory - builder + tls + builder factory-method prototype singleton @@ -466,4 +467,9 @@ - \ No newline at end of file + + + Contact GitHub API Training Shop Blog About + + © 2017 GitHub, Inc. Terms Privacy Security Status Help + From 3d3dd58501e0911a4e431d4e9ab2a22b5777c6fe Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 12:08:11 +0100 Subject: [PATCH 33/67] Update pom.xml removed errors caused by copy code from master --- pom.xml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 12b4c3a06..42ae2626c 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ abstract-factory tls - builder + builder factory-method prototype singleton @@ -468,8 +468,3 @@ - - Contact GitHub API Training Shop Blog About - - © 2017 GitHub, Inc. Terms Privacy Security Status Help - From 59ea20745f468819894a440a42a0a76383225151 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 12:32:21 +0100 Subject: [PATCH 34/67] Delete DateFormatRunnableTest.java --- .../iluwatar/tls/DateFormatRunnableTest.java | 144 ------------------ 1 file changed, 144 deletions(-) delete mode 100644 tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTest.java diff --git a/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTest.java b/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTest.java deleted file mode 100644 index d6105dc98..000000000 --- a/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/** - * The MIT License - * Copyright (c) 2016 Thomas Bauer - * - * 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.tls; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -import org.junit.BeforeClass; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -/** - * - * Test of the Callable - * - * In this test {@link DateFormatCallable} is tested with only one thread (i.e. without concurrency situation) - *

- * After a successful run 5 date values should be in the result object. All dates should have - * the same value (15.11.2015). To avoid problems with time zone not the date instances themselves - * are compared by the test. For the test the dates are converted into string format DD.MM.YYY - *

- * Additionally the number of list entries are tested for both the list with the date values - * and the list with the exceptions - * - * @author Thomas Bauer, January 2017 - * - */ -public class DateFormatRunnableTest { - - // Class variables used in setup() have to be static because setup() has to be static - /** - * Result object given back by DateFormatCallable - * -- Array with converted date values - * -- Array with thrown exceptions - */ - static Result result; - - /** - * The date values created by the run of of DateFormatRunnalbe. List will be filled in the setup() method - */ - static List createdDateValues = new ArrayList(); - - /** - * Expected number of date values in the date value list created by the run of DateFormatRunnalbe - */ - int expectedCounterDateValues = 5; - - /** - * Expected number of exceptions in the exception list created by the run of DateFormatRunnalbe. - */ - int expectedCounterExceptions = 0; - - /** - * 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"); - - /** - * Run Callable and prepare results for usage in the test methods - */ - @BeforeClass - public static void setup() { - // Create a callable - DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15/12/2015"); - // start thread using the Callable instance - ExecutorService executor = Executors.newCachedThreadPool(); - Future futureResult = executor.submit(callableDf); - try { - result = futureResult.get(); - createdDateValues = convertDatesToString(result); - } catch (Exception e) { - fail("Setup failed: " + e); - } - executor.shutdown(); - } - - private static List convertDatesToString(Result res) { - // Format date value as DD.MM.YYYY - if (res == null || res.getDateList() == null || res.getDateList().size() == 0) { - return null; - } - List returnList = new ArrayList(); - - for (Date dt : res.getDateList()) { - Calendar cal = Calendar.getInstance(); - cal.setTime(dt); - returnList.add(cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + cal.get(Calendar.YEAR)); - } - return returnList; - } - - /** - * Test date values after the run of DateFormatRunnalbe. A correct run should deliver 5 times 15.12.2015 - */ - @Test - public void testDateValues() { - assertEquals(expectedDateValues, createdDateValues); - } - - /** - * Test number of dates in the list after the run of DateFormatRunnalbe. A correct run should deliver 5 date values - */ - @Test - public void testCounterDateValues() { - assertEquals(expectedCounterDateValues, result.getDateList().size()); - } - - /** - * Test number of Exceptions in the list after the run of DateFormatRunnalbe. A correct run should deliver - * no exceptions - */ - @Test - public void testCounterExceptions() { - assertEquals(expectedCounterExceptions, result.getExceptionList().size()); - } -} From 82f8460243e49d7bd5804acf3b1f1331284cc66c Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 12:32:32 +0100 Subject: [PATCH 35/67] Delete DateFormatRunnableTestIncorrectDateFormat.java --- ...FormatRunnableTestIncorrectDateFormat.java | 127 ------------------ 1 file changed, 127 deletions(-) delete mode 100644 tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestIncorrectDateFormat.java diff --git a/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestIncorrectDateFormat.java b/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestIncorrectDateFormat.java deleted file mode 100644 index bae89f160..000000000 --- a/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestIncorrectDateFormat.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * The MIT License - * Copyright (c) 2016 Thomas Bauer - * - * 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.tls; - -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.BeforeClass; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -/** - * - * Test of the Callable - * - * In this test {@link DateFormatCallable} is tested with only one thread (i.e. without concurrency situation) - *

- * An incorrect formatted date is passed to the Callable - * After a successful run 0 date values and 5 exceptions should be in the result object. - * - * @author Thomas Bauer, January 2017 - * - */ -public class DateFormatRunnableTestIncorrectDateFormat { - - // Class variables used in setup() have to be static because setup() has to be static - /** - * Result object given back by DateFormatCallable - * -- Array with converted date values - * -- Array with thrown exceptions - */ - static Result result; - - /** - * The date values created by the run of DateFormatRunnalbe. List will be filled in the setup() method - */ - static List createdExceptions = new ArrayList(); - - /** - * Expected number of date values in the date value list created by the run of DateFormatRunnalbe - */ - int expectedCounterDateValues = 0; - - /** - * Expected number of exceptions in the exception list created by the run of DateFormatRunnalbe. - */ - int expectedCounterExceptions = 5; - - /** - * 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\"", - "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\""); - - /** - * Run Callable and prepare results for usage in the test methods - */ - @BeforeClass - public static void setup() { - // Create a callable. Pass a string date value not matching the format string - DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15.12.2015"); - // start thread using the Callable instance - ExecutorService executor = Executors.newCachedThreadPool(); - Future futureResult = executor.submit(callableDf); - try { - result = futureResult.get(); - } catch (Exception e) { - fail("Setup failed: " + e); - } - executor.shutdown(); - } - - /** - * Test Exceptions after the run of DateFormatRunnalbe. A correct run should deliver 5 times the - * same exception - */ - @Test - public void testExecptions() { - assertEquals(expectedExceptions, result.getExceptionList()); - } - - /** - * Test number of dates in the list after the run of DateFormatRunnalbe. A correct run should deliver no date values - */ - @Test - public void testCounterDateValues() { - assertEquals(expectedCounterDateValues, result.getDateList().size()); - } - - /** - * Test number of Exceptions in the list after the run of DateFormatRunnalbe. A correct run should - * deliver 5 exceptions - */ - @Test - public void testCounterExceptions() { - assertEquals(expectedCounterExceptions, result.getExceptionList().size()); - } -} From 2bbf84233e9c4d04e1c4fbe538f07d996f702458 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 12:32:44 +0100 Subject: [PATCH 36/67] Delete DateFormatRunnableTestMultiThread.java --- .../DateFormatRunnableTestMultiThread.java | 164 ------------------ 1 file changed, 164 deletions(-) delete mode 100644 tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestMultiThread.java diff --git a/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestMultiThread.java b/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestMultiThread.java deleted file mode 100644 index 354915209..000000000 --- a/tls/src/test/java/com/iluwatar/tls/DateFormatRunnableTestMultiThread.java +++ /dev/null @@ -1,164 +0,0 @@ -/** - * The MIT License - * Copyright (c) 2016 Thomas Bauer - * - * 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.tls; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -import org.junit.BeforeClass; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -/** - * - * Test of the Callable - * - * In this test {@link DateFormatCallable} is used by 4 threads in parallel - *

- * After a successful run 5 date values should be in the result object of each thread. All dates - * should have the same value (15.11.2015). To avoid problems with time zone not the date instances - * themselves are compared by the test. For the test the dates are converted into string format DD.MM.YYY - *

- * Additionally the number of list entries are tested for both the list with the date values - * and the list with the exceptions - * - * @author Thomas Bauer, January 2017 - * - */ -public class DateFormatRunnableTestMultiThread { - - // Class variables used in setup() have to be static because setup() has to be static - /** - * Result object given back by DateFormatCallable, one for each thread - * -- Array with converted date values - * -- Array with thrown exceptions - */ - static Result[] result = new Result[4]; - - /** - * The date values created by the run of of DateFormatRunnalbe. List will be filled in the setup() method - */ - @SuppressWarnings("serial") - static class StringArrayList extends ArrayList { - /* nothing needed here */ - } - static List[] createdDateValues = new StringArrayList[4]; - - /** - * Expected number of date values in the date value list created by each thread - */ - int expectedCounterDateValues = 5; - - /** - * Expected number of exceptions in the exception list created by each thread - */ - int expectedCounterExceptions = 0; - - /** - * 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"); - - /** - * Run Callable and prepare results for usage in the test methods - */ - @BeforeClass - public static void setup() { - // Create a callable - DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15/12/2015"); - // start thread using the Callable instance - ExecutorService executor = Executors.newCachedThreadPool(); - Future futureResult1 = executor.submit(callableDf); - Future futureResult2 = executor.submit(callableDf); - Future futureResult3 = executor.submit(callableDf); - Future futureResult4 = executor.submit(callableDf); - try { - result[0] = futureResult1.get(); - result[1] = futureResult2.get(); - result[2] = futureResult3.get(); - result[3] = futureResult4.get(); - for (int i = 0; i < result.length; i++) { - createdDateValues[i] = convertDatesToString(result[i]); - } - } catch (Exception e) { - fail("Setup failed: " + e); - } - executor.shutdown(); - } - - private static List convertDatesToString(Result res) { - // Format date value as DD.MM.YYYY - if (res == null || res.getDateList() == null || res.getDateList().size() == 0) { - return null; - } - List returnList = new StringArrayList(); - - for (Date dt : res.getDateList()) { - Calendar cal = Calendar.getInstance(); - cal.setTime(dt); - returnList.add(cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + cal.get(Calendar.YEAR)); - } - return returnList; - } - - /** - * Test date values after the run of DateFormatRunnalbe. A correct run should deliver 5 times 15.12.2015 - * by each thread - */ - @Test - public void testDateValues() { - for (int i = 0; i < createdDateValues.length; i++) { - assertEquals(expectedDateValues, createdDateValues[i]); - } - } - - /** - * Test number of dates in the list after the run of DateFormatRunnalbe. A correct run should - * deliver 5 date values by each thread - */ - @Test - public void testCounterDateValues() { - for (int i = 0; i < result.length; i++) { - assertEquals(expectedCounterDateValues, result[i].getDateList().size()); - } - } - - /** - * Test number of Exceptions in the list after the run of DateFormatRunnalbe. A correct run should - * deliver no exceptions - */ - @Test - public void testCounterExceptions() { - for (int i = 0; i < result.length; i++) { - assertEquals(expectedCounterExceptions, result[i].getExceptionList().size()); - } - } -} From ddac9dc6cb09a314111aed660c98c5b1fa12a9ce Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Jan 2017 12:34:13 +0100 Subject: [PATCH 37/67] Add files via upload Changed the classname part "runnable" to "callable" --- .../iluwatar/tls/DateFormatCallableTest.java | 144 +++++++++++++++ ...FormatCallableTestIncorrectDateFormat.java | 127 ++++++++++++++ .../DateFormatCallableTestMultiThread.java | 164 ++++++++++++++++++ 3 files changed, 435 insertions(+) create mode 100644 tls/src/test/java/com/iluwatar/tls/DateFormatCallableTest.java create mode 100644 tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestIncorrectDateFormat.java create mode 100644 tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestMultiThread.java diff --git a/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTest.java b/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTest.java new file mode 100644 index 000000000..b4f24be9b --- /dev/null +++ b/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTest.java @@ -0,0 +1,144 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +/** + * + * Test of the Callable + * + * In this test {@link DateFormatCallable} is tested with only one thread (i.e. without concurrency situation) + *

+ * After a successful run 5 date values should be in the result object. All dates should have + * the same value (15.11.2015). To avoid problems with time zone not the date instances themselves + * are compared by the test. For the test the dates are converted into string format DD.MM.YYY + *

+ * Additionally the number of list entries are tested for both the list with the date values + * and the list with the exceptions + * + * @author Thomas Bauer, January 2017 + * + */ +public class DateFormatCallableTest { + + // Class variables used in setup() have to be static because setup() has to be static + /** + * Result object given back by DateFormatCallable + * -- Array with converted date values + * -- Array with thrown exceptions + */ + static Result result; + + /** + * The date values created by the run of of DateFormatRunnalbe. List will be filled in the setup() method + */ + static List createdDateValues = new ArrayList(); + + /** + * Expected number of date values in the date value list created by the run of DateFormatRunnalbe + */ + int expectedCounterDateValues = 5; + + /** + * Expected number of exceptions in the exception list created by the run of DateFormatRunnalbe. + */ + int expectedCounterExceptions = 0; + + /** + * 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"); + + /** + * Run Callable and prepare results for usage in the test methods + */ + @BeforeClass + public static void setup() { + // Create a callable + DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15/12/2015"); + // start thread using the Callable instance + ExecutorService executor = Executors.newCachedThreadPool(); + Future futureResult = executor.submit(callableDf); + try { + result = futureResult.get(); + createdDateValues = convertDatesToString(result); + } catch (Exception e) { + fail("Setup failed: " + e); + } + executor.shutdown(); + } + + private static List convertDatesToString(Result res) { + // Format date value as DD.MM.YYYY + if (res == null || res.getDateList() == null || res.getDateList().size() == 0) { + return null; + } + List returnList = new ArrayList(); + + for (Date dt : res.getDateList()) { + Calendar cal = Calendar.getInstance(); + cal.setTime(dt); + returnList.add(cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + cal.get(Calendar.YEAR)); + } + return returnList; + } + + /** + * Test date values after the run of DateFormatRunnalbe. A correct run should deliver 5 times 15.12.2015 + */ + @Test + public void testDateValues() { + assertEquals(expectedDateValues, createdDateValues); + } + + /** + * Test number of dates in the list after the run of DateFormatRunnalbe. A correct run should deliver 5 date values + */ + @Test + public void testCounterDateValues() { + assertEquals(expectedCounterDateValues, result.getDateList().size()); + } + + /** + * Test number of Exceptions in the list after the run of DateFormatRunnalbe. A correct run should deliver + * no exceptions + */ + @Test + public void testCounterExceptions() { + assertEquals(expectedCounterExceptions, result.getExceptionList().size()); + } +} diff --git a/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestIncorrectDateFormat.java b/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestIncorrectDateFormat.java new file mode 100644 index 000000000..e0a1507e9 --- /dev/null +++ b/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestIncorrectDateFormat.java @@ -0,0 +1,127 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +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.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +/** + * + * Test of the Callable + * + * In this test {@link DateFormatCallable} is tested with only one thread (i.e. without concurrency situation) + *

+ * An incorrect formatted date is passed to the Callable + * After a successful run 0 date values and 5 exceptions should be in the result object. + * + * @author Thomas Bauer, January 2017 + * + */ +public class DateFormatCallableTestIncorrectDateFormat { + + // Class variables used in setup() have to be static because setup() has to be static + /** + * Result object given back by DateFormatCallable + * -- Array with converted date values + * -- Array with thrown exceptions + */ + static Result result; + + /** + * The date values created by the run of DateFormatRunnalbe. List will be filled in the setup() method + */ + static List createdExceptions = new ArrayList(); + + /** + * Expected number of date values in the date value list created by the run of DateFormatRunnalbe + */ + int expectedCounterDateValues = 0; + + /** + * Expected number of exceptions in the exception list created by the run of DateFormatRunnalbe. + */ + int expectedCounterExceptions = 5; + + /** + * 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\"", + "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\""); + + /** + * Run Callable and prepare results for usage in the test methods + */ + @BeforeClass + public static void setup() { + // Create a callable. Pass a string date value not matching the format string + DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15.12.2015"); + // start thread using the Callable instance + ExecutorService executor = Executors.newCachedThreadPool(); + Future futureResult = executor.submit(callableDf); + try { + result = futureResult.get(); + } catch (Exception e) { + fail("Setup failed: " + e); + } + executor.shutdown(); + } + + /** + * Test Exceptions after the run of DateFormatRunnalbe. A correct run should deliver 5 times the + * same exception + */ + @Test + public void testExecptions() { + assertEquals(expectedExceptions, result.getExceptionList()); + } + + /** + * Test number of dates in the list after the run of DateFormatRunnalbe. A correct run should deliver no date values + */ + @Test + public void testCounterDateValues() { + assertEquals(expectedCounterDateValues, result.getDateList().size()); + } + + /** + * Test number of Exceptions in the list after the run of DateFormatRunnalbe. A correct run should + * deliver 5 exceptions + */ + @Test + public void testCounterExceptions() { + assertEquals(expectedCounterExceptions, result.getExceptionList().size()); + } +} diff --git a/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestMultiThread.java b/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestMultiThread.java new file mode 100644 index 000000000..635d6f25a --- /dev/null +++ b/tls/src/test/java/com/iluwatar/tls/DateFormatCallableTestMultiThread.java @@ -0,0 +1,164 @@ +/** + * The MIT License + * Copyright (c) 2016 Thomas Bauer + * + * 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.tls; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +/** + * + * Test of the Callable + * + * In this test {@link DateFormatCallable} is used by 4 threads in parallel + *

+ * After a successful run 5 date values should be in the result object of each thread. All dates + * should have the same value (15.11.2015). To avoid problems with time zone not the date instances + * themselves are compared by the test. For the test the dates are converted into string format DD.MM.YYY + *

+ * Additionally the number of list entries are tested for both the list with the date values + * and the list with the exceptions + * + * @author Thomas Bauer, January 2017 + * + */ +public class DateFormatCallableTestMultiThread { + + // Class variables used in setup() have to be static because setup() has to be static + /** + * Result object given back by DateFormatCallable, one for each thread + * -- Array with converted date values + * -- Array with thrown exceptions + */ + static Result[] result = new Result[4]; + + /** + * The date values created by the run of of DateFormatRunnalbe. List will be filled in the setup() method + */ + @SuppressWarnings("serial") + static class StringArrayList extends ArrayList { + /* nothing needed here */ + } + static List[] createdDateValues = new StringArrayList[4]; + + /** + * Expected number of date values in the date value list created by each thread + */ + int expectedCounterDateValues = 5; + + /** + * Expected number of exceptions in the exception list created by each thread + */ + int expectedCounterExceptions = 0; + + /** + * 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"); + + /** + * Run Callable and prepare results for usage in the test methods + */ + @BeforeClass + public static void setup() { + // Create a callable + DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15/12/2015"); + // start thread using the Callable instance + ExecutorService executor = Executors.newCachedThreadPool(); + Future futureResult1 = executor.submit(callableDf); + Future futureResult2 = executor.submit(callableDf); + Future futureResult3 = executor.submit(callableDf); + Future futureResult4 = executor.submit(callableDf); + try { + result[0] = futureResult1.get(); + result[1] = futureResult2.get(); + result[2] = futureResult3.get(); + result[3] = futureResult4.get(); + for (int i = 0; i < result.length; i++) { + createdDateValues[i] = convertDatesToString(result[i]); + } + } catch (Exception e) { + fail("Setup failed: " + e); + } + executor.shutdown(); + } + + private static List convertDatesToString(Result res) { + // Format date value as DD.MM.YYYY + if (res == null || res.getDateList() == null || res.getDateList().size() == 0) { + return null; + } + List returnList = new StringArrayList(); + + for (Date dt : res.getDateList()) { + Calendar cal = Calendar.getInstance(); + cal.setTime(dt); + returnList.add(cal.get(Calendar.DAY_OF_MONTH) + "." + cal.get(Calendar.MONTH) + "." + cal.get(Calendar.YEAR)); + } + return returnList; + } + + /** + * Test date values after the run of DateFormatRunnalbe. A correct run should deliver 5 times 15.12.2015 + * by each thread + */ + @Test + public void testDateValues() { + for (int i = 0; i < createdDateValues.length; i++) { + assertEquals(expectedDateValues, createdDateValues[i]); + } + } + + /** + * Test number of dates in the list after the run of DateFormatRunnalbe. A correct run should + * deliver 5 date values by each thread + */ + @Test + public void testCounterDateValues() { + for (int i = 0; i < result.length; i++) { + assertEquals(expectedCounterDateValues, result[i].getDateList().size()); + } + } + + /** + * Test number of Exceptions in the list after the run of DateFormatRunnalbe. A correct run should + * deliver no exceptions + */ + @Test + public void testCounterExceptions() { + for (int i = 0; i < result.length; i++) { + assertEquals(expectedCounterExceptions, result[i].getExceptionList().size()); + } + } +} From fd7107694a75ebe7cadee666e3d397ed468df86f Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 18 Feb 2017 15:16:15 +0100 Subject: [PATCH 38/67] Update pom.xml Changed 1.14.0-SNAPSHOT to 1.15.0-SNAPSHOT --- tls/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tls/pom.xml b/tls/pom.xml index 68ebcdbf1..fa8bf6860 100644 --- a/tls/pom.xml +++ b/tls/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.14.0-SNAPSHOT + 1.15.0-SNAPSHOT tls From 8871f788d2564ff383e5527a6db45aa5b3edcc79 Mon Sep 17 00:00:00 2001 From: Kamil Pietruszka Date: Fri, 10 Mar 2017 20:08:58 +0100 Subject: [PATCH 39/67] #497 Converter pattern implementation --- converter/README.md | 25 ++++++ converter/pom.xml | 21 +++++ .../main/java/com/iluwatar/converter/App.java | 44 ++++++++++ .../com/iluwatar/converter/Converter.java | 86 +++++++++++++++++++ .../java/com/iluwatar/converter/User.java | 69 +++++++++++++++ .../java/com/iluwatar/converter/UserDto.java | 69 +++++++++++++++ .../java/com/iluwatar/converter/AppTest.java | 35 ++++++++ pom.xml | 3 +- 8 files changed, 351 insertions(+), 1 deletion(-) create mode 100644 converter/README.md create mode 100644 converter/pom.xml create mode 100644 converter/src/main/java/com/iluwatar/converter/App.java create mode 100644 converter/src/main/java/com/iluwatar/converter/Converter.java create mode 100644 converter/src/main/java/com/iluwatar/converter/User.java create mode 100644 converter/src/main/java/com/iluwatar/converter/UserDto.java create mode 100644 converter/src/test/java/com/iluwatar/converter/AppTest.java diff --git a/converter/README.md b/converter/README.md new file mode 100644 index 000000000..cbca98e8f --- /dev/null +++ b/converter/README.md @@ -0,0 +1,25 @@ +--- +layout: pattern +title: Converter +folder: converter +permalink: /patterns/converter/ +categories: +tags: + - Java + - Difficulty-Beginner +--- + +## Intent +TODO + +![alt text](./etc/converter.png "TODO") + +## Applicability +TODO + +* TODO 1 +* TODO 2 + +## Credits + +* [Converter](http://todo.com) diff --git a/converter/pom.xml b/converter/pom.xml new file mode 100644 index 000000000..53eca720b --- /dev/null +++ b/converter/pom.xml @@ -0,0 +1,21 @@ + + + + java-design-patterns + com.iluwatar + 1.15.0-SNAPSHOT + + 4.0.0 + + + junit + junit + test + + + converter + + + diff --git a/converter/src/main/java/com/iluwatar/converter/App.java b/converter/src/main/java/com/iluwatar/converter/App.java new file mode 100644 index 000000000..593240b43 --- /dev/null +++ b/converter/src/main/java/com/iluwatar/converter/App.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.converter; + +/** + * + * + */ +public class App { + /** + * Program entry point + * + * @param args command line args + */ + public static void main(String[] args) { + Converter userConverter = new Converter<>( + userDto -> new User(userDto.getName(), userDto.getSurname(), userDto.isActive()), + user -> new UserDto(user.getName(), user.getSurname(), user.isActive())); + UserDto dtoUser = new UserDto("John", "Doe", true); + User user = userConverter.convertFromDTO(dtoUser); + UserDto dtoUserCopy = userConverter.convertFromEntity(user); + + } +} diff --git a/converter/src/main/java/com/iluwatar/converter/Converter.java b/converter/src/main/java/com/iluwatar/converter/Converter.java new file mode 100644 index 000000000..0b3531a22 --- /dev/null +++ b/converter/src/main/java/com/iluwatar/converter/Converter.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.converter; + +import java.util.Collection; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @param + * @param + */ +public class Converter { + /** + * + */ + private final Function fromDTO; + /** + * + */ + private final Function fromEntity; + + /** + * @param fromDTO + * @param fromEntity + */ + public Converter(final Function fromDTO, final Function fromEntity) { + this.fromDTO = fromDTO; + this.fromEntity = fromEntity; + } + + /** + * @param arg + * @return + */ + public U convertFromDTO(final T arg) { + return fromDTO.apply(arg); + } + + /** + * @param arg + * @return + */ + public T convertFromEntity(final U arg) { + return fromEntity.apply(arg); + } + + /** + * @param arg + * @return + */ + public List createFromDTOs(final Collection arg) { + return arg.stream().map(this::convertFromDTO).collect(Collectors.toList()); + } + + /** + * @param arg + * @return + */ + public List createFromEntities(final Collection arg) { + return arg.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 new file mode 100644 index 000000000..bcd09c1cc --- /dev/null +++ b/converter/src/main/java/com/iluwatar/converter/User.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.converter; + +/** + * Created by crossy on 2017-03-10. + */ +public class User { + private String name; + private String surname; + private boolean isActive; + + /** + * + * @param name + * @param surname + * @param isActive + */ + public User(String name, String surname, boolean isActive) { + this.name = name; + this.surname = surname; + this.isActive = isActive; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + + public boolean isActive() { + return isActive; + } + + public void setActive(boolean active) { + isActive = active; + } +} diff --git a/converter/src/main/java/com/iluwatar/converter/UserDto.java b/converter/src/main/java/com/iluwatar/converter/UserDto.java new file mode 100644 index 000000000..aaff1e623 --- /dev/null +++ b/converter/src/main/java/com/iluwatar/converter/UserDto.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.converter; + +/** + * + */ +public class UserDto { + private String name; + private String surname; + private boolean isActive; + + /** + * + * @param name + * @param surname + * @param isActive + */ + public UserDto(String name, String surname, boolean isActive) { + this.name = name; + this.surname = surname; + this.isActive = isActive; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + + public boolean isActive() { + return isActive; + } + + public void setActive(boolean active) { + isActive = active; + } +} diff --git a/converter/src/test/java/com/iluwatar/converter/AppTest.java b/converter/src/test/java/com/iluwatar/converter/AppTest.java new file mode 100644 index 000000000..5198827d2 --- /dev/null +++ b/converter/src/test/java/com/iluwatar/converter/AppTest.java @@ -0,0 +1,35 @@ +/** + * 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.converter; + +import org.junit.Test; + +public class AppTest { + + @Test + public void testMain() { + String[] args = {}; + App.main(args); + } + +} diff --git a/pom.xml b/pom.xml index 5ddd3bf98..8a012665d 100644 --- a/pom.xml +++ b/pom.xml @@ -134,6 +134,7 @@ event-asynchronous queue-load-leveling object-mother + converter @@ -466,4 +467,4 @@ - \ No newline at end of file + From e8b634c33e03f57af5e87364a55d898a32518216 Mon Sep 17 00:00:00 2001 From: Kamil Pietruszka Date: Fri, 10 Mar 2017 20:59:24 +0100 Subject: [PATCH 40/67] java docs added --- .../main/java/com/iluwatar/converter/App.java | 10 ++-- .../com/iluwatar/converter/Converter.java | 47 +++++++++---------- .../java/com/iluwatar/converter/User.java | 35 +++++++------- .../java/com/iluwatar/converter/UserDto.java | 36 +++++++------- 4 files changed, 58 insertions(+), 70 deletions(-) diff --git a/converter/src/main/java/com/iluwatar/converter/App.java b/converter/src/main/java/com/iluwatar/converter/App.java index 593240b43..91fbb98f8 100644 --- a/converter/src/main/java/com/iluwatar/converter/App.java +++ b/converter/src/main/java/com/iluwatar/converter/App.java @@ -22,10 +22,6 @@ */ package com.iluwatar.converter; -/** - * - * - */ public class App { /** * Program entry point @@ -34,10 +30,10 @@ public class App { */ public static void main(String[] args) { Converter userConverter = new Converter<>( - userDto -> new User(userDto.getName(), userDto.getSurname(), userDto.isActive()), - user -> new UserDto(user.getName(), user.getSurname(), user.isActive())); + userDto -> new User(userDto.getFirstName(), userDto.getLastName(), userDto.isActive()), + user -> new UserDto(user.getFirstName(), user.getLastName(), user.isActive())); UserDto dtoUser = new UserDto("John", "Doe", true); - User user = userConverter.convertFromDTO(dtoUser); + User user = userConverter.convertFromDto(dtoUser); UserDto dtoUserCopy = userConverter.convertFromEntity(user); } diff --git a/converter/src/main/java/com/iluwatar/converter/Converter.java b/converter/src/main/java/com/iluwatar/converter/Converter.java index 0b3531a22..7f7a702cd 100644 --- a/converter/src/main/java/com/iluwatar/converter/Converter.java +++ b/converter/src/main/java/com/iluwatar/converter/Converter.java @@ -29,55 +29,52 @@ import java.util.function.Function; import java.util.stream.Collectors; /** - * @param - * @param + * @param DTO representation's type + * @param Domain representation's type */ public class Converter { - /** - * - */ - private final Function fromDTO; - /** - * - */ + + private final Function fromDto; private final Function fromEntity; /** - * @param fromDTO - * @param fromEntity + * @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) { - this.fromDTO = fromDTO; + public Converter(final Function fromDto, final Function fromEntity) { + this.fromDto = fromDto; this.fromEntity = fromEntity; } /** - * @param arg - * @return + * @param arg DTO entity + * @return The domain representation - the result of the converting function application on dto entity. */ - public U convertFromDTO(final T arg) { - return fromDTO.apply(arg); + public U convertFromDto(final T arg) { + return fromDto.apply(arg); } /** - * @param arg - * @return + * @param arg domain entity + * @return The DTO representation - the result of the converting function application on domain entity. */ public T convertFromEntity(final U arg) { return fromEntity.apply(arg); } /** - * @param arg - * @return + * @param arg collection of DTO entities + * @return List of domain representation of provided entities retrieved by + * mapping each of them with the convertion function */ - public List createFromDTOs(final Collection arg) { - return arg.stream().map(this::convertFromDTO).collect(Collectors.toList()); + public List createFromDtos(final Collection arg) { + return arg.stream().map(this::convertFromDto).collect(Collectors.toList()); } /** - * @param arg - * @return + * @param arg collection of domain entities + * @return List of domain representation of provided entities retrieved by + * mapping each of them with the convertion function */ public List createFromEntities(final Collection arg) { return arg.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 bcd09c1cc..8a4e9186c 100644 --- a/converter/src/main/java/com/iluwatar/converter/User.java +++ b/converter/src/main/java/com/iluwatar/converter/User.java @@ -23,40 +23,37 @@ package com.iluwatar.converter; -/** - * Created by crossy on 2017-03-10. - */ public class User { - private String name; - private String surname; + private String firstName; + private String lastName; private boolean isActive; /** * - * @param name - * @param surname - * @param isActive + * @param firstName user's first name + * @param lastName user's last name + * @param isActive flag indicating whether the user is active */ - public User(String name, String surname, boolean isActive) { - this.name = name; - this.surname = surname; + public User(String firstName, String lastName, boolean isActive) { + this.firstName = firstName; + this.lastName = lastName; this.isActive = isActive; } - public String getName() { - return name; + public String getFirstName() { + return firstName; } - public void setName(String name) { - this.name = name; + public void setFirstName(String firstName) { + this.firstName = firstName; } - public String getSurname() { - return surname; + public String getLastName() { + return lastName; } - public void setSurname(String surname) { - this.surname = surname; + public void setLastName(String lastName) { + this.lastName = lastName; } public boolean isActive() { diff --git a/converter/src/main/java/com/iluwatar/converter/UserDto.java b/converter/src/main/java/com/iluwatar/converter/UserDto.java index aaff1e623..bdadf6e39 100644 --- a/converter/src/main/java/com/iluwatar/converter/UserDto.java +++ b/converter/src/main/java/com/iluwatar/converter/UserDto.java @@ -23,40 +23,38 @@ package com.iluwatar.converter; -/** - * - */ + public class UserDto { - private String name; - private String surname; + private String firstName; + private String lastName; private boolean isActive; /** * - * @param name - * @param surname - * @param isActive + * @param firstName user's first name + * @param lastName user's last name + * @param isActive flag indicating whether the user is active */ - public UserDto(String name, String surname, boolean isActive) { - this.name = name; - this.surname = surname; + public UserDto(String firstName, String lastName, boolean isActive) { + this.firstName = firstName; + this.lastName = lastName; this.isActive = isActive; } - public String getName() { - return name; + public String getFirstName() { + return firstName; } - public void setName(String name) { - this.name = name; + public void setFirstName(String firstName) { + this.firstName = firstName; } - public String getSurname() { - return surname; + public String getLastName() { + return lastName; } - public void setSurname(String surname) { - this.surname = surname; + public void setLastName(String lastName) { + this.lastName = lastName; } public boolean isActive() { From 764ff4bf5374e5c09bdd821a82537b2e283c15c3 Mon Sep 17 00:00:00 2001 From: Robert Kasperczyk Date: Fri, 6 Jan 2017 00:57:47 +0100 Subject: [PATCH 41/67] Initial commit of guarded suspension design pattern --- guarded-suspension/README.md | 21 ++++++ guarded-suspension/etc/guarded-suspension.png | Bin 0 -> 8011 bytes .../etc/guarded-suspension.ucls | 22 ++++++ .../etc/guarded-suspension.urm.puml | 11 +++ guarded-suspension/pom.xml | 45 ++++++++++++ .../guarded/suspension/GuardedQueue.java | 66 ++++++++++++++++++ .../guarded/suspension/GuardedQueueTest.java | 53 ++++++++++++++ pom.xml | 1 + 8 files changed, 219 insertions(+) create mode 100644 guarded-suspension/README.md create mode 100644 guarded-suspension/etc/guarded-suspension.png create mode 100644 guarded-suspension/etc/guarded-suspension.ucls create mode 100644 guarded-suspension/etc/guarded-suspension.urm.puml create mode 100644 guarded-suspension/pom.xml create mode 100644 guarded-suspension/src/main/java/com/iluwatar/guarded/suspension/GuardedQueue.java create mode 100644 guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java diff --git a/guarded-suspension/README.md b/guarded-suspension/README.md new file mode 100644 index 000000000..df10a9ef3 --- /dev/null +++ b/guarded-suspension/README.md @@ -0,0 +1,21 @@ +--- +layout: pattern +title: Guarded Suspension +folder: guarded-suspension +permalink: /patterns/guarded-suspension/ +pumlid: RScv3SCm3030LU819FRPXg5fIm552tnYPFiyjRi3RkbAaYkdoQr5JBy369vrxz7oaSv6XmPhL3e6TCaJ0msU-CAoilTToyG8DdKOw5z0GzcAlvNAN_WZSD1brBHHPmxv0000 +categories: Concurrency +tags: + - Java + - Difficulty-Beginner +--- + +## Intent +Use Guareded suspension pattern to handle a situation when you want to execute a method on object which is not in a proper state. +![Guarded Suspension diagram](./etc/guarded-suspension.png) + +## Applicability +Use Guareded Suspension pattern when: + +* the developer knows that the method execution will be blocked for a finite period of time + diff --git a/guarded-suspension/etc/guarded-suspension.png b/guarded-suspension/etc/guarded-suspension.png new file mode 100644 index 0000000000000000000000000000000000000000..db962e539b40d41364de4496a41d1e6542f8cfff GIT binary patch literal 8011 zcmcJUWmFu^*6+!L2^O3{a2O=mFbNQX>);;TU4n+-p23~qZovk3cTIx3ySux-)dtk*ZZNn*4owGtEy{P?f?GmAbD9abW|c#1Ox=eF(nYC#4(-}mF#e#95d_MXA|ddhU?G1;p}<1G6`(+%<nEHw6=dvImMUalrK(jt&lseCaeM? zrHBhylHep#T;EjsN#DTewlMaFre248N%$|~EG|u(&@kbAFKws5I_XTM?l?=Ll*&a= zRHpdW_v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zs1_yGqccjT`5WdOQb=0^_}*nCzin9qxwO~bs|CbVDQocVa4HgYgcvy_7E8eCi}~IB z-~I495e%sGB(Tmok9^(ihl(^o$RNmZIxVl;^^Ury(@>F)^KQHgu($W>84x;;I7iwJ z+nHILYGm|FkC!tQ?>qF8hdt<}9=?JYqjSi7uzQF>O8ywj&i3^;!@UbD5A518`7nPL zSDSR9Z^CRFti+*~L5bs=2JJ)UKnD$I5UASF?z02@*+Mwb|jZ{ud zth5TZr4ybp2C^ynk#`X*hL1x=h#6tn8YHn5HwY48A^wEG{ImX%u=V4U>E@90cDJwB z_sqAQ?Oex0&I8BMWo+5~@6k7WuG)vLhmNi9)i5S^1|`ZAmPF{Nee>0Sr30VD@0oyr z(Ek$_v8Apt?7bwEU*KyFezJ>G43Q z{0jp9q_+=T1^uUQzof-5BCub`_cF{*!@4a2wMzsFQl&4aCjtJosXp6&zr6^Af+X#y2F{_xLN+<4!dXF-ah=rHF<~ym``VMHY!kHa(k^S9B}N^t zcuWa8EZ?~QPhkzcs$(rzC{09l<((MPf2RT?S6Z${vpqq4zKRkQ)*zfr(q=u_4h@I> zvFipcWmx*46NqI_L7ocd7vnV+_LaCZP9AmT0f)U#RtqvqWLfckkqx8-n$v@In9nG(0AQlrVj$s+)KCuM)k3_Ff@V{d zrljja86VL3pgp`orp#wKa~5{Ep>e>c&r+su;50IZnPMc06g(grDlD_N0NZFPY#g%{ zKs3*_#H)pa*a~9g*jpof7)S3B3}t`O>!@sgD+^-W!%j*g6Pzd6rO(){WTW&5L*^V zQh&R*V}AF|HQ-tvEyT&(+-xQE+z7qN=|N(*F;Gfbfo|Ce6<-xAb+N1?x5 z@&EF&|IZJE17Il9TC#M18>)ow0(u>6FJNuHUv9lZN<|xOZj#xbi{uCrBC^mDAwBQ^ E0VIn*qW}N^ literal 0 HcmV?d00001 diff --git a/guarded-suspension/etc/guarded-suspension.ucls b/guarded-suspension/etc/guarded-suspension.ucls new file mode 100644 index 000000000..2e46325e4 --- /dev/null +++ b/guarded-suspension/etc/guarded-suspension.ucls @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/guarded-suspension/etc/guarded-suspension.urm.puml b/guarded-suspension/etc/guarded-suspension.urm.puml new file mode 100644 index 000000000..f99607d82 --- /dev/null +++ b/guarded-suspension/etc/guarded-suspension.urm.puml @@ -0,0 +1,11 @@ +@startuml +package com.iluwatar.guarded.suspension { + class GuardedQueue { + - LOGGER : Logger {static} + - sourceList : Queue + + GuardedQueue() + + get() : Integer + + put(e : Integer) + } +} +@enduml \ No newline at end of file diff --git a/guarded-suspension/pom.xml b/guarded-suspension/pom.xml new file mode 100644 index 000000000..a7d813ae2 --- /dev/null +++ b/guarded-suspension/pom.xml @@ -0,0 +1,45 @@ + + + + + java-design-patterns + com.iluwatar + 1.14.0-SNAPSHOT + + 4.0.0 + + guarded-suspension + + + junit + junit + + + + + \ No newline at end of file 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 new file mode 100644 index 000000000..a5b16544f --- /dev/null +++ b/guarded-suspension/src/main/java/com/iluwatar/guarded/suspension/GuardedQueue.java @@ -0,0 +1,66 @@ +/** + * 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.guarded.suspension; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.LinkedList; +import java.util.Queue; + + + +public class GuardedQueue { + private static final Logger LOGGER = LoggerFactory.getLogger(GuardedQueue.class); + private Queue sourceList; + + public GuardedQueue() { + this.sourceList = new LinkedList<>(); + } + + /** + * @return last element of a queue if queue is not empty + */ + public synchronized Integer get() { + while (sourceList.isEmpty()) { + try { + LOGGER.info("waiting"); + wait(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + return sourceList.peek(); + } + + /** + * @param e number which we want to put to our queue + */ + public synchronized void put(Integer e) { + sourceList.add(e); + notify(); + LOGGER.info("notifying"); + + } +} diff --git a/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java b/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java new file mode 100644 index 000000000..ca1ffad28 --- /dev/null +++ b/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.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.guarded.suspension; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +/** + * Created by robertt240 on 1/2/17. + */ +public class GuardedQueueTest { + private volatile Integer value; + + @Test + public void testGet() { + GuardedQueue g = new GuardedQueue(); + ExecutorService executorService = Executors.newFixedThreadPool(2); + executorService.submit(() -> value = g.get()); + executorService.submit(() -> g.put(Integer.valueOf(10))); + executorService.shutdown(); + try { + executorService.awaitTermination(30, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + Assert.assertEquals(Integer.valueOf(10), value); + } + +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5ddd3bf98..242ae4b1a 100644 --- a/pom.xml +++ b/pom.xml @@ -134,6 +134,7 @@ event-asynchronous queue-load-leveling object-mother + guarded-suspension From 1824b4138b17c972fc0012c5cb91e82938e5ddb4 Mon Sep 17 00:00:00 2001 From: Robert Kasperczyk Date: Fri, 6 Jan 2017 01:00:23 +0100 Subject: [PATCH 42/67] readme fix --- guarded-suspension/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/guarded-suspension/README.md b/guarded-suspension/README.md index df10a9ef3..ca6f5886f 100644 --- a/guarded-suspension/README.md +++ b/guarded-suspension/README.md @@ -3,7 +3,6 @@ layout: pattern title: Guarded Suspension folder: guarded-suspension permalink: /patterns/guarded-suspension/ -pumlid: RScv3SCm3030LU819FRPXg5fIm552tnYPFiyjRi3RkbAaYkdoQr5JBy369vrxz7oaSv6XmPhL3e6TCaJ0msU-CAoilTToyG8DdKOw5z0GzcAlvNAN_WZSD1brBHHPmxv0000 categories: Concurrency tags: - Java From a09866d35b146517c6ca02e68992048031b04ba7 Mon Sep 17 00:00:00 2001 From: Robert Kasperczyk Date: Fri, 6 Jan 2017 01:01:47 +0100 Subject: [PATCH 43/67] another readme fix --- guarded-suspension/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/guarded-suspension/README.md b/guarded-suspension/README.md index ca6f5886f..01c03f192 100644 --- a/guarded-suspension/README.md +++ b/guarded-suspension/README.md @@ -11,6 +11,7 @@ tags: ## Intent Use Guareded suspension pattern to handle a situation when you want to execute a method on object which is not in a proper state. + ![Guarded Suspension diagram](./etc/guarded-suspension.png) ## Applicability From e5034c6ae99e11684f4dd8d9d5ee74b14a361c4a Mon Sep 17 00:00:00 2001 From: Robert Kasperczyk Date: Fri, 6 Jan 2017 01:25:47 +0100 Subject: [PATCH 44/67] guarded suspension pattern #69 --- .../java/com/iluwatar/guarded/suspension/GuardedQueue.java | 7 +++---- .../com/iluwatar/guarded/suspension/GuardedQueueTest.java | 3 --- 2 files changed, 3 insertions(+), 7 deletions(-) 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 a5b16544f..47939141f 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 @@ -1,17 +1,17 @@ /** * 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 @@ -29,7 +29,6 @@ import java.util.LinkedList; import java.util.Queue; - public class GuardedQueue { private static final Logger LOGGER = LoggerFactory.getLogger(GuardedQueue.class); private Queue sourceList; diff --git a/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java b/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java index ca1ffad28..45251acbf 100644 --- a/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java +++ b/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java @@ -29,9 +29,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -/** - * Created by robertt240 on 1/2/17. - */ public class GuardedQueueTest { private volatile Integer value; From 29715028d15f2afa442edefa4088cf6c4cf49f71 Mon Sep 17 00:00:00 2001 From: Robert Kasperczyk Date: Mon, 9 Jan 2017 21:17:36 +0100 Subject: [PATCH 45/67] fix in POM formatting #69 --- guarded-suspension/pom.xml | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/guarded-suspension/pom.xml b/guarded-suspension/pom.xml index a7d813ae2..8326a6e96 100644 --- a/guarded-suspension/pom.xml +++ b/guarded-suspension/pom.xml @@ -26,20 +26,18 @@ - - java-design-patterns - com.iluwatar - 1.14.0-SNAPSHOT - - 4.0.0 - - guarded-suspension - - - junit - junit - - - + + java-design-patterns + com.iluwatar + 1.14.0-SNAPSHOT + + 4.0.0 + guarded-suspension + + + junit + junit + + \ No newline at end of file From f09578c091f9536ecba2a45589866bd2fa1c9a0d Mon Sep 17 00:00:00 2001 From: Robert Kasperczyk Date: Mon, 9 Jan 2017 21:25:24 +0100 Subject: [PATCH 46/67] further POM rearragments #69 --- guarded-suspension/pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/guarded-suspension/pom.xml b/guarded-suspension/pom.xml index 8326a6e96..9e44d410b 100644 --- a/guarded-suspension/pom.xml +++ b/guarded-suspension/pom.xml @@ -23,16 +23,16 @@ THE SOFTWARE. --> - + + 4.0.0 - java-design-patterns com.iluwatar + java-design-patterns 1.14.0-SNAPSHOT - 4.0.0 - + jar guarded-suspension From 7423f47daac7d84d4e3fe78d85340296c2b28254 Mon Sep 17 00:00:00 2001 From: Robert Kasperczyk Date: Mon, 9 Jan 2017 21:37:09 +0100 Subject: [PATCH 47/67] further POM rearragments #69 --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 242ae4b1a..5ddd3bf98 100644 --- a/pom.xml +++ b/pom.xml @@ -134,7 +134,6 @@ event-asynchronous queue-load-leveling object-mother - guarded-suspension From a20abae21cd990965adea18c2647345b2729fafe Mon Sep 17 00:00:00 2001 From: Robert Kasperczyk Date: Tue, 28 Feb 2017 15:06:50 +0100 Subject: [PATCH 48/67] apply changes from review #69 --- guarded-suspension/README.md | 8 +- guarded-suspension/etc/guarded-suspension.png | Bin 8011 -> 10318 bytes guarded-suspension/pom.xml | 1 + .../com/iluwatar/guarded/suspension/App.java | 76 ++++++++++++++++++ .../guarded/suspension/GuardedQueue.java | 8 +- .../guarded/suspension/GuardedQueueTest.java | 8 ++ pom.xml | 4 +- 7 files changed, 96 insertions(+), 9 deletions(-) create mode 100644 guarded-suspension/src/main/java/com/iluwatar/guarded/suspension/App.java diff --git a/guarded-suspension/README.md b/guarded-suspension/README.md index 01c03f192..35044f9b2 100644 --- a/guarded-suspension/README.md +++ b/guarded-suspension/README.md @@ -10,12 +10,12 @@ tags: --- ## Intent -Use Guareded suspension pattern to handle a situation when you want to execute a method on object which is not in a proper state. +Use Guarded suspension pattern to handle a situation when you want to execute a method on object which is not in a proper state. ![Guarded Suspension diagram](./etc/guarded-suspension.png) ## Applicability -Use Guareded Suspension pattern when: - -* the developer knows that the method execution will be blocked for a finite period of time +Use Guarded Suspension pattern when the developer knows that the method execution will be blocked for a finite period of time +## Related patterns +* Balking diff --git a/guarded-suspension/etc/guarded-suspension.png b/guarded-suspension/etc/guarded-suspension.png index db962e539b40d41364de4496a41d1e6542f8cfff..bd3fa5661fab47538fb3df095fecd6bbfba7217b 100644 GIT binary patch literal 10318 zcmb7qWmH_vwk-+n0RnUy2u_02XmAPcfgr&GG!WdqaSMS4LU4EY;K715?$%h4#x;1* ze&jp%ym8)r_s4sG_Sm(@-nCb)npHLDTI-9tsvJHJ5C;VX1z$m4S_1{;iPYnL8rIXt zYw{QLWE7OwqzclK?>*BGGca{Eb*N$Hg4Xv7dKGx+@lm!|6w*Yo?5}GFiQ^+Gn!c9g zHnHH~U_~UXJtd_KpwYx;fbVVZ&6U>A3XQKz4B@1#v|-Z^v`GYf4cWNMx?012^=dnF z$;Iy~6XHAu>6?%UKmozPlpU-nPtn3-F@6Hj!a>x&fEZNTr=5*{7^cs29j>^KErAt8 z^5J~ZRe-bmecTij7#&MM4HvdCTkcZ;Zrp!0t!zz|n>}qyx+r%Q;u0C^obx31ZV^_r zVS0nL?-TM9&e`e5vX1ll+_l)=IW8}BU2zHv5lca3nsl(ZU_GZTGxI9(ewqts+x`Oy z81&@%@L{ePMPHeahhE>N`c4@m6Z!^wH2g56r#R|WuKmyFVm9Tbc;3Cn70j;zBxx>V zht4&jcYVzN@af^@%eh{jPw>((X{c^d~0_+-RchHMn@iV>PwMZ>v>~l z7Pl-(a+1V$eTou;5_^IgX{^&#>NC1t}BaltOpZ9CFxyIKyx?~DoysT4wE`Zn&C znQG}NYSiNJc?Br6d02p~&+iD?dT(I#j{w*^jTvEPJ2jE*kun{PKc0(A}R5Wlixiy4Kt*v>Z zB5B2?CnxE*A@%AL1*ZcAxY??Vr8<5)?Xd37QF{{n!Z0MvTSR#)} zZd2tV)XJUZoxr|Tv6nZ$q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mNi9)i5S^1|`ZAmPF{Nee>0Sr30VD@0oyr z(Ek$_v8Apt?7bwEU*KyFezJ>G43Q z{0jp9q_+=T1^uUQzof-5BCub`_cF{*!@4a2wMzsFQl&4aCjtJosXp6&zr6^Af+X#y2F{_xLN+<4!dXF-ah=rHF<~ym``VMHY!kHa(k^S9B}N^t zcuWa8EZ?~QPhkzcs$(rzC{09l<((MPf2RT?S6Z${vpqq4zKRkQ)*zfr(q=u_4h@I> zvFipcWmx*46NqI_L7ocd7vnV+_LaCZP9AmT0f)U#RtqvqWLfckkqx8-n$v@In9nG(0AQlrVj$s+)KCuM)k3_Ff@V{d zrljja86VL3pgp`orp#wKa~5{Ep>e>c&r+su;50IZnPMc06g(grDlD_N0NZFPY#g%{ zKs3*_#H)pa*a~9g*jpof7)S3B3}t`O>!@sgD+^-W!%j*g6Pzd6rO(){WTW&5L*^V zQh&R*V}AF|HQ-tvEyT&(+-xQE+z7qN=|N(*F;Gfbfo|Ce6<-xAb+N1?x5 z@&EF&|IZJE17Il9TC#M18>)ow0(u>6FJNuHUv9lZN<|xOZj#xbi{uCrBC^mDAwBQ^ E0VIn*qW}N^ diff --git a/guarded-suspension/pom.xml b/guarded-suspension/pom.xml index 9e44d410b..e3a13f2c8 100644 --- a/guarded-suspension/pom.xml +++ b/guarded-suspension/pom.xml @@ -38,6 +38,7 @@ junit junit + test \ No newline at end of file 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 new file mode 100644 index 000000000..8747c84e5 --- /dev/null +++ b/guarded-suspension/src/main/java/com/iluwatar/guarded/suspension/App.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. + */ +/** + * 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; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +/** + * Created by robertt240 on 1/26/17. + */ +public class App { + /** + * Example pattern execution + * + * @param args - command line args + */ + public static void main(String[] args) { + GuardedQueue guardedQueue = new GuardedQueue(); + ExecutorService executorService = Executors.newFixedThreadPool(3); + + //here we create first thread which is supposed to get from guardedQueue + executorService.execute(() -> { + guardedQueue.get(); + } + ); + + //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 + executorService.execute(() -> { + guardedQueue.put(20); + } + ); + executorService.shutdown(); + try { + executorService.awaitTermination(30, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + +} 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 47939141f..89b330bfb 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 @@ -31,7 +31,7 @@ import java.util.Queue; public class GuardedQueue { private static final Logger LOGGER = LoggerFactory.getLogger(GuardedQueue.class); - private Queue sourceList; + private final Queue sourceList; public GuardedQueue() { this.sourceList = new LinkedList<>(); @@ -49,7 +49,7 @@ public class GuardedQueue { e.printStackTrace(); } } - + LOGGER.info("getting"); return sourceList.peek(); } @@ -57,9 +57,9 @@ public class GuardedQueue { * @param e number which we want to put to our queue */ public synchronized void put(Integer e) { + LOGGER.info("putting"); sourceList.add(e); - notify(); LOGGER.info("notifying"); - + notify(); } } diff --git a/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java b/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java index 45251acbf..41eaccd49 100644 --- a/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java +++ b/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java @@ -47,4 +47,12 @@ public class GuardedQueueTest { Assert.assertEquals(Integer.valueOf(10), value); } + @Test + public void testPut() { + GuardedQueue g = new GuardedQueue(); + g.put(12); + Assert.assertEquals(Integer.valueOf(12), g.get()); + + } + } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5ddd3bf98..d2ea715a7 100644 --- a/pom.xml +++ b/pom.xml @@ -121,7 +121,7 @@ factory-kit feature-toggle value-object - module + module monad mute-idiom mutex @@ -134,6 +134,8 @@ event-asynchronous queue-load-leveling object-mother + guarded-suspension + From 449aed1a5346f7cc2c58c76aa7f39368f32c7ed9 Mon Sep 17 00:00:00 2001 From: Robert Kasperczyk Date: Sat, 11 Mar 2017 12:02:04 +0100 Subject: [PATCH 49/67] changed parent POM version #69 --- guarded-suspension/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guarded-suspension/pom.xml b/guarded-suspension/pom.xml index e3a13f2c8..b51de54e1 100644 --- a/guarded-suspension/pom.xml +++ b/guarded-suspension/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.14.0-SNAPSHOT + 1.15.0-SNAPSHOT jar guarded-suspension From 8632bafcd7dfc28c141dd24ad258da9abe951c10 Mon Sep 17 00:00:00 2001 From: Kamil Pietruszka Date: Sat, 11 Mar 2017 12:24:48 +0100 Subject: [PATCH 50/67] comments, tests and description --- .../iluwatar/api/gateway/ImageClientImpl.java | 2 +- .../iluwatar/api/gateway/PriceClientImpl.java | 2 +- converter/README.md | 16 +++-- converter/pom.xml | 4 ++ .../main/java/com/iluwatar/converter/App.java | 29 ++++++++- .../com/iluwatar/converter/Converter.java | 27 +++++---- .../java/com/iluwatar/converter/User.java | 45 +++++++++----- .../com/iluwatar/converter/UserConverter.java | 40 +++++++++++++ .../java/com/iluwatar/converter/UserDto.java | 46 ++++++++++----- .../com/iluwatar/converter/ConverterTest.java | 59 +++++++++++++++++++ 10 files changed, 219 insertions(+), 51 deletions(-) create mode 100644 converter/src/main/java/com/iluwatar/converter/UserConverter.java create mode 100644 converter/src/test/java/com/iluwatar/converter/ConverterTest.java 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 10f8625c5..ebabfe839 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 @@ -35,7 +35,7 @@ import java.io.IOException; * An adapter to communicate with the Image microservice */ @Component -public class ImageClientImpl implements ImageClient{ +public class ImageClientImpl implements ImageClient { /** * Makes a simple HTTP Get request to the Image microservice * @return The path to the image 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 aa2686845..87f44761c 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 @@ -35,7 +35,7 @@ import java.io.IOException; * An adapter to communicate with the Price microservice */ @Component -public class PriceClientImpl implements PriceClient{ +public class PriceClientImpl implements PriceClient { /** * Makes a simple HTTP Get request to the Price microservice * @return The price of the product diff --git a/converter/README.md b/converter/README.md index cbca98e8f..190ae8bfc 100644 --- a/converter/README.md +++ b/converter/README.md @@ -10,16 +10,20 @@ tags: --- ## Intent -TODO +The purpose of the Converter Pattern is to provide a generic, common way of bidirectional +conversion between corresponding types, allowing a clean implementation in which the types do not +need to be aware of each other. Moreover, the Converter Pattern introduces bidirectional collection +mapping, reducing a boilerplate code to minimum. -![alt text](./etc/converter.png "TODO") +![alt text](./etc/converter.png "Converter Pattern") ## Applicability -TODO +Use the Converter Pattern in the following situations: -* TODO 1 -* TODO 2 +* When you have types that logically correspond which other and you need to convert entities between them +* When you want to provide different ways of types conversions depending on a context +* Whenever you introduce a DTO (Data transfer object), you will probably need to convert it into the domain equivalence ## Credits -* [Converter](http://todo.com) +* [Converter](http://www.xsolve.pl/blog/converter-pattern-in-java-8/) diff --git a/converter/pom.xml b/converter/pom.xml index 53eca720b..026f30d40 100644 --- a/converter/pom.xml +++ b/converter/pom.xml @@ -14,6 +14,10 @@ junit test + + com.google.guava + guava + converter diff --git a/converter/src/main/java/com/iluwatar/converter/App.java b/converter/src/main/java/com/iluwatar/converter/App.java index 91fbb98f8..1d6076fd9 100644 --- a/converter/src/main/java/com/iluwatar/converter/App.java +++ b/converter/src/main/java/com/iluwatar/converter/App.java @@ -22,6 +22,18 @@ */ package com.iluwatar.converter; + +import com.google.common.collect.Lists; + +import java.util.ArrayList; +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 + * isomorphic types). Moreover, the pattern introduces a common way of converting a collection of + * objects between types. + */ public class App { /** * Program entry point @@ -30,11 +42,22 @@ public class App { */ public static void main(String[] args) { Converter userConverter = new Converter<>( - userDto -> new User(userDto.getFirstName(), userDto.getLastName(), userDto.isActive()), - user -> new UserDto(user.getFirstName(), user.getLastName(), user.isActive())); - UserDto dtoUser = new UserDto("John", "Doe", true); + userDto -> new User(userDto.getFirstName(), userDto.getLastName(), userDto.isActive(), + userDto.getEmail()), + user -> new UserDto(user.getFirstName(), user.getLastName(), user.isActive(), user.getUserId())); + + UserDto dtoUser = new UserDto("John", "Doe", true, "whatever[at]wherever.com"); User user = userConverter.convertFromDto(dtoUser); UserDto dtoUserCopy = userConverter.convertFromEntity(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); + + System.out.println("DTO entities converted from domain:"); + List dtoEntities = userConverter.createFromEntities(users); + dtoEntities.forEach(System.out::println); + } } diff --git a/converter/src/main/java/com/iluwatar/converter/Converter.java b/converter/src/main/java/com/iluwatar/converter/Converter.java index 7f7a702cd..eeabc4102 100644 --- a/converter/src/main/java/com/iluwatar/converter/Converter.java +++ b/converter/src/main/java/com/iluwatar/converter/Converter.java @@ -29,6 +29,9 @@ import java.util.function.Function; import java.util.stream.Collectors; /** + * 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 + * of the same type, reducing boilerplate code to the absolute minimum. * @param DTO representation's type * @param Domain representation's type */ @@ -47,37 +50,37 @@ public class Converter { } /** - * @param arg DTO entity + * @param userDto DTO entity * @return The domain representation - the result of the converting function application on dto entity. */ - public U convertFromDto(final T arg) { - return fromDto.apply(arg); + public final U convertFromDto(final T userDto) { + return fromDto.apply(userDto); } /** - * @param arg domain entity + * @param user domain entity * @return The DTO representation - the result of the converting function application on domain entity. */ - public T convertFromEntity(final U arg) { - return fromEntity.apply(arg); + public final T convertFromEntity(final U user) { + return fromEntity.apply(user); } /** - * @param arg collection of DTO entities + * @param dtoUsers collection of DTO entities * @return List of domain representation of provided entities retrieved by * mapping each of them with the convertion function */ - public List createFromDtos(final Collection arg) { - return arg.stream().map(this::convertFromDto).collect(Collectors.toList()); + public final List createFromDtos(final Collection dtoUsers) { + return dtoUsers.stream().map(this::convertFromDto).collect(Collectors.toList()); } /** - * @param arg collection of domain entities + * @param users collection of domain entities * @return List of domain representation of provided entities retrieved by * mapping each of them with the convertion function */ - public List createFromEntities(final Collection arg) { - return arg.stream().map(this::convertFromEntity).collect(Collectors.toList()); + public final List createFromEntities(final Collection users) { + return users.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 8a4e9186c..f40c01e79 100644 --- a/converter/src/main/java/com/iluwatar/converter/User.java +++ b/converter/src/main/java/com/iluwatar/converter/User.java @@ -23,44 +23,61 @@ package com.iluwatar.converter; +import java.util.Objects; + public class User { private String firstName; private String lastName; private boolean isActive; + private String userId; /** - * * @param firstName user's first name - * @param lastName user's last name - * @param isActive flag indicating whether the user is active + * @param lastName user's last name + * @param isActive flag indicating whether the user is active + * @param userId user's identificator */ - public User(String firstName, String lastName, boolean isActive) { + public User(String firstName, String lastName, boolean isActive, String userId) { this.firstName = firstName; this.lastName = lastName; this.isActive = isActive; + this.userId = userId; } public String getFirstName() { return firstName; } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - public String getLastName() { return lastName; } - public void setLastName(String lastName) { - this.lastName = lastName; - } - public boolean isActive() { return isActive; } - public void setActive(boolean active) { - isActive = active; + public String getUserId() { + return userId; + } + + @Override public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return isActive == user.isActive && Objects.equals(firstName, user.firstName) && Objects + .equals(lastName, user.lastName) && Objects.equals(userId, user.userId); + } + + @Override public int hashCode() { + return Objects.hash(firstName, lastName, isActive, userId); + } + + @Override public String toString() { + return "User{" + "firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + + ", 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 new file mode 100644 index 000000000..9ef1d03c2 --- /dev/null +++ b/converter/src/main/java/com/iluwatar/converter/UserConverter.java @@ -0,0 +1,40 @@ +/** + * 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.converter; + +/** + * Example implementation of the simple User converter. + */ +public class UserConverter extends Converter { + + /** + * Constructor. + */ + public UserConverter() { + super(userDto -> new User(userDto.getFirstName(), userDto.getLastName(), userDto.isActive(), + userDto.getEmail()), + user -> new UserDto(user.getFirstName(), user.getLastName(), user.isActive(), + 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 bdadf6e39..8f55bbe0e 100644 --- a/converter/src/main/java/com/iluwatar/converter/UserDto.java +++ b/converter/src/main/java/com/iluwatar/converter/UserDto.java @@ -24,44 +24,62 @@ package com.iluwatar.converter; +import java.util.Objects; + public class UserDto { + private String firstName; private String lastName; private boolean isActive; + private String email; /** - * * @param firstName user's first name - * @param lastName user's last name - * @param isActive flag indicating whether the user is active + * @param lastName user's last name + * @param isActive flag indicating whether the user is active + * @param email user's email address */ - public UserDto(String firstName, String lastName, boolean isActive) { + public UserDto(String firstName, String lastName, boolean isActive, String email) { this.firstName = firstName; this.lastName = lastName; this.isActive = isActive; + this.email = email; } public String getFirstName() { return firstName; } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - public String getLastName() { return lastName; } - public void setLastName(String lastName) { - this.lastName = lastName; - } - public boolean isActive() { return isActive; } - public void setActive(boolean active) { - isActive = active; + public String getEmail() { + return email; + } + + @Override public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserDto userDto = (UserDto) o; + return isActive == userDto.isActive && Objects.equals(firstName, userDto.firstName) && Objects + .equals(lastName, userDto.lastName) && Objects.equals(email, userDto.email); + } + + @Override public int hashCode() { + return Objects.hash(firstName, lastName, isActive, email); + } + + @Override public String toString() { + return "UserDto{" + "firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + + ", isActive=" + isActive + ", email='" + email + '\'' + '}'; } } diff --git a/converter/src/test/java/com/iluwatar/converter/ConverterTest.java b/converter/src/test/java/com/iluwatar/converter/ConverterTest.java new file mode 100644 index 000000000..45cebc4e6 --- /dev/null +++ b/converter/src/test/java/com/iluwatar/converter/ConverterTest.java @@ -0,0 +1,59 @@ +package com.iluwatar.converter; + +import com.google.common.collect.Lists; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import static junit.framework.TestCase.assertEquals; + +public class ConverterTest { + + private UserConverter userConverter = new UserConverter(); + + /** + * Tests whether a converter created of opposite functions holds equality as a bijection. + */ + @Test public void testConversionsStartingFromDomain() { + User u1 = new User("Tom", "Hanks", true, "tom@hanks.com"); + User u2 = userConverter.convertFromDto(userConverter.convertFromEntity(u1)); + assertEquals(u1, u2); + } + + /** + * Tests whether a converter created of opposite functions holds equality as a bijection. + */ + @Test public void testConversionsStartingFromDto() { + UserDto u1 = new UserDto("Tom", "Hanks", true, "tom@hanks.com"); + UserDto u2 = userConverter.convertFromEntity(userConverter.convertFromDto(u1)); + assertEquals(u1, u2); + } + + /** + * Tests the custom users converter. Thanks to Java8 lambdas, converter can be easily and + * cleanly instantiated allowing various different conversion strategies to be implemented. + */ + @Test public void testCustomConverter() { + Converter converter = new Converter<>( + userDto -> new User(userDto.getFirstName(), userDto.getLastName(), userDto.isActive(), + String.valueOf(new Random().nextInt())), + user -> new UserDto(user.getFirstName(), user.getLastName(), user.isActive(), + user.getFirstName().toLowerCase() + user.getLastName().toLowerCase() + "@whatever.com")); + User u1 = new User("John", "Doe", false, "12324"); + UserDto userDto = converter.convertFromEntity(u1); + assertEquals(userDto.getEmail(), "johndoe@whatever.com"); + } + + /** + * Test whether converting a collection of Users to DTO Users and then converting them back to domain + * users returns an equal collection. + */ + @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 fromDtos = userConverter.createFromDtos(userConverter.createFromEntities(users)); + assertEquals(fromDtos, users); + } +} From 3a243eee6e77f46b72711706771b2d6e1394c525 Mon Sep 17 00:00:00 2001 From: Kamil Pietruszka Date: Sat, 11 Mar 2017 12:47:58 +0100 Subject: [PATCH 51/67] diagrams added --- converter/etc/Converter.png | Bin 0 -> 19389 bytes converter/etc/Converter.ucls | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 converter/etc/Converter.png create mode 100644 converter/etc/Converter.ucls diff --git a/converter/etc/Converter.png b/converter/etc/Converter.png new file mode 100644 index 0000000000000000000000000000000000000000..01435ef5ae29dbda20c7078291a8c1c912003000 GIT binary patch literal 19389 zcmcJ%by$_#+Bd4A6Qre^NlABigLFuDcc-+ZG$J4^-QC?K69MT4=@Jm6^E}{kt^Mw` z_Ws`QI_L1u9M_!BGsZo}xbNTHgviT^Bf#RoK6>;BLE@E&;-g1T+8;f7{1N5}@Xduo z=J2COQUMYof=X{v_EK%b@m0NU%g}B}FP}`%|9pv3B9E?2t0ps$TZpD9gG(p&LM1d@ zU&_kw^(YI4VU4O@Y~cHw?$KY|3Rl4|5y&sr3|FE2{I{Sk!1R_Fywyoxnd zHdT)8_0jE6YMbd$+J)o6d}<!8C-Yh20gvOx{Lj6J#{f}}Br{cAq3#D? z`Sif|pYk{%zSAvNb?%Q?u!J(5waK;c)6u?C*`Zg~qCyefG7_{s);HXiswS{=ZdVj3 z`l<|>?GFx0qq~_S)$7`>Qo(|3@>DXSzgj;Sj?P=w-?^AMSO0^+{-QkGB;XIQDJwlJr?OX9wN=E3w*hxF^~LMiaH z3-X#eHfbuf!qCi@Bb{+7UMMefsERRs+MgtXZUi*W7t^Z_qebL{*Scz(LoZ5HhTH=S zaRR@IeU)n@d&0QO{^D#a$+v#@xaG`h{%UXPP64lH*!$vV*V1j+Tixrt9D1I+^ly2? z-m2H7F8u6)8s!gn9M_z8G(JJa-UgDA=1ZXH1 z3A5c(;CP{Cj3L!nJfuzba16@3<}e2^8rjOW#5HMkkZoXf>y!Nj-KO2+i4f+Sk>RE5 zuc~*)u5Cx;eg@06aZz4I)=T)iY4z6YtKRy_zOQ_iC{5F0J5~EdtfRlLam9>VORB!J z@O6Y}Mhu~WIz7W_Nq?S)||FoXx?M2_d+LF(~j}G01bAEd; z|9L;s-Ol_Gd#QBz&fVhqgy}n^#VY&r3?H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ir04hl0JmNfk^lez literal 0 HcmV?d00001 diff --git a/converter/etc/Converter.ucls b/converter/etc/Converter.ucls new file mode 100644 index 000000000..368657430 --- /dev/null +++ b/converter/etc/Converter.ucls @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 2ed7acbc31ef08e77fc6f0808a22ad86f47354ce Mon Sep 17 00:00:00 2001 From: Kamil Pietruszka Date: Sat, 11 Mar 2017 13:02:29 +0100 Subject: [PATCH 52/67] fixed checkstyle violations --- .../src/test/java/com/iluwatar/converter/ConverterTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/converter/src/test/java/com/iluwatar/converter/ConverterTest.java b/converter/src/test/java/com/iluwatar/converter/ConverterTest.java index 45cebc4e6..eccb81cf9 100644 --- a/converter/src/test/java/com/iluwatar/converter/ConverterTest.java +++ b/converter/src/test/java/com/iluwatar/converter/ConverterTest.java @@ -37,9 +37,9 @@ public class ConverterTest { */ @Test public void testCustomConverter() { Converter converter = new Converter<>( - userDto -> new User(userDto.getFirstName(), userDto.getLastName(), userDto.isActive(), + userDto -> new User(userDto.getFirstName(), userDto.getLastName(), userDto.isActive(), String.valueOf(new Random().nextInt())), - user -> new UserDto(user.getFirstName(), user.getLastName(), user.isActive(), + user -> new UserDto(user.getFirstName(), user.getLastName(), user.isActive(), user.getFirstName().toLowerCase() + user.getLastName().toLowerCase() + "@whatever.com")); User u1 = new User("John", "Doe", false, "12324"); UserDto userDto = converter.convertFromEntity(u1); @@ -52,7 +52,7 @@ public class ConverterTest { */ @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")); + new User("Marti", "Luther", true, "42309fd"), new User("Kate", "Smith", true, "if0243")); List fromDtos = userConverter.createFromDtos(userConverter.createFromEntities(users)); assertEquals(fromDtos, users); } From 77a534385cba9b357b4e73c57c42faebe74de0c3 Mon Sep 17 00:00:00 2001 From: Kamil Pietruszka Date: Sat, 11 Mar 2017 13:35:55 +0100 Subject: [PATCH 53/67] fixed pmd violation --- converter/src/main/java/com/iluwatar/converter/App.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/converter/src/main/java/com/iluwatar/converter/App.java b/converter/src/main/java/com/iluwatar/converter/App.java index 1d6076fd9..fbae0309d 100644 --- a/converter/src/main/java/com/iluwatar/converter/App.java +++ b/converter/src/main/java/com/iluwatar/converter/App.java @@ -48,7 +48,7 @@ public class App { UserDto dtoUser = new UserDto("John", "Doe", true, "whatever[at]wherever.com"); User user = userConverter.convertFromDto(dtoUser); - UserDto dtoUserCopy = userConverter.convertFromEntity(user); + System.out.println("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")); From 1aed5905d78689f36a9cc0b9071bb58f3759cffc Mon Sep 17 00:00:00 2001 From: Katarzyna Rzepecka Date: Fri, 6 Jan 2017 01:20:59 +0100 Subject: [PATCH 54/67] #66 Balking Pattern --- balking/README.md | 23 ++++++ balking/etc/balking.png | Bin 0 -> 21427 bytes balking/etc/balking.ucls | 46 +++++++++++ balking/etc/balking.urm.puml | 24 ++++++ balking/pom.xml | 46 +++++++++++ .../main/java/com/iluwatar/balking/App.java | 53 +++++++++++++ .../com/iluwatar/balking/WashingMachine.java | 73 ++++++++++++++++++ .../iluwatar/balking/WashingMachineState.java | 25 ++++++ .../java/com/iluwatar/balking/AppTest.java | 32 ++++++++ .../iluwatar/balking/WashingMachineTest.java | 62 +++++++++++++++ 10 files changed, 384 insertions(+) create mode 100644 balking/README.md create mode 100644 balking/etc/balking.png create mode 100644 balking/etc/balking.ucls create mode 100644 balking/etc/balking.urm.puml create mode 100644 balking/pom.xml create mode 100644 balking/src/main/java/com/iluwatar/balking/App.java create mode 100644 balking/src/main/java/com/iluwatar/balking/WashingMachine.java create mode 100644 balking/src/main/java/com/iluwatar/balking/WashingMachineState.java create mode 100644 balking/src/test/java/com/iluwatar/balking/AppTest.java create mode 100644 balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java diff --git a/balking/README.md b/balking/README.md new file mode 100644 index 000000000..e5f8a6711 --- /dev/null +++ b/balking/README.md @@ -0,0 +1,23 @@ +--- +layout: pattern +title: Balking +folder: balking +permalink: /patterns/balking/ +categories: Concurrency +tags: + - Java + - Difficulty-Beginner +--- + +## Intent +Balking Pattern is used to prevent an object from executing certain code if it is an +incomplete or inappropriate state + +![alt text](./etc/balking.png "Balking") + +## Applicability +Use the Balking pattern when + +*you want to invoke an action on an object only when it is in a particular state +*objects are generally only in a state that is prone to balking temporarily +but for an unknown amount of time \ No newline at end of file diff --git a/balking/etc/balking.png b/balking/etc/balking.png new file mode 100644 index 0000000000000000000000000000000000000000..f409eaacbb951b01f4bbeb5b6b6f51bed1a86179 GIT binary patch literal 21427 zcmcG#RY084k}eu)po2CL+!_r8cL~-IBxrD#;O?%Wakt>^?(RW?1oz;<-Q8~|d+)h> zX70>6FZY25daZwXeO2{URq$sSF%(36#1}7KpnMYlDF5Qc%Tm}M8}JqEm*wO)XL0F1mBP%ub5dm6D*JF@~DT}KN9tQF0K`af2GVJiO4x1&wwpV===6<$+9UiT|7qXXsC08KJ$yAJw^sexx^p<)rc~cHHq+q2+{BIdr(kDa^1{KaWJF9*?m~o(AtSiu5vX{1m?ni=ijsUvAk_0I)<95=-YuNNJ z0UtOW)ZaMC3Pow!-zYw~;7G=PmkzElSyaG1cr0S3^{g+-3om*tvtX+IAP`>AFjquZ z{yisU-2U2~+J7UiekI^%Jdsy%fZPem#!UV5vCaHsl9;g)anu+;Q?m^exVC2bS-*WSoA(^ zqbw?@FHU5bFk-}BQDr|{6eXpUPGuLLJRh)3YE*ZiYt?mW4OTR!+o$}DUp{|7Enzz& zgCX`s^>LT4uQTI-V^+=XYnX+CHyx|#YzNybF~ogfoOOluJfWVc)i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;VdiSlF z`9*65{Iaug?QVRuKU!m}zW7cRzihn2XKwuqs(|GeP?al?86U#HL2(^VtYG);gT@A u_*XZG)q$8o_go6e`oInc#$np-{;R6Zn}I3FF$fsOdBE7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/balking/etc/balking.urm.puml b/balking/etc/balking.urm.puml new file mode 100644 index 000000000..b0296b925 --- /dev/null +++ b/balking/etc/balking.urm.puml @@ -0,0 +1,24 @@ +@startuml +package com.iluwatar.balking { + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} + } + class WashingMachine { + - LOGGER : Logger {static} + - washingMachineState : WashingMachineState + + WashingMachine() + + endOfWashing() + + getWashingMachineState() : WashingMachineState + + wash() + } + enum WashingMachineState { + + ENABLED {static} + + WASHING {static} + + valueOf(name : String) : WashingMachineState {static} + + values() : WashingMachineState[] {static} + } +} +WashingMachine --> "-washingMachineState" WashingMachineState +@enduml \ No newline at end of file diff --git a/balking/pom.xml b/balking/pom.xml new file mode 100644 index 000000000..e5b8f11f3 --- /dev/null +++ b/balking/pom.xml @@ -0,0 +1,46 @@ + + + + + java-design-patterns + com.iluwatar + 1.14.0-SNAPSHOT + + 4.0.0 + + balking + + + junit + junit + test + + + + + \ No newline at end of file diff --git a/balking/src/main/java/com/iluwatar/balking/App.java b/balking/src/main/java/com/iluwatar/balking/App.java new file mode 100644 index 000000000..8fb0edcb0 --- /dev/null +++ b/balking/src/main/java/com/iluwatar/balking/App.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.balking; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class App { + + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); + + /** + * @param args the command line arguments - not used + */ + public static void main(String... args) { + final WashingMachine washingMachine = new WashingMachine(); + ExecutorService executorService = Executors.newFixedThreadPool(3); + for (int i = 0; i < 3; i++) { + executorService.execute(washingMachine::wash); + } + executorService.shutdown(); + try { + executorService.awaitTermination(10, TimeUnit.SECONDS); + } catch (InterruptedException ie) { + LOGGER.error("ERROR: Waiting on executor service shutdown!"); + } + } + +} diff --git a/balking/src/main/java/com/iluwatar/balking/WashingMachine.java b/balking/src/main/java/com/iluwatar/balking/WashingMachine.java new file mode 100644 index 000000000..fd4455e70 --- /dev/null +++ b/balking/src/main/java/com/iluwatar/balking/WashingMachine.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.balking; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class WashingMachine { + + private static final Logger LOGGER = LoggerFactory.getLogger(WashingMachine.class); + + private WashingMachineState washingMachineState; + + public WashingMachine() { + washingMachineState = WashingMachineState.ENABLED; + } + + public WashingMachineState getWashingMachineState() { + return washingMachineState; + } + + /** + * 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) { + LOGGER.error("ERROR: Cannot wash if the machine has been already washing!"); + return; + } + washingMachineState = WashingMachineState.WASHING; + } + LOGGER.info("{}: Doing the washing", Thread.currentThread().getName()); + try { + Thread.sleep(50); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + endOfWashing(); + } + + /** + * Method responsible of ending the washing + * by changing machine state + */ + public synchronized void endOfWashing() { + washingMachineState = WashingMachineState.ENABLED; + LOGGER.info("{}: Washing completed.", Thread.currentThread().getId()); + } + +} diff --git a/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java b/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java new file mode 100644 index 000000000..9d6cf875a --- /dev/null +++ b/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java @@ -0,0 +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.balking; + +public enum WashingMachineState {ENABLED, WASHING} diff --git a/balking/src/test/java/com/iluwatar/balking/AppTest.java b/balking/src/test/java/com/iluwatar/balking/AppTest.java new file mode 100644 index 000000000..8b647e1a6 --- /dev/null +++ b/balking/src/test/java/com/iluwatar/balking/AppTest.java @@ -0,0 +1,32 @@ +/** + * 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.balking; + +public class AppTest { + @org.junit.Test + public void main() throws Exception { + String[] args = {}; + App.main(args); + } + +} \ No newline at end of file diff --git a/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java b/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java new file mode 100644 index 000000000..2c7527676 --- /dev/null +++ b/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java @@ -0,0 +1,62 @@ +/** + * 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.balking; + +import org.junit.Test; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.*; + +public class WashingMachineTest { + + private volatile WashingMachineState machineStateGlobal; + + @Test + public void wash() throws Exception { + WashingMachine washingMachine = new WashingMachine(); + ExecutorService executorService = Executors.newFixedThreadPool(2); + executorService.execute(washingMachine::wash); + executorService.execute(() -> { + washingMachine.wash(); + machineStateGlobal = washingMachine.getWashingMachineState(); + }); + executorService.shutdown(); + try { + executorService.awaitTermination(10, TimeUnit.SECONDS); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + assertEquals(WashingMachineState.WASHING, machineStateGlobal); + } + + @Test + public void endOfWashing() throws Exception { + WashingMachine washingMachine = new WashingMachine(); + washingMachine.wash(); + assertEquals(WashingMachineState.ENABLED, washingMachine.getWashingMachineState()); + } + +} \ No newline at end of file From bb4a1bdc05ac0cc5500c5dc40b4b6724d22f9b39 Mon Sep 17 00:00:00 2001 From: Katarzyna Rzepecka Date: Mon, 9 Jan 2017 22:54:20 +0100 Subject: [PATCH 55/67] Pom.xml files fixed. --- balking/pom.xml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/balking/pom.xml b/balking/pom.xml index e5b8f11f3..fe54815cb 100644 --- a/balking/pom.xml +++ b/balking/pom.xml @@ -26,21 +26,21 @@ - - java-design-patterns - com.iluwatar - 1.14.0-SNAPSHOT - - 4.0.0 + + java-design-patterns + com.iluwatar + 1.14.0-SNAPSHOT + + 4.0.0 - balking - - - junit - junit - test - - + balking + + + junit + junit + test + + \ No newline at end of file From cca4d5a670e3dbff8a64b8635d2604827211a38b Mon Sep 17 00:00:00 2001 From: Katarzyna Rzepecka Date: Mon, 13 Mar 2017 01:33:14 +0100 Subject: [PATCH 56/67] Update after changes from review. Additional improvements. --- balking/README.md | 6 +++++- balking/pom.xml | 2 +- .../main/java/com/iluwatar/balking/App.java | 18 +++++++++++++++--- .../com/iluwatar/balking/WashingMachine.java | 6 +++--- .../iluwatar/balking/WashingMachineState.java | 15 +++++++++++---- .../java/com/iluwatar/balking/AppTest.java | 15 +++++++++++---- .../iluwatar/balking/WashingMachineTest.java | 6 +++--- pom.xml | 1 + 8 files changed, 50 insertions(+), 19 deletions(-) diff --git a/balking/README.md b/balking/README.md index e5f8a6711..1ca7ccfb1 100644 --- a/balking/README.md +++ b/balking/README.md @@ -20,4 +20,8 @@ Use the Balking pattern when *you want to invoke an action on an object only when it is in a particular state *objects are generally only in a state that is prone to balking temporarily -but for an unknown amount of time \ No newline at end of file +but for an unknown amount of time + +## Related patterns +* Guarded Suspendion Pattern +* Double Checked Locking Pattern \ No newline at end of file diff --git a/balking/pom.xml b/balking/pom.xml index fe54815cb..ad066aee6 100644 --- a/balking/pom.xml +++ b/balking/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.14.0-SNAPSHOT + 1.15.0-SNAPSHOT 4.0.0 diff --git a/balking/src/main/java/com/iluwatar/balking/App.java b/balking/src/main/java/com/iluwatar/balking/App.java index 8fb0edcb0..47b10cd46 100644 --- a/balking/src/main/java/com/iluwatar/balking/App.java +++ b/balking/src/main/java/com/iluwatar/balking/App.java @@ -1,17 +1,17 @@ /** * 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 @@ -29,6 +29,18 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +/** + * 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 + * + * 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 { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); diff --git a/balking/src/main/java/com/iluwatar/balking/WashingMachine.java b/balking/src/main/java/com/iluwatar/balking/WashingMachine.java index fd4455e70..2167a0e52 100644 --- a/balking/src/main/java/com/iluwatar/balking/WashingMachine.java +++ b/balking/src/main/java/com/iluwatar/balking/WashingMachine.java @@ -1,17 +1,17 @@ /** * 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 diff --git a/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java b/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java index 9d6cf875a..40a5b2f38 100644 --- a/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java +++ b/balking/src/main/java/com/iluwatar/balking/WashingMachineState.java @@ -1,17 +1,17 @@ /** * 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 @@ -22,4 +22,11 @@ */ package com.iluwatar.balking; -public enum WashingMachineState {ENABLED, 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/AppTest.java b/balking/src/test/java/com/iluwatar/balking/AppTest.java index 8b647e1a6..df104b901 100644 --- a/balking/src/test/java/com/iluwatar/balking/AppTest.java +++ b/balking/src/test/java/com/iluwatar/balking/AppTest.java @@ -1,17 +1,17 @@ /** * 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 @@ -20,10 +20,17 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + package com.iluwatar.balking; +import org.junit.Test; + +/** + * Application test + */ public class AppTest { - @org.junit.Test + + @Test public void main() throws Exception { String[] args = {}; App.main(args); diff --git a/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java b/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java index 2c7527676..3dc87d64f 100644 --- a/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java +++ b/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java @@ -1,17 +1,17 @@ /** * 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 diff --git a/pom.xml b/pom.xml index d2ea715a7..925aea6ed 100644 --- a/pom.xml +++ b/pom.xml @@ -135,6 +135,7 @@ queue-load-leveling object-mother guarded-suspension + balking From 2c2d874ac89fdceda239e55ac26ce1470a543aae Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 18 Mar 2017 10:00:13 +0100 Subject: [PATCH 57/67] Update App.java Correction of error detected by maven-pmd-plugin. --- tls/src/main/java/com/iluwatar/tls/App.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tls/src/main/java/com/iluwatar/tls/App.java b/tls/src/main/java/com/iluwatar/tls/App.java index 80e87042c..bc67d0c2c 100644 --- a/tls/src/main/java/com/iluwatar/tls/App.java +++ b/tls/src/main/java/com/iluwatar/tls/App.java @@ -104,7 +104,7 @@ public class App { System.out.println("The List exceptionList contains " + counterExceptions + " exceptions"); } catch (Exception e) { - // no action here + System.out.println("Abnormal end of program. Program throws exception: "); } executor.shutdown(); } From f84c4c161120fa18ae2a1c854e61229df23b9aef Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 18 Mar 2017 10:02:37 +0100 Subject: [PATCH 58/67] Update App.java Correction of correction ;-) --- tls/src/main/java/com/iluwatar/tls/App.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tls/src/main/java/com/iluwatar/tls/App.java b/tls/src/main/java/com/iluwatar/tls/App.java index bc67d0c2c..634d36d26 100644 --- a/tls/src/main/java/com/iluwatar/tls/App.java +++ b/tls/src/main/java/com/iluwatar/tls/App.java @@ -104,7 +104,7 @@ public class App { System.out.println("The List exceptionList contains " + counterExceptions + " exceptions"); } catch (Exception e) { - System.out.println("Abnormal end of program. Program throws exception: "); + System.out.println("Abnormal end of program. Program throws exception: " + e); } executor.shutdown(); } From 09585c3874e9b8a3e59bb044f96baec1be0c07b7 Mon Sep 17 00:00:00 2001 From: Mudit Porwal Date: Wed, 22 Mar 2017 01:16:01 +0800 Subject: [PATCH 59/67] Removed AvoidStarImport Rule Added JavaDocType Rule --- .../abstractfactory/AbstractFactoryTest.java | 3 ++ .../aggregator/microservices/App.java | 3 ++ .../microservices/AggregatorTest.java | 11 +++--- .../microservice/InformationController.java | 3 ++ .../InformationControllerTest.java | 5 ++- .../microservice/InventoryController.java | 3 ++ .../microservice/InventoryControllerTest.java | 6 ++-- .../iluwatar/api/gateway/ImageClientImpl.java | 2 +- .../iluwatar/api/gateway/PriceClientImpl.java | 2 +- .../iluwatar/api/gateway/ApiGatewayTest.java | 9 +++-- .../microservice/ImageControllerTest.java | 3 ++ .../microservice/PriceControllerTest.java | 4 +++ .../async/method/invocation/AsyncResult.java | 2 +- checkstyle.xml | 15 ++++---- .../com/iluwatar/dao/CustomerSchemaSql.java | 9 +++-- .../java/com/iluwatar/dao/CustomerTest.java | 3 ++ .../java/com/iluwatar/datamapper/Student.java | 23 ++++++------ .../datamapper/StudentDataMapper.java | 3 ++ .../datamapper/StudentDataMapperImpl.java | 3 ++ .../com/iluwatar/datamapper/StudentTest.java | 10 ++++-- .../delegation/simple/PrinterController.java | 6 ++++ .../iluwatar/delegation/simple/AppTest.java | 4 ++- .../delegation/simple/DelegateTest.java | 15 +++++--- .../injection/utils/InMemoryAppender.java | 4 +++ .../doubledispatch/CollisionTest.java | 7 ++-- .../event/aggregator/EventEmitterTest.java | 18 +++++----- .../EventDoesNotExistException.java | 3 ++ .../iluwatar/event/asynchronous/IEvent.java | 4 +++ .../InvalidOperationException.java | 3 ++ .../LongRunningEventException.java | 3 ++ .../MaxNumOfEventsAllowedException.java | 3 ++ .../asynchronous/ThreadCompleteListener.java | 3 ++ .../com/iluwatar/eda/framework/Handler.java | 3 +- .../java/com/iluwatar/factorykit/Axe.java | 3 ++ .../java/com/iluwatar/factorykit/Bow.java | 3 ++ .../java/com/iluwatar/factorykit/Spear.java | 4 ++- .../java/com/iluwatar/factorykit/Sword.java | 4 ++- .../com/iluwatar/factorykit/app/AppTest.java | 3 ++ .../factorykit/factorykit/FactoryKitTest.java | 17 ++++++--- .../PropertiesFeatureToggleVersionTest.java | 16 +++++---- .../TieredFeatureToggleVersionTest.java | 11 +++--- .../featuretoggle/user/UserGroupTest.java | 9 +++-- .../lazy/DecoratingIterator.java | 7 ++-- .../iluwatar/fluentinterface/app/AppTest.java | 4 ++- .../controller/utils/InMemoryAppender.java | 3 ++ .../guarded/suspension/GuardedQueue.java | 7 +++- .../guarded/suspension/GuardedQueueTest.java | 5 ++- .../domain/LotteryTicketCheckResult.java | 9 +++-- .../hexagonal/domain/LotteryTicketTest.java | 3 ++ .../iluwatar/interpreter/ExpressionTest.java | 9 ++--- .../model/view/controller/GiantViewTest.java | 14 ++++---- .../src/main/java/com/iluwatar/monad/Sex.java | 3 ++ .../main/java/com/iluwatar/monad/User.java | 3 ++ .../test/java/com/iluwatar/monad/AppTest.java | 3 ++ .../java/com/iluwatar/monad/MonadTest.java | 3 ++ .../java/com/iluwatar/monostate/AppTest.java | 3 ++ .../test/java/com/iluwatar/mute/MuteTest.java | 25 +++++++------ .../test/java/com/iluwatar/mutex/AppTest.java | 5 ++- .../dom/app/homepage/HomePageService.java | 8 +++-- .../dom/app/homepage/HomePageViewModel.java | 9 +++-- .../dom/modules/simple/SimpleObject.java | 12 +++++-- .../dom/modules/simple/SimpleObjects.java | 10 ++++-- .../dom/modules/simple/SimpleObjectTest.java | 10 ++++-- .../dom/modules/simple/SimpleObjectsTest.java | 22 +++++++----- .../modules/simple/SimpleObjectCreate.java | 11 +++--- .../modules/simple/SimpleObjectsTearDown.java | 9 +++-- .../scenarios/RecreateSimpleObjects.java | 12 ++++--- .../bootstrap/SimpleAppSystemInitializer.java | 7 ++-- .../specglue/BootstrappingGlue.java | 3 ++ .../specglue/CatalogOfFixturesGlue.java | 3 ++ .../modules/simple/SimpleObjectGlue.java | 14 ++++---- .../integtests/tests/SimpleAppIntegTest.java | 4 ++- .../modules/simple/SimpleObjectIntegTest.java | 32 +++++++++++------ .../simple/SimpleObjectsIntegTest.java | 36 +++++++++++-------- .../java/com/iluwatar/objectmother/King.java | 9 +++-- .../java/com/iluwatar/objectmother/Queen.java | 7 ++-- .../com/iluwatar/objectmother/Royalty.java | 9 +++-- .../objectmother/RoyaltyObjectMother.java | 15 ++++---- .../test/RoyaltyObjectMotherTest.java | 15 ++++---- .../com/iluwatar/object/pool/ObjectPool.java | 2 +- .../iluwatar/observer/generic/Observer.java | 4 ++- .../observer/WeatherObserverTest.java | 10 +++--- .../observer/generic/ObserverTest.java | 10 +++--- .../observer/utils/InMemoryAppender.java | 3 ++ .../pageobject/AlbumListPageTest.java | 8 +++-- .../iluwatar/pageobject/AlbumPageTest.java | 7 ++-- .../iluwatar/pageobject/LoginPageTest.java | 7 ++-- .../com/iluwatar/poison/pill/Message.java | 3 ++ .../utils/InMemoryAppender.java | 3 ++ .../java/com/iluwatar/promise/Utility.java | 3 ++ .../java/com/iluwatar/property/Character.java | 3 ++ .../com/iluwatar/prototype/PrototypeTest.java | 15 ++++---- .../proxy/utils/InMemoryAppender.java | 4 +++ .../writer/lock/utils/InMemoryAppender.java | 3 ++ .../repository/PersonSpecifications.java | 3 ++ .../is/initialization/ClosableTest.java | 12 ++++--- .../java/com/iluwatar/semaphore/Fruit.java | 21 ++++++----- .../java/com/iluwatar/semaphore/AppTest.java | 5 ++- .../servicelayer/common/BaseDaoTest.java | 24 ++++++------- .../com/iluwatar/singleton/SingletonTest.java | 9 +++-- .../templatemethod/StealingMethodTest.java | 13 ++++--- .../com/iluwatar/threadpool/TaskTest.java | 12 +++---- .../java/com/iluwatar/twin/BallItemTest.java | 18 ++++++---- .../java/com/iluwatar/visitor/UnitTest.java | 14 ++++---- .../com/iluwatar/visitor/VisitorTest.java | 14 ++++---- 105 files changed, 577 insertions(+), 284 deletions(-) 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 82fd8acff..b6fca8b23 100644 --- a/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AbstractFactoryTest.java +++ b/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AbstractFactoryTest.java @@ -28,6 +28,9 @@ import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; +/** + * Test for abstract factory + */ public class AbstractFactoryTest { private App app = new App(); 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 2c14774d5..c43112c2e 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 @@ -25,6 +25,9 @@ package com.iluwatar.aggregator.microservices; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +/** + * Spring Boot EntryPoint Class + */ @SpringBootApplication public class App { 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 f44aa2044..2955f6781 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 @@ -22,15 +22,18 @@ */ package com.iluwatar.aggregator.microservices; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - +/** + * Test Aggregation of domain objects + */ public class AggregatorTest { @InjectMocks @@ -64,4 +67,4 @@ public class AggregatorTest { assertEquals(inventories, testProduct.getProductInventories()); } -} \ No newline at end of file +} 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 ff020585c..63b6fb9d5 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 @@ -26,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +/** + * Controller providing endpoints to retrieve information about products + */ @RestController public class InformationController { 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 12d59aee6..127dd3956 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 @@ -25,6 +25,9 @@ package com.iluwatar.information.microservice; import org.junit.Assert; import org.junit.Test; +/** + * Test for Information Rest Controller + */ public class InformationControllerTest { @Test @@ -36,4 +39,4 @@ public class InformationControllerTest { Assert.assertEquals("The Product Title.", title); } -} \ No newline at end of file +} 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 987ab0b3d..e6b2eca80 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 @@ -26,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +/** + * Controller providing endpoints to retrieve product inventories + */ @RestController public class InventoryController { 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 b461461d3..b04370fba 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 @@ -25,8 +25,10 @@ package com.iluwatar.inventory.microservice; import org.junit.Assert; import org.junit.Test; +/** + * Test Inventory Rest Controller + */ public class InventoryControllerTest { - @Test public void testGetProductInventories() throws Exception { InventoryController inventoryController = new InventoryController(); @@ -35,4 +37,4 @@ public class InventoryControllerTest { Assert.assertEquals(5, numberOfInventories); } -} \ No newline at end of file +} 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 10f8625c5..ebabfe839 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 @@ -35,7 +35,7 @@ import java.io.IOException; * An adapter to communicate with the Image microservice */ @Component -public class ImageClientImpl implements ImageClient{ +public class ImageClientImpl implements ImageClient { /** * Makes a simple HTTP Get request to the Image microservice * @return The path to the image 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 aa2686845..87f44761c 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 @@ -35,7 +35,7 @@ import java.io.IOException; * An adapter to communicate with the Price microservice */ @Component -public class PriceClientImpl implements PriceClient{ +public class PriceClientImpl implements PriceClient { /** * Makes a simple HTTP Get request to the Price microservice * @return The price of the product 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 fe8e76db4..6a79e5d00 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 @@ -22,15 +22,18 @@ */ package com.iluwatar.api.gateway; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - +/** + * Test API Gateway Pattern + */ public class ApiGatewayTest { @InjectMocks 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 3f4154b58..1b934014a 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 @@ -25,6 +25,9 @@ package com.iluwatar.image.microservice; import org.junit.Assert; import org.junit.Test; +/** + * Test for Image Rest Controller + */ public class ImageControllerTest { @Test public void testGetImagePath() { 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 634a60b04..b1fe66d42 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 @@ -25,6 +25,10 @@ package com.iluwatar.price.microservice; import org.junit.Assert; import org.junit.Test; + +/** + * Test for Price Rest Controller + */ public class PriceControllerTest { @Test public void testgetPrice() { 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 3fa99cc27..f7fd9ab61 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 @@ -25,8 +25,8 @@ package com.iluwatar.async.method.invocation; import java.util.concurrent.ExecutionException; /** - * * AsyncResult interface + * @param parameter returned when getValue is invoked */ public interface AsyncResult { diff --git a/checkstyle.xml b/checkstyle.xml index 46b1aa354..37db7e711 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -32,10 +32,10 @@ Source = https://github.com/checkstyle/checkstyle/tree/master/src/main/resources Checkstyle configurartion that checks the Google coding conventions from: - + - Google Java Style https://google-styleguide.googlecode.com/svn-history/r130/trunk/javaguide.html - + Checkstyle is very configurable. Be sure to read the documentation at http://checkstyle.sf.net (or in your downloaded distribution). @@ -44,12 +44,12 @@ To completely disable a check, just comment it out or delete it from the file. Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov. - + --> - + @@ -77,7 +77,6 @@ - @@ -120,7 +119,7 @@ - + @@ -185,6 +184,10 @@ + + + + find(int studentId); 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 7ecd9e7f8..685a439ac 100644 --- a/data-mapper/src/main/java/com/iluwatar/datamapper/StudentDataMapperImpl.java +++ b/data-mapper/src/main/java/com/iluwatar/datamapper/StudentDataMapperImpl.java @@ -22,6 +22,9 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; +/** + * Implementation of Actions on Students Data + */ public final class StudentDataMapperImpl implements StudentDataMapper { /* Note: Normally this would be in the form of an actual database */ diff --git a/data-mapper/src/test/java/com/iluwatar/datamapper/StudentTest.java b/data-mapper/src/test/java/com/iluwatar/datamapper/StudentTest.java index a3c0e46c1..ec35b21de 100644 --- a/data-mapper/src/test/java/com/iluwatar/datamapper/StudentTest.java +++ b/data-mapper/src/test/java/com/iluwatar/datamapper/StudentTest.java @@ -18,17 +18,21 @@ */ package com.iluwatar.datamapper; -import org.junit.Test; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +/** + * Tests {@link Student}. + */ public final class StudentTest { @Test /** * This API tests the equality behaviour of Student object * Object Equality should work as per logic defined in equals method - * + * * @throws Exception if any execution error during test */ public void testEquality() throws Exception { 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 86b841a28..c54f611ee 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/PrinterController.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/PrinterController.java @@ -22,6 +22,12 @@ */ 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 + */ public class PrinterController implements Printer { private final Printer printer; 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 a8fae59e3..434d94baa 100644 --- a/delegation/src/test/java/com/iluwatar/delegation/simple/AppTest.java +++ b/delegation/src/test/java/com/iluwatar/delegation/simple/AppTest.java @@ -23,7 +23,9 @@ package com.iluwatar.delegation.simple; import org.junit.Test; - +/** + * Application Test Entry + */ public class AppTest { @Test 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 b27539def..fd99a30dd 100644 --- a/delegation/src/test/java/com/iluwatar/delegation/simple/DelegateTest.java +++ b/delegation/src/test/java/com/iluwatar/delegation/simple/DelegateTest.java @@ -22,22 +22,24 @@ */ package com.iluwatar.delegation.simple; +import static org.junit.Assert.assertEquals; + import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.AppenderBase; import com.iluwatar.delegation.simple.printers.CanonPrinter; import com.iluwatar.delegation.simple.printers.EpsonPrinter; import com.iluwatar.delegation.simple.printers.HpPrinter; +import java.util.LinkedList; +import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.LoggerFactory; -import java.util.LinkedList; -import java.util.List; - -import static org.junit.Assert.assertEquals; - +/** + * Test for Delegation Pattern + */ public class DelegateTest { private InMemoryAppender appender; @@ -78,6 +80,9 @@ public class DelegateTest { assertEquals("Epson Printer : Test Message Printed", appender.getLastMessage()); } + /** + * Logging Appender + */ private class InMemoryAppender extends AppenderBase { private List log = new LinkedList<>(); diff --git a/dependency-injection/src/test/java/com/iluwatar/dependency/injection/utils/InMemoryAppender.java b/dependency-injection/src/test/java/com/iluwatar/dependency/injection/utils/InMemoryAppender.java index 76d1cc1dd..b79bf3d40 100644 --- a/dependency-injection/src/test/java/com/iluwatar/dependency/injection/utils/InMemoryAppender.java +++ b/dependency-injection/src/test/java/com/iluwatar/dependency/injection/utils/InMemoryAppender.java @@ -30,6 +30,10 @@ import org.slf4j.LoggerFactory; import java.util.LinkedList; import java.util.List; + +/** + * InMemory Log Appender Util. + */ public class InMemoryAppender extends AppenderBase { private List log = new LinkedList<>(); diff --git a/double-dispatch/src/test/java/com/iluwatar/doubledispatch/CollisionTest.java b/double-dispatch/src/test/java/com/iluwatar/doubledispatch/CollisionTest.java index 5e9a001e7..3dc32905a 100644 --- a/double-dispatch/src/test/java/com/iluwatar/doubledispatch/CollisionTest.java +++ b/double-dispatch/src/test/java/com/iluwatar/doubledispatch/CollisionTest.java @@ -22,13 +22,14 @@ */ package com.iluwatar.doubledispatch; -import java.util.Objects; - import static org.junit.Assert.assertEquals; +import java.util.Objects; + /** * Date: 12/10/15 - 8:37 PM - * + * Test for Collision + * @param Type of GameObject * @author Jeroen Meulemeester */ public abstract class CollisionTest { diff --git a/event-aggregator/src/test/java/com/iluwatar/event/aggregator/EventEmitterTest.java b/event-aggregator/src/test/java/com/iluwatar/event/aggregator/EventEmitterTest.java index ba7ecbc2d..a67272789 100644 --- a/event-aggregator/src/test/java/com/iluwatar/event/aggregator/EventEmitterTest.java +++ b/event-aggregator/src/test/java/com/iluwatar/event/aggregator/EventEmitterTest.java @@ -22,22 +22,22 @@ */ package com.iluwatar.event.aggregator; -import org.junit.Test; - -import java.util.Objects; -import java.util.function.Function; -import java.util.function.Supplier; - import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.verifyZeroInteractions; + +import java.util.Objects; +import java.util.function.Function; +import java.util.function.Supplier; +import org.junit.Test; /** * Date: 12/12/15 - 10:58 PM - * + * Tests for Event Emitter + * @param Type of Event Emitter * @author Jeroen Meulemeester */ public abstract class EventEmitterTest { @@ -115,7 +115,7 @@ public abstract class EventEmitterTest { // The observers should not have received any additional events after the week verifyNoMoreInteractions(observers); } - + /** * Go over every day of the month, and check if the event is emitted on the given day. Use an * event emitter without a default observer 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 85edaa815..e7a5e75b6 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 @@ -16,6 +16,9 @@ */ package com.iluwatar.event.asynchronous; +/** + * Custom Exception Class for Non Existent Event + */ public class EventDoesNotExistException extends Exception { private static final long serialVersionUID = -3398463738273811509L; 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 296a312a3..bfb5d4f04 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 @@ -16,6 +16,10 @@ */ package com.iluwatar.event.asynchronous; +/** + * Events that fulfill the start stop and list out current status behaviour + * follow this interface + */ public interface IEvent { void start(); 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 3c930d935..7ca5cfc9a 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 @@ -16,6 +16,9 @@ */ package com.iluwatar.event.asynchronous; +/** + * Type of Exception raised when the Operation being invoked is Invalid + */ public class InvalidOperationException extends Exception { private static final long serialVersionUID = -6191545255213410803L; 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 7c9091a15..b11f1a335 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 @@ -16,6 +16,9 @@ */ package com.iluwatar.event.asynchronous; +/** + * Type of Exception raised when the Operation being invoked is Long Running + */ public class LongRunningEventException extends Exception { private static final long serialVersionUID = -483423544320148809L; 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 2b8f2221c..17b46fd88 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 @@ -16,6 +16,9 @@ */ package com.iluwatar.event.asynchronous; +/** + * Type of Exception raised when the max number of allowed events is exceeded + */ public class MaxNumOfEventsAllowedException extends Exception { private static final long serialVersionUID = -8430876973516292695L; diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/ThreadCompleteListener.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/ThreadCompleteListener.java index be4ecf93b..7a37f7614 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/ThreadCompleteListener.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/ThreadCompleteListener.java @@ -16,6 +16,9 @@ */ package com.iluwatar.event.asynchronous; +/** + * Interface with listener behaviour related to Thread Completion. + */ public interface ThreadCompleteListener { void completedEventHandler(final int eventId); } diff --git a/event-driven-architecture/src/main/java/com/iluwatar/eda/framework/Handler.java b/event-driven-architecture/src/main/java/com/iluwatar/eda/framework/Handler.java index e2b58cd49..3208e1edf 100644 --- a/event-driven-architecture/src/main/java/com/iluwatar/eda/framework/Handler.java +++ b/event-driven-architecture/src/main/java/com/iluwatar/eda/framework/Handler.java @@ -25,6 +25,7 @@ package com.iluwatar.eda.framework; /** * This interface can be implemented to handle different types of messages. * Every handler is responsible for a single of type message + * @param Handler can handle events of type E */ public interface Handler { @@ -35,4 +36,4 @@ public interface Handler { * @param event the {@link Event} object to be handled. */ void onEvent(E event); -} \ No newline at end of file +} diff --git a/factory-kit/src/main/java/com/iluwatar/factorykit/Axe.java b/factory-kit/src/main/java/com/iluwatar/factorykit/Axe.java index 96ce73a35..429728cbc 100644 --- a/factory-kit/src/main/java/com/iluwatar/factorykit/Axe.java +++ b/factory-kit/src/main/java/com/iluwatar/factorykit/Axe.java @@ -22,6 +22,9 @@ */ package com.iluwatar.factorykit; +/** + * Class representing Axe + */ public class Axe implements Weapon { @Override public String toString() { diff --git a/factory-kit/src/main/java/com/iluwatar/factorykit/Bow.java b/factory-kit/src/main/java/com/iluwatar/factorykit/Bow.java index b9b2708c9..c655c3be8 100644 --- a/factory-kit/src/main/java/com/iluwatar/factorykit/Bow.java +++ b/factory-kit/src/main/java/com/iluwatar/factorykit/Bow.java @@ -22,6 +22,9 @@ */ package com.iluwatar.factorykit; +/** + * Class representing Bows + */ public class Bow implements Weapon { @Override public String toString() { diff --git a/factory-kit/src/main/java/com/iluwatar/factorykit/Spear.java b/factory-kit/src/main/java/com/iluwatar/factorykit/Spear.java index 080007093..15ff8b246 100644 --- a/factory-kit/src/main/java/com/iluwatar/factorykit/Spear.java +++ b/factory-kit/src/main/java/com/iluwatar/factorykit/Spear.java @@ -21,7 +21,9 @@ * THE SOFTWARE. */ package com.iluwatar.factorykit; - +/** + * Class representing Spear + */ public class Spear implements Weapon { @Override public String toString() { diff --git a/factory-kit/src/main/java/com/iluwatar/factorykit/Sword.java b/factory-kit/src/main/java/com/iluwatar/factorykit/Sword.java index 504ddb397..42ab53799 100644 --- a/factory-kit/src/main/java/com/iluwatar/factorykit/Sword.java +++ b/factory-kit/src/main/java/com/iluwatar/factorykit/Sword.java @@ -21,7 +21,9 @@ * THE SOFTWARE. */ package com.iluwatar.factorykit; - +/** + * Class representing Swords + */ public class Sword implements Weapon { @Override public String toString() { diff --git a/factory-kit/src/test/java/com/iluwatar/factorykit/app/AppTest.java b/factory-kit/src/test/java/com/iluwatar/factorykit/app/AppTest.java index add378296..4d8691ef0 100644 --- a/factory-kit/src/test/java/com/iluwatar/factorykit/app/AppTest.java +++ b/factory-kit/src/test/java/com/iluwatar/factorykit/app/AppTest.java @@ -25,6 +25,9 @@ package com.iluwatar.factorykit.app; import com.iluwatar.factorykit.App; import org.junit.Test; +/** + * Application Test Entrypoint + */ public class AppTest { @Test diff --git a/factory-kit/src/test/java/com/iluwatar/factorykit/factorykit/FactoryKitTest.java b/factory-kit/src/test/java/com/iluwatar/factorykit/factorykit/FactoryKitTest.java index da39caa8f..3f732546d 100644 --- a/factory-kit/src/test/java/com/iluwatar/factorykit/factorykit/FactoryKitTest.java +++ b/factory-kit/src/test/java/com/iluwatar/factorykit/factorykit/FactoryKitTest.java @@ -1,4 +1,4 @@ -/** + /** * The MIT License * Copyright (c) 2014-2016 Ilkka Seppälä * @@ -22,12 +22,19 @@ */ package com.iluwatar.factorykit.factorykit; -import com.iluwatar.factorykit.*; -import org.junit.Before; -import org.junit.Test; - import static org.junit.Assert.assertTrue; +import com.iluwatar.factorykit.Axe; +import com.iluwatar.factorykit.Spear; +import com.iluwatar.factorykit.Sword; +import com.iluwatar.factorykit.Weapon; +import com.iluwatar.factorykit.WeaponFactory; +import com.iluwatar.factorykit.WeaponType; +import org.junit.Before; +import org.junit.Test; +/** + * Test Factory Kit Pattern + */ public class FactoryKitTest { private WeaponFactory factory; 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 def53b97c..846b46bcf 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 @@ -23,16 +23,18 @@ package com.iluwatar.featuretoggle.pattern.propertiesversion; -import com.iluwatar.featuretoggle.pattern.Service; -import com.iluwatar.featuretoggle.user.User; -import org.junit.Test; - -import java.util.Properties; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import com.iluwatar.featuretoggle.pattern.Service; +import com.iluwatar.featuretoggle.user.User; +import java.util.Properties; +import org.junit.Test; + +/** + * Test Properties Toggle + */ public class PropertiesFeatureToggleVersionTest { @Test(expected = IllegalArgumentException.class) @@ -66,4 +68,4 @@ public class PropertiesFeatureToggleVersionTest { final String welcomeMessage = service.getWelcomeMessage(new User("Jamie No Code")); assertEquals("Welcome to the application.", welcomeMessage); } -} \ No newline at end of file +} 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 6c33b260c..3966032d5 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 @@ -22,15 +22,18 @@ */ package com.iluwatar.featuretoggle.pattern.tieredversion; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import com.iluwatar.featuretoggle.pattern.Service; import com.iluwatar.featuretoggle.user.User; import com.iluwatar.featuretoggle.user.UserGroup; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - +/** + * Test Tiered Feature Toggle + */ public class TieredFeatureToggleVersionTest { final User paidUser = new User("Jamie Coder"); @@ -61,4 +64,4 @@ public class TieredFeatureToggleVersionTest { public void testIsEnhancedAlwaysTrueAsTiered() throws Exception { assertTrue(service.isEnhanced()); } -} \ No newline at end of file +} 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 c6ff30855..b2c6e5859 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 @@ -22,11 +22,14 @@ */ package com.iluwatar.featuretoggle.user; -import org.junit.Test; - import static junit.framework.TestCase.assertFalse; import static org.junit.Assert.assertTrue; +import org.junit.Test; + +/** + * Test User Group specific feature + */ public class UserGroupTest { @Test @@ -56,4 +59,4 @@ public class UserGroupTest { UserGroup.addUserToPaidGroup(user); UserGroup.addUserToFreeGroup(user); } -} \ No newline at end of file +} diff --git a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/DecoratingIterator.java b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/DecoratingIterator.java index 54d367c20..389904bff 100644 --- a/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/DecoratingIterator.java +++ b/fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/lazy/DecoratingIterator.java @@ -27,6 +27,7 @@ import java.util.Iterator; /** * This class is used to realize LazyFluentIterables. It decorates a given iterator. Does not * support consecutive hasNext() calls. + * @param Iterable Collection of Elements of Type E */ public abstract class DecoratingIterator implements Iterator { @@ -43,7 +44,7 @@ public abstract class DecoratingIterator implements Iterator { /** * Precomputes and saves the next element of the Iterable. null is considered as end of data. - * + * * @return true if a next element is available */ @Override @@ -54,7 +55,7 @@ public abstract class DecoratingIterator implements Iterator { /** * Returns the next element of the Iterable. - * + * * @return the next element of the Iterable, or null if not present. */ @Override @@ -71,7 +72,7 @@ public abstract class DecoratingIterator implements Iterator { /** * Computes the next object of the Iterable. Can be implemented to realize custom behaviour for an * iteration process. null is considered as end of data. - * + * * @return the next element of the Iterable. */ public abstract E computeNext(); diff --git a/fluentinterface/src/test/java/com/iluwatar/fluentinterface/app/AppTest.java b/fluentinterface/src/test/java/com/iluwatar/fluentinterface/app/AppTest.java index 6d6420d55..11740bf1a 100644 --- a/fluentinterface/src/test/java/com/iluwatar/fluentinterface/app/AppTest.java +++ b/fluentinterface/src/test/java/com/iluwatar/fluentinterface/app/AppTest.java @@ -23,7 +23,9 @@ package com.iluwatar.fluentinterface.app; import org.junit.Test; - +/** + * Application Test Entry + */ public class AppTest { @Test diff --git a/front-controller/src/test/java/com/iluwatar/front/controller/utils/InMemoryAppender.java b/front-controller/src/test/java/com/iluwatar/front/controller/utils/InMemoryAppender.java index 62a234d0d..2e6f26c0c 100644 --- a/front-controller/src/test/java/com/iluwatar/front/controller/utils/InMemoryAppender.java +++ b/front-controller/src/test/java/com/iluwatar/front/controller/utils/InMemoryAppender.java @@ -30,6 +30,9 @@ import org.slf4j.LoggerFactory; import java.util.LinkedList; import java.util.List; +/** + * InMemory Log Appender Util. + */ public class InMemoryAppender extends AppenderBase { private List log = new LinkedList<>(); 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 89b330bfb..bf6142dd9 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 @@ -28,7 +28,12 @@ import org.slf4j.LoggerFactory; import java.util.LinkedList; import java.util.Queue; - +/** + * 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 { private static final Logger LOGGER = LoggerFactory.getLogger(GuardedQueue.class); private final Queue sourceList; diff --git a/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java b/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java index 41eaccd49..5a741d399 100644 --- a/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java +++ b/guarded-suspension/src/test/java/com/iluwatar/guarded/suspension/GuardedQueueTest.java @@ -29,6 +29,9 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +/** + * Test for Guarded Queue + */ public class GuardedQueueTest { private volatile Integer value; @@ -55,4 +58,4 @@ public class GuardedQueueTest { } -} \ No newline at end of file +} 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 babbd6d03..a5b455354 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketCheckResult.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketCheckResult.java @@ -23,12 +23,15 @@ package com.iluwatar.hexagonal.domain; /** - * + * * Represents lottery ticket check result. * */ public class LotteryTicketCheckResult { + /** + * Enumeration of Type of Outcomes of a Lottery + */ public enum CheckResult { WIN_PRIZE, NO_PRIZE, TICKET_NOT_SUBMITTED } private final CheckResult checkResult; @@ -41,7 +44,7 @@ public class LotteryTicketCheckResult { checkResult = result; prizeAmount = 0; } - + /** * Constructor. */ @@ -56,7 +59,7 @@ public class LotteryTicketCheckResult { public CheckResult getResult() { return checkResult; } - + /** * @return prize amount */ 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 8aaa83681..a83f9033c 100644 --- a/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTicketTest.java +++ b/hexagonal/src/test/java/com/iluwatar/hexagonal/domain/LotteryTicketTest.java @@ -30,6 +30,9 @@ import java.util.HashSet; import org.junit.Test; +/** + * Test Lottery Tickets for equality + */ public class LotteryTicketTest { @Test diff --git a/interpreter/src/test/java/com/iluwatar/interpreter/ExpressionTest.java b/interpreter/src/test/java/com/iluwatar/interpreter/ExpressionTest.java index 95a65e82c..2d444373c 100644 --- a/interpreter/src/test/java/com/iluwatar/interpreter/ExpressionTest.java +++ b/interpreter/src/test/java/com/iluwatar/interpreter/ExpressionTest.java @@ -22,18 +22,19 @@ */ package com.iluwatar.interpreter; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.util.ArrayList; import java.util.List; import java.util.function.BiFunction; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import org.junit.Test; /** * Date: 12/14/15 - 11:48 AM * + * Test Case for Expressions + * @param Type of Expression * @author Jeroen Meulemeester */ public abstract class ExpressionTest { 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 ba72fea1a..ec0aabd15 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 @@ -22,20 +22,19 @@ */ package com.iluwatar.model.view.controller; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.AppenderBase; +import java.util.LinkedList; +import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.LoggerFactory; -import java.util.LinkedList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; - /** * Date: 12/20/15 - 2:04 PM * @@ -70,6 +69,9 @@ public class GiantViewTest { assertEquals(1, appender.getLogSize()); } + /** + * Logging Appender Implementation + */ public class InMemoryAppender extends AppenderBase { private List log = new LinkedList<>(); diff --git a/monad/src/main/java/com/iluwatar/monad/Sex.java b/monad/src/main/java/com/iluwatar/monad/Sex.java index 3cbe22971..6c6d6eff6 100644 --- a/monad/src/main/java/com/iluwatar/monad/Sex.java +++ b/monad/src/main/java/com/iluwatar/monad/Sex.java @@ -22,6 +22,9 @@ */ package com.iluwatar.monad; +/** + * Enumeration of Types of Sex + */ public enum Sex { MALE, FEMALE } diff --git a/monad/src/main/java/com/iluwatar/monad/User.java b/monad/src/main/java/com/iluwatar/monad/User.java index 53cf759cf..406407fea 100644 --- a/monad/src/main/java/com/iluwatar/monad/User.java +++ b/monad/src/main/java/com/iluwatar/monad/User.java @@ -22,6 +22,9 @@ */ package com.iluwatar.monad; +/** + * User Definition + */ public class User { private String name; diff --git a/monad/src/test/java/com/iluwatar/monad/AppTest.java b/monad/src/test/java/com/iluwatar/monad/AppTest.java index f661ee1c6..69464ff87 100644 --- a/monad/src/test/java/com/iluwatar/monad/AppTest.java +++ b/monad/src/test/java/com/iluwatar/monad/AppTest.java @@ -24,6 +24,9 @@ package com.iluwatar.monad; import org.junit.Test; +/** + * Application Test + */ public class AppTest { @Test diff --git a/monad/src/test/java/com/iluwatar/monad/MonadTest.java b/monad/src/test/java/com/iluwatar/monad/MonadTest.java index 2676e6e80..a34243978 100644 --- a/monad/src/test/java/com/iluwatar/monad/MonadTest.java +++ b/monad/src/test/java/com/iluwatar/monad/MonadTest.java @@ -30,6 +30,9 @@ import org.junit.rules.ExpectedException; import java.util.Objects; +/** + * Test for Monad Pattern + */ public class MonadTest { @Rule diff --git a/monostate/src/test/java/com/iluwatar/monostate/AppTest.java b/monostate/src/test/java/com/iluwatar/monostate/AppTest.java index 301beea3e..3e88b3bf2 100644 --- a/monostate/src/test/java/com/iluwatar/monostate/AppTest.java +++ b/monostate/src/test/java/com/iluwatar/monostate/AppTest.java @@ -24,6 +24,9 @@ package com.iluwatar.monostate; import org.junit.Test; +/** + * Application Test Entry + */ public class AppTest { @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 698395cc2..7e1d2e1af 100644 --- a/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java +++ b/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java @@ -35,47 +35,50 @@ import org.junit.rules.ExpectedException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * Test for the mute-idiom pattern + */ public class MuteTest { private static final Logger LOGGER = LoggerFactory.getLogger(MuteTest.class); private static final String MESSAGE = "should not occur"; - + @Rule public ExpectedException exception = ExpectedException.none(); - + @Test public void muteShouldRunTheCheckedRunnableAndNotThrowAnyExceptionIfCheckedRunnableDoesNotThrowAnyException() { Mute.mute(() -> methodNotThrowingAnyException()); } - + @Test public void muteShouldRethrowUnexpectedExceptionAsAssertionError() throws Exception { exception.expect(AssertionError.class); exception.expectMessage(MESSAGE); - + Mute.mute(() -> methodThrowingException()); } - + @Test public void loggedMuteShouldRunTheCheckedRunnableAndNotThrowAnyExceptionIfCheckedRunnableDoesNotThrowAnyException() { Mute.loggedMute(() -> methodNotThrowingAnyException()); } - + @Test public void loggedMuteShouldLogExceptionTraceBeforeSwallowingIt() throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); System.setErr(new PrintStream(stream)); - + Mute.loggedMute(() -> methodThrowingException()); - + assertTrue(new String(stream.toByteArray()).contains(MESSAGE)); } - - + + private void methodNotThrowingAnyException() { LOGGER.info("Executed successfully"); } - + private void methodThrowingException() throws Exception { throw new Exception(MESSAGE); } diff --git a/mutex/src/test/java/com/iluwatar/mutex/AppTest.java b/mutex/src/test/java/com/iluwatar/mutex/AppTest.java index dfc0de124..f224a56f5 100644 --- a/mutex/src/test/java/com/iluwatar/mutex/AppTest.java +++ b/mutex/src/test/java/com/iluwatar/mutex/AppTest.java @@ -25,10 +25,13 @@ package com.iluwatar.mutex; import org.junit.Test; import java.io.IOException; +/** + * Application Test Entrypoint + */ public class AppTest{ @Test public void test() throws IOException { String[] args = {}; App.main(args); } -} \ No newline at end of file +} 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 162cd3bb4..30469ba8e 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 @@ -4,9 +4,9 @@ * 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 @@ -21,6 +21,10 @@ import org.apache.isis.applib.annotation.HomePage; import org.apache.isis.applib.annotation.NatureOfService; import org.apache.isis.applib.annotation.SemanticsOf; +/** + * HomePage Domain Service + * @see HomePageViewModel linked view to HomePage + */ @DomainService(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY) public class HomePageService { 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 f367a39fd..dfb499f0f 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 @@ -4,9 +4,9 @@ * 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 @@ -21,6 +21,11 @@ import org.apache.isis.applib.annotation.ViewModel; import domainapp.dom.modules.simple.SimpleObject; import domainapp.dom.modules.simple.SimpleObjects; +/** + * Model linked to the HomePage + * The underlying layout is specified by json + * @see HomePageService - Service Linked to the HomePage + */ @ViewModel public class HomePageViewModel { 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 bbbd54b00..c7972ab84 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 @@ -4,9 +4,9 @@ * 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 @@ -33,6 +33,9 @@ import org.apache.isis.applib.services.eventbus.ActionDomainEvent; import org.apache.isis.applib.services.i18n.TranslatableString; import org.apache.isis.applib.util.ObjectContracts; +/** + * Definition of a Simple Object + */ @javax.jdo.annotations.PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "simple", table = "SimpleObject") @javax.jdo.annotations.DatastoreIdentity( @@ -53,7 +56,7 @@ public class SimpleObject implements Comparable { // region > name (property) private String name; - + // region > identificatiom public TranslatableString title() { return TranslatableString.tr("Object: {name}", "name", getName()); @@ -74,6 +77,9 @@ public class SimpleObject implements Comparable { // region > updateName (action) + /** + * Event used to update the Name in the Domain + */ public static class UpdateNameDomainEvent extends ActionDomainEvent { public UpdateNameDomainEvent(final SimpleObject source, final Identifier identifier, final Object... arguments) { 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 5ebad0159..249fbb1f0 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 @@ -4,9 +4,9 @@ * 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 @@ -30,6 +30,9 @@ import org.apache.isis.applib.query.QueryDefault; import org.apache.isis.applib.services.eventbus.ActionDomainEvent; import org.apache.isis.applib.services.i18n.TranslatableString; +/** + * Domain Service for Simple Objects + */ @DomainService(repositoryFor = SimpleObject.class) @DomainServiceLayout(menuOrder = "10") public class SimpleObjects { @@ -69,6 +72,9 @@ public class SimpleObjects { // endregion + /** + * Create Domain Event on SimpleObjects + */ // region > create (action) public static class CreateDomainEvent extends ActionDomainEvent { public CreateDomainEvent(final SimpleObjects source, final Identifier identifier, 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 fc62239c2..d80d0786a 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 @@ -14,11 +14,14 @@ */ package domainapp.dom.modules.simple; +import static org.assertj.core.api.Assertions.assertThat; + import org.junit.Before; import org.junit.Test; -import static org.assertj.core.api.Assertions.assertThat; - +/** + * Test for SimpleObject + */ public class SimpleObjectTest { SimpleObject simpleObject; @@ -28,6 +31,9 @@ public class SimpleObjectTest { simpleObject = new SimpleObject(); } + /** + * Test for Names for SimpleObjects + */ public static class Name extends SimpleObjectTest { @Test 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 47cad61b8..91fe3d715 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 @@ -14,10 +14,13 @@ */ package domainapp.dom.modules.simple; -import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; import com.google.common.collect.Lists; - +import java.util.List; +import org.apache.isis.applib.DomainObjectContainer; +import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; +import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode; import org.jmock.Expectations; import org.jmock.Sequence; import org.jmock.auto.Mock; @@ -25,12 +28,9 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import org.apache.isis.applib.DomainObjectContainer; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; -import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode; - -import static org.assertj.core.api.Assertions.assertThat; - +/** + * Test for SimpleObjects + */ public class SimpleObjectsTest { @Rule @@ -47,6 +47,9 @@ public class SimpleObjectsTest { simpleObjects.container = mockContainer; } + /** + * Test Creation of Simple Objects + */ public static class Create extends SimpleObjectsTest { @Test @@ -77,6 +80,9 @@ public class SimpleObjectsTest { } + /** + * Test Listing of Simple Objects + */ public static class ListAll extends SimpleObjectsTest { @Test 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 f0617fea2..58b656a98 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 @@ -4,9 +4,9 @@ * 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 @@ -20,6 +20,9 @@ import org.apache.isis.applib.fixturescripts.FixtureScript; import domainapp.dom.modules.simple.SimpleObject; import domainapp.dom.modules.simple.SimpleObjects; +/** + * Fixture to create a simple object + */ public class SimpleObjectCreate extends FixtureScript { // endregion @@ -45,7 +48,7 @@ public class SimpleObjectCreate extends FixtureScript { this.name = name; return this; } - + /** * The created simple object (output). */ @@ -65,5 +68,5 @@ public class SimpleObjectCreate extends FixtureScript { // also make available to UI ec.addResult(this, simpleObject); } - + } 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 7000bf4c0..c0319d953 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 @@ -4,9 +4,9 @@ * 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 @@ -18,6 +18,9 @@ package domainapp.fixture.modules.simple; import org.apache.isis.applib.fixturescripts.FixtureScript; import org.apache.isis.applib.services.jdosupport.IsisJdoSupport; +/** + * TearDown/Cleanup for SimpleObjects + */ public class SimpleObjectsTearDown extends FixtureScript { @javax.inject.Inject @@ -27,5 +30,5 @@ public class SimpleObjectsTearDown extends FixtureScript { protected void execute(ExecutionContext executionContext) { isisJdoSupport.executeUpdate("delete from \"simple\".\"SimpleObject\""); } - + } 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 62ad0405a..be891158a 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 @@ -4,9 +4,9 @@ * 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 @@ -27,6 +27,10 @@ import domainapp.dom.modules.simple.SimpleObject; import domainapp.fixture.modules.simple.SimpleObjectCreate; import domainapp.fixture.modules.simple.SimpleObjectsTearDown; + +/** + * Create a bunch of simple Objects + */ public class RecreateSimpleObjects extends FixtureScript { public final List names = Collections.unmodifiableList(Arrays.asList("Foo", "Bar", "Baz", @@ -43,7 +47,7 @@ public class RecreateSimpleObjects extends FixtureScript { public RecreateSimpleObjects() { withDiscoverability(Discoverability.DISCOVERABLE); } - + /** * The number of objects to create, up to 10; optional, defaults to 3. */ @@ -55,7 +59,7 @@ public class RecreateSimpleObjects extends FixtureScript { this.number = number; return this; } - + /** * The simpleobjects created by this fixture (output). */ 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 b7c76d0ed..3ac5a1d75 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 @@ -4,9 +4,9 @@ * 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 @@ -19,6 +19,9 @@ import org.apache.isis.core.integtestsupport.IsisSystemForTest; import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller; import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests; +/** + * Initializer for the Simple App + */ public final class SimpleAppSystemInitializer { private SimpleAppSystemInitializer() { 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 190e1f5bb..e41399fdd 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 @@ -21,6 +21,9 @@ import cucumber.api.java.After; import cucumber.api.java.Before; import domainapp.integtests.bootstrap.SimpleAppSystemInitializer; +/** + * BootStrapping IntegrationTesting Before and After Steps + */ public class BootstrappingGlue extends CukeGlueAbstract { @Before(value = {"@integration"}, order = 100) 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 2fcb7cca7..7a75a0381 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 @@ -19,6 +19,9 @@ import org.apache.isis.core.specsupport.specs.CukeGlueAbstract; import cucumber.api.java.Before; import domainapp.fixture.scenarios.RecreateSimpleObjects; +/** + * Test Execution to append a fixture of SimpleObjects + */ public class CatalogOfFixturesGlue extends CukeGlueAbstract { @Before(value = {"@integration", "@SimpleObjectsFixture"}, order = 20000) 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 2ea375b4a..b7af9f052 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 @@ -14,18 +14,20 @@ */ package domainapp.integtests.specglue.modules.simple; -import java.util.List; -import java.util.UUID; - -import org.apache.isis.core.specsupport.specs.CukeGlueAbstract; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; import cucumber.api.java.en.Given; import cucumber.api.java.en.When; import domainapp.dom.modules.simple.SimpleObject; import domainapp.dom.modules.simple.SimpleObjects; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import java.util.List; +import java.util.UUID; +import org.apache.isis.core.specsupport.specs.CukeGlueAbstract; +/** + * Test Simple Object Operations + */ public class SimpleObjectGlue extends CukeGlueAbstract { @Given("^there are.* (\\d+) simple objects$") 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 7a7ad91b2..66deaeb84 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 @@ -25,6 +25,9 @@ import org.apache.isis.core.integtestsupport.scenarios.ScenarioExecutionForInteg import domainapp.integtests.bootstrap.SimpleAppSystemInitializer; +/** + * SimpleApp Integration Tests will implement this Abstract Class. + */ public abstract class SimpleAppIntegTest extends IntegrationTestAbstract { @BeforeClass @@ -35,5 +38,4 @@ public abstract class SimpleAppIntegTest extends IntegrationTestAbstract { // instantiating will install onto ThreadLocal new ScenarioExecutionForIntegration(); } - } 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 872aff7a3..f2cbb1723 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 @@ -18,21 +18,22 @@ */ package domainapp.integtests.tests.modules.simple; -import javax.inject.Inject; - -import org.junit.Before; -import org.junit.Test; - -import org.apache.isis.applib.DomainObjectContainer; -import org.apache.isis.applib.fixturescripts.FixtureScripts; -import org.apache.isis.applib.services.wrapper.DisabledException; -import org.apache.isis.applib.services.wrapper.InvalidException; +import static org.assertj.core.api.Assertions.assertThat; import domainapp.dom.modules.simple.SimpleObject; import domainapp.fixture.scenarios.RecreateSimpleObjects; import domainapp.integtests.tests.SimpleAppIntegTest; -import static org.assertj.core.api.Assertions.assertThat; +import javax.inject.Inject; +import org.apache.isis.applib.DomainObjectContainer; +import org.apache.isis.applib.fixturescripts.FixtureScripts; +import org.apache.isis.applib.services.wrapper.DisabledException; +import org.apache.isis.applib.services.wrapper.InvalidException; +import org.junit.Before; +import org.junit.Test; +/** + * Test Fixtures with Simple Objects + */ public class SimpleObjectIntegTest extends SimpleAppIntegTest { @Inject @@ -54,6 +55,9 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest { simpleObjectWrapped = wrap(simpleObjectPojo); } + /** + * Test Object Name accessibility + */ public static class Name extends SimpleObjectIntegTest { @Test @@ -75,6 +79,9 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest { } } + /** + * Test Validation of SimpleObject Names + */ public static class UpdateName extends SimpleObjectIntegTest { @Test @@ -99,6 +106,9 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest { } } + /** + * Test ContainerTitle generation based on SimpleObject Name + */ public static class Title extends SimpleObjectIntegTest { @Inject @@ -117,4 +127,4 @@ public class SimpleObjectIntegTest extends SimpleAppIntegTest { assertThat(title).isEqualTo("Object: " + name); } } -} \ No newline at end of file +} 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 332213542..d57454dc1 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 @@ -18,28 +18,27 @@ */ package domainapp.integtests.tests.modules.simple; -import java.sql.SQLIntegrityConstraintViolationException; -import java.util.List; - -import javax.inject.Inject; +import static org.assertj.core.api.Assertions.assertThat; import com.google.common.base.Throwables; - -import org.hamcrest.Description; -import org.hamcrest.Matcher; -import org.hamcrest.TypeSafeMatcher; -import org.junit.Test; - -import org.apache.isis.applib.fixturescripts.FixtureScript; -import org.apache.isis.applib.fixturescripts.FixtureScripts; - import domainapp.dom.modules.simple.SimpleObject; import domainapp.dom.modules.simple.SimpleObjects; import domainapp.fixture.modules.simple.SimpleObjectsTearDown; import domainapp.fixture.scenarios.RecreateSimpleObjects; import domainapp.integtests.tests.SimpleAppIntegTest; -import static org.assertj.core.api.Assertions.assertThat; +import java.sql.SQLIntegrityConstraintViolationException; +import java.util.List; +import javax.inject.Inject; +import org.apache.isis.applib.fixturescripts.FixtureScript; +import org.apache.isis.applib.fixturescripts.FixtureScripts; +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; +import org.junit.Test; +/** + * Fixture Pattern Integration Test + */ public class SimpleObjectsIntegTest extends SimpleAppIntegTest { @Inject @@ -47,6 +46,9 @@ public class SimpleObjectsIntegTest extends SimpleAppIntegTest { @Inject SimpleObjects simpleObjects; + /** + * Test Listing of All Simple Objects + */ public static class ListAll extends SimpleObjectsIntegTest { @Test @@ -83,6 +85,10 @@ public class SimpleObjectsIntegTest extends SimpleAppIntegTest { } } + + /** + * Test Creation of Simple Objects + */ public static class Create extends SimpleObjectsIntegTest { @Test @@ -140,4 +146,4 @@ public class SimpleObjectsIntegTest extends SimpleAppIntegTest { } } -} \ No newline at end of file +} 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 544b0bacb..b1b5f3610 100644 --- a/object-mother/src/main/java/com/iluwatar/objectmother/King.java +++ b/object-mother/src/main/java/com/iluwatar/objectmother/King.java @@ -22,6 +22,9 @@ */ package com.iluwatar.objectmother; +/** + * Defines all attributes and behaviour related to the King + */ public class King implements Royalty { boolean isDrunk = false; boolean isHappy = false; @@ -45,11 +48,11 @@ public class King implements Royalty { public void makeUnhappy() { isHappy = false; } - + public boolean isHappy() { return isHappy; } - + /** * Method to flirt to a queen. * @param queen Queen which should be flirted. @@ -61,6 +64,6 @@ public class King implements Royalty { } else { this.makeHappy(); } - + } } 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 3e18fbf3a..e7e488602 100644 --- a/object-mother/src/main/java/com/iluwatar/objectmother/Queen.java +++ b/object-mother/src/main/java/com/iluwatar/objectmother/Queen.java @@ -22,6 +22,9 @@ */ package com.iluwatar.objectmother; +/** + * Defines all attributes and behaviour related to the Queen + */ public class Queen implements Royalty { private boolean isDrunk = false; private boolean isHappy = false; @@ -46,7 +49,7 @@ public class Queen implements Royalty { public void makeUnhappy() { isHappy = false; } - + public boolean isFlirty() { return isFlirty; } @@ -54,7 +57,7 @@ public class Queen implements Royalty { public void setFlirtiness(boolean flirtiness) { this.isFlirty = flirtiness; } - + /** * Method which is called when the king is flirting to a queen. * @param king King who initialized the flirt. 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 2bebc0939..42271a21d 100644 --- a/object-mother/src/main/java/com/iluwatar/objectmother/Royalty.java +++ b/object-mother/src/main/java/com/iluwatar/objectmother/Royalty.java @@ -22,12 +22,15 @@ */ package com.iluwatar.objectmother; +/** + * Interface contracting Royalty Behaviour + */ public interface Royalty { void makeDrunk(); - + void makeSober(); - + void makeHappy(); - + void makeUnhappy(); } 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 624a29132..118253d56 100644 --- a/object-mother/src/main/java/com/iluwatar/objectmother/RoyaltyObjectMother.java +++ b/object-mother/src/main/java/com/iluwatar/objectmother/RoyaltyObjectMother.java @@ -22,8 +22,11 @@ */ package com.iluwatar.objectmother; +/** + * Object Mother Pattern generating Royalty Types + */ public final class RoyaltyObjectMother { - + /** * Method to create a sober and unhappy king. The standard paramters are set. * @return An instance of {@link com.iluwatar.objectmother.King} with the standard properties. @@ -31,7 +34,7 @@ public final class RoyaltyObjectMother { public static King createSoberUnhappyKing() { return new King(); } - + /** * Method of the object mother to create a drunk king. * @return A drunk {@link com.iluwatar.objectmother.King}. @@ -41,7 +44,7 @@ public final class RoyaltyObjectMother { king.makeDrunk(); return king; } - + /** * Method to create a happy king. * @return A happy {@link com.iluwatar.objectmother.King}. @@ -51,7 +54,7 @@ public final class RoyaltyObjectMother { king.makeHappy(); return king; } - + /** * Method to create a happy and drunk king. * @return A drunk and happy {@link com.iluwatar.objectmother.King}. @@ -62,7 +65,7 @@ public final class RoyaltyObjectMother { king.makeDrunk(); return king; } - + /** * Method to create a flirty queen. * @return A flirty {@link com.iluwatar.objectmother.Queen}. @@ -72,7 +75,7 @@ public final class RoyaltyObjectMother { queen.setFlirtiness(true); return queen; } - + /** * Method to create a not flirty queen. * @return A not flirty {@link com.iluwatar.objectmother.Queen}. 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 ebe536d24..cc5af45aa 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 @@ -33,8 +33,11 @@ import com.iluwatar.objectmother.Queen; import com.iluwatar.objectmother.Royalty; import com.iluwatar.objectmother.RoyaltyObjectMother; +/** + * Test Generation of Royalty Types using the object-mother + */ public class RoyaltyObjectMotherTest { - + @Test public void unsuccessfulKingFlirt() { King soberUnhappyKing = RoyaltyObjectMother.createSoberUnhappyKing(); @@ -42,7 +45,7 @@ public class RoyaltyObjectMotherTest { soberUnhappyKing.flirt(flirtyQueen); assertFalse(soberUnhappyKing.isHappy()); } - + @Test public void queenIsBlockingFlirtCauseDrunkKing() { King drunkUnhappyKing = RoyaltyObjectMother.createDrunkKing(); @@ -50,7 +53,7 @@ public class RoyaltyObjectMotherTest { drunkUnhappyKing.flirt(notFlirtyQueen); assertFalse(drunkUnhappyKing.isHappy()); } - + @Test public void queenIsBlockingFlirt() { King soberHappyKing = RoyaltyObjectMother.createHappyKing(); @@ -58,7 +61,7 @@ public class RoyaltyObjectMotherTest { soberHappyKing.flirt(notFlirtyQueen); assertFalse(soberHappyKing.isHappy()); } - + @Test public void successfullKingFlirt() { King soberHappyKing = RoyaltyObjectMother.createHappyKing(); @@ -66,7 +69,7 @@ public class RoyaltyObjectMotherTest { soberHappyKing.flirt(flirtyQueen); assertTrue(soberHappyKing.isHappy()); } - + @Test public void testQueenType() { Royalty flirtyQueen = RoyaltyObjectMother.createFlirtyQueen(); @@ -74,7 +77,7 @@ public class RoyaltyObjectMotherTest { assertEquals(flirtyQueen.getClass(), Queen.class); assertEquals(notFlirtyQueen.getClass(), Queen.class); } - + @Test public void testKingType() { Royalty drunkKing = RoyaltyObjectMother.createDrunkKing(); 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 510d9dc88..f502b86e2 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 @@ -26,8 +26,8 @@ import java.util.HashSet; import java.util.Set; /** - * * Generic object pool + * @param Type T of Object in the Pool */ public abstract class ObjectPool { 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 b427aae2c..f8c30853b 100644 --- a/observer/src/main/java/com/iluwatar/observer/generic/Observer.java +++ b/observer/src/main/java/com/iluwatar/observer/generic/Observer.java @@ -23,8 +23,10 @@ package com.iluwatar.observer.generic; /** - * * Observer + * @param Observable + * @param Observer + * @param Action */ public interface Observer, O extends Observer, A> { diff --git a/observer/src/test/java/com/iluwatar/observer/WeatherObserverTest.java b/observer/src/test/java/com/iluwatar/observer/WeatherObserverTest.java index 7120a31e0..70a7922c5 100644 --- a/observer/src/test/java/com/iluwatar/observer/WeatherObserverTest.java +++ b/observer/src/test/java/com/iluwatar/observer/WeatherObserverTest.java @@ -22,18 +22,18 @@ */ package com.iluwatar.observer; +import static org.junit.Assert.assertEquals; + import com.iluwatar.observer.utils.InMemoryAppender; +import java.util.function.Supplier; import org.junit.After; import org.junit.Before; import org.junit.Test; -import java.util.function.Supplier; - -import static org.junit.Assert.assertEquals; - /** * Date: 12/27/15 - 11:44 AM - * + * Weather Observer Tests + * @param Type of WeatherObserver * @author Jeroen Meulemeester */ public abstract class WeatherObserverTest { 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 eef89da62..930f7533f 100644 --- a/observer/src/test/java/com/iluwatar/observer/generic/ObserverTest.java +++ b/observer/src/test/java/com/iluwatar/observer/generic/ObserverTest.java @@ -22,19 +22,19 @@ */ package com.iluwatar.observer.generic; +import static org.junit.Assert.assertEquals; + import com.iluwatar.observer.WeatherType; import com.iluwatar.observer.utils.InMemoryAppender; +import java.util.function.Supplier; import org.junit.After; import org.junit.Before; import org.junit.Test; -import java.util.function.Supplier; - -import static org.junit.Assert.assertEquals; - /** * Date: 12/27/15 - 11:44 AM - * + * Test for Observers + * @param Type of Observer * @author Jeroen Meulemeester */ public abstract class ObserverTest { 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 b0503a4a1..07d5726d0 100644 --- a/observer/src/test/java/com/iluwatar/observer/utils/InMemoryAppender.java +++ b/observer/src/test/java/com/iluwatar/observer/utils/InMemoryAppender.java @@ -30,6 +30,9 @@ import org.slf4j.LoggerFactory; import java.util.LinkedList; import java.util.List; +/** + * InMemory Log Appender Util. + */ public class InMemoryAppender extends AppenderBase { private List log = new LinkedList<>(); 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 f41a79760..79101f3d3 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/AlbumListPageTest.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/AlbumListPageTest.java @@ -23,15 +23,17 @@ package com.iluwatar.pageobject; +import static org.junit.Assert.assertTrue; + import com.gargoylesoftware.htmlunit.WebClient; import com.iluwatar.pageobject.pages.AlbumListPage; import com.iluwatar.pageobject.pages.AlbumPage; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertTrue; - - +/** + * Test Album Selection and Album Listing + */ public class AlbumListPageTest { private AlbumListPage albumListPage = new AlbumListPage(new 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 248a0ddf8..cb07a8293 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/AlbumPageTest.java @@ -22,14 +22,17 @@ */ package com.iluwatar.pageobject; +import static org.junit.Assert.assertTrue; + import com.gargoylesoftware.htmlunit.WebClient; import com.iluwatar.pageobject.pages.AlbumListPage; import com.iluwatar.pageobject.pages.AlbumPage; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertTrue; - +/** + * Test Album Page Operations + */ public class AlbumPageTest { private AlbumPage albumPage = new AlbumPage(new 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 a0483ae40..ad10a1927 100644 --- a/page-object/src/test/java/com/iluwatar/pageobject/LoginPageTest.java +++ b/page-object/src/test/java/com/iluwatar/pageobject/LoginPageTest.java @@ -22,14 +22,17 @@ */ package com.iluwatar.pageobject; +import static org.junit.Assert.assertTrue; + import com.gargoylesoftware.htmlunit.WebClient; import com.iluwatar.pageobject.pages.AlbumListPage; import com.iluwatar.pageobject.pages.LoginPage; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertTrue; - +/** + * Test Login Page Object + */ public class LoginPageTest { private LoginPage loginPage = new LoginPage(new WebClient()); 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 cb89f5f5f..cd2d2da6a 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 @@ -63,6 +63,9 @@ public interface Message { }; + /** + * Enumeration of Type of Headers + */ public enum Headers { DATE, SENDER } 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 37a5458b5..bea71ab15 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 @@ -30,6 +30,9 @@ import org.slf4j.LoggerFactory; import java.util.LinkedList; import java.util.List; +/** + * InMemory Log Appender Util. + */ public class InMemoryAppender extends AppenderBase { private List log = new LinkedList<>(); diff --git a/promise/src/main/java/com/iluwatar/promise/Utility.java b/promise/src/main/java/com/iluwatar/promise/Utility.java index 525cda338..41e07be45 100644 --- a/promise/src/main/java/com/iluwatar/promise/Utility.java +++ b/promise/src/main/java/com/iluwatar/promise/Utility.java @@ -39,6 +39,9 @@ import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; +/** + * Utility to perform various operations + */ public class Utility { private static final Logger LOGGER = LoggerFactory.getLogger(Utility.class); diff --git a/property/src/main/java/com/iluwatar/property/Character.java b/property/src/main/java/com/iluwatar/property/Character.java index db5de2b64..37552fdc8 100644 --- a/property/src/main/java/com/iluwatar/property/Character.java +++ b/property/src/main/java/com/iluwatar/property/Character.java @@ -30,6 +30,9 @@ import java.util.Map; */ public class Character implements Prototype { + /** + * Enumeration of Character types + */ public enum Type { WARRIOR, MAGE, ROGUE } diff --git a/prototype/src/test/java/com/iluwatar/prototype/PrototypeTest.java b/prototype/src/test/java/com/iluwatar/prototype/PrototypeTest.java index c17d08772..add5617b1 100644 --- a/prototype/src/test/java/com/iluwatar/prototype/PrototypeTest.java +++ b/prototype/src/test/java/com/iluwatar/prototype/PrototypeTest.java @@ -22,21 +22,20 @@ */ package com.iluwatar.prototype; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import java.util.Arrays; -import java.util.Collection; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; +import java.util.Arrays; +import java.util.Collection; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + /** * Date: 12/28/15 - 8:45 PM - * + * @param

Prototype * @author Jeroen Meulemeester */ @RunWith(Parameterized.class) 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 b0c48167d..d78fdc93f 100644 --- a/proxy/src/test/java/com/iluwatar/proxy/utils/InMemoryAppender.java +++ b/proxy/src/test/java/com/iluwatar/proxy/utils/InMemoryAppender.java @@ -30,6 +30,10 @@ import org.slf4j.LoggerFactory; import java.util.LinkedList; import java.util.List; + +/** + * InMemory Log Appender Util. + */ public class InMemoryAppender extends AppenderBase { private List log = new LinkedList<>(); 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 c22040418..30624a650 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 @@ -30,6 +30,9 @@ import org.slf4j.LoggerFactory; import java.util.LinkedList; import java.util.List; +/** + * InMemory Log Appender Util. + */ public class InMemoryAppender extends AppenderBase { private List log = new LinkedList<>(); diff --git a/repository/src/main/java/com/iluwatar/repository/PersonSpecifications.java b/repository/src/main/java/com/iluwatar/repository/PersonSpecifications.java index 0bab0950a..3da46e2ee 100644 --- a/repository/src/main/java/com/iluwatar/repository/PersonSpecifications.java +++ b/repository/src/main/java/com/iluwatar/repository/PersonSpecifications.java @@ -34,6 +34,9 @@ import org.springframework.data.jpa.domain.Specification; */ public class PersonSpecifications { + /** + * Specifications stating the Between (From - To) Age Specification + */ public static class AgeBetweenSpec implements Specification { private int from; 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 38649cd96..6786416fa 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 @@ -22,19 +22,18 @@ */ package com.iluwatar.resource.acquisition.is.initialization; +import static org.junit.Assert.assertTrue; + import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.AppenderBase; +import java.util.LinkedList; +import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.LoggerFactory; -import java.util.LinkedList; -import java.util.List; - -import static org.junit.Assert.assertTrue; - /** * Date: 12/28/15 - 9:31 PM * @@ -64,6 +63,9 @@ public class ClosableTest { assertTrue(appender.logContains("Sliding door closes.")); } + /** + * Logging Appender Implementation + */ public class InMemoryAppender extends AppenderBase { private List log = new LinkedList<>(); diff --git a/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java b/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java index fc01b8329..88255997f 100644 --- a/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java +++ b/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java @@ -23,36 +23,39 @@ package com.iluwatar.semaphore; /** - * Fruit is a resource stored in a FruitBowl. + * Fruit is a resource stored in a FruitBowl. */ public class Fruit { + /** + * Enumeration of Fruit Types + */ public static enum FruitType { ORANGE, APPLE, LEMON } - + private FruitType type; - + public Fruit(FruitType type) { this.type = type; } - + public FruitType getType() { return type; } - + /** * toString method - */ + */ public String toString() { switch (type) { case ORANGE: return "Orange"; - case APPLE: + case APPLE: return "Apple"; - case LEMON: + case LEMON: return "Lemon"; - default: + default: return ""; } } diff --git a/semaphore/src/test/java/com/iluwatar/semaphore/AppTest.java b/semaphore/src/test/java/com/iluwatar/semaphore/AppTest.java index 25dba2a6d..26d274262 100644 --- a/semaphore/src/test/java/com/iluwatar/semaphore/AppTest.java +++ b/semaphore/src/test/java/com/iluwatar/semaphore/AppTest.java @@ -25,10 +25,13 @@ package com.iluwatar.semaphore; import org.junit.Test; import java.io.IOException; +/** + * Application Test Entrypoint + */ public class AppTest{ @Test public void test() throws IOException { String[] args = {}; App.main(args); } -} \ No newline at end of file +} 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 79c7a0f86..694fc746d 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 @@ -22,23 +22,23 @@ */ package com.iluwatar.servicelayer.common; -import com.iluwatar.servicelayer.hibernate.HibernateUtil; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Function; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import com.iluwatar.servicelayer.hibernate.HibernateUtil; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + /** * Date: 12/28/15 - 10:53 PM - * + * Test for Base Data Access Objects + * @param Type of Base Entity + * @param Type of Dao Base Implementation * @author Jeroen Meulemeester */ public abstract class BaseDaoTest> { @@ -142,4 +142,4 @@ public abstract class BaseDaoTest assertEquals(expectedName, entity.toString()); } -} \ No newline at end of file +} diff --git a/singleton/src/test/java/com/iluwatar/singleton/SingletonTest.java b/singleton/src/test/java/com/iluwatar/singleton/SingletonTest.java index e8040ee99..f468ad0b8 100644 --- a/singleton/src/test/java/com/iluwatar/singleton/SingletonTest.java +++ b/singleton/src/test/java/com/iluwatar/singleton/SingletonTest.java @@ -22,7 +22,8 @@ */ package com.iluwatar.singleton; -import org.junit.Test; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; import java.util.ArrayList; import java.util.List; @@ -31,9 +32,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.function.Supplier; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; +import org.junit.Test; /** * This class provides several test case that test singleton construction. @@ -43,7 +42,7 @@ import static org.junit.Assert.assertSame; * the same when called in the DIFFERENT thread. * * Date: 12/29/15 - 19:25 PM - * + * @param Supplier method generating singletons * @author Jeroen Meulemeester * @author Richard Jones */ diff --git a/template-method/src/test/java/com/iluwatar/templatemethod/StealingMethodTest.java b/template-method/src/test/java/com/iluwatar/templatemethod/StealingMethodTest.java index 70cb23bfe..98ac62613 100644 --- a/template-method/src/test/java/com/iluwatar/templatemethod/StealingMethodTest.java +++ b/template-method/src/test/java/com/iluwatar/templatemethod/StealingMethodTest.java @@ -22,23 +22,22 @@ */ package com.iluwatar.templatemethod; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.AppenderBase; +import java.util.LinkedList; +import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.LoggerFactory; -import java.util.LinkedList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - /** * Date: 12/30/15 - 18:12 PM - * + * @param Type of StealingMethod * @author Jeroen Meulemeester */ public abstract class StealingMethodTest { diff --git a/thread-pool/src/test/java/com/iluwatar/threadpool/TaskTest.java b/thread-pool/src/test/java/com/iluwatar/threadpool/TaskTest.java index 8f061575e..b3f253056 100644 --- a/thread-pool/src/test/java/com/iluwatar/threadpool/TaskTest.java +++ b/thread-pool/src/test/java/com/iluwatar/threadpool/TaskTest.java @@ -22,7 +22,8 @@ */ package com.iluwatar.threadpool; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.util.ArrayList; import java.util.List; @@ -34,13 +35,12 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.function.Function; import java.util.stream.Collectors; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import org.junit.Test; /** * Date: 12/30/15 - 18:22 PM - * + * Test for Tasks using a Thread Pool + * @param Type of Task * @author Jeroen Meulemeester */ public abstract class TaskTest { @@ -140,4 +140,4 @@ public abstract class TaskTest { } } -} \ No newline at end of file +} diff --git a/twin/src/test/java/com/iluwatar/twin/BallItemTest.java b/twin/src/test/java/com/iluwatar/twin/BallItemTest.java index 8dfe9515c..5dad02481 100644 --- a/twin/src/test/java/com/iluwatar/twin/BallItemTest.java +++ b/twin/src/test/java/com/iluwatar/twin/BallItemTest.java @@ -22,22 +22,23 @@ */ package com.iluwatar.twin; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verifyNoMoreInteractions; + import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.AppenderBase; +import java.util.LinkedList; +import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.InOrder; import org.slf4j.LoggerFactory; -import java.util.LinkedList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.*; - /** * Date: 12/30/15 - 18:44 PM * @@ -103,6 +104,9 @@ public class BallItemTest { assertEquals(1, appender.getLogSize()); } + /** + * Logging Appender Implementation + */ public class InMemoryAppender extends AppenderBase { private List log = new LinkedList<>(); diff --git a/visitor/src/test/java/com/iluwatar/visitor/UnitTest.java b/visitor/src/test/java/com/iluwatar/visitor/UnitTest.java index 98f0f66dc..ab8470512 100644 --- a/visitor/src/test/java/com/iluwatar/visitor/UnitTest.java +++ b/visitor/src/test/java/com/iluwatar/visitor/UnitTest.java @@ -22,19 +22,19 @@ */ package com.iluwatar.visitor; -import org.junit.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.Test; + /** * Date: 12/30/15 - 18:59 PM - * + * Test related to Units + * @param Type of Unit * @author Jeroen Meulemeester */ public abstract class UnitTest { @@ -79,4 +79,4 @@ public abstract class UnitTest { */ abstract void verifyVisit(final U unit, final UnitVisitor mockedVisitor); -} \ No newline at end of file +} diff --git a/visitor/src/test/java/com/iluwatar/visitor/VisitorTest.java b/visitor/src/test/java/com/iluwatar/visitor/VisitorTest.java index dbcae196f..ba6705b23 100644 --- a/visitor/src/test/java/com/iluwatar/visitor/VisitorTest.java +++ b/visitor/src/test/java/com/iluwatar/visitor/VisitorTest.java @@ -22,23 +22,23 @@ */ package com.iluwatar.visitor; +import static org.junit.Assert.assertEquals; + import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.AppenderBase; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.LoggerFactory; -import java.util.LinkedList; -import java.util.List; -import java.util.Optional; - -import static org.junit.Assert.assertEquals; - /** * Date: 12/30/15 - 18:59 PM - * + * Test case for Visitor Pattern + * @param Type of UnitVisitor * @author Jeroen Meulemeester */ public abstract class VisitorTest { From c2a7b902a9847d360aa605b7fff7e8cc25847a87 Mon Sep 17 00:00:00 2001 From: NooBxGockeL Date: Sat, 25 Mar 2017 22:07:10 +0100 Subject: [PATCH 60/67] Work on #190: urm/puml updates * added pumlid where it was missing and possible * removed pumlid where it generated a bad image * regenerated some incorrect puml's * added 'left to right direction' puml prefix to some diagrams to improve the automatic layouting --- event-asynchronous/README.md | 11 ++++--- guarded-suspension/README.md | 1 + .../etc/guarded-suspension.urm.puml | 4 +++ hexagonal/README.md | 1 + .../etc/intercepting-filter.urm.puml | 15 ++++----- interpreter/etc/interpreter.urm.puml | 11 ++++--- layers/README.md | 1 + message-channel/README.md | 5 ++- naked-objects/README.md | 1 - object-mother/README.md | 4 +-- observer/etc/observer.urm.puml | 15 ++++----- page-object/README.md | 6 ++-- promise/README.md | 1 + promise/etc/promise.urm.puml | 5 +-- publish-subscribe/README.md | 3 +- queue-load-leveling/README.md | 4 +-- reactor/README.md | 3 +- reactor/etc/reactor.urm.puml | 13 ++++---- service-layer/etc/service-layer.urm.puml | 31 ++++++++++--------- 19 files changed, 73 insertions(+), 62 deletions(-) diff --git a/event-asynchronous/README.md b/event-asynchronous/README.md index ef35d0b38..4c26e0a3c 100644 --- a/event-asynchronous/README.md +++ b/event-asynchronous/README.md @@ -12,11 +12,12 @@ tags: ## Intent 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. +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. ![alt text](./etc/event-asynchronous.png "Event-based Asynchronous") diff --git a/guarded-suspension/README.md b/guarded-suspension/README.md index 35044f9b2..3e00539a2 100644 --- a/guarded-suspension/README.md +++ b/guarded-suspension/README.md @@ -3,6 +3,7 @@ layout: pattern title: Guarded Suspension folder: guarded-suspension permalink: /patterns/guarded-suspension/ +pumlid: ROux3W8n30LxJW47IDnJxLLCOcMD4YVoXxq-eQTwev56UeSvgiVejmTBwL4fjDzFzsLF0CKhD_OpNc6aPOgJU2vp0FUuSAVmnW-cIiPDqa9tKZ4OQ1kW1MgbcYniaHXF0VBoH-VGaTVlnK5Iztu1 categories: Concurrency tags: - Java diff --git a/guarded-suspension/etc/guarded-suspension.urm.puml b/guarded-suspension/etc/guarded-suspension.urm.puml index f99607d82..45a7d3790 100644 --- a/guarded-suspension/etc/guarded-suspension.urm.puml +++ b/guarded-suspension/etc/guarded-suspension.urm.puml @@ -1,5 +1,9 @@ @startuml package com.iluwatar.guarded.suspension { + class App { + + App() + + main(args : String[]) {static} + } class GuardedQueue { - LOGGER : Logger {static} - sourceList : Queue diff --git a/hexagonal/README.md b/hexagonal/README.md index 88908421d..dc1566625 100644 --- a/hexagonal/README.md +++ b/hexagonal/README.md @@ -4,6 +4,7 @@ title: Hexagonal Architecture folder: hexagonal permalink: /patterns/hexagonal/ pumlid: HSTB4W8X30N0g-W1XkozpPD90LO8L3wEnzUTk-xxq2fvSfhSUiJs1v7XAcr4psSwMrqQh57gcZGaBmICNdZZEDb7qsCZWasT9lm7wln1MmeXZlfVIPjbvvGl +pumlformat: svg categories: Architectural tags: - Java diff --git a/intercepting-filter/etc/intercepting-filter.urm.puml b/intercepting-filter/etc/intercepting-filter.urm.puml index 5c1e79ee4..74444c2d0 100644 --- a/intercepting-filter/etc/intercepting-filter.urm.puml +++ b/intercepting-filter/etc/intercepting-filter.urm.puml @@ -1,4 +1,5 @@ @startuml +left to right direction package com.iluwatar.intercepting.filter { abstract class AbstractFilter { - next : Filter @@ -79,10 +80,10 @@ AbstractFilter --> "-next" Filter DListener --+ Target FilterChain --> "-chain" Filter FilterManager --> "-filterChain" FilterChain -AbstractFilter ..|> Filter -AddressFilter --|> AbstractFilter -ContactFilter --|> AbstractFilter -DepositFilter --|> AbstractFilter -NameFilter --|> AbstractFilter -OrderFilter --|> AbstractFilter -@enduml \ No newline at end of file +AbstractFilter ..|> Filter +AddressFilter --|> AbstractFilter +ContactFilter --|> AbstractFilter +DepositFilter --|> AbstractFilter +NameFilter --|> AbstractFilter +OrderFilter --|> AbstractFilter +@enduml diff --git a/interpreter/etc/interpreter.urm.puml b/interpreter/etc/interpreter.urm.puml index e79ad1989..e1286a2a9 100644 --- a/interpreter/etc/interpreter.urm.puml +++ b/interpreter/etc/interpreter.urm.puml @@ -1,4 +1,5 @@ @startuml +left to right direction package com.iluwatar.interpreter { class App { - LOGGER : Logger {static} @@ -44,8 +45,8 @@ package com.iluwatar.interpreter { MultiplyExpression --> "-leftExpression" Expression MinusExpression --> "-leftExpression" Expression PlusExpression --> "-leftExpression" Expression -MinusExpression --|> Expression -MultiplyExpression --|> Expression -NumberExpression --|> Expression -PlusExpression --|> Expression -@enduml \ No newline at end of file +MinusExpression --|> Expression +MultiplyExpression --|> Expression +NumberExpression --|> Expression +PlusExpression --|> Expression +@enduml diff --git a/layers/README.md b/layers/README.md index d62c6b6b7..8eac62412 100644 --- a/layers/README.md +++ b/layers/README.md @@ -4,6 +4,7 @@ title: Layers folder: layers permalink: /patterns/layers/ pumlid: BSR13OCm30NGLSe0n7UsCS62L8w9x6yGszD3t-bDpQhc9kdwEO0H2v7pNVQ68zSCyNeQn53gsQbftWns-lB5yoRHTfi70-8Mr3b-8UL7F4XG_otflOpi-W80 +pumlformat: svg categories: Architectural tags: - Java diff --git a/message-channel/README.md b/message-channel/README.md index aa357ac0c..09361dd4a 100644 --- a/message-channel/README.md +++ b/message-channel/README.md @@ -3,9 +3,8 @@ layout: pattern title: Message Channel folder: message-channel permalink: /patterns/message-channel/ -pumlid: NSZB3SCm203GLTe1RExTXX1akm9YyMdMRy-zFRtdCf8wkLmUCtF72y3nxcFbhAE2dIvBjknqAIof6nCTtlZ1TdAiOMrZ9hi5ACOFe1o1WnjDD6C1Jlg_NgvzbyeN categories: Integration -tags: +tags: - Java - EIP - Apache Camel™ @@ -24,4 +23,4 @@ Use the Message Channel pattern when ## Real world examples -* [akka-camel](http://doc.akka.io/docs/akka/snapshot/scala/camel.html) \ No newline at end of file +* [akka-camel](http://doc.akka.io/docs/akka/snapshot/scala/camel.html) diff --git a/naked-objects/README.md b/naked-objects/README.md index 14391dd40..66e6ac2b0 100644 --- a/naked-objects/README.md +++ b/naked-objects/README.md @@ -3,7 +3,6 @@ layout: pattern title: Naked Objects folder: naked-objects permalink: /patterns/naked-objects/ -pumlid: LSX15i8W30N0g-W187jlaq9igH1uoO_r-BfrDs_kJKkFAc7zTW3B7qJ6LzuRZjZ2nSfKY2ANEQZrk1XiTFARKnLlkwR5W9Ww3VOVIFabDStjb08dGVcVz6mVX4aE6td5w5y0 categories: Architectural tags: - Java diff --git a/object-mother/README.md b/object-mother/README.md index 9188c8b41..cda3336cf 100644 --- a/object-mother/README.md +++ b/object-mother/README.md @@ -3,7 +3,7 @@ layout: pattern title: Object Mother folder: object-mother permalink: /patterns/object-mother/ -pumlid: +pumlid: LOr13iCW30JlVKNx0E3UKxxYW9KGWK7sklb-wR6dtLbfj9k15DxRurKbDo_isfudCEsTaj8TZuhJTpVMF0GiY7dqL9lVjDHqqOT2OQk7X4a0grZgPAkaiL-S4Vh0kOYH_vVeskFyVMyiPUKN categories: Creational tags: - Java @@ -28,4 +28,4 @@ Use the Object Mother pattern when * [c2wiki - Object Mother](http://c2.com/cgi/wiki?ObjectMother) -* [Nat Pryce - Test Data Builders: an alternative to the Object Mother pattern](http://www.natpryce.com/articles/000714.html) \ No newline at end of file +* [Nat Pryce - Test Data Builders: an alternative to the Object Mother pattern](http://www.natpryce.com/articles/000714.html) diff --git a/observer/etc/observer.urm.puml b/observer/etc/observer.urm.puml index bea9aab53..5d046d880 100644 --- a/observer/etc/observer.urm.puml +++ b/observer/etc/observer.urm.puml @@ -1,4 +1,5 @@ @startuml +left to right direction package com.iluwatar.observer { class App { - LOGGER : Logger {static} @@ -71,10 +72,10 @@ package com.iluwatar.observer.generic { Weather --> "-currentWeather" WeatherType GWeather --> "-currentWeather" WeatherType Weather --> "-observers" WeatherObserver -Hobbits ..|> WeatherObserver -Orcs ..|> WeatherObserver -GHobbits ..|> Race -GOrcs ..|> Race -GWeather --|> Observable -Race --|> Observer -@enduml \ No newline at end of file +Hobbits ..|> WeatherObserver +Orcs ..|> WeatherObserver +GHobbits ..|> Race +GOrcs ..|> Race +GWeather --|> Observable +Race --|> Observer +@enduml diff --git a/page-object/README.md b/page-object/README.md index 2219a077c..16c021dfb 100644 --- a/page-object/README.md +++ b/page-object/README.md @@ -3,7 +3,6 @@ layout: pattern title: Page Object folder: page-object permalink: /patterns/page-object/ -pumlid: JSV14OGW30NGLjO28FVj9iOCua1Wme-sxnxtzjvMJLeS6ju-9p3NbyZvoQNYZ3sMkWo36hACJhN5ms2dYszEXwvQB4q6r6rHv_K3JIwQndwfW1Jo_npUyupUNW00 categories: Testing tags: - Java @@ -12,7 +11,7 @@ tags: ## Intent -Page Object encapsulates the UI, hiding the underlying UI widgetry of an application (commonly a web application) and providing an application-specific API to allow the manipulation of UI components required for tests. In doing so, it allows the test class itself to focus on the test logic instead. +Page Object encapsulates the UI, hiding the underlying UI widgetry of an application (commonly a web application) and providing an application-specific API to allow the manipulation of UI components required for tests. In doing so, it allows the test class itself to focus on the test logic instead. ![alt text](./etc/page-object.png "Page Object") @@ -22,11 +21,10 @@ Page Object encapsulates the UI, hiding the underlying UI widgetry of an applica Use the Page Object pattern when -* You are writing automated tests for your web application and you want to separate the UI manipulation required for the tests from the actual test logic. +* You are writing automated tests for your web application and you want to separate the UI manipulation required for the tests from the actual test logic. * Make your tests less brittle, and more readable and robust ## Credits * [Martin Fowler - PageObject](http://martinfowler.com/bliki/PageObject.html) * [Selenium - Page Objects](https://github.com/SeleniumHQ/selenium/wiki/PageObjects) - diff --git a/promise/README.md b/promise/README.md index 638bb3ef5..65d463550 100644 --- a/promise/README.md +++ b/promise/README.md @@ -3,6 +3,7 @@ layout: pattern title: Promise folder: promise permalink: /patterns/promise/ +pumlid: DOqv4i8m301xNW4FYDLJvIl2rYHYBDcZWtmVKr3jDZkxUw15IhyzM6lFHcdzVaPCVm8ONkNWEFELJbQ71ccKEWIuvuKhXJT-S6laVEWsCO9C7GHz2KmRmav0KVzUqgJCtsydROjV categories: Concurrency tags: - Java diff --git a/promise/etc/promise.urm.puml b/promise/etc/promise.urm.puml index 45cae7ff1..8aabc1d2a 100644 --- a/promise/etc/promise.urm.puml +++ b/promise/etc/promise.urm.puml @@ -1,4 +1,5 @@ @startuml +left to right direction package com.iluwatar.promise { class App { - DEFAULT_URL : String {static} @@ -70,9 +71,9 @@ package com.iluwatar.promise { + lowestFrequencyChar(charFrequency : Map) : Character {static} } } -TransformAction --> "-src" Promise TransformAction --+ Promise +TransformAction --> "-src" Promise ConsumeAction --+ Promise ConsumeAction --> "-src" Promise Promise --|> PromiseSupport -@enduml \ No newline at end of file +@enduml diff --git a/publish-subscribe/README.md b/publish-subscribe/README.md index 3265e42ea..462209074 100644 --- a/publish-subscribe/README.md +++ b/publish-subscribe/README.md @@ -3,9 +3,8 @@ layout: pattern title: Publish Subscribe folder: publish-subscribe permalink: /patterns/publish-subscribe/ -pumlid: PSZB3SCm203GLTe1RExT1XCKKs5YyMdMR--zFRsd66aTNAwFcRdZ1U1uzrDorgXWfykIBJjT2qJhnaI7Dtwm7HnoMjkOoMu12-C7s3LKOhQe4UGo63ZfVtlvwhkMVW40 categories: Integration -tags: +tags: - Java - EIP - Apache Camel™ diff --git a/queue-load-leveling/README.md b/queue-load-leveling/README.md index 126d19176..ca73ac34a 100644 --- a/queue-load-leveling/README.md +++ b/queue-load-leveling/README.md @@ -3,7 +3,7 @@ layout: pattern title: Queue based load leveling folder: queue-load-leveling permalink: /patterns/queue-load-leveling/ -pumlid: +pumlid: ROux3W8n30LxJW47IDnJxLLCOcM376VnP_VwX9xgZKOQwMtcg1w3RuykXQDIADztzyEU08fNRjttU8MHbYbEuhdC0PtZmfN26qzCbQmtIGUwauh1G5i0dw2Wn1DhOZg9kpGWB_zy3Xtv-FtOIEhQBm00 categories: Other tags: - Java @@ -34,4 +34,4 @@ for both the task and the service. ## Credits -* [Microsoft Cloud Design Patterns: Queue-Based Load Leveling Pattern](https://msdn.microsoft.com/en-us/library/dn589783.aspx) \ No newline at end of file +* [Microsoft Cloud Design Patterns: Queue-Based Load Leveling Pattern](https://msdn.microsoft.com/en-us/library/dn589783.aspx) diff --git a/reactor/README.md b/reactor/README.md index 7fd3982ad..68461cfdd 100644 --- a/reactor/README.md +++ b/reactor/README.md @@ -4,8 +4,9 @@ title: Reactor folder: reactor permalink: /patterns/reactor/ pumlid: DSR14OGm20NGLjO23FVj1f7Hx2Ga0nzjVxtuJc-f9YrtJM-V4vZn9NA-or5nvfQXBiEWXYAZKsrvCzZfnnUlkqOzR9qCg5jGvtX2hYmOJWfvNz9xcTdR7m00 +pumlformat: svg categories: Concurrency -tags: +tags: - Java - Difficulty-Expert - I/O diff --git a/reactor/etc/reactor.urm.puml b/reactor/etc/reactor.urm.puml index cc56eae7a..1ce92cab2 100644 --- a/reactor/etc/reactor.urm.puml +++ b/reactor/etc/reactor.urm.puml @@ -1,4 +1,5 @@ @startuml +left to right direction package com.iluwatar.reactor.framework { abstract class AbstractNioChannel { - channel : SelectableChannel @@ -147,9 +148,9 @@ App --> "-channels" AbstractNioChannel DatagramPacket ..+ NioDatagramChannel App --> "-dispatcher" Dispatcher ChangeKeyOpsCommand --+ NioReactor -LoggingHandler ..|> ChannelHandler -NioDatagramChannel --|> AbstractNioChannel -NioServerSocketChannel --|> AbstractNioChannel -SameThreadDispatcher ..|> Dispatcher -ThreadPoolDispatcher ..|> Dispatcher -@enduml \ No newline at end of file +LoggingHandler ..|> ChannelHandler +NioDatagramChannel --|> AbstractNioChannel +NioServerSocketChannel --|> AbstractNioChannel +SameThreadDispatcher ..|> Dispatcher +ThreadPoolDispatcher ..|> Dispatcher +@enduml diff --git a/service-layer/etc/service-layer.urm.puml b/service-layer/etc/service-layer.urm.puml index ff870a5e9..6cf9b938d 100644 --- a/service-layer/etc/service-layer.urm.puml +++ b/service-layer/etc/service-layer.urm.puml @@ -1,4 +1,5 @@ @startuml +left to right direction package com.iluwatar.servicelayer.hibernate { class HibernateUtil { - LOGGER : Logger {static} @@ -143,18 +144,18 @@ MagicServiceImpl --> "-spellbookDao" SpellbookDao MagicServiceImpl --> "-spellDao" SpellDao Spellbook --> "-spells" Spell Spellbook --> "-wizards" Wizard -DaoBaseImpl ..|> Dao -MagicServiceImpl ..|> MagicService -Spell --|> BaseEntity -SpellDao --|> Dao -SpellDaoImpl ..|> SpellDao -SpellDaoImpl --|> DaoBaseImpl -Spellbook --|> BaseEntity -SpellbookDao --|> Dao -SpellbookDaoImpl ..|> SpellbookDao -SpellbookDaoImpl --|> DaoBaseImpl -Wizard --|> BaseEntity -WizardDao --|> Dao -WizardDaoImpl ..|> WizardDao -WizardDaoImpl --|> DaoBaseImpl -@enduml \ No newline at end of file +DaoBaseImpl ..|> Dao +MagicServiceImpl ..|> MagicService +Spell --|> BaseEntity +SpellDao --|> Dao +SpellDaoImpl ..|> SpellDao +SpellDaoImpl --|> DaoBaseImpl +Spellbook --|> BaseEntity +SpellbookDao --|> Dao +SpellbookDaoImpl ..|> SpellbookDao +SpellbookDaoImpl --|> DaoBaseImpl +Wizard --|> BaseEntity +WizardDao --|> Dao +WizardDaoImpl ..|> WizardDao +WizardDaoImpl --|> DaoBaseImpl +@enduml From 6ba4d7be98bbff255d0fdd280ae357ec10a5798e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 1 Apr 2017 12:39:06 +0300 Subject: [PATCH 61/67] #77 Add missing license header --- .../main/java/com/iluwatar/tls/Result.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tls/src/main/java/com/iluwatar/tls/Result.java b/tls/src/main/java/com/iluwatar/tls/Result.java index 951a02a2f..69ec5c502 100644 --- a/tls/src/main/java/com/iluwatar/tls/Result.java +++ b/tls/src/main/java/com/iluwatar/tls/Result.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. + */ /* * Fiducia IT AG, All rights reserved. Use is subject to license terms. */ From 2921448f8bc39cdb9a917eb0a312eb45a75dd234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 1 Apr 2017 14:25:13 +0300 Subject: [PATCH 62/67] #497 Add missing puml and license headers --- converter/etc/converter.urm.puml | 49 +++++++++++++++++++ converter/pom.xml | 24 +++++++++ .../com/iluwatar/converter/ConverterTest.java | 22 +++++++++ 3 files changed, 95 insertions(+) create mode 100644 converter/etc/converter.urm.puml diff --git a/converter/etc/converter.urm.puml b/converter/etc/converter.urm.puml new file mode 100644 index 000000000..5e0acf191 --- /dev/null +++ b/converter/etc/converter.urm.puml @@ -0,0 +1,49 @@ +@startuml +package com.iluwatar.converter { + class App { + + App() + + main(args : String[]) {static} + } + class Converter { + - fromDto : Function + - fromEntity : Function + + Converter(fromDto : Function, fromEntity : Function) + + convertFromDto(userDto : T) : U + + convertFromEntity(user : U) : T + + createFromDtos(dtoUsers : Collection) : List + + createFromEntities(users : Collection) : List + } + class User { + - firstName : String + - isActive : boolean + - lastName : String + - userId : String + + User(firstName : String, lastName : String, isActive : boolean, userId : String) + + equals(o : Object) : boolean + + getFirstName() : String + + getLastName() : String + + getUserId() : String + + hashCode() : int + + isActive() : boolean + + toString() : String + } + class UserConverter { + + UserConverter() + } + class UserDto { + - email : String + - firstName : String + - isActive : boolean + - lastName : String + + UserDto(firstName : String, lastName : String, isActive : boolean, email : String) + + equals(o : Object) : boolean + + getEmail() : String + + getFirstName() : String + + getLastName() : String + + hashCode() : int + + isActive() : boolean + + toString() : String + } +} +UserConverter --|> Converter +@enduml \ No newline at end of file diff --git a/converter/pom.xml b/converter/pom.xml index 026f30d40..01f1171a1 100644 --- a/converter/pom.xml +++ b/converter/pom.xml @@ -1,4 +1,28 @@ + diff --git a/converter/src/test/java/com/iluwatar/converter/ConverterTest.java b/converter/src/test/java/com/iluwatar/converter/ConverterTest.java index eccb81cf9..5bf820605 100644 --- a/converter/src/test/java/com/iluwatar/converter/ConverterTest.java +++ b/converter/src/test/java/com/iluwatar/converter/ConverterTest.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.converter; import com.google.common.collect.Lists; From c1c4411957c0f93f482d8bb00e99892d1e28a713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 1 Apr 2017 15:34:13 +0300 Subject: [PATCH 63/67] #539 Checkstyle fixes --- balking/src/main/java/com/iluwatar/balking/WashingMachine.java | 3 +++ converter/src/main/java/com/iluwatar/converter/User.java | 3 +++ converter/src/main/java/com/iluwatar/converter/UserDto.java | 3 +++ 3 files changed, 9 insertions(+) diff --git a/balking/src/main/java/com/iluwatar/balking/WashingMachine.java b/balking/src/main/java/com/iluwatar/balking/WashingMachine.java index 2167a0e52..e4f1259ad 100644 --- a/balking/src/main/java/com/iluwatar/balking/WashingMachine.java +++ b/balking/src/main/java/com/iluwatar/balking/WashingMachine.java @@ -25,6 +25,9 @@ package com.iluwatar.balking; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * Washing machine class + */ public class WashingMachine { private static final Logger LOGGER = LoggerFactory.getLogger(WashingMachine.class); diff --git a/converter/src/main/java/com/iluwatar/converter/User.java b/converter/src/main/java/com/iluwatar/converter/User.java index f40c01e79..62903a931 100644 --- a/converter/src/main/java/com/iluwatar/converter/User.java +++ b/converter/src/main/java/com/iluwatar/converter/User.java @@ -25,6 +25,9 @@ package com.iluwatar.converter; import java.util.Objects; +/** + * User class + */ public class User { private String firstName; private String lastName; diff --git a/converter/src/main/java/com/iluwatar/converter/UserDto.java b/converter/src/main/java/com/iluwatar/converter/UserDto.java index 8f55bbe0e..8eacc0b3b 100644 --- a/converter/src/main/java/com/iluwatar/converter/UserDto.java +++ b/converter/src/main/java/com/iluwatar/converter/UserDto.java @@ -26,6 +26,9 @@ package com.iluwatar.converter; import java.util.Objects; +/** + * User DTO class + */ public class UserDto { private String firstName; From f3c4640d1220084c65074c59e7857a1e8ee26745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 1 Apr 2017 15:43:36 +0300 Subject: [PATCH 64/67] #539 More Checkstyle fixes --- converter/src/test/java/com/iluwatar/converter/AppTest.java | 3 +++ .../src/test/java/com/iluwatar/converter/ConverterTest.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/converter/src/test/java/com/iluwatar/converter/AppTest.java b/converter/src/test/java/com/iluwatar/converter/AppTest.java index 5198827d2..091fbe2ca 100644 --- a/converter/src/test/java/com/iluwatar/converter/AppTest.java +++ b/converter/src/test/java/com/iluwatar/converter/AppTest.java @@ -24,6 +24,9 @@ package com.iluwatar.converter; import org.junit.Test; +/** + * App running test + */ public class AppTest { @Test diff --git a/converter/src/test/java/com/iluwatar/converter/ConverterTest.java b/converter/src/test/java/com/iluwatar/converter/ConverterTest.java index 5bf820605..9fc2e2a0c 100644 --- a/converter/src/test/java/com/iluwatar/converter/ConverterTest.java +++ b/converter/src/test/java/com/iluwatar/converter/ConverterTest.java @@ -31,6 +31,9 @@ import java.util.Random; import static junit.framework.TestCase.assertEquals; +/** + * Tests for {@link Converter} + */ public class ConverterTest { private UserConverter userConverter = new UserConverter(); From 139876f96a920dfdcb1b51fb5fbda57fb855065b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 1 Apr 2017 15:51:01 +0300 Subject: [PATCH 65/67] #539 Checkstyle fix --- .../src/test/java/com/iluwatar/balking/WashingMachineTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java b/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java index 3dc87d64f..ecf81f409 100644 --- a/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java +++ b/balking/src/test/java/com/iluwatar/balking/WashingMachineTest.java @@ -30,6 +30,9 @@ import java.util.concurrent.TimeUnit; import static org.junit.Assert.*; +/** + * Tests for {@link WashingMachine} + */ public class WashingMachineTest { private volatile WashingMachineState machineStateGlobal; From 8fea969912d42830b9ac09d20dafa83ef4e5c45b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 1 Apr 2017 17:14:02 +0300 Subject: [PATCH 66/67] Reached milestone 1.15.0 --- abstract-document/pom.xml | 2 +- abstract-factory/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 +- 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 +- caching/pom.xml | 2 +- callback/pom.xml | 2 +- chain/pom.xml | 2 +- command/pom.xml | 2 +- composite/pom.xml | 2 +- converter/pom.xml | 2 +- dao/pom.xml | 2 +- data-mapper/pom.xml | 2 +- decorator/pom.xml | 2 +- delegation/pom.xml | 2 +- dependency-injection/pom.xml | 2 +- double-checked-locking/pom.xml | 2 +- double-dispatch/pom.xml | 2 +- event-aggregator/pom.xml | 2 +- event-asynchronous/pom.xml | 2 +- event-driven-architecture/pom.xml | 2 +- execute-around/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 +- mediator/pom.xml | 2 +- memento/pom.xml | 2 +- message-channel/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 +- poison-pill/pom.xml | 2 +- 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 +- publish-subscribe/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 +- semaphore/pom.xml | 2 +- servant/pom.xml | 2 +- service-layer/pom.xml | 2 +- service-locator/pom.xml | 2 +- singleton/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 +- tls/pom.xml | 2 +- tolerant-reader/pom.xml | 2 +- twin/pom.xml | 2 +- value-object/pom.xml | 2 +- visitor/pom.xml | 2 +- 100 files changed, 103 insertions(+), 103 deletions(-) diff --git a/abstract-document/pom.xml b/abstract-document/pom.xml index 85215a021..766deabb3 100644 --- a/abstract-document/pom.xml +++ b/abstract-document/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 abstract-document diff --git a/abstract-factory/pom.xml b/abstract-factory/pom.xml index e3129f6f0..f1d37068c 100644 --- a/abstract-factory/pom.xml +++ b/abstract-factory/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 abstract-factory diff --git a/adapter/pom.xml b/adapter/pom.xml index 83462f28c..aa87cb8d5 100644 --- a/adapter/pom.xml +++ b/adapter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 adapter diff --git a/aggregator-microservices/aggregator-service/pom.xml b/aggregator-microservices/aggregator-service/pom.xml index 64b27f12d..1a7c75845 100644 --- a/aggregator-microservices/aggregator-service/pom.xml +++ b/aggregator-microservices/aggregator-service/pom.xml @@ -29,7 +29,7 @@ aggregator-microservices com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 4.0.0 diff --git a/aggregator-microservices/information-microservice/pom.xml b/aggregator-microservices/information-microservice/pom.xml index 3cb68099b..2a323e06d 100644 --- a/aggregator-microservices/information-microservice/pom.xml +++ b/aggregator-microservices/information-microservice/pom.xml @@ -29,7 +29,7 @@ aggregator-microservices com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 4.0.0 diff --git a/aggregator-microservices/inventory-microservice/pom.xml b/aggregator-microservices/inventory-microservice/pom.xml index 027105e7f..145f1d430 100644 --- a/aggregator-microservices/inventory-microservice/pom.xml +++ b/aggregator-microservices/inventory-microservice/pom.xml @@ -29,7 +29,7 @@ aggregator-microservices com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 4.0.0 diff --git a/aggregator-microservices/pom.xml b/aggregator-microservices/pom.xml index a38975177..e7ff8819c 100644 --- a/aggregator-microservices/pom.xml +++ b/aggregator-microservices/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 4.0.0 aggregator-microservices diff --git a/api-gateway/api-gateway-service/pom.xml b/api-gateway/api-gateway-service/pom.xml index 3bd2392fa..4e820b0f5 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.15.0-SNAPSHOT + 1.15.0 4.0.0 api-gateway-service diff --git a/api-gateway/image-microservice/pom.xml b/api-gateway/image-microservice/pom.xml index d42b31933..73bc99c48 100644 --- a/api-gateway/image-microservice/pom.xml +++ b/api-gateway/image-microservice/pom.xml @@ -29,7 +29,7 @@ api-gateway com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 4.0.0 diff --git a/api-gateway/pom.xml b/api-gateway/pom.xml index de2b3f099..dd07d1828 100644 --- a/api-gateway/pom.xml +++ b/api-gateway/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 4.0.0 api-gateway diff --git a/api-gateway/price-microservice/pom.xml b/api-gateway/price-microservice/pom.xml index 8a9a6f379..6cb04d753 100644 --- a/api-gateway/price-microservice/pom.xml +++ b/api-gateway/price-microservice/pom.xml @@ -29,7 +29,7 @@ api-gateway com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 4.0.0 diff --git a/async-method-invocation/pom.xml b/async-method-invocation/pom.xml index dc5b64404..dda91cfce 100644 --- a/async-method-invocation/pom.xml +++ b/async-method-invocation/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 async-method-invocation diff --git a/balking/pom.xml b/balking/pom.xml index ad066aee6..f33a74fdb 100644 --- a/balking/pom.xml +++ b/balking/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 4.0.0 diff --git a/bridge/pom.xml b/bridge/pom.xml index ec04ff395..f67ec274b 100644 --- a/bridge/pom.xml +++ b/bridge/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 bridge diff --git a/builder/pom.xml b/builder/pom.xml index 305de70bd..69177f27b 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 builder diff --git a/business-delegate/pom.xml b/business-delegate/pom.xml index d5fde8ea3..fa8f1658d 100644 --- a/business-delegate/pom.xml +++ b/business-delegate/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 business-delegate diff --git a/caching/pom.xml b/caching/pom.xml index 6d866eb03..632f9d70a 100644 --- a/caching/pom.xml +++ b/caching/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 caching diff --git a/callback/pom.xml b/callback/pom.xml index 2b8d1fec6..f07bc276a 100644 --- a/callback/pom.xml +++ b/callback/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 callback diff --git a/chain/pom.xml b/chain/pom.xml index 81aaf7e1f..1a3d0be20 100644 --- a/chain/pom.xml +++ b/chain/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 chain diff --git a/command/pom.xml b/command/pom.xml index e50be3e3d..e7810fb03 100644 --- a/command/pom.xml +++ b/command/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 command diff --git a/composite/pom.xml b/composite/pom.xml index 107502963..5b5e2a0bc 100644 --- a/composite/pom.xml +++ b/composite/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 composite diff --git a/converter/pom.xml b/converter/pom.xml index 01f1171a1..350bf4d7f 100644 --- a/converter/pom.xml +++ b/converter/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 4.0.0 diff --git a/dao/pom.xml b/dao/pom.xml index 374a1c14c..5f23fbd12 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 dao diff --git a/data-mapper/pom.xml b/data-mapper/pom.xml index c23868a4e..1d5a05e60 100644 --- a/data-mapper/pom.xml +++ b/data-mapper/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 data-mapper diff --git a/decorator/pom.xml b/decorator/pom.xml index 51684065c..ae3eb99ec 100644 --- a/decorator/pom.xml +++ b/decorator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 decorator diff --git a/delegation/pom.xml b/delegation/pom.xml index cf0349024..a6f18882d 100644 --- a/delegation/pom.xml +++ b/delegation/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 4.0.0 diff --git a/dependency-injection/pom.xml b/dependency-injection/pom.xml index 603bb2c05..eb83e5321 100644 --- a/dependency-injection/pom.xml +++ b/dependency-injection/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 dependency-injection diff --git a/double-checked-locking/pom.xml b/double-checked-locking/pom.xml index 0b0541b8f..f73ff254b 100644 --- a/double-checked-locking/pom.xml +++ b/double-checked-locking/pom.xml @@ -27,7 +27,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 double-checked-locking diff --git a/double-dispatch/pom.xml b/double-dispatch/pom.xml index b15e76f88..ce2520aef 100644 --- a/double-dispatch/pom.xml +++ b/double-dispatch/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 double-dispatch diff --git a/event-aggregator/pom.xml b/event-aggregator/pom.xml index 3bf8c281b..ed5113f59 100644 --- a/event-aggregator/pom.xml +++ b/event-aggregator/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 event-aggregator diff --git a/event-asynchronous/pom.xml b/event-asynchronous/pom.xml index 9fecfa606..5aa2eef38 100644 --- a/event-asynchronous/pom.xml +++ b/event-asynchronous/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 event-asynchronous diff --git a/event-driven-architecture/pom.xml b/event-driven-architecture/pom.xml index 2ced1abda..1ddc66232 100644 --- a/event-driven-architecture/pom.xml +++ b/event-driven-architecture/pom.xml @@ -31,7 +31,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 event-driven-architecture diff --git a/execute-around/pom.xml b/execute-around/pom.xml index acc36b4b4..f07fe309e 100644 --- a/execute-around/pom.xml +++ b/execute-around/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 execute-around diff --git a/facade/pom.xml b/facade/pom.xml index 0f1fa8688..97dc8c338 100644 --- a/facade/pom.xml +++ b/facade/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 facade diff --git a/factory-kit/pom.xml b/factory-kit/pom.xml index f356fc3b8..06cf9b7e3 100644 --- a/factory-kit/pom.xml +++ b/factory-kit/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 factory-kit diff --git a/factory-method/pom.xml b/factory-method/pom.xml index d6359ff03..a7625ff64 100644 --- a/factory-method/pom.xml +++ b/factory-method/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 factory-method diff --git a/feature-toggle/pom.xml b/feature-toggle/pom.xml index e2635f228..46e558c2d 100644 --- a/feature-toggle/pom.xml +++ b/feature-toggle/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 4.0.0 diff --git a/fluentinterface/pom.xml b/fluentinterface/pom.xml index 8d815079c..b26c29fb4 100644 --- a/fluentinterface/pom.xml +++ b/fluentinterface/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 4.0.0 diff --git a/flux/pom.xml b/flux/pom.xml index aa0c95796..667e851f5 100644 --- a/flux/pom.xml +++ b/flux/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 flux diff --git a/flyweight/pom.xml b/flyweight/pom.xml index 2c210a0ca..162402ab0 100644 --- a/flyweight/pom.xml +++ b/flyweight/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 flyweight diff --git a/front-controller/pom.xml b/front-controller/pom.xml index 11802d2f5..88d7bcebc 100644 --- a/front-controller/pom.xml +++ b/front-controller/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 front-controller diff --git a/guarded-suspension/pom.xml b/guarded-suspension/pom.xml index b51de54e1..12b7efbc7 100644 --- a/guarded-suspension/pom.xml +++ b/guarded-suspension/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 jar guarded-suspension diff --git a/half-sync-half-async/pom.xml b/half-sync-half-async/pom.xml index 4b3285ff1..7a199b09c 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.15.0-SNAPSHOT + 1.15.0 half-sync-half-async diff --git a/hexagonal/pom.xml b/hexagonal/pom.xml index 2cf88b626..0557aa545 100644 --- a/hexagonal/pom.xml +++ b/hexagonal/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 hexagonal diff --git a/intercepting-filter/pom.xml b/intercepting-filter/pom.xml index 2c23edff2..d02047137 100644 --- a/intercepting-filter/pom.xml +++ b/intercepting-filter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 intercepting-filter diff --git a/interpreter/pom.xml b/interpreter/pom.xml index a932e10b4..743326b48 100644 --- a/interpreter/pom.xml +++ b/interpreter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 interpreter diff --git a/iterator/pom.xml b/iterator/pom.xml index 3fcdd9852..74ad6fed4 100644 --- a/iterator/pom.xml +++ b/iterator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 iterator diff --git a/layers/pom.xml b/layers/pom.xml index 13604cb0e..3d012389d 100644 --- a/layers/pom.xml +++ b/layers/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 com.iluwatar.layers layers diff --git a/lazy-loading/pom.xml b/lazy-loading/pom.xml index 2ed0a1020..d4d4ba144 100644 --- a/lazy-loading/pom.xml +++ b/lazy-loading/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 lazy-loading diff --git a/mediator/pom.xml b/mediator/pom.xml index b9fda50a5..7b20330af 100644 --- a/mediator/pom.xml +++ b/mediator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 mediator diff --git a/memento/pom.xml b/memento/pom.xml index e6cd095d9..eeef15c41 100644 --- a/memento/pom.xml +++ b/memento/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 memento diff --git a/message-channel/pom.xml b/message-channel/pom.xml index 98b2a0c2e..6198e6ffa 100644 --- a/message-channel/pom.xml +++ b/message-channel/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 message-channel diff --git a/model-view-controller/pom.xml b/model-view-controller/pom.xml index 29823d9e8..82fabee55 100644 --- a/model-view-controller/pom.xml +++ b/model-view-controller/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 model-view-controller diff --git a/model-view-presenter/pom.xml b/model-view-presenter/pom.xml index 6c43a0048..9d3ccdf6b 100644 --- a/model-view-presenter/pom.xml +++ b/model-view-presenter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 model-view-presenter model-view-presenter diff --git a/module/pom.xml b/module/pom.xml index 8920916cb..f1338d3e6 100644 --- a/module/pom.xml +++ b/module/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 module diff --git a/monad/pom.xml b/monad/pom.xml index 63d6431db..adb0b3b4f 100644 --- a/monad/pom.xml +++ b/monad/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 monad diff --git a/monostate/pom.xml b/monostate/pom.xml index bc025fdeb..498e79b06 100644 --- a/monostate/pom.xml +++ b/monostate/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 monostate diff --git a/multiton/pom.xml b/multiton/pom.xml index 34cc4ae8d..aabc72576 100644 --- a/multiton/pom.xml +++ b/multiton/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 multiton diff --git a/mute-idiom/pom.xml b/mute-idiom/pom.xml index d68b016f9..036bb759b 100644 --- a/mute-idiom/pom.xml +++ b/mute-idiom/pom.xml @@ -21,7 +21,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 mute-idiom diff --git a/mutex/pom.xml b/mutex/pom.xml index d42a2fdab..a12ba29da 100644 --- a/mutex/pom.xml +++ b/mutex/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 mutex diff --git a/naked-objects/dom/pom.xml b/naked-objects/dom/pom.xml index 39560b5c0..895a8a8d2 100644 --- a/naked-objects/dom/pom.xml +++ b/naked-objects/dom/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.15.0-SNAPSHOT + 1.15.0 naked-objects-dom diff --git a/naked-objects/fixture/pom.xml b/naked-objects/fixture/pom.xml index a96c24626..b11796435 100644 --- a/naked-objects/fixture/pom.xml +++ b/naked-objects/fixture/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.15.0-SNAPSHOT + 1.15.0 naked-objects-fixture diff --git a/naked-objects/integtests/pom.xml b/naked-objects/integtests/pom.xml index 32ec4cd6b..d44c045f4 100644 --- a/naked-objects/integtests/pom.xml +++ b/naked-objects/integtests/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.15.0-SNAPSHOT + 1.15.0 naked-objects-integtests diff --git a/naked-objects/pom.xml b/naked-objects/pom.xml index d8acdc745..c71209513 100644 --- a/naked-objects/pom.xml +++ b/naked-objects/pom.xml @@ -15,7 +15,7 @@ java-design-patterns com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 naked-objects @@ -367,17 +367,17 @@ ${project.groupId} naked-objects-dom - 1.15.0-SNAPSHOT + 1.15.0 ${project.groupId} naked-objects-fixture - 1.15.0-SNAPSHOT + 1.15.0 ${project.groupId} naked-objects-webapp - 1.15.0-SNAPSHOT + 1.15.0 diff --git a/naked-objects/webapp/pom.xml b/naked-objects/webapp/pom.xml index 7e6d3ffcd..45d413128 100644 --- a/naked-objects/webapp/pom.xml +++ b/naked-objects/webapp/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.15.0-SNAPSHOT + 1.15.0 naked-objects-webapp diff --git a/null-object/pom.xml b/null-object/pom.xml index 2c494e3b7..4fa75ceeb 100644 --- a/null-object/pom.xml +++ b/null-object/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 null-object diff --git a/object-mother/pom.xml b/object-mother/pom.xml index fc7d96a85..4c8a8252c 100644 --- a/object-mother/pom.xml +++ b/object-mother/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 object-mother diff --git a/object-pool/pom.xml b/object-pool/pom.xml index 19ac48956..4ab51470a 100644 --- a/object-pool/pom.xml +++ b/object-pool/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 object-pool diff --git a/observer/pom.xml b/observer/pom.xml index bb313552c..f52be8ab1 100644 --- a/observer/pom.xml +++ b/observer/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 observer diff --git a/page-object/pom.xml b/page-object/pom.xml index 35ee916a5..aec481498 100644 --- a/page-object/pom.xml +++ b/page-object/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 page-object diff --git a/poison-pill/pom.xml b/poison-pill/pom.xml index e518649cf..ecb9ccfdc 100644 --- a/poison-pill/pom.xml +++ b/poison-pill/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 poison-pill diff --git a/pom.xml b/pom.xml index 4b22adeb6..a548b6bf1 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 4.0.0 com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 pom 2014 diff --git a/private-class-data/pom.xml b/private-class-data/pom.xml index 957e18033..496b48283 100644 --- a/private-class-data/pom.xml +++ b/private-class-data/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 private-class-data diff --git a/producer-consumer/pom.xml b/producer-consumer/pom.xml index dbc80614f..8570d98bc 100644 --- a/producer-consumer/pom.xml +++ b/producer-consumer/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 producer-consumer diff --git a/promise/pom.xml b/promise/pom.xml index a93ef2ba5..5bf362613 100644 --- a/promise/pom.xml +++ b/promise/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 promise diff --git a/property/pom.xml b/property/pom.xml index 4b28b9f54..bf0840739 100644 --- a/property/pom.xml +++ b/property/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 property diff --git a/prototype/pom.xml b/prototype/pom.xml index 995757d5a..4145ac538 100644 --- a/prototype/pom.xml +++ b/prototype/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 prototype diff --git a/proxy/pom.xml b/proxy/pom.xml index f12db724c..bf32d8556 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 proxy diff --git a/publish-subscribe/pom.xml b/publish-subscribe/pom.xml index 1586815c1..ee6a6720b 100644 --- a/publish-subscribe/pom.xml +++ b/publish-subscribe/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 publish-subscribe diff --git a/queue-load-leveling/pom.xml b/queue-load-leveling/pom.xml index 351f94906..6167570cb 100644 --- a/queue-load-leveling/pom.xml +++ b/queue-load-leveling/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 queue-load-leveling diff --git a/reactor/pom.xml b/reactor/pom.xml index 1d3aa22e7..69dccf542 100644 --- a/reactor/pom.xml +++ b/reactor/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 reactor diff --git a/reader-writer-lock/pom.xml b/reader-writer-lock/pom.xml index a46f6f5b2..d811d3c8b 100644 --- a/reader-writer-lock/pom.xml +++ b/reader-writer-lock/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 reader-writer-lock diff --git a/repository/pom.xml b/repository/pom.xml index 5cae0466f..879d1b58e 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 repository diff --git a/resource-acquisition-is-initialization/pom.xml b/resource-acquisition-is-initialization/pom.xml index ecf304ad2..92707a5bb 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.15.0-SNAPSHOT + 1.15.0 resource-acquisition-is-initialization diff --git a/semaphore/pom.xml b/semaphore/pom.xml index 34b6bf629..22ee544c6 100644 --- a/semaphore/pom.xml +++ b/semaphore/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 semaphore diff --git a/servant/pom.xml b/servant/pom.xml index fc59c795b..f861ae746 100644 --- a/servant/pom.xml +++ b/servant/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 servant diff --git a/service-layer/pom.xml b/service-layer/pom.xml index 3d9e5e26f..af0d96a02 100644 --- a/service-layer/pom.xml +++ b/service-layer/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 service-layer diff --git a/service-locator/pom.xml b/service-locator/pom.xml index 397955f8e..4046670a0 100644 --- a/service-locator/pom.xml +++ b/service-locator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 service-locator diff --git a/singleton/pom.xml b/singleton/pom.xml index 8ddcb2131..c68d58235 100644 --- a/singleton/pom.xml +++ b/singleton/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 singleton diff --git a/specification/pom.xml b/specification/pom.xml index 40584b7ca..8a58a8dd6 100644 --- a/specification/pom.xml +++ b/specification/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 specification diff --git a/state/pom.xml b/state/pom.xml index 18a2608cd..f0245dfd9 100644 --- a/state/pom.xml +++ b/state/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 state diff --git a/step-builder/pom.xml b/step-builder/pom.xml index b33f48fb7..5d63f0187 100644 --- a/step-builder/pom.xml +++ b/step-builder/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.15.0-SNAPSHOT + 1.15.0 step-builder diff --git a/strategy/pom.xml b/strategy/pom.xml index c47281228..88749d2cb 100644 --- a/strategy/pom.xml +++ b/strategy/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 strategy diff --git a/template-method/pom.xml b/template-method/pom.xml index 4a40c89fb..81ac4ddfb 100644 --- a/template-method/pom.xml +++ b/template-method/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 template-method diff --git a/thread-pool/pom.xml b/thread-pool/pom.xml index a3b8d1fe6..127fdad8d 100644 --- a/thread-pool/pom.xml +++ b/thread-pool/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 thread-pool diff --git a/tls/pom.xml b/tls/pom.xml index fa8bf6860..3ab25fadd 100644 --- a/tls/pom.xml +++ b/tls/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 tls diff --git a/tolerant-reader/pom.xml b/tolerant-reader/pom.xml index da580631d..ee983bbba 100644 --- a/tolerant-reader/pom.xml +++ b/tolerant-reader/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 tolerant-reader diff --git a/twin/pom.xml b/twin/pom.xml index b9f6fb6ee..2b57a6cd4 100644 --- a/twin/pom.xml +++ b/twin/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 twin diff --git a/value-object/pom.xml b/value-object/pom.xml index ae18ed94a..4b9958fa5 100644 --- a/value-object/pom.xml +++ b/value-object/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 value-object diff --git a/visitor/pom.xml b/visitor/pom.xml index 2aeeb73b0..48a68386c 100644 --- a/visitor/pom.xml +++ b/visitor/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0-SNAPSHOT + 1.15.0 visitor From 073d06c0ae9cf4277bd54a7195c28420c6b8efb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sat, 1 Apr 2017 17:15:59 +0300 Subject: [PATCH 67/67] Set version for next development iteration --- abstract-document/pom.xml | 2 +- abstract-factory/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 +- 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 +- caching/pom.xml | 2 +- callback/pom.xml | 2 +- chain/pom.xml | 2 +- command/pom.xml | 2 +- composite/pom.xml | 2 +- converter/pom.xml | 2 +- dao/pom.xml | 2 +- data-mapper/pom.xml | 2 +- decorator/pom.xml | 2 +- delegation/pom.xml | 2 +- dependency-injection/pom.xml | 2 +- double-checked-locking/pom.xml | 2 +- double-dispatch/pom.xml | 2 +- event-aggregator/pom.xml | 2 +- event-asynchronous/pom.xml | 2 +- event-driven-architecture/pom.xml | 2 +- execute-around/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 +- mediator/pom.xml | 2 +- memento/pom.xml | 2 +- message-channel/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 +- poison-pill/pom.xml | 2 +- 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 +- publish-subscribe/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 +- semaphore/pom.xml | 2 +- servant/pom.xml | 2 +- service-layer/pom.xml | 2 +- service-locator/pom.xml | 2 +- singleton/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 +- tls/pom.xml | 2 +- tolerant-reader/pom.xml | 2 +- twin/pom.xml | 2 +- value-object/pom.xml | 2 +- visitor/pom.xml | 2 +- 100 files changed, 103 insertions(+), 103 deletions(-) diff --git a/abstract-document/pom.xml b/abstract-document/pom.xml index 766deabb3..54b157df6 100644 --- a/abstract-document/pom.xml +++ b/abstract-document/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT abstract-document diff --git a/abstract-factory/pom.xml b/abstract-factory/pom.xml index f1d37068c..d37159409 100644 --- a/abstract-factory/pom.xml +++ b/abstract-factory/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT abstract-factory diff --git a/adapter/pom.xml b/adapter/pom.xml index aa87cb8d5..8cf754618 100644 --- a/adapter/pom.xml +++ b/adapter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT adapter diff --git a/aggregator-microservices/aggregator-service/pom.xml b/aggregator-microservices/aggregator-service/pom.xml index 1a7c75845..477ce00c8 100644 --- a/aggregator-microservices/aggregator-service/pom.xml +++ b/aggregator-microservices/aggregator-service/pom.xml @@ -29,7 +29,7 @@ aggregator-microservices com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT 4.0.0 diff --git a/aggregator-microservices/information-microservice/pom.xml b/aggregator-microservices/information-microservice/pom.xml index 2a323e06d..234daa25d 100644 --- a/aggregator-microservices/information-microservice/pom.xml +++ b/aggregator-microservices/information-microservice/pom.xml @@ -29,7 +29,7 @@ aggregator-microservices com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT 4.0.0 diff --git a/aggregator-microservices/inventory-microservice/pom.xml b/aggregator-microservices/inventory-microservice/pom.xml index 145f1d430..bdd96eec9 100644 --- a/aggregator-microservices/inventory-microservice/pom.xml +++ b/aggregator-microservices/inventory-microservice/pom.xml @@ -29,7 +29,7 @@ aggregator-microservices com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT 4.0.0 diff --git a/aggregator-microservices/pom.xml b/aggregator-microservices/pom.xml index e7ff8819c..e08ee58f8 100644 --- a/aggregator-microservices/pom.xml +++ b/aggregator-microservices/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT 4.0.0 aggregator-microservices diff --git a/api-gateway/api-gateway-service/pom.xml b/api-gateway/api-gateway-service/pom.xml index 4e820b0f5..e36b09fd4 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.15.0 + 1.16.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 73bc99c48..b9430ff69 100644 --- a/api-gateway/image-microservice/pom.xml +++ b/api-gateway/image-microservice/pom.xml @@ -29,7 +29,7 @@ api-gateway com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT 4.0.0 diff --git a/api-gateway/pom.xml b/api-gateway/pom.xml index dd07d1828..7fdc54f8a 100644 --- a/api-gateway/pom.xml +++ b/api-gateway/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT 4.0.0 api-gateway diff --git a/api-gateway/price-microservice/pom.xml b/api-gateway/price-microservice/pom.xml index 6cb04d753..68dc75640 100644 --- a/api-gateway/price-microservice/pom.xml +++ b/api-gateway/price-microservice/pom.xml @@ -29,7 +29,7 @@ api-gateway com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT 4.0.0 diff --git a/async-method-invocation/pom.xml b/async-method-invocation/pom.xml index dda91cfce..1dc9a6b73 100644 --- a/async-method-invocation/pom.xml +++ b/async-method-invocation/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT async-method-invocation diff --git a/balking/pom.xml b/balking/pom.xml index f33a74fdb..2e27d9332 100644 --- a/balking/pom.xml +++ b/balking/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT 4.0.0 diff --git a/bridge/pom.xml b/bridge/pom.xml index f67ec274b..7c60f8ef8 100644 --- a/bridge/pom.xml +++ b/bridge/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT bridge diff --git a/builder/pom.xml b/builder/pom.xml index 69177f27b..806d61b0a 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT builder diff --git a/business-delegate/pom.xml b/business-delegate/pom.xml index fa8f1658d..6ac3d9f4f 100644 --- a/business-delegate/pom.xml +++ b/business-delegate/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT business-delegate diff --git a/caching/pom.xml b/caching/pom.xml index 632f9d70a..6ec90234d 100644 --- a/caching/pom.xml +++ b/caching/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT caching diff --git a/callback/pom.xml b/callback/pom.xml index f07bc276a..a64ddac51 100644 --- a/callback/pom.xml +++ b/callback/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT callback diff --git a/chain/pom.xml b/chain/pom.xml index 1a3d0be20..7b283b012 100644 --- a/chain/pom.xml +++ b/chain/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT chain diff --git a/command/pom.xml b/command/pom.xml index e7810fb03..cbf851701 100644 --- a/command/pom.xml +++ b/command/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT command diff --git a/composite/pom.xml b/composite/pom.xml index 5b5e2a0bc..f3b1a38b5 100644 --- a/composite/pom.xml +++ b/composite/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT composite diff --git a/converter/pom.xml b/converter/pom.xml index 350bf4d7f..569899f1d 100644 --- a/converter/pom.xml +++ b/converter/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT 4.0.0 diff --git a/dao/pom.xml b/dao/pom.xml index 5f23fbd12..b7de27bd4 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT dao diff --git a/data-mapper/pom.xml b/data-mapper/pom.xml index 1d5a05e60..878f02fed 100644 --- a/data-mapper/pom.xml +++ b/data-mapper/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT data-mapper diff --git a/decorator/pom.xml b/decorator/pom.xml index ae3eb99ec..5b6d24723 100644 --- a/decorator/pom.xml +++ b/decorator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT decorator diff --git a/delegation/pom.xml b/delegation/pom.xml index a6f18882d..befd02a59 100644 --- a/delegation/pom.xml +++ b/delegation/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT 4.0.0 diff --git a/dependency-injection/pom.xml b/dependency-injection/pom.xml index eb83e5321..ccbbea9a2 100644 --- a/dependency-injection/pom.xml +++ b/dependency-injection/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT dependency-injection diff --git a/double-checked-locking/pom.xml b/double-checked-locking/pom.xml index f73ff254b..7e19561de 100644 --- a/double-checked-locking/pom.xml +++ b/double-checked-locking/pom.xml @@ -27,7 +27,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT double-checked-locking diff --git a/double-dispatch/pom.xml b/double-dispatch/pom.xml index ce2520aef..c87efc185 100644 --- a/double-dispatch/pom.xml +++ b/double-dispatch/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT double-dispatch diff --git a/event-aggregator/pom.xml b/event-aggregator/pom.xml index ed5113f59..276aecd0c 100644 --- a/event-aggregator/pom.xml +++ b/event-aggregator/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT event-aggregator diff --git a/event-asynchronous/pom.xml b/event-asynchronous/pom.xml index 5aa2eef38..a10fec55d 100644 --- a/event-asynchronous/pom.xml +++ b/event-asynchronous/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT event-asynchronous diff --git a/event-driven-architecture/pom.xml b/event-driven-architecture/pom.xml index 1ddc66232..f021f4023 100644 --- a/event-driven-architecture/pom.xml +++ b/event-driven-architecture/pom.xml @@ -31,7 +31,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT event-driven-architecture diff --git a/execute-around/pom.xml b/execute-around/pom.xml index f07fe309e..765b52846 100644 --- a/execute-around/pom.xml +++ b/execute-around/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT execute-around diff --git a/facade/pom.xml b/facade/pom.xml index 97dc8c338..a9a1ed226 100644 --- a/facade/pom.xml +++ b/facade/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT facade diff --git a/factory-kit/pom.xml b/factory-kit/pom.xml index 06cf9b7e3..0fef94e84 100644 --- a/factory-kit/pom.xml +++ b/factory-kit/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT factory-kit diff --git a/factory-method/pom.xml b/factory-method/pom.xml index a7625ff64..8cc506c62 100644 --- a/factory-method/pom.xml +++ b/factory-method/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT factory-method diff --git a/feature-toggle/pom.xml b/feature-toggle/pom.xml index 46e558c2d..7fbb085f2 100644 --- a/feature-toggle/pom.xml +++ b/feature-toggle/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT 4.0.0 diff --git a/fluentinterface/pom.xml b/fluentinterface/pom.xml index b26c29fb4..cc243123b 100644 --- a/fluentinterface/pom.xml +++ b/fluentinterface/pom.xml @@ -29,7 +29,7 @@ java-design-patterns com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT 4.0.0 diff --git a/flux/pom.xml b/flux/pom.xml index 667e851f5..158ca8c65 100644 --- a/flux/pom.xml +++ b/flux/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT flux diff --git a/flyweight/pom.xml b/flyweight/pom.xml index 162402ab0..d9574b589 100644 --- a/flyweight/pom.xml +++ b/flyweight/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT flyweight diff --git a/front-controller/pom.xml b/front-controller/pom.xml index 88d7bcebc..082fe27c0 100644 --- a/front-controller/pom.xml +++ b/front-controller/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT front-controller diff --git a/guarded-suspension/pom.xml b/guarded-suspension/pom.xml index 12b7efbc7..b7423d1eb 100644 --- a/guarded-suspension/pom.xml +++ b/guarded-suspension/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT jar guarded-suspension diff --git a/half-sync-half-async/pom.xml b/half-sync-half-async/pom.xml index 7a199b09c..2952f8d54 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.15.0 + 1.16.0-SNAPSHOT half-sync-half-async diff --git a/hexagonal/pom.xml b/hexagonal/pom.xml index 0557aa545..9af418fbb 100644 --- a/hexagonal/pom.xml +++ b/hexagonal/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT hexagonal diff --git a/intercepting-filter/pom.xml b/intercepting-filter/pom.xml index d02047137..e5082ef00 100644 --- a/intercepting-filter/pom.xml +++ b/intercepting-filter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT intercepting-filter diff --git a/interpreter/pom.xml b/interpreter/pom.xml index 743326b48..a9c4126d4 100644 --- a/interpreter/pom.xml +++ b/interpreter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT interpreter diff --git a/iterator/pom.xml b/iterator/pom.xml index 74ad6fed4..c05c78d3c 100644 --- a/iterator/pom.xml +++ b/iterator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT iterator diff --git a/layers/pom.xml b/layers/pom.xml index 3d012389d..621facbea 100644 --- a/layers/pom.xml +++ b/layers/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT com.iluwatar.layers layers diff --git a/lazy-loading/pom.xml b/lazy-loading/pom.xml index d4d4ba144..4e95046bf 100644 --- a/lazy-loading/pom.xml +++ b/lazy-loading/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT lazy-loading diff --git a/mediator/pom.xml b/mediator/pom.xml index 7b20330af..b48324472 100644 --- a/mediator/pom.xml +++ b/mediator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT mediator diff --git a/memento/pom.xml b/memento/pom.xml index eeef15c41..0990844f7 100644 --- a/memento/pom.xml +++ b/memento/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT memento diff --git a/message-channel/pom.xml b/message-channel/pom.xml index 6198e6ffa..91c631313 100644 --- a/message-channel/pom.xml +++ b/message-channel/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT message-channel diff --git a/model-view-controller/pom.xml b/model-view-controller/pom.xml index 82fabee55..bf7ace403 100644 --- a/model-view-controller/pom.xml +++ b/model-view-controller/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT model-view-controller diff --git a/model-view-presenter/pom.xml b/model-view-presenter/pom.xml index 9d3ccdf6b..2eeedc6df 100644 --- a/model-view-presenter/pom.xml +++ b/model-view-presenter/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT model-view-presenter model-view-presenter diff --git a/module/pom.xml b/module/pom.xml index f1338d3e6..caa66cb54 100644 --- a/module/pom.xml +++ b/module/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT module diff --git a/monad/pom.xml b/monad/pom.xml index adb0b3b4f..694ba71ed 100644 --- a/monad/pom.xml +++ b/monad/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT monad diff --git a/monostate/pom.xml b/monostate/pom.xml index 498e79b06..be7ba99a4 100644 --- a/monostate/pom.xml +++ b/monostate/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT monostate diff --git a/multiton/pom.xml b/multiton/pom.xml index aabc72576..b4dd361ae 100644 --- a/multiton/pom.xml +++ b/multiton/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT multiton diff --git a/mute-idiom/pom.xml b/mute-idiom/pom.xml index 036bb759b..0fedbf901 100644 --- a/mute-idiom/pom.xml +++ b/mute-idiom/pom.xml @@ -21,7 +21,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT mute-idiom diff --git a/mutex/pom.xml b/mutex/pom.xml index a12ba29da..0a3ad9e93 100644 --- a/mutex/pom.xml +++ b/mutex/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT mutex diff --git a/naked-objects/dom/pom.xml b/naked-objects/dom/pom.xml index 895a8a8d2..9b98700b8 100644 --- a/naked-objects/dom/pom.xml +++ b/naked-objects/dom/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.15.0 + 1.16.0-SNAPSHOT naked-objects-dom diff --git a/naked-objects/fixture/pom.xml b/naked-objects/fixture/pom.xml index b11796435..e48ec5b30 100644 --- a/naked-objects/fixture/pom.xml +++ b/naked-objects/fixture/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.15.0 + 1.16.0-SNAPSHOT naked-objects-fixture diff --git a/naked-objects/integtests/pom.xml b/naked-objects/integtests/pom.xml index d44c045f4..7389e5cef 100644 --- a/naked-objects/integtests/pom.xml +++ b/naked-objects/integtests/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.15.0 + 1.16.0-SNAPSHOT naked-objects-integtests diff --git a/naked-objects/pom.xml b/naked-objects/pom.xml index c71209513..d2cf69296 100644 --- a/naked-objects/pom.xml +++ b/naked-objects/pom.xml @@ -15,7 +15,7 @@ java-design-patterns com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT naked-objects @@ -367,17 +367,17 @@ ${project.groupId} naked-objects-dom - 1.15.0 + 1.16.0-SNAPSHOT ${project.groupId} naked-objects-fixture - 1.15.0 + 1.16.0-SNAPSHOT ${project.groupId} naked-objects-webapp - 1.15.0 + 1.16.0-SNAPSHOT diff --git a/naked-objects/webapp/pom.xml b/naked-objects/webapp/pom.xml index 45d413128..c415050bc 100644 --- a/naked-objects/webapp/pom.xml +++ b/naked-objects/webapp/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.15.0 + 1.16.0-SNAPSHOT naked-objects-webapp diff --git a/null-object/pom.xml b/null-object/pom.xml index 4fa75ceeb..6f96d777c 100644 --- a/null-object/pom.xml +++ b/null-object/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT null-object diff --git a/object-mother/pom.xml b/object-mother/pom.xml index 4c8a8252c..f2f933e49 100644 --- a/object-mother/pom.xml +++ b/object-mother/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT object-mother diff --git a/object-pool/pom.xml b/object-pool/pom.xml index 4ab51470a..bf2e3d4ae 100644 --- a/object-pool/pom.xml +++ b/object-pool/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT object-pool diff --git a/observer/pom.xml b/observer/pom.xml index f52be8ab1..a854aaada 100644 --- a/observer/pom.xml +++ b/observer/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT observer diff --git a/page-object/pom.xml b/page-object/pom.xml index aec481498..748342d99 100644 --- a/page-object/pom.xml +++ b/page-object/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT page-object diff --git a/poison-pill/pom.xml b/poison-pill/pom.xml index ecb9ccfdc..c1c8432a1 100644 --- a/poison-pill/pom.xml +++ b/poison-pill/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT poison-pill diff --git a/pom.xml b/pom.xml index a548b6bf1..4b9740857 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 4.0.0 com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT pom 2014 diff --git a/private-class-data/pom.xml b/private-class-data/pom.xml index 496b48283..de75796dc 100644 --- a/private-class-data/pom.xml +++ b/private-class-data/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT private-class-data diff --git a/producer-consumer/pom.xml b/producer-consumer/pom.xml index 8570d98bc..ccdfc135a 100644 --- a/producer-consumer/pom.xml +++ b/producer-consumer/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT producer-consumer diff --git a/promise/pom.xml b/promise/pom.xml index 5bf362613..1b20fd784 100644 --- a/promise/pom.xml +++ b/promise/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT promise diff --git a/property/pom.xml b/property/pom.xml index bf0840739..b488f8e57 100644 --- a/property/pom.xml +++ b/property/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT property diff --git a/prototype/pom.xml b/prototype/pom.xml index 4145ac538..a73223b9c 100644 --- a/prototype/pom.xml +++ b/prototype/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT prototype diff --git a/proxy/pom.xml b/proxy/pom.xml index bf32d8556..293f3098d 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT proxy diff --git a/publish-subscribe/pom.xml b/publish-subscribe/pom.xml index ee6a6720b..3f969eac9 100644 --- a/publish-subscribe/pom.xml +++ b/publish-subscribe/pom.xml @@ -28,7 +28,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT publish-subscribe diff --git a/queue-load-leveling/pom.xml b/queue-load-leveling/pom.xml index 6167570cb..3966dd4db 100644 --- a/queue-load-leveling/pom.xml +++ b/queue-load-leveling/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT queue-load-leveling diff --git a/reactor/pom.xml b/reactor/pom.xml index 69dccf542..ca6440318 100644 --- a/reactor/pom.xml +++ b/reactor/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT reactor diff --git a/reader-writer-lock/pom.xml b/reader-writer-lock/pom.xml index d811d3c8b..7a873c551 100644 --- a/reader-writer-lock/pom.xml +++ b/reader-writer-lock/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT reader-writer-lock diff --git a/repository/pom.xml b/repository/pom.xml index 879d1b58e..cbb431e39 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT repository diff --git a/resource-acquisition-is-initialization/pom.xml b/resource-acquisition-is-initialization/pom.xml index 92707a5bb..fae94e91c 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.15.0 + 1.16.0-SNAPSHOT resource-acquisition-is-initialization diff --git a/semaphore/pom.xml b/semaphore/pom.xml index 22ee544c6..1d606ae6c 100644 --- a/semaphore/pom.xml +++ b/semaphore/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT semaphore diff --git a/servant/pom.xml b/servant/pom.xml index f861ae746..185076b59 100644 --- a/servant/pom.xml +++ b/servant/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT servant diff --git a/service-layer/pom.xml b/service-layer/pom.xml index af0d96a02..8028bcaea 100644 --- a/service-layer/pom.xml +++ b/service-layer/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT service-layer diff --git a/service-locator/pom.xml b/service-locator/pom.xml index 4046670a0..3c9551770 100644 --- a/service-locator/pom.xml +++ b/service-locator/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT service-locator diff --git a/singleton/pom.xml b/singleton/pom.xml index c68d58235..672807527 100644 --- a/singleton/pom.xml +++ b/singleton/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT singleton diff --git a/specification/pom.xml b/specification/pom.xml index 8a58a8dd6..33cc0f1e5 100644 --- a/specification/pom.xml +++ b/specification/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT specification diff --git a/state/pom.xml b/state/pom.xml index f0245dfd9..7c0e9ab3f 100644 --- a/state/pom.xml +++ b/state/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT state diff --git a/step-builder/pom.xml b/step-builder/pom.xml index 5d63f0187..e98069d60 100644 --- a/step-builder/pom.xml +++ b/step-builder/pom.xml @@ -30,7 +30,7 @@ java-design-patterns com.iluwatar - 1.15.0 + 1.16.0-SNAPSHOT step-builder diff --git a/strategy/pom.xml b/strategy/pom.xml index 88749d2cb..d29f4b2ba 100644 --- a/strategy/pom.xml +++ b/strategy/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT strategy diff --git a/template-method/pom.xml b/template-method/pom.xml index 81ac4ddfb..a2ceadc10 100644 --- a/template-method/pom.xml +++ b/template-method/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT template-method diff --git a/thread-pool/pom.xml b/thread-pool/pom.xml index 127fdad8d..2efd4cb50 100644 --- a/thread-pool/pom.xml +++ b/thread-pool/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT thread-pool diff --git a/tls/pom.xml b/tls/pom.xml index 3ab25fadd..99849bf22 100644 --- a/tls/pom.xml +++ b/tls/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT tls diff --git a/tolerant-reader/pom.xml b/tolerant-reader/pom.xml index ee983bbba..4e614e44c 100644 --- a/tolerant-reader/pom.xml +++ b/tolerant-reader/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT tolerant-reader diff --git a/twin/pom.xml b/twin/pom.xml index 2b57a6cd4..15b2e3094 100644 --- a/twin/pom.xml +++ b/twin/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT twin diff --git a/value-object/pom.xml b/value-object/pom.xml index 4b9958fa5..90716fbcc 100644 --- a/value-object/pom.xml +++ b/value-object/pom.xml @@ -30,7 +30,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT value-object diff --git a/visitor/pom.xml b/visitor/pom.xml index 48a68386c..9acd24003 100644 --- a/visitor/pom.xml +++ b/visitor/pom.xml @@ -29,7 +29,7 @@ com.iluwatar java-design-patterns - 1.15.0 + 1.16.0-SNAPSHOT visitor