diff --git a/.gitignore b/.gitignore index 1890e8bd0e..08f570ad06 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ SpringDataInjectionDemo/.mvn/wrapper/maven-wrapper.properties spring-call-getters-using-reflection/.mvn/wrapper/maven-wrapper.properties spring-check-if-a-property-is-null/.mvn/wrapper/maven-wrapper.properties +*.springBeans + diff --git a/README.md b/README.md index f0d3d29da7..25398d1d39 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,4 @@ Any IDE can be used to work with the projects, but if you're using Eclipse, cons CI - Jenkins ================================ -This tutorials project is being built **[>> HERE](https://rest-security.ci.cloudbees.com/job/tutorials/)** +This tutorials project is being built **[>> HERE](https://rest-security.ci.cloudbees.com/job/github%20projects%20Jobs/job/tutorials/)** diff --git a/algorithms/README.md b/algorithms/README.md index dc12b528da..8cf4c35b68 100644 --- a/algorithms/README.md +++ b/algorithms/README.md @@ -8,3 +8,4 @@ - [Check If a Number Is Prime in Java](http://www.baeldung.com/java-prime-numbers) - [Example of Hill Climbing Algorithm](http://www.baeldung.com/java-hill-climbing-algorithm) - [Monte Carlo Tree Search for Tic-Tac-Toe Game](http://www.baeldung.com/java-monte-carlo-tree-search) +- [String Search Algorithms for Large Texts](http://www.baeldung.com/java-full-text-search-algorithms) diff --git a/algorithms/src/main/java/com/baeldung/algorithms/BinarySearch.java b/algorithms/src/main/java/com/baeldung/algorithms/BinarySearch.java deleted file mode 100644 index be4a9e578a..0000000000 --- a/algorithms/src/main/java/com/baeldung/algorithms/BinarySearch.java +++ /dev/null @@ -1,26 +0,0 @@ -public class BinarySearch { - - public int runBinarySearch() { - int[] sortedArray = { 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9 }; - int key = 6; - - int low = 0; - int high = sortedArray.length - 1; - int index = Integer.MAX_VALUE; - - while (low <= high) { - - int mid = (low + high) / 2; - - if (sortedArray[mid] < key) { - low = mid + 1; - } else if (sortedArray[mid] > key) { - high = mid - 1; - } else if (sortedArray[mid] == key) { - index = mid; - break; - } - } - return index; - } -} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java b/algorithms/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java new file mode 100644 index 0000000000..5b2ac49d4e --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/binarysearch/BinarySearch.java @@ -0,0 +1,55 @@ +package com.baeldung.algorithms.binarysearch; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class BinarySearch { + + public int runBinarySearchIteratively(int[] sortedArray, int key, int low, int high) { + + int index = Integer.MAX_VALUE; + + while (low <= high) { + + int mid = (low + high) / 2; + + if (sortedArray[mid] < key) { + low = mid + 1; + } else if (sortedArray[mid] > key) { + high = mid - 1; + } else if (sortedArray[mid] == key) { + index = mid; + break; + } + } + return index; + } + + public int runBinarySearchRecursively(int[] sortedArray, int key, int low, int high) { + + int middle = (low + high) / 2; + if (high < low) { + return -1; + } + + if (key == sortedArray[middle]) { + return middle; + } else if (key < sortedArray[middle]) { + return runBinarySearchRecursively(sortedArray, key, low, middle - 1); + } else { + return runBinarySearchRecursively(sortedArray, key, middle + 1, high); + } + } + + public int runBinarySearchUsingJavaArrays(int[] sortedArray, Integer key) { + int index = Arrays.binarySearch(sortedArray, key); + return index; + } + + public int runBinarySearchUsingJavaCollections(List sortedList, Integer key) { + int index = Collections.binarySearch(sortedList, key); + return index; + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForce.java b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForce.java new file mode 100644 index 0000000000..1df425ad2e --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForce.java @@ -0,0 +1,38 @@ +package com.baeldung.algorithms.linkedlist; + +public class CycleDetectionBruteForce { + + public static CycleDetectionResult detectCycle(Node head) { + if (head == null) { + return new CycleDetectionResult<>(false, null); + } + + Node it1 = head; + int nodesTraversedByOuter = 0; + while (it1 != null && it1.next != null) { + it1 = it1.next; + nodesTraversedByOuter++; + + int x = nodesTraversedByOuter; + Node it2 = head; + int noOfTimesCurrentNodeVisited = 0; + + while (x > 0) { + it2 = it2.next; + + if (it2 == it1) { + noOfTimesCurrentNodeVisited++; + } + + if (noOfTimesCurrentNodeVisited == 2) { + return new CycleDetectionResult<>(true, it1); + } + + x--; + } + } + + return new CycleDetectionResult<>(false, null); + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIterators.java b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIterators.java new file mode 100644 index 0000000000..ab088de44a --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIterators.java @@ -0,0 +1,25 @@ +package com.baeldung.algorithms.linkedlist; + +public class CycleDetectionByFastAndSlowIterators { + + public static CycleDetectionResult detectCycle(Node head) { + if (head == null) { + return new CycleDetectionResult<>(false, null); + } + + Node slow = head; + Node fast = head; + + while (fast != null && fast.next != null) { + slow = slow.next; + fast = fast.next.next; + + if (slow == fast) { + return new CycleDetectionResult<>(true, fast); + } + } + + return new CycleDetectionResult<>(false, null); + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashing.java b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashing.java new file mode 100644 index 0000000000..90d5ecd711 --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashing.java @@ -0,0 +1,27 @@ +package com.baeldung.algorithms.linkedlist; + +import java.util.HashSet; +import java.util.Set; + +public class CycleDetectionByHashing { + + public static CycleDetectionResult detectCycle(Node head) { + if (head == null) { + return new CycleDetectionResult<>(false, null); + } + + Set> set = new HashSet<>(); + Node node = head; + + while (node != null) { + if (set.contains(node)) { + return new CycleDetectionResult<>(true, node); + } + set.add(node); + node = node.next; + } + + return new CycleDetectionResult<>(false, null); + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionResult.java b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionResult.java new file mode 100644 index 0000000000..e7556311b3 --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleDetectionResult.java @@ -0,0 +1,12 @@ +package com.baeldung.algorithms.linkedlist; + +public class CycleDetectionResult { + boolean cycleExists; + Node node; + + public CycleDetectionResult(boolean cycleExists, Node node) { + super(); + this.cycleExists = cycleExists; + this.node = node; + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForce.java b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForce.java new file mode 100644 index 0000000000..a2bfaee9a1 --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForce.java @@ -0,0 +1,56 @@ +package com.baeldung.algorithms.linkedlist; + +public class CycleRemovalBruteForce { + + public static boolean detectAndRemoveCycle(Node head) { + CycleDetectionResult result = CycleDetectionByFastAndSlowIterators.detectCycle(head); + + if (result.cycleExists) { + removeCycle(result.node, head); + } + + return result.cycleExists; + } + + /** + * @param loopNodeParam - reference to the node where Flyods cycle + * finding algorithm ends, i.e. the fast and the slow iterators + * meet. + * @param head - reference to the head of the list + */ + private static void removeCycle(Node loopNodeParam, Node head) { + Node it = head; + + while (it != null) { + if (isNodeReachableFromLoopNode(it, loopNodeParam)) { + Node loopStart = it; + findEndNodeAndBreakCycle(loopStart); + break; + } + it = it.next; + } + } + + private static boolean isNodeReachableFromLoopNode(Node it, Node loopNodeParam) { + Node loopNode = loopNodeParam; + + do { + if (it == loopNode) { + return true; + } + loopNode = loopNode.next; + } while (loopNode.next != loopNodeParam); + + return false; + } + + private static void findEndNodeAndBreakCycle(Node loopStartParam) { + Node loopStart = loopStartParam; + + while (loopStart.next != loopStartParam) { + loopStart = loopStart.next; + } + + loopStart.next = null; + } +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodes.java b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodes.java new file mode 100644 index 0000000000..d8db37fc4c --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodes.java @@ -0,0 +1,44 @@ +package com.baeldung.algorithms.linkedlist; + +public class CycleRemovalByCountingLoopNodes { + + public static boolean detectAndRemoveCycle(Node head) { + CycleDetectionResult result = CycleDetectionByFastAndSlowIterators.detectCycle(head); + + if (result.cycleExists) { + removeCycle(result.node, head); + } + + return result.cycleExists; + } + + private static void removeCycle(Node loopNodeParam, Node head) { + int cycleLength = calculateCycleLength(loopNodeParam); + Node cycleLengthAdvancedIterator = head; + Node it = head; + + for (int i = 0; i < cycleLength; i++) { + cycleLengthAdvancedIterator = cycleLengthAdvancedIterator.next; + } + + while (it.next != cycleLengthAdvancedIterator.next) { + it = it.next; + cycleLengthAdvancedIterator = cycleLengthAdvancedIterator.next; + } + + cycleLengthAdvancedIterator.next = null; + } + + private static int calculateCycleLength(Node loopNodeParam) { + Node loopNode = loopNodeParam; + int length = 1; + + while (loopNode.next != loopNodeParam) { + length++; + loopNode = loopNode.next; + } + + return length; + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodes.java b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodes.java new file mode 100644 index 0000000000..b979f7f677 --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodes.java @@ -0,0 +1,27 @@ +package com.baeldung.algorithms.linkedlist; + +public class CycleRemovalWithoutCountingLoopNodes { + + public static boolean detectAndRemoveCycle(Node head) { + CycleDetectionResult result = CycleDetectionByFastAndSlowIterators.detectCycle(head); + + if (result.cycleExists) { + removeCycle(result.node, head); + } + + return result.cycleExists; + } + + private static void removeCycle(Node meetingPointParam, Node head) { + Node loopNode = meetingPointParam; + Node it = head; + + while (loopNode.next != it.next) { + it = it.next; + loopNode = loopNode.next; + } + + loopNode.next = null; + } + +} diff --git a/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/Node.java b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/Node.java new file mode 100644 index 0000000000..4add22c77d --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/linkedlist/Node.java @@ -0,0 +1,38 @@ +package com.baeldung.algorithms.linkedlist; + +public class Node { + T data; + Node next; + + public static Node createNewNode(T data, Node next) { + Node node = new Node(); + node.data = data; + node.next = next; + return node; + } + + public static void traverseList(Node root) { + if (root == null) { + return; + } + + Node node = root; + while (node != null) { + System.out.println(node.data); + node = node.next; + } + } + + public static Node getTail(Node root) { + if (root == null) { + return null; + } + + Node node = root; + while (node.next != null) { + node = node.next; + } + return node; + } + +} \ No newline at end of file diff --git a/algorithms/src/main/java/com/baeldung/algorithms/string/search/StringSearchAlgorithms.java b/algorithms/src/main/java/com/baeldung/algorithms/string/search/StringSearchAlgorithms.java new file mode 100755 index 0000000000..45ac53e039 --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/string/search/StringSearchAlgorithms.java @@ -0,0 +1,194 @@ +package com.baeldung.algorithms.string.search; + +import java.math.BigInteger; +import java.util.Random; + +public class StringSearchAlgorithms { + public static long getBiggerPrime(int m) { + BigInteger prime = BigInteger.probablePrime(getNumberOfBits(m) + 1, new Random()); + return prime.longValue(); + } + + public static long getLowerPrime(long number) { + BigInteger prime = BigInteger.probablePrime(getNumberOfBits(number) - 1, new Random()); + return prime.longValue(); + } + + private static int getNumberOfBits(final int number) { + return Integer.SIZE - Integer.numberOfLeadingZeros(number); + } + + private static int getNumberOfBits(final long number) { + return Long.SIZE - Long.numberOfLeadingZeros(number); + } + + public static int simpleTextSearch(char[] pattern, char[] text) { + int patternSize = pattern.length; + int textSize = text.length; + + int i = 0; + + while ((i + patternSize) <= textSize) { + int j = 0; + while (text[i + j] == pattern[j]) { + j += 1; + if (j >= patternSize) + return i; + } + i += 1; + } + + return -1; + } + + public static int RabinKarpMethod(char[] pattern, char[] text) { + int patternSize = pattern.length; // m + int textSize = text.length; // n + + long prime = getBiggerPrime(patternSize); + + long r = 1; + for (int i = 0; i < patternSize - 1; i++) { + r *= 2; + r = r % prime; + } + + long[] t = new long[textSize]; + t[0] = 0; + + long pfinger = 0; + + for (int j = 0; j < patternSize; j++) { + t[0] = (2 * t[0] + text[j]) % prime; + pfinger = (2 * pfinger + pattern[j]) % prime; + } + + int i = 0; + boolean passed = false; + + int diff = textSize - patternSize; + for (i = 0; i <= diff; i++) { + if (t[i] == pfinger) { + passed = true; + for (int k = 0; k < patternSize; k++) { + if (text[i + k] != pattern[k]) { + passed = false; + break; + } + } + + if (passed) { + return i; + } + } + + if (i < diff) { + long value = 2 * (t[i] - r * text[i]) + text[i + patternSize]; + t[i + 1] = ((value % prime) + prime) % prime; + } + } + return -1; + + } + + public static int KnuthMorrisPrattSearch(char[] pattern, char[] text) { + int patternSize = pattern.length; // m + int textSize = text.length; // n + + int i = 0, j = 0; + + int[] shift = KnuthMorrisPrattShift(pattern); + + while ((i + patternSize) <= textSize) { + while (text[i + j] == pattern[j]) { + j += 1; + if (j >= patternSize) + return i; + } + + if (j > 0) { + i += shift[j - 1]; + j = Math.max(j - shift[j - 1], 0); + } else { + i++; + j = 0; + } + } + return -1; + } + + public static int[] KnuthMorrisPrattShift(char[] pattern) { + int patternSize = pattern.length; + + int[] shift = new int[patternSize]; + shift[0] = 1; + + int i = 1, j = 0; + + while ((i + j) < patternSize) { + if (pattern[i + j] == pattern[j]) { + shift[i + j] = i; + j++; + } else { + if (j == 0) + shift[i] = i + 1; + + if (j > 0) { + i = i + shift[j - 1]; + j = Math.max(j - shift[j - 1], 0); + } else { + i = i + 1; + j = 0; + } + } + } + return shift; + } + + public static int BoyerMooreHorspoolSimpleSearch(char[] pattern, char[] text) { + int patternSize = pattern.length; + int textSize = text.length; + + int i = 0, j = 0; + + while ((i + patternSize) <= textSize) { + j = patternSize - 1; + while (text[i + j] == pattern[j]) { + j--; + if (j < 0) + return i; + } + i++; + } + return -1; + } + + public static int BoyerMooreHorspoolSearch(char[] pattern, char[] text) { + + int shift[] = new int[256]; + + for (int k = 0; k < 256; k++) { + shift[k] = pattern.length; + } + + for (int k = 0; k < pattern.length - 1; k++) { + shift[pattern[k]] = pattern.length - 1 - k; + } + + int i = 0, j = 0; + + while ((i + pattern.length) <= text.length) { + j = pattern.length - 1; + + while (text[i + j] == pattern[j]) { + j -= 1; + if (j < 0) + return i; + } + + i = i + shift[text[i + pattern.length - 1]]; + + } + return -1; + } +} diff --git a/algorithms/src/test/java/algorithms/BinarySearchTest.java b/algorithms/src/test/java/algorithms/BinarySearchTest.java deleted file mode 100644 index d53b074cc4..0000000000 --- a/algorithms/src/test/java/algorithms/BinarySearchTest.java +++ /dev/null @@ -1,14 +0,0 @@ -import org.junit.Assert; -import org.junit.Test; - - -public class BinarySearchTest { - - @Test - public void givenASortedArrayOfIntegers_whenBinarySearchRunForANumber_thenGetIndexOfTheNumber() { - BinarySearch binSearch = new BinarySearch(); - int expectedIndexForSearchKey = 7; - Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearch()); - } - -} diff --git a/algorithms/src/test/java/algorithms/StringSearchAlgorithmsTest.java b/algorithms/src/test/java/algorithms/StringSearchAlgorithmsTest.java new file mode 100755 index 0000000000..e260cd7e5b --- /dev/null +++ b/algorithms/src/test/java/algorithms/StringSearchAlgorithmsTest.java @@ -0,0 +1,25 @@ +package algorithms; + + +import org.junit.Assert; +import org.junit.Test; + +import com.baeldung.algorithms.string.search.StringSearchAlgorithms; + +public class StringSearchAlgorithmsTest { + + + @Test + public void testStringSearchAlgorithms(){ + String text = "This is some nice text."; + String pattern = "some"; + + int realPosition = text.indexOf(pattern); + Assert.assertTrue(realPosition == StringSearchAlgorithms.simpleTextSearch(pattern.toCharArray(), text.toCharArray())); + Assert.assertTrue(realPosition == StringSearchAlgorithms.RabinKarpMethod(pattern.toCharArray(), text.toCharArray())); + Assert.assertTrue(realPosition == StringSearchAlgorithms.KnuthMorrisPrattSearch(pattern.toCharArray(), text.toCharArray())); + Assert.assertTrue(realPosition == StringSearchAlgorithms.BoyerMooreHorspoolSimpleSearch(pattern.toCharArray(), text.toCharArray())); + Assert.assertTrue(realPosition == StringSearchAlgorithms.BoyerMooreHorspoolSearch(pattern.toCharArray(), text.toCharArray())); + } + +} diff --git a/algorithms/src/test/java/algorithms/binarysearch/BinarySearchTest.java b/algorithms/src/test/java/algorithms/binarysearch/BinarySearchTest.java new file mode 100644 index 0000000000..959f47a275 --- /dev/null +++ b/algorithms/src/test/java/algorithms/binarysearch/BinarySearchTest.java @@ -0,0 +1,43 @@ +package algorithms.binarysearch; + +import java.util.Arrays; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import com.baeldung.algorithms.binarysearch.BinarySearch; + +public class BinarySearchTest { + + int[] sortedArray = { 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9 }; + int key = 6; + int expectedIndexForSearchKey = 7; + int low = 0; + int high = sortedArray.length - 1; + List sortedList = Arrays.asList(0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9); + + @Test + public void givenASortedArrayOfIntegers_whenBinarySearchRunIterativelyForANumber_thenGetIndexOfTheNumber() { + BinarySearch binSearch = new BinarySearch(); + Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearchIteratively(sortedArray, key, low, high)); + } + + @Test + public void givenASortedArrayOfIntegers_whenBinarySearchRunRecursivelyForANumber_thenGetIndexOfTheNumber() { + BinarySearch binSearch = new BinarySearch(); + Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearchRecursively(sortedArray, key, low, high)); + } + + @Test + public void givenASortedArrayOfIntegers_whenBinarySearchRunUsingArraysClassStaticMethodForANumber_thenGetIndexOfTheNumber() { + BinarySearch binSearch = new BinarySearch(); + Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearchUsingJavaArrays(sortedArray, key)); + } + + @Test + public void givenASortedListOfIntegers_whenBinarySearchRunUsingCollectionsClassStaticMethodForANumber_thenGetIndexOfTheNumber() { + BinarySearch binSearch = new BinarySearch(); + Assert.assertEquals(expectedIndexForSearchKey, binSearch.runBinarySearchUsingJavaCollections(sortedList, key)); + } + +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForceTest.java b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForceTest.java new file mode 100644 index 0000000000..7f9b8acdbd --- /dev/null +++ b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionBruteForceTest.java @@ -0,0 +1,23 @@ +package com.baeldung.algorithms.linkedlist; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(value = Parameterized.class) +public class CycleDetectionBruteForceTest extends CycleDetectionTestBase { + boolean cycleExists; + Node head; + + public CycleDetectionBruteForceTest(Node head, boolean cycleExists) { + super(); + this.cycleExists = cycleExists; + this.head = head; + } + + @Test + public void givenList_detectLoop() { + Assert.assertEquals(cycleExists, CycleDetectionBruteForce.detectCycle(head).cycleExists); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIteratorsTest.java b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIteratorsTest.java new file mode 100644 index 0000000000..17d339bc33 --- /dev/null +++ b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByFastAndSlowIteratorsTest.java @@ -0,0 +1,23 @@ +package com.baeldung.algorithms.linkedlist; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(value = Parameterized.class) +public class CycleDetectionByFastAndSlowIteratorsTest extends CycleDetectionTestBase { + boolean cycleExists; + Node head; + + public CycleDetectionByFastAndSlowIteratorsTest(Node head, boolean cycleExists) { + super(); + this.cycleExists = cycleExists; + this.head = head; + } + + @Test + public void givenList_detectLoop() { + Assert.assertEquals(cycleExists, CycleDetectionByFastAndSlowIterators.detectCycle(head).cycleExists); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashingTest.java b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashingTest.java new file mode 100644 index 0000000000..73a2cc7861 --- /dev/null +++ b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionByHashingTest.java @@ -0,0 +1,23 @@ +package com.baeldung.algorithms.linkedlist; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(value = Parameterized.class) +public class CycleDetectionByHashingTest extends CycleDetectionTestBase { + boolean cycleExists; + Node head; + + public CycleDetectionByHashingTest(Node head, boolean cycleExists) { + super(); + this.cycleExists = cycleExists; + this.head = head; + } + + @Test + public void givenList_detectLoop() { + Assert.assertEquals(cycleExists, CycleDetectionByHashing.detectCycle(head).cycleExists); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionTestBase.java b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionTestBase.java new file mode 100644 index 0000000000..51906de8e5 --- /dev/null +++ b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleDetectionTestBase.java @@ -0,0 +1,62 @@ +package com.baeldung.algorithms.linkedlist; + +import java.util.Arrays; +import java.util.Collection; + +import org.junit.runners.Parameterized.Parameters; + +public class CycleDetectionTestBase { + + @Parameters + public static Collection getLists() { + return Arrays.asList(new Object[][] { + { createList(), false }, + { createListWithLoop(), true }, + { createListWithFullCycle(), true }, + { createListWithSingleNodeInCycle(), true } + }); + } + + public static Node createList() { + Node root = Node.createNewNode(10, null); + + for (int i = 9; i >= 1; --i) { + Node current = Node.createNewNode(i, root); + root = current; + } + + return root; + } + + public static Node createListWithLoop() { + Node node = createList(); + createLoop(node); + return node; + } + + public static Node createListWithFullCycle() { + Node head = createList(); + Node tail = Node.getTail(head); + tail.next = head; + return head; + } + + public static Node createListWithSingleNodeInCycle() { + Node head = createList(); + Node tail = Node.getTail(head); + tail.next = tail; + return head; + } + + public static void createLoop(Node root) { + Node tail = Node.getTail(root); + + Node middle = root; + for (int i = 1; i <= 4; i++) { + middle = middle.next; + } + + tail.next = middle; + } + +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForceTest.java b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForceTest.java new file mode 100644 index 0000000000..6484c9988e --- /dev/null +++ b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalBruteForceTest.java @@ -0,0 +1,24 @@ +package com.baeldung.algorithms.linkedlist; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(value = Parameterized.class) +public class CycleRemovalBruteForceTest extends CycleDetectionTestBase { + boolean cycleExists; + Node head; + + public CycleRemovalBruteForceTest(Node head, boolean cycleExists) { + super(); + this.cycleExists = cycleExists; + this.head = head; + } + + @Test + public void givenList_ifLoopExists_thenDetectAndRemoveLoop() { + Assert.assertEquals(cycleExists, CycleRemovalBruteForce.detectAndRemoveCycle(head)); + Assert.assertFalse(CycleDetectionByFastAndSlowIterators.detectCycle(head).cycleExists); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodesTest.java b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodesTest.java new file mode 100644 index 0000000000..7bfd89c502 --- /dev/null +++ b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalByCountingLoopNodesTest.java @@ -0,0 +1,24 @@ +package com.baeldung.algorithms.linkedlist; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(value = Parameterized.class) +public class CycleRemovalByCountingLoopNodesTest extends CycleDetectionTestBase { + boolean cycleExists; + Node head; + + public CycleRemovalByCountingLoopNodesTest(Node head, boolean cycleExists) { + super(); + this.cycleExists = cycleExists; + this.head = head; + } + + @Test + public void givenList_ifLoopExists_thenDetectAndRemoveLoop() { + Assert.assertEquals(cycleExists, CycleRemovalByCountingLoopNodes.detectAndRemoveCycle(head)); + Assert.assertFalse(CycleDetectionByFastAndSlowIterators.detectCycle(head).cycleExists); + } +} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodesTest.java b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodesTest.java new file mode 100644 index 0000000000..c77efb3e3e --- /dev/null +++ b/algorithms/src/test/java/com/baeldung/algorithms/linkedlist/CycleRemovalWithoutCountingLoopNodesTest.java @@ -0,0 +1,24 @@ +package com.baeldung.algorithms.linkedlist; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(value = Parameterized.class) +public class CycleRemovalWithoutCountingLoopNodesTest extends CycleDetectionTestBase { + boolean cycleExists; + Node head; + + public CycleRemovalWithoutCountingLoopNodesTest(Node head, boolean cycleExists) { + super(); + this.cycleExists = cycleExists; + this.head = head; + } + + @Test + public void givenList_ifLoopExists_thenDetectAndRemoveLoop() { + Assert.assertEquals(cycleExists, CycleRemovalWithoutCountingLoopNodes.detectAndRemoveCycle(head)); + Assert.assertFalse(CycleDetectionByFastAndSlowIterators.detectCycle(head).cycleExists); + } +} \ No newline at end of file diff --git a/apache-cayenne/pom.xml b/apache-cayenne/pom.xml new file mode 100644 index 0000000000..52631e8594 --- /dev/null +++ b/apache-cayenne/pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + + apache-cayenne + 0.0.1-SNAPSHOT + jar + + apache-cayenne + Introduction to Apache Cayenne + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + UTF-8 + UTF-8 + 1.8 + 5.1.44 + 4.0.M5 + 4.12 + + + + + org.apache.cayenne + cayenne-server + ${cayenne.version} + + + mysql + mysql-connector-java + ${mysql.connector.version} + runtime + + + + junit + junit + ${junit.version} + test + + + + + + + org.apache.cayenne.plugins + cayenne-modeler-maven-plugin + ${cayenne.version} + + + + + diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Article.java b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Article.java new file mode 100644 index 0000000000..303c180887 --- /dev/null +++ b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Article.java @@ -0,0 +1,9 @@ +package com.baeldung.apachecayenne.persistent; + +import com.baeldung.apachecayenne.persistent.auto._Article; + +public class Article extends _Article { + + private static final long serialVersionUID = 1L; + +} diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Author.java b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Author.java new file mode 100644 index 0000000000..5a8df57c6e --- /dev/null +++ b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/Author.java @@ -0,0 +1,9 @@ +package com.baeldung.apachecayenne.persistent; + +import com.baeldung.apachecayenne.persistent.auto._Author; + +public class Author extends _Author { + + private static final long serialVersionUID = 1L; + +} diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Article.java b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Article.java new file mode 100644 index 0000000000..f6c179fcfd --- /dev/null +++ b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Article.java @@ -0,0 +1,47 @@ +package com.baeldung.apachecayenne.persistent.auto; + +import org.apache.cayenne.CayenneDataObject; +import org.apache.cayenne.exp.Property; + +import com.baeldung.apachecayenne.persistent.Author; + +/** + * Class _Article was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Article extends CayenneDataObject { + + private static final long serialVersionUID = 1L; + + public static final String ID_PK_COLUMN = "id"; + + public static final Property CONTENT = Property.create("content", String.class); + public static final Property TITLE = Property.create("title", String.class); + public static final Property AUTHOR = Property.create("author", Author.class); + + public void setContent(String content) { + writeProperty("content", content); + } + public String getContent() { + return (String)readProperty("content"); + } + + public void setTitle(String title) { + writeProperty("title", title); + } + public String getTitle() { + return (String)readProperty("title"); + } + + public void setAuthor(Author author) { + setToOneTarget("author", author, true); + } + + public Author getAuthor() { + return (Author)readProperty("author"); + } + + +} diff --git a/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java new file mode 100644 index 0000000000..4d3bb090ca --- /dev/null +++ b/apache-cayenne/src/main/java/com/baeldung/apachecayenne/persistent/auto/_Author.java @@ -0,0 +1,44 @@ +package com.baeldung.apachecayenne.persistent.auto; + +import java.util.List; + +import org.apache.cayenne.CayenneDataObject; +import org.apache.cayenne.exp.Property; + +import com.baeldung.apachecayenne.persistent.Article; + +/** + * Class _Author was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Author extends CayenneDataObject { + + private static final long serialVersionUID = 1L; + + public static final String ID_PK_COLUMN = "id"; + + public static final Property NAME = Property.create("name", String.class); + public static final Property> ARTICLES = Property.create("articles", List.class); + + public void setName(String name) { + writeProperty("name", name); + } + public String getName() { + return (String)readProperty("name"); + } + + public void addToArticles(Article obj) { + addToManyTarget("articles", obj, true); + } + public void removeFromArticles(Article obj) { + removeToManyTarget("articles", obj, true); + } + @SuppressWarnings("unchecked") + public List
getArticles() { + return (List
)readProperty("articles"); + } + + +} diff --git a/apache-cayenne/src/main/resources/cayenne-project.xml b/apache-cayenne/src/main/resources/cayenne-project.xml new file mode 100644 index 0000000000..3f3c59e0e9 --- /dev/null +++ b/apache-cayenne/src/main/resources/cayenne-project.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + diff --git a/apache-cayenne/src/main/resources/datamap.map.xml b/apache-cayenne/src/main/resources/datamap.map.xml new file mode 100644 index 0000000000..3305649669 --- /dev/null +++ b/apache-cayenne/src/main/resources/datamap.map.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java new file mode 100644 index 0000000000..8a0d210d8d --- /dev/null +++ b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationTests.java @@ -0,0 +1,131 @@ +package com.baeldung.apachecayenne; + +import com.baeldung.apachecayenne.persistent.Article; +import com.baeldung.apachecayenne.persistent.Author; +import org.apache.cayenne.ObjectContext; +import org.apache.cayenne.configuration.server.ServerRuntime; +import org.apache.cayenne.query.ObjectSelect; +import org.apache.cayenne.query.SQLTemplate; +import org.junit.After; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.List; + +import static junit.framework.Assert.assertEquals; +import static org.junit.Assert.assertNull; + + +public class CayenneOperationTests { + private static ObjectContext context = null; + + @BeforeClass + public static void setupTheCayenneContext() { + ServerRuntime cayenneRuntime = ServerRuntime.builder() + .addConfig("cayenne-project.xml") + .build(); + context = cayenneRuntime.newContext(); + } + + @After + public void deleteAllRecords() { + SQLTemplate deleteArticles = new SQLTemplate(Article.class, "delete from article"); + SQLTemplate deleteAuthors = new SQLTemplate(Author.class, "delete from author"); + + context.performGenericQuery(deleteArticles); + context.performGenericQuery(deleteAuthors); + } + + @Test + public void givenAuthor_whenInsert_thenWeGetOneRecordInTheDatabase() { + Author author = context.newObject(Author.class); + author.setName("Paul"); + + context.commitChanges(); + + long records = ObjectSelect.dataRowQuery(Author.class).selectCount(context); + assertEquals(1, records); + } + + @Test + public void givenAuthor_whenInsert_andQueryByFirstName_thenWeGetTheAuthor() { + Author author = context.newObject(Author.class); + author.setName("Paul"); + + context.commitChanges(); + + Author expectedAuthor = ObjectSelect.query(Author.class) + .where(Author.NAME.eq("Paul")) + .selectOne(context); + + assertEquals("Paul", expectedAuthor.getName()); + } + + @Test + public void givenTwoAuthor_whenInsert_andQueryAll_thenWeGetTwoAuthors() { + Author firstAuthor = context.newObject(Author.class); + firstAuthor.setName("Paul"); + + Author secondAuthor = context.newObject(Author.class); + secondAuthor.setName("Ludovic"); + + context.commitChanges(); + + List authors = ObjectSelect.query(Author.class).select(context); + assertEquals(2, authors.size()); + } + + @Test + public void givenAuthor_whenUpdating_thenWeGetAnUpatedeAuthor() { + Author author = context.newObject(Author.class); + author.setName("Paul"); + context.commitChanges(); + + Author expectedAuthor = ObjectSelect.query(Author.class) + .where(Author.NAME.eq("Paul")) + .selectOne(context); + expectedAuthor.setName("Garcia"); + context.commitChanges(); + + assertEquals(author.getName(), expectedAuthor.getName()); + } + + @Test + public void givenAuthor_whenDeleting_thenWeLostHisDetails() { + Author author = context.newObject(Author.class); + author.setName("Paul"); + context.commitChanges(); + + Author savedAuthor = ObjectSelect.query(Author.class) + .where(Author.NAME.eq("Paul")).selectOne(context); + if(savedAuthor != null) { + context.deleteObjects(author); + context.commitChanges(); + } + + Author expectedAuthor = ObjectSelect.query(Author.class) + .where(Author.NAME.eq("Paul")).selectOne(context); + assertNull(expectedAuthor); + } + + @Test + public void givenAuthor_whenAttachingToArticle_thenTheRelationIsMade() { + Author author = context.newObject(Author.class); + author.setName("Paul"); + + Article article = context.newObject(Article.class); + article.setTitle("My post title"); + article.setContent("The content"); + article.setAuthor(author); + + context.commitChanges(); + + Author expectedAuthor = ObjectSelect.query(Author.class) + .where(Author.NAME.eq("Paul")) + .selectOne(context); + + Article expectedArticle = (expectedAuthor.getArticles()).get(0); + assertEquals(article.getTitle(), expectedArticle.getTitle()); + } + +} diff --git a/apache-shiro/README.md b/apache-shiro/README.md index e69de29bb2..bc3480b266 100644 --- a/apache-shiro/README.md +++ b/apache-shiro/README.md @@ -0,0 +1,2 @@ +### Relevant articles +- [Introduction to Apache Shiro](http://www.baeldung.com/apache-shiro) diff --git a/apache-shiro/pom.xml b/apache-shiro/pom.xml index 97ed872a26..711ddb5cee 100644 --- a/apache-shiro/pom.xml +++ b/apache-shiro/pom.xml @@ -9,9 +9,9 @@ 1.0-SNAPSHOT - com.baeldung - parent-modules - 1.0.0-SNAPSHOT + org.springframework.boot + spring-boot-starter-parent + 1.5.2.RELEASE @@ -21,6 +21,19 @@ + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-freemarker + + + org.apache.shiro + shiro-spring-boot-web-starter + ${apache-shiro-core-version} + org.apache.shiro shiro-core diff --git a/apache-shiro/src/main/java/com/baeldung/ShiroSpringApplication.java b/apache-shiro/src/main/java/com/baeldung/ShiroSpringApplication.java new file mode 100644 index 0000000000..e12d3ebffa --- /dev/null +++ b/apache-shiro/src/main/java/com/baeldung/ShiroSpringApplication.java @@ -0,0 +1,45 @@ +package com.baeldung; + +import org.apache.shiro.realm.Realm; +import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition; +import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +/** + * Created by smatt on 21/08/2017. + */ +@SpringBootApplication +public class ShiroSpringApplication { + + private static final transient Logger log = LoggerFactory.getLogger(ShiroSpringApplication.class); + + public static void main(String... args) { + SpringApplication.run(ShiroSpringApplication.class, args); + } + + + @Bean + public Realm realm() { + return new MyCustomRealm(); + } + + + @Bean + public ShiroFilterChainDefinition shiroFilterChainDefinition() { + DefaultShiroFilterChainDefinition filter + = new DefaultShiroFilterChainDefinition(); + + filter.addPathDefinition("/secure", "authc"); + filter.addPathDefinition("/**", "anon"); + + return filter; + } + + + + +} diff --git a/apache-shiro/src/main/java/com/baeldung/controllers/ShiroSpringController.java b/apache-shiro/src/main/java/com/baeldung/controllers/ShiroSpringController.java new file mode 100644 index 0000000000..e6e72b2579 --- /dev/null +++ b/apache-shiro/src/main/java/com/baeldung/controllers/ShiroSpringController.java @@ -0,0 +1,105 @@ +package com.baeldung.controllers; + +import com.baeldung.models.UserCredentials; +import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authc.AuthenticationException; +import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.subject.Subject; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import javax.servlet.http.HttpServletRequest; + +@Controller +public class ShiroSpringController { + + + + @GetMapping("/") + public String index() { + return "index"; + } + + + @RequestMapping( value = "/login", method = {RequestMethod.GET, RequestMethod.POST}) + public String login(HttpServletRequest req, UserCredentials cred, RedirectAttributes attr) { + + if(req.getMethod().equals(RequestMethod.GET.toString())) { + return "login"; + } + else { + + Subject subject = SecurityUtils.getSubject(); + + if(!subject.isAuthenticated()) { + UsernamePasswordToken token = new UsernamePasswordToken( + cred.getUsername(), cred.getPassword(), cred.isRememberMe()); + try { + subject.login(token); + } catch (AuthenticationException ae) { + ae.printStackTrace(); + attr.addFlashAttribute("error", "Invalid Credentials"); + return "redirect:/login"; + } + } + + return "redirect:/secure"; + } + } + + + @GetMapping("/secure") + public String secure(ModelMap modelMap) { + + Subject currentUser = SecurityUtils.getSubject(); + String role = "", permission = ""; + + if(currentUser.hasRole("admin")) { + role = role + "You are an Admin"; + } + else if(currentUser.hasRole("editor")) { + role = role + "You are an Editor"; + } + else if(currentUser.hasRole("author")) { + role = role + "You are an Author"; + } + + if(currentUser.isPermitted("articles:compose")) { + permission = permission + "You can compose an article, "; + } else { + permission = permission + "You are not permitted to compose an article!, "; + } + + if(currentUser.isPermitted("articles:save")) { + permission = permission + "You can save articles, "; + } else { + permission = permission + "\nYou can not save articles, "; + } + + if(currentUser.isPermitted("articles:publish")) { + permission = permission + "\nYou can publish articles"; + } else { + permission = permission + "\nYou can not publish articles"; + } + + modelMap.addAttribute("username", currentUser.getPrincipal()); + modelMap.addAttribute("permission", permission); + modelMap.addAttribute("role", role); + + return "secure"; + } + + + @PostMapping("/logout") + public String logout() { + Subject subject = SecurityUtils.getSubject(); + subject.logout(); + return "redirect:/"; + } + +} diff --git a/apache-shiro/src/main/java/com/baeldung/models/UserCredentials.java b/apache-shiro/src/main/java/com/baeldung/models/UserCredentials.java new file mode 100644 index 0000000000..51b429046a --- /dev/null +++ b/apache-shiro/src/main/java/com/baeldung/models/UserCredentials.java @@ -0,0 +1,40 @@ +package com.baeldung.models; + +public class UserCredentials { + + private String username; + private String password; + private boolean rememberMe = false; + + public UserCredentials() {} + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public boolean isRememberMe() { + return rememberMe; + } + + public void setRememberMe(boolean rememberMe) { + this.rememberMe = rememberMe; + } + + @Override + public String toString() { + return "username = " + getUsername() + + "\nrememberMe = " + isRememberMe(); + } +} diff --git a/apache-shiro/src/main/resources/application.properties b/apache-shiro/src/main/resources/application.properties new file mode 100644 index 0000000000..5bcb6b3352 --- /dev/null +++ b/apache-shiro/src/main/resources/application.properties @@ -0,0 +1,11 @@ +server.port=9000 +server.servlet-path=/ +server.context-path=/ + +#shiro-spring-boot-config +shiro.loginUrl = /login +shiro.successUrl = /secure +shiro.unauthorizedUrl = /login + +#freemarker +spring.freemarker.suffix=.ftl diff --git a/apache-shiro/src/main/resources/templates/index.ftl b/apache-shiro/src/main/resources/templates/index.ftl new file mode 100644 index 0000000000..0210d656fc --- /dev/null +++ b/apache-shiro/src/main/resources/templates/index.ftl @@ -0,0 +1,10 @@ + + + Index + + +

Welcome Guest!

+
+ Login + + \ No newline at end of file diff --git a/apache-shiro/src/main/resources/templates/login.ftl b/apache-shiro/src/main/resources/templates/login.ftl new file mode 100644 index 0000000000..3a0552dc2e --- /dev/null +++ b/apache-shiro/src/main/resources/templates/login.ftl @@ -0,0 +1,27 @@ + + + Login + + +

Login

+
+
+ <#if (error?length > 0)??> +

${error}

+ <#else> + + + +
+ +

+ +
+ +

+ Remember Me +

+ +
+ + \ No newline at end of file diff --git a/apache-shiro/src/main/resources/templates/secure.ftl b/apache-shiro/src/main/resources/templates/secure.ftl new file mode 100644 index 0000000000..4466a0162f --- /dev/null +++ b/apache-shiro/src/main/resources/templates/secure.ftl @@ -0,0 +1,15 @@ + + + Secure + + +

Welcome ${username}!

+

Role: ${role}

+

Permissions

+

${permission}

+
+
+ +
+ + \ No newline at end of file diff --git a/bootique/README.md b/bootique/README.md new file mode 100644 index 0000000000..2ef898fcf7 --- /dev/null +++ b/bootique/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Introduction to Bootique](http://www.baeldung.com/bootique) diff --git a/core-java-8/.gitignore b/core-java-8/.gitignore new file mode 100644 index 0000000000..3de4cc647e --- /dev/null +++ b/core-java-8/.gitignore @@ -0,0 +1,26 @@ +*.class + +0.* + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* +.resourceCache + +# Packaged files # +*.jar +*.war +*.ear + +# Files generated by integration tests +*.txt +backup-pom.xml +/bin/ +/temp + +#IntelliJ specific +.idea/ +*.iml \ No newline at end of file diff --git a/core-java-8/README.md b/core-java-8/README.md new file mode 100644 index 0000000000..4610b3c86d --- /dev/null +++ b/core-java-8/README.md @@ -0,0 +1,32 @@ +========= + +## Core Java 8 Cookbooks and Examples + +### Relevant Articles: +- [Java 8 Collectors](http://www.baeldung.com/java-8-collectors) +- [Guide to Java 8’s Functional Interfaces](http://www.baeldung.com/java-8-functional-interfaces) +- [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) +- [Java 8 New Features](http://www.baeldung.com/java-8-new-features) +- [Lambda Expressions and Functional Interfaces: Tips and Best Practices](http://www.baeldung.com/java-8-lambda-expressions-tips) +- [The Double Colon Operator in Java 8](http://www.baeldung.com/java-8-double-colon-operator) +- [Java 8 Streams Advanced](http://www.baeldung.com/java-8-streams) +- [Introduction to Java 8 Streams](http://www.baeldung.com/java-8-streams-introduction) +- [Guide to Java 8 groupingBy Collector](http://www.baeldung.com/java-groupingby-collector) +- [Strategy Design Pattern in Java 8](http://www.baeldung.com/java-strategy-pattern) +- [Java 8 and Infinite Streams](http://www.baeldung.com/java-inifinite-streams) +- [String Operations with Java Streams](http://www.baeldung.com/java-stream-operations-on-strings) +- [Exceptions in Java 8 Lambda Expressions](http://www.baeldung.com/java-lambda-exceptions) +- [Java 8 Stream findFirst() vs. findAny()](http://www.baeldung.com/java-stream-findfirst-vs-findany) +- [Guide to Java 8 Comparator.comparing()](http://www.baeldung.com/java-8-comparator-comparing) +- [How to Get the Last Element of a Stream in Java?](http://www.baeldung.com/java-stream-last-element) +- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro) +- [Migrating to the New Java 8 Date Time API](http://www.baeldung.com/migrating-to-java-8-date-time-api) +- [Guide To Java 8 Optional](http://www.baeldung.com/java-optional) +- [Guide to the Java 8 forEach](http://www.baeldung.com/foreach-java) +- [Get the Current Date, Time and Timestamp in Java 8](http://www.baeldung.com/current-date-time-and-timestamp-in-java-8) +- [TemporalAdjuster in Java](http://www.baeldung.com/java-temporal-adjuster) +- [Finding Max/Min of a List or Collection](http://www.baeldung.com/java-collection-min-max) +- [Java Base64 Encoding and Decoding](http://www.baeldung.com/java-base64-encode-and-decode) +- [The Difference Between map() and flatMap()](http://www.baeldung.com/java-difference-map-and-flatmap) + +- [Merging Streams in Java](http://www.baeldung.com/java-merge-streams) \ No newline at end of file diff --git a/core-java-8/pom.xml b/core-java-8/pom.xml new file mode 100644 index 0000000000..f5506f095e --- /dev/null +++ b/core-java-8/pom.xml @@ -0,0 +1,258 @@ + + 4.0.0 + com.baeldung + core-java-8 + 0.1.0-SNAPSHOT + jar + + core-java-8 + + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + + + com.google.guava + guava + ${guava.version} + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + + commons-io + commons-io + ${commons-io.version} + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + + log4j + log4j + 1.2.17 + + + + commons-codec + commons-codec + ${commons-codec.version} + + + + org.projectlombok + lombok + ${lombok.version} + provided + + + + + + org.assertj + assertj-core + ${assertj.version} + test + + + + com.jayway.awaitility + awaitility + ${avaitility.version} + test + + + + + + core-java-8 + + + src/main/resources + true + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + prepare-package + + copy-dependencies + + + ${project.build.directory}/libs + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + libs/ + org.baeldung.executable.ExecutableMavenJar + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + ${project.basedir} + + + org.baeldung.executable.ExecutableMavenJar + + + + jar-with-dependencies + + + + + + + org.apache.maven.plugins + maven-shade-plugin + + + + shade + + + true + + + org.baeldung.executable.ExecutableMavenJar + + + + + + + + com.jolira + onejar-maven-plugin + + + + org.baeldung.executable.ExecutableMavenJar + true + ${project.build.finalName}-onejar.${project.packaging} + + + one-jar + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + spring-boot + org.baeldung.executable.ExecutableMavenJar + + + + + + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*ManualTest.java + + + **/*IntegrationTest.java + + + + + + + json + + + + + + + + + + + + 21.0 + 3.5 + 3.6.1 + 2.5 + 4.1 + 4.01 + 1.10 + 1.16.12 + + + 3.6.1 + 1.7.0 + + + \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/Adder.java b/core-java-8/src/main/java/com/baeldung/Adder.java similarity index 100% rename from core-java/src/main/java/com/baeldung/Adder.java rename to core-java-8/src/main/java/com/baeldung/Adder.java diff --git a/core-java/src/main/java/com/baeldung/AdderImpl.java b/core-java-8/src/main/java/com/baeldung/AdderImpl.java similarity index 99% rename from core-java/src/main/java/com/baeldung/AdderImpl.java rename to core-java-8/src/main/java/com/baeldung/AdderImpl.java index f67cdc26b3..7852934d55 100644 --- a/core-java/src/main/java/com/baeldung/AdderImpl.java +++ b/core-java-8/src/main/java/com/baeldung/AdderImpl.java @@ -1,5 +1,6 @@ package com.baeldung; + import java.util.function.Consumer; import java.util.function.Function; diff --git a/core-java/src/main/java/com/baeldung/Bar.java b/core-java-8/src/main/java/com/baeldung/Bar.java similarity index 99% rename from core-java/src/main/java/com/baeldung/Bar.java rename to core-java-8/src/main/java/com/baeldung/Bar.java index f9b6f2773e..6219bddf74 100644 --- a/core-java/src/main/java/com/baeldung/Bar.java +++ b/core-java-8/src/main/java/com/baeldung/Bar.java @@ -1,5 +1,6 @@ package com.baeldung; + @FunctionalInterface public interface Bar { diff --git a/core-java/src/main/java/com/baeldung/Baz.java b/core-java-8/src/main/java/com/baeldung/Baz.java similarity index 99% rename from core-java/src/main/java/com/baeldung/Baz.java rename to core-java-8/src/main/java/com/baeldung/Baz.java index 6d03f74198..23180551ac 100644 --- a/core-java/src/main/java/com/baeldung/Baz.java +++ b/core-java-8/src/main/java/com/baeldung/Baz.java @@ -1,5 +1,6 @@ package com.baeldung; + @FunctionalInterface public interface Baz { diff --git a/core-java/src/main/java/com/baeldung/Foo.java b/core-java-8/src/main/java/com/baeldung/Foo.java similarity index 99% rename from core-java/src/main/java/com/baeldung/Foo.java rename to core-java-8/src/main/java/com/baeldung/Foo.java index 90ebdfeed3..c8223727a1 100644 --- a/core-java/src/main/java/com/baeldung/Foo.java +++ b/core-java-8/src/main/java/com/baeldung/Foo.java @@ -1,5 +1,6 @@ package com.baeldung; + @FunctionalInterface public interface Foo { diff --git a/core-java/src/main/java/com/baeldung/FooExtended.java b/core-java-8/src/main/java/com/baeldung/FooExtended.java similarity index 99% rename from core-java/src/main/java/com/baeldung/FooExtended.java rename to core-java-8/src/main/java/com/baeldung/FooExtended.java index c8ed0c35dd..8c9b21e397 100644 --- a/core-java/src/main/java/com/baeldung/FooExtended.java +++ b/core-java-8/src/main/java/com/baeldung/FooExtended.java @@ -1,5 +1,6 @@ package com.baeldung; + @FunctionalInterface public interface FooExtended extends Baz, Bar { diff --git a/core-java/src/main/java/com/baeldung/UseFoo.java b/core-java-8/src/main/java/com/baeldung/UseFoo.java similarity index 99% rename from core-java/src/main/java/com/baeldung/UseFoo.java rename to core-java-8/src/main/java/com/baeldung/UseFoo.java index a91404ebaf..950d02062d 100644 --- a/core-java/src/main/java/com/baeldung/UseFoo.java +++ b/core-java-8/src/main/java/com/baeldung/UseFoo.java @@ -1,5 +1,6 @@ package com.baeldung; + import java.util.function.Function; public class UseFoo { diff --git a/core-java/src/main/java/com/baeldung/datetime/README.md b/core-java-8/src/main/java/com/baeldung/datetime/README.md similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/README.md rename to core-java-8/src/main/java/com/baeldung/datetime/README.md diff --git a/core-java/src/main/java/com/baeldung/datetime/UseDuration.java b/core-java-8/src/main/java/com/baeldung/datetime/UseDuration.java similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/UseDuration.java rename to core-java-8/src/main/java/com/baeldung/datetime/UseDuration.java diff --git a/core-java/src/main/java/com/baeldung/datetime/UseLocalDate.java b/core-java-8/src/main/java/com/baeldung/datetime/UseLocalDate.java similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/UseLocalDate.java rename to core-java-8/src/main/java/com/baeldung/datetime/UseLocalDate.java diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalDateTime.java b/core-java-8/src/main/java/com/baeldung/datetime/UseLocalDateTime.java new file mode 100644 index 0000000000..7f39ac2f91 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/datetime/UseLocalDateTime.java @@ -0,0 +1,11 @@ +package com.baeldung.datetime; + +import java.time.LocalDateTime; + +public class UseLocalDateTime { + + public LocalDateTime getLocalDateTimeUsingParseMethod(String representation) { + return LocalDateTime.parse(representation); + } + +} diff --git a/core-java/src/main/java/com/baeldung/datetime/UseLocalTime.java b/core-java-8/src/main/java/com/baeldung/datetime/UseLocalTime.java similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/UseLocalTime.java rename to core-java-8/src/main/java/com/baeldung/datetime/UseLocalTime.java diff --git a/core-java/src/main/java/com/baeldung/datetime/UsePeriod.java b/core-java-8/src/main/java/com/baeldung/datetime/UsePeriod.java similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/UsePeriod.java rename to core-java-8/src/main/java/com/baeldung/datetime/UsePeriod.java diff --git a/core-java/src/main/java/com/baeldung/datetime/UseToInstant.java b/core-java-8/src/main/java/com/baeldung/datetime/UseToInstant.java similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/UseToInstant.java rename to core-java-8/src/main/java/com/baeldung/datetime/UseToInstant.java diff --git a/core-java/src/main/java/com/baeldung/datetime/UseZonedDateTime.java b/core-java-8/src/main/java/com/baeldung/datetime/UseZonedDateTime.java similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/UseZonedDateTime.java rename to core-java-8/src/main/java/com/baeldung/datetime/UseZonedDateTime.java diff --git a/core-java/src/main/java/com/baeldung/doublecolon/Computer.java b/core-java-8/src/main/java/com/baeldung/doublecolon/Computer.java similarity index 100% rename from core-java/src/main/java/com/baeldung/doublecolon/Computer.java rename to core-java-8/src/main/java/com/baeldung/doublecolon/Computer.java diff --git a/core-java/src/main/java/com/baeldung/doublecolon/ComputerUtils.java b/core-java-8/src/main/java/com/baeldung/doublecolon/ComputerUtils.java similarity index 100% rename from core-java/src/main/java/com/baeldung/doublecolon/ComputerUtils.java rename to core-java-8/src/main/java/com/baeldung/doublecolon/ComputerUtils.java diff --git a/core-java/src/main/java/com/baeldung/doublecolon/MacbookPro.java b/core-java-8/src/main/java/com/baeldung/doublecolon/MacbookPro.java similarity index 100% rename from core-java/src/main/java/com/baeldung/doublecolon/MacbookPro.java rename to core-java-8/src/main/java/com/baeldung/doublecolon/MacbookPro.java diff --git a/core-java/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java b/core-java-8/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java similarity index 100% rename from core-java/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java rename to core-java-8/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java diff --git a/core-java/src/main/java/com/baeldung/doublecolon/function/TriFunction.java b/core-java-8/src/main/java/com/baeldung/doublecolon/function/TriFunction.java similarity index 100% rename from core-java/src/main/java/com/baeldung/doublecolon/function/TriFunction.java rename to core-java-8/src/main/java/com/baeldung/doublecolon/function/TriFunction.java diff --git a/core-java/src/main/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappers.java b/core-java-8/src/main/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappers.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappers.java rename to core-java-8/src/main/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappers.java diff --git a/core-java/src/main/java/com/baeldung/java8/lambda/exceptions/ThrowingConsumer.java b/core-java-8/src/main/java/com/baeldung/java8/lambda/exceptions/ThrowingConsumer.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java8/lambda/exceptions/ThrowingConsumer.java rename to core-java-8/src/main/java/com/baeldung/java8/lambda/exceptions/ThrowingConsumer.java diff --git a/core-java/src/main/java/com/baeldung/java_8_features/Address.java b/core-java-8/src/main/java/com/baeldung/java_8_features/Address.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java_8_features/Address.java rename to core-java-8/src/main/java/com/baeldung/java_8_features/Address.java diff --git a/core-java/src/main/java/com/baeldung/java_8_features/CustomException.java b/core-java-8/src/main/java/com/baeldung/java_8_features/CustomException.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java_8_features/CustomException.java rename to core-java-8/src/main/java/com/baeldung/java_8_features/CustomException.java diff --git a/core-java/src/main/java/com/baeldung/java_8_features/Detail.java b/core-java-8/src/main/java/com/baeldung/java_8_features/Detail.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java_8_features/Detail.java rename to core-java-8/src/main/java/com/baeldung/java_8_features/Detail.java diff --git a/core-java/src/main/java/com/baeldung/java_8_features/OptionalAddress.java b/core-java-8/src/main/java/com/baeldung/java_8_features/OptionalAddress.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java_8_features/OptionalAddress.java rename to core-java-8/src/main/java/com/baeldung/java_8_features/OptionalAddress.java diff --git a/core-java/src/main/java/com/baeldung/java_8_features/OptionalUser.java b/core-java-8/src/main/java/com/baeldung/java_8_features/OptionalUser.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java_8_features/OptionalUser.java rename to core-java-8/src/main/java/com/baeldung/java_8_features/OptionalUser.java diff --git a/core-java/src/main/java/com/baeldung/java_8_features/Person.java b/core-java-8/src/main/java/com/baeldung/java_8_features/Person.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java_8_features/Person.java rename to core-java-8/src/main/java/com/baeldung/java_8_features/Person.java diff --git a/core-java/src/main/java/com/baeldung/java_8_features/User.java b/core-java-8/src/main/java/com/baeldung/java_8_features/User.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java_8_features/User.java rename to core-java-8/src/main/java/com/baeldung/java_8_features/User.java diff --git a/core-java/src/main/java/com/baeldung/java_8_features/Vehicle.java b/core-java-8/src/main/java/com/baeldung/java_8_features/Vehicle.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java_8_features/Vehicle.java rename to core-java-8/src/main/java/com/baeldung/java_8_features/Vehicle.java diff --git a/core-java/src/main/java/com/baeldung/java_8_features/VehicleImpl.java b/core-java-8/src/main/java/com/baeldung/java_8_features/VehicleImpl.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java_8_features/VehicleImpl.java rename to core-java-8/src/main/java/com/baeldung/java_8_features/VehicleImpl.java diff --git a/core-java/src/main/java/com/baeldung/java_8_features/groupingby/BlogPost.java b/core-java-8/src/main/java/com/baeldung/java_8_features/groupingby/BlogPost.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java_8_features/groupingby/BlogPost.java rename to core-java-8/src/main/java/com/baeldung/java_8_features/groupingby/BlogPost.java diff --git a/core-java/src/main/java/com/baeldung/java_8_features/groupingby/BlogPostType.java b/core-java-8/src/main/java/com/baeldung/java_8_features/groupingby/BlogPostType.java similarity index 100% rename from core-java/src/main/java/com/baeldung/java_8_features/groupingby/BlogPostType.java rename to core-java-8/src/main/java/com/baeldung/java_8_features/groupingby/BlogPostType.java diff --git a/core-java/src/main/java/com/baeldung/optional/Modem.java b/core-java-8/src/main/java/com/baeldung/optional/Modem.java similarity index 100% rename from core-java/src/main/java/com/baeldung/optional/Modem.java rename to core-java-8/src/main/java/com/baeldung/optional/Modem.java diff --git a/core-java/src/main/java/com/baeldung/optional/Person.java b/core-java-8/src/main/java/com/baeldung/optional/Person.java similarity index 100% rename from core-java/src/main/java/com/baeldung/optional/Person.java rename to core-java-8/src/main/java/com/baeldung/optional/Person.java diff --git a/core-java/src/main/java/com/baeldung/strategy/ChristmasDiscounter.java b/core-java-8/src/main/java/com/baeldung/strategy/ChristmasDiscounter.java similarity index 100% rename from core-java/src/main/java/com/baeldung/strategy/ChristmasDiscounter.java rename to core-java-8/src/main/java/com/baeldung/strategy/ChristmasDiscounter.java diff --git a/core-java/src/main/java/com/baeldung/strategy/Discounter.java b/core-java-8/src/main/java/com/baeldung/strategy/Discounter.java similarity index 100% rename from core-java/src/main/java/com/baeldung/strategy/Discounter.java rename to core-java-8/src/main/java/com/baeldung/strategy/Discounter.java diff --git a/core-java/src/main/java/com/baeldung/strategy/EasterDiscounter.java b/core-java-8/src/main/java/com/baeldung/strategy/EasterDiscounter.java similarity index 100% rename from core-java/src/main/java/com/baeldung/strategy/EasterDiscounter.java rename to core-java-8/src/main/java/com/baeldung/strategy/EasterDiscounter.java diff --git a/core-java/src/main/java/com/baeldung/stream/InfiniteStreams.java b/core-java-8/src/main/java/com/baeldung/stream/InfiniteStreams.java similarity index 100% rename from core-java/src/main/java/com/baeldung/stream/InfiniteStreams.java rename to core-java-8/src/main/java/com/baeldung/stream/InfiniteStreams.java diff --git a/core-java/src/main/java/com/baeldung/stream/StreamApi.java b/core-java-8/src/main/java/com/baeldung/stream/StreamApi.java similarity index 100% rename from core-java/src/main/java/com/baeldung/stream/StreamApi.java rename to core-java-8/src/main/java/com/baeldung/stream/StreamApi.java diff --git a/core-java/src/main/java/com/baeldung/streamApi/Product.java b/core-java-8/src/main/java/com/baeldung/streamApi/Product.java similarity index 100% rename from core-java/src/main/java/com/baeldung/streamApi/Product.java rename to core-java-8/src/main/java/com/baeldung/streamApi/Product.java diff --git a/core-java/src/main/java/com/baeldung/string/JoinerSplitter.java b/core-java-8/src/main/java/com/baeldung/string/JoinerSplitter.java similarity index 100% rename from core-java/src/main/java/com/baeldung/string/JoinerSplitter.java rename to core-java-8/src/main/java/com/baeldung/string/JoinerSplitter.java diff --git a/core-java/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java b/core-java-8/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java similarity index 100% rename from core-java/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java rename to core-java-8/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java diff --git a/core-java/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java b/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java rename to core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/dateapi/ConversionExample.java b/core-java-8/src/test/java/com/baeldung/dateapi/ConversionExample.java similarity index 100% rename from core-java/src/test/java/com/baeldung/dateapi/ConversionExample.java rename to core-java-8/src/test/java/com/baeldung/dateapi/ConversionExample.java diff --git a/core-java/src/test/java/com/baeldung/dateapi/JavaDurationUnitTest.java b/core-java-8/src/test/java/com/baeldung/dateapi/JavaDurationUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/dateapi/JavaDurationUnitTest.java rename to core-java-8/src/test/java/com/baeldung/dateapi/JavaDurationUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/dateapi/JavaPeriodUnitTest.java b/core-java-8/src/test/java/com/baeldung/dateapi/JavaPeriodUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/dateapi/JavaPeriodUnitTest.java rename to core-java-8/src/test/java/com/baeldung/dateapi/JavaPeriodUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/dateapi/JavaUtilTimeUnitTest.java b/core-java-8/src/test/java/com/baeldung/dateapi/JavaUtilTimeUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/dateapi/JavaUtilTimeUnitTest.java rename to core-java-8/src/test/java/com/baeldung/dateapi/JavaUtilTimeUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java b/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java similarity index 75% rename from core-java/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java rename to core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java index a10ec66f20..e7a76d1ab9 100644 --- a/core-java/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java @@ -15,7 +15,9 @@ public class UseLocalDateTimeUnitTest { @Test public void givenString_whenUsingParse_thenLocalDateTime() { - assertEquals(LocalDate.of(2016, Month.MAY, 10), useLocalDateTime.getLocalDateTimeUsingParseMethod("2016-05-10T06:30").toLocalDate()); - assertEquals(LocalTime.of(6, 30), useLocalDateTime.getLocalDateTimeUsingParseMethod("2016-05-10T06:30").toLocalTime()); + assertEquals(LocalDate.of(2016, Month.MAY, 10), useLocalDateTime.getLocalDateTimeUsingParseMethod("2016-05-10T06:30") + .toLocalDate()); + assertEquals(LocalTime.of(6, 30), useLocalDateTime.getLocalDateTimeUsingParseMethod("2016-05-10T06:30") + .toLocalTime()); } } diff --git a/core-java/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java b/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java similarity index 76% rename from core-java/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java rename to core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java index e158c0fd67..90e858f9ac 100644 --- a/core-java/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java @@ -15,12 +15,14 @@ public class UseLocalDateUnitTest { @Test public void givenValues_whenUsingFactoryOf_thenLocalDate() { - assertEquals("2016-05-10", useLocalDate.getLocalDateUsingFactoryOfMethod(2016, 5, 10).toString()); + assertEquals("2016-05-10", useLocalDate.getLocalDateUsingFactoryOfMethod(2016, 5, 10) + .toString()); } @Test public void givenString_whenUsingParse_thenLocalDate() { - assertEquals("2016-05-10", useLocalDate.getLocalDateUsingParseMethod("2016-05-10").toString()); + assertEquals("2016-05-10", useLocalDate.getLocalDateUsingParseMethod("2016-05-10") + .toString()); } @Test @@ -30,12 +32,14 @@ public class UseLocalDateUnitTest { @Test public void givenDate_whenUsingPlus_thenNextDay() { - assertEquals(LocalDate.now().plusDays(1), useLocalDate.getNextDay(LocalDate.now())); + assertEquals(LocalDate.now() + .plusDays(1), useLocalDate.getNextDay(LocalDate.now())); } @Test public void givenDate_whenUsingMinus_thenPreviousDay() { - assertEquals(LocalDate.now().minusDays(1), useLocalDate.getPreviousDay(LocalDate.now())); + assertEquals(LocalDate.now() + .minusDays(1), useLocalDate.getPreviousDay(LocalDate.now())); } @Test @@ -45,7 +49,8 @@ public class UseLocalDateUnitTest { @Test public void givenToday_whenUsingWithTemporalAdjuster_thenFirstDayOfMonth() { - assertEquals(1, useLocalDate.getFirstDayOfMonth().getDayOfMonth()); + assertEquals(1, useLocalDate.getFirstDayOfMonth() + .getDayOfMonth()); } @Test diff --git a/core-java/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java b/core-java-8/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java rename to core-java-8/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java b/core-java-8/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java rename to core-java-8/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java b/core-java-8/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java rename to core-java-8/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/doublecolon/ComputerUtilsUnitTest.java b/core-java-8/src/test/java/com/baeldung/doublecolon/ComputerUtilsUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/doublecolon/ComputerUtilsUnitTest.java rename to core-java-8/src/test/java/com/baeldung/doublecolon/ComputerUtilsUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java b/core-java-8/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java similarity index 94% rename from core-java/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java rename to core-java-8/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java index 811088cc0c..e91cbfcb75 100644 --- a/core-java/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java @@ -21,7 +21,6 @@ public class FunctionalInterfaceUnitTest { private static final Logger LOG = LoggerFactory.getLogger(FunctionalInterfaceUnitTest.class); - @Test public void whenPassingLambdaToComputeIfAbsent_thenTheValueGetsComputedAndPutIntoMap() { Map nameMap = new HashMap<>(); @@ -83,7 +82,8 @@ public class FunctionalInterfaceUnitTest { return result; }); - List fibonacci5 = fibonacci.limit(5).collect(Collectors.toList()); + List fibonacci5 = fibonacci.limit(5) + .collect(Collectors.toList()); assertEquals(new Integer(1), fibonacci5.get(0)); assertEquals(new Integer(1), fibonacci5.get(1)); @@ -112,7 +112,9 @@ public class FunctionalInterfaceUnitTest { public void whenUsingPredicateInFilter_thenListValuesAreFilteredOut() { List names = Arrays.asList("Angela", "Aaron", "Bob", "Claire", "David"); - List namesWithA = names.stream().filter(name -> name.startsWith("A")).collect(Collectors.toList()); + List namesWithA = names.stream() + .filter(name -> name.startsWith("A")) + .collect(Collectors.toList()); assertEquals(2, namesWithA.size()); assertTrue(namesWithA.contains("Angela")); @@ -135,7 +137,8 @@ public class FunctionalInterfaceUnitTest { List values = Arrays.asList(3, 5, 8, 9, 12); - int sum = values.stream().reduce(0, (i1, i2) -> i1 + i2); + int sum = values.stream() + .reduce(0, (i1, i2) -> i1 + i2); assertEquals(37, sum); diff --git a/core-java/src/test/java/com/baeldung/functionalinterface/ShortToByteFunction.java b/core-java-8/src/test/java/com/baeldung/functionalinterface/ShortToByteFunction.java similarity index 100% rename from core-java/src/test/java/com/baeldung/functionalinterface/ShortToByteFunction.java rename to core-java-8/src/test/java/com/baeldung/functionalinterface/ShortToByteFunction.java diff --git a/core-java/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/Java8FindAnyFindFirstUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8FindAnyFindFirstUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/Java8FindAnyFindFirstUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/Java8FindAnyFindFirstUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/Java8ForEachUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8ForEachUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/Java8ForEachUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/Java8ForEachUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8GroupingByCollectorUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8GroupingByCollectorUnitTest.java new file mode 100644 index 0000000000..eea019da2c --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/java8/Java8GroupingByCollectorUnitTest.java @@ -0,0 +1,183 @@ +package com.baeldung.java8; + +import com.baeldung.java_8_features.groupingby.BlogPost; +import com.baeldung.java_8_features.groupingby.BlogPostType; +import org.junit.Test; + +import java.util.*; +import java.util.concurrent.ConcurrentMap; + +import static java.util.Comparator.comparingInt; +import static java.util.stream.Collectors.*; +import static org.junit.Assert.*; + +public class Java8GroupingByCollectorUnitTest { + + private static final List posts = Arrays.asList(new BlogPost("News item 1", "Author 1", BlogPostType.NEWS, 15), new BlogPost("Tech review 1", "Author 2", BlogPostType.REVIEW, 5), + new BlogPost("Programming guide", "Author 1", BlogPostType.GUIDE, 20), new BlogPost("News item 2", "Author 2", BlogPostType.NEWS, 35), new BlogPost("Tech review 2", "Author 1", BlogPostType.REVIEW, 15)); + + @Test + public void givenAListOfPosts_whenGroupedByType_thenGetAMapBetweenTypeAndPosts() { + Map> postsPerType = posts.stream() + .collect(groupingBy(BlogPost::getType)); + + assertEquals(2, postsPerType.get(BlogPostType.NEWS) + .size()); + assertEquals(1, postsPerType.get(BlogPostType.GUIDE) + .size()); + assertEquals(2, postsPerType.get(BlogPostType.REVIEW) + .size()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeAndTheirTitlesAreJoinedInAString_thenGetAMapBetweenTypeAndCsvTitles() { + Map postsPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, mapping(BlogPost::getTitle, joining(", ", "Post titles: [", "]")))); + + assertEquals("Post titles: [News item 1, News item 2]", postsPerType.get(BlogPostType.NEWS)); + assertEquals("Post titles: [Programming guide]", postsPerType.get(BlogPostType.GUIDE)); + assertEquals("Post titles: [Tech review 1, Tech review 2]", postsPerType.get(BlogPostType.REVIEW)); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeAndSumTheLikes_thenGetAMapBetweenTypeAndPostLikes() { + Map likesPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, summingInt(BlogPost::getLikes))); + + assertEquals(50, likesPerType.get(BlogPostType.NEWS) + .intValue()); + assertEquals(20, likesPerType.get(BlogPostType.REVIEW) + .intValue()); + assertEquals(20, likesPerType.get(BlogPostType.GUIDE) + .intValue()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeInAnEnumMap_thenGetAnEnumMapBetweenTypeAndPosts() { + EnumMap> postsPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, () -> new EnumMap<>(BlogPostType.class), toList())); + + assertEquals(2, postsPerType.get(BlogPostType.NEWS) + .size()); + assertEquals(1, postsPerType.get(BlogPostType.GUIDE) + .size()); + assertEquals(2, postsPerType.get(BlogPostType.REVIEW) + .size()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeInSets_thenGetAMapBetweenTypesAndSetsOfPosts() { + Map> postsPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, toSet())); + + assertEquals(2, postsPerType.get(BlogPostType.NEWS) + .size()); + assertEquals(1, postsPerType.get(BlogPostType.GUIDE) + .size()); + assertEquals(2, postsPerType.get(BlogPostType.REVIEW) + .size()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeConcurrently_thenGetAMapBetweenTypeAndPosts() { + ConcurrentMap> postsPerType = posts.parallelStream() + .collect(groupingByConcurrent(BlogPost::getType)); + + assertEquals(2, postsPerType.get(BlogPostType.NEWS) + .size()); + assertEquals(1, postsPerType.get(BlogPostType.GUIDE) + .size()); + assertEquals(2, postsPerType.get(BlogPostType.REVIEW) + .size()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeAndAveragingLikes_thenGetAMapBetweenTypeAndAverageNumberOfLikes() { + Map averageLikesPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, averagingInt(BlogPost::getLikes))); + + assertEquals(25, averageLikesPerType.get(BlogPostType.NEWS) + .intValue()); + assertEquals(20, averageLikesPerType.get(BlogPostType.GUIDE) + .intValue()); + assertEquals(10, averageLikesPerType.get(BlogPostType.REVIEW) + .intValue()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeAndCounted_thenGetAMapBetweenTypeAndNumberOfPosts() { + Map numberOfPostsPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, counting())); + + assertEquals(2, numberOfPostsPerType.get(BlogPostType.NEWS) + .intValue()); + assertEquals(1, numberOfPostsPerType.get(BlogPostType.GUIDE) + .intValue()); + assertEquals(2, numberOfPostsPerType.get(BlogPostType.REVIEW) + .intValue()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeAndMaxingLikes_thenGetAMapBetweenTypeAndMaximumNumberOfLikes() { + Map> maxLikesPerPostType = posts.stream() + .collect(groupingBy(BlogPost::getType, maxBy(comparingInt(BlogPost::getLikes)))); + + assertTrue(maxLikesPerPostType.get(BlogPostType.NEWS) + .isPresent()); + assertEquals(35, maxLikesPerPostType.get(BlogPostType.NEWS) + .get() + .getLikes()); + + assertTrue(maxLikesPerPostType.get(BlogPostType.GUIDE) + .isPresent()); + assertEquals(20, maxLikesPerPostType.get(BlogPostType.GUIDE) + .get() + .getLikes()); + + assertTrue(maxLikesPerPostType.get(BlogPostType.REVIEW) + .isPresent()); + assertEquals(15, maxLikesPerPostType.get(BlogPostType.REVIEW) + .get() + .getLikes()); + } + + @Test + public void givenAListOfPosts_whenGroupedByAuthorAndThenByType_thenGetAMapBetweenAuthorAndMapsBetweenTypeAndBlogPosts() { + Map>> map = posts.stream() + .collect(groupingBy(BlogPost::getAuthor, groupingBy(BlogPost::getType))); + + assertEquals(1, map.get("Author 1") + .get(BlogPostType.NEWS) + .size()); + assertEquals(1, map.get("Author 1") + .get(BlogPostType.GUIDE) + .size()); + assertEquals(1, map.get("Author 1") + .get(BlogPostType.REVIEW) + .size()); + + assertEquals(1, map.get("Author 2") + .get(BlogPostType.NEWS) + .size()); + assertEquals(1, map.get("Author 2") + .get(BlogPostType.REVIEW) + .size()); + assertNull(map.get("Author 2") + .get(BlogPostType.GUIDE)); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeAndSummarizingLikes_thenGetAMapBetweenTypeAndSummary() { + Map likeStatisticsPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, summarizingInt(BlogPost::getLikes))); + + IntSummaryStatistics newsLikeStatistics = likeStatisticsPerType.get(BlogPostType.NEWS); + + assertEquals(2, newsLikeStatistics.getCount()); + assertEquals(50, newsLikeStatistics.getSum()); + assertEquals(25.0, newsLikeStatistics.getAverage(), 0.001); + assertEquals(35, newsLikeStatistics.getMax()); + assertEquals(15, newsLikeStatistics.getMin()); + } + +} diff --git a/core-java/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/Java8MethodReferenceUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8MethodReferenceUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/Java8MethodReferenceUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/Java8MethodReferenceUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/Java8OptionalUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8OptionalUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/Java8OptionalUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/Java8OptionalUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/Java8SortUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/Java8SortUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/Java8StreamsUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8StreamsUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/Java8StreamsUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/Java8StreamsUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java similarity index 93% rename from core-java/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java index 28fea0fd31..32879aed0c 100644 --- a/core-java/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesLongRunningUnitTest.java @@ -1,20 +1,19 @@ package com.baeldung.java8; -import org.junit.Assert; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.PrintWriter; import java.io.StringWriter; import java.util.Date; import java.util.Scanner; +import org.junit.Assert; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class JavaTryWithResourcesLongRunningUnitTest { private static final Logger LOG = LoggerFactory.getLogger(JavaTryWithResourcesLongRunningUnitTest.class); - private static final String TEST_STRING_HELLO_WORLD = "Hello World"; private Date resource1Date, resource2Date; @@ -28,7 +27,8 @@ public class JavaTryWithResourcesLongRunningUnitTest { pw.print(TEST_STRING_HELLO_WORLD); } - Assert.assertEquals(sw.getBuffer().toString(), TEST_STRING_HELLO_WORLD); + Assert.assertEquals(sw.getBuffer() + .toString(), TEST_STRING_HELLO_WORLD); } /* Example for using multiple resources */ @@ -42,7 +42,8 @@ public class JavaTryWithResourcesLongRunningUnitTest { } } - Assert.assertEquals(sw.getBuffer().toString(), TEST_STRING_HELLO_WORLD); + Assert.assertEquals(sw.getBuffer() + .toString(), TEST_STRING_HELLO_WORLD); } /* Example to show order in which the resources are closed */ @@ -88,4 +89,4 @@ public class JavaTryWithResourcesLongRunningUnitTest { } } -} +} \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/comparator/Employee.java b/core-java-8/src/test/java/com/baeldung/java8/comparator/Employee.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/comparator/Employee.java rename to core-java-8/src/test/java/com/baeldung/java8/comparator/Employee.java diff --git a/core-java/src/test/java/com/baeldung/java8/comparator/Java8ComparatorUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/comparator/Java8ComparatorUnitTest.java similarity index 68% rename from core-java/src/test/java/com/baeldung/java8/comparator/Java8ComparatorUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/comparator/Java8ComparatorUnitTest.java index 26536ba705..1cac428285 100644 --- a/core-java/src/test/java/com/baeldung/java8/comparator/Java8ComparatorUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/java8/comparator/Java8ComparatorUnitTest.java @@ -1,4 +1,5 @@ package com.baeldung.java8.comparator; + import java.util.Arrays; import java.util.Comparator; @@ -25,44 +26,32 @@ public class Java8ComparatorUnitTest { @Before public void initData() { - employees = new Employee[] { new Employee("John", 25, 3000, 9922001), new Employee("Ace", 22, 2000, 5924001), - new Employee("Keith", 35, 4000, 3924401) }; - employeesArrayWithNulls = new Employee[] { new Employee("John", 25, 3000, 9922001), null, new Employee("Ace", 22, 2000, 5924001), - null, new Employee("Keith", 35, 4000, 3924401) }; + employees = new Employee[] { new Employee("John", 25, 3000, 9922001), new Employee("Ace", 22, 2000, 5924001), new Employee("Keith", 35, 4000, 3924401) }; + employeesArrayWithNulls = new Employee[] { new Employee("John", 25, 3000, 9922001), null, new Employee("Ace", 22, 2000, 5924001), null, new Employee("Keith", 35, 4000, 3924401) }; - sortedEmployeesByName = new Employee[] { new Employee("Ace", 22, 2000, 5924001), - new Employee("John", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401) }; - sortedEmployeesByNameDesc = new Employee[] { new Employee("Keith", 35, 4000, 3924401), new Employee("John", 25, 3000, 9922001), - new Employee("Ace", 22, 2000, 5924001) }; + sortedEmployeesByName = new Employee[] { new Employee("Ace", 22, 2000, 5924001), new Employee("John", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401) }; + sortedEmployeesByNameDesc = new Employee[] { new Employee("Keith", 35, 4000, 3924401), new Employee("John", 25, 3000, 9922001), new Employee("Ace", 22, 2000, 5924001) }; - sortedEmployeesByAge = new Employee[] { new Employee("Ace", 22, 2000, 5924001), - new Employee("John", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401) }; + sortedEmployeesByAge = new Employee[] { new Employee("Ace", 22, 2000, 5924001), new Employee("John", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401) }; - sortedEmployeesByMobile = new Employee[] { new Employee("Keith", 35, 4000, 3924401), new Employee("Ace", 22, 2000, 5924001), - new Employee("John", 25, 3000, 9922001), }; + sortedEmployeesByMobile = new Employee[] { new Employee("Keith", 35, 4000, 3924401), new Employee("Ace", 22, 2000, 5924001), new Employee("John", 25, 3000, 9922001), }; - sortedEmployeesBySalary = new Employee[] { new Employee("Ace", 22, 2000, 5924001), new Employee("John", 25, 3000, 9922001), - new Employee("Keith", 35, 4000, 3924401), }; + sortedEmployeesBySalary = new Employee[] { new Employee("Ace", 22, 2000, 5924001), new Employee("John", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401), }; - sortedEmployeesArray_WithNullsFirst = new Employee[] { null, null, new Employee("Ace", 22, 2000, 5924001), - new Employee("John", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401) }; - sortedEmployeesArray_WithNullsLast = new Employee[] { new Employee("Ace", 22, 2000, 5924001), - new Employee("John", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401), null, null }; + sortedEmployeesArray_WithNullsFirst = new Employee[] { null, null, new Employee("Ace", 22, 2000, 5924001), new Employee("John", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401) }; + sortedEmployeesArray_WithNullsLast = new Employee[] { new Employee("Ace", 22, 2000, 5924001), new Employee("John", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401), null, null }; - someMoreEmployees = new Employee[] { new Employee("Jake", 25, 3000, 9922001), new Employee("Jake", 22, 2000, 5924001), - new Employee("Ace", 22, 3000, 6423001), new Employee("Keith", 35, 4000, 3924401) }; + someMoreEmployees = new Employee[] { new Employee("Jake", 25, 3000, 9922001), new Employee("Jake", 22, 2000, 5924001), new Employee("Ace", 22, 3000, 6423001), new Employee("Keith", 35, 4000, 3924401) }; - sortedEmployeesByAgeName = new Employee[] { new Employee("Ace", 22, 3000, 6423001), - new Employee("Jake", 22, 2000, 5924001), new Employee("Jake", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401) }; - sortedEmployeesByNameAge = new Employee[] { new Employee("Ace", 22, 3000, 6423001), - new Employee("Jake", 22, 2000, 5924001), new Employee("Jake", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401) }; + sortedEmployeesByAgeName = new Employee[] { new Employee("Ace", 22, 3000, 6423001), new Employee("Jake", 22, 2000, 5924001), new Employee("Jake", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401) }; + sortedEmployeesByNameAge = new Employee[] { new Employee("Ace", 22, 3000, 6423001), new Employee("Jake", 22, 2000, 5924001), new Employee("Jake", 25, 3000, 9922001), new Employee("Keith", 35, 4000, 3924401) }; } @Test public void whenComparing_thenSortedByName() { Comparator employeeNameComparator = Comparator.comparing(Employee::getName); Arrays.sort(employees, employeeNameComparator); -// System.out.println(Arrays.toString(employees)); + // System.out.println(Arrays.toString(employees)); assertTrue(Arrays.equals(employees, sortedEmployeesByName)); } @@ -72,16 +61,16 @@ public class Java8ComparatorUnitTest { return s2.compareTo(s1); }); Arrays.sort(employees, employeeNameComparator); -// System.out.println(Arrays.toString(employees)); + // System.out.println(Arrays.toString(employees)); assertTrue(Arrays.equals(employees, sortedEmployeesByNameDesc)); } - + @Test public void whenReversed_thenSortedByNameDesc() { - Comparator employeeNameComparator = Comparator.comparing(Employee::getName); - Comparator employeeNameComparatorReversed = employeeNameComparator.reversed(); + Comparator employeeNameComparator = Comparator.comparing(Employee::getName); + Comparator employeeNameComparatorReversed = employeeNameComparator.reversed(); Arrays.sort(employees, employeeNameComparatorReversed); -// System.out.println(Arrays.toString(employees)); + // System.out.println(Arrays.toString(employees)); assertTrue(Arrays.equals(employees, sortedEmployeesByNameDesc)); } @@ -89,7 +78,7 @@ public class Java8ComparatorUnitTest { public void whenComparingInt_thenSortedByAge() { Comparator employeeAgeComparator = Comparator.comparingInt(Employee::getAge); Arrays.sort(employees, employeeAgeComparator); -// System.out.println(Arrays.toString(employees)); + // System.out.println(Arrays.toString(employees)); assertTrue(Arrays.equals(employees, sortedEmployeesByAge)); } @@ -97,7 +86,7 @@ public class Java8ComparatorUnitTest { public void whenComparingLong_thenSortedByMobile() { Comparator employeeMobileComparator = Comparator.comparingLong(Employee::getMobile); Arrays.sort(employees, employeeMobileComparator); -// System.out.println(Arrays.toString(employees)); + // System.out.println(Arrays.toString(employees)); assertTrue(Arrays.equals(employees, sortedEmployeesByMobile)); } @@ -105,7 +94,7 @@ public class Java8ComparatorUnitTest { public void whenComparingDouble_thenSortedBySalary() { Comparator employeeSalaryComparator = Comparator.comparingDouble(Employee::getSalary); Arrays.sort(employees, employeeSalaryComparator); -// System.out.println(Arrays.toString(employees)); + // System.out.println(Arrays.toString(employees)); assertTrue(Arrays.equals(employees, sortedEmployeesBySalary)); } @@ -113,7 +102,7 @@ public class Java8ComparatorUnitTest { public void whenNaturalOrder_thenSortedByName() { Comparator employeeNameComparator = Comparator. naturalOrder(); Arrays.sort(employees, employeeNameComparator); -// System.out.println(Arrays.toString(employees)); + // System.out.println(Arrays.toString(employees)); assertTrue(Arrays.equals(employees, sortedEmployeesByName)); } @@ -121,7 +110,7 @@ public class Java8ComparatorUnitTest { public void whenReverseOrder_thenSortedByNameDesc() { Comparator employeeNameComparator = Comparator. reverseOrder(); Arrays.sort(employees, employeeNameComparator); -// System.out.println(Arrays.toString(employees)); + // System.out.println(Arrays.toString(employees)); assertTrue(Arrays.equals(employees, sortedEmployeesByNameDesc)); } @@ -130,7 +119,7 @@ public class Java8ComparatorUnitTest { Comparator employeeNameComparator = Comparator.comparing(Employee::getName); Comparator employeeNameComparator_nullFirst = Comparator.nullsFirst(employeeNameComparator); Arrays.sort(employeesArrayWithNulls, employeeNameComparator_nullFirst); -// System.out.println(Arrays.toString(employeesArrayWithNulls)); + // System.out.println(Arrays.toString(employeesArrayWithNulls)); assertTrue(Arrays.equals(employeesArrayWithNulls, sortedEmployeesArray_WithNullsFirst)); } @@ -139,27 +128,28 @@ public class Java8ComparatorUnitTest { Comparator employeeNameComparator = Comparator.comparing(Employee::getName); Comparator employeeNameComparator_nullLast = Comparator.nullsLast(employeeNameComparator); Arrays.sort(employeesArrayWithNulls, employeeNameComparator_nullLast); -// System.out.println(Arrays.toString(employeesArrayWithNulls)); + // System.out.println(Arrays.toString(employeesArrayWithNulls)); assertTrue(Arrays.equals(employeesArrayWithNulls, sortedEmployeesArray_WithNullsLast)); } @Test public void whenThenComparing_thenSortedByAgeName() { - Comparator employee_Age_Name_Comparator = Comparator.comparing(Employee::getAge).thenComparing(Employee::getName); + Comparator employee_Age_Name_Comparator = Comparator.comparing(Employee::getAge) + .thenComparing(Employee::getName); Arrays.sort(someMoreEmployees, employee_Age_Name_Comparator); -// System.out.println(Arrays.toString(someMoreEmployees)); + // System.out.println(Arrays.toString(someMoreEmployees)); assertTrue(Arrays.equals(someMoreEmployees, sortedEmployeesByAgeName)); } @Test public void whenThenComparing_thenSortedByNameAge() { - Comparator employee_Name_Age_Comparator = Comparator.comparing(Employee::getName).thenComparingInt(Employee::getAge); + Comparator employee_Name_Age_Comparator = Comparator.comparing(Employee::getName) + .thenComparingInt(Employee::getAge); Arrays.sort(someMoreEmployees, employee_Name_Age_Comparator); -// System.out.println(Arrays.toString(someMoreEmployees)); + // System.out.println(Arrays.toString(someMoreEmployees)); assertTrue(Arrays.equals(someMoreEmployees, sortedEmployeesByNameAge)); } - } diff --git a/core-java/src/test/java/com/baeldung/java8/entity/Human.java b/core-java-8/src/test/java/com/baeldung/java8/entity/Human.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/entity/Human.java rename to core-java-8/src/test/java/com/baeldung/java8/entity/Human.java diff --git a/core-java/src/test/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappersUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappersUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappersUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/lambda/exceptions/LambdaExceptionWrappersUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java similarity index 81% rename from core-java/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java rename to core-java-8/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java index 0085de6327..4cb2551fae 100644 --- a/core-java/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/java8/optional/OptionalUnitTest.java @@ -17,7 +17,6 @@ public class OptionalUnitTest { private static final Logger LOG = LoggerFactory.getLogger(OptionalUnitTest.class); - // creating Optional @Test public void whenCreatesEmptyOptional_thenCorrect() { @@ -94,9 +93,11 @@ public class OptionalUnitTest { public void whenOptionalFilterWorks_thenCorrect() { Integer year = 2016; Optional yearOptional = Optional.of(year); - boolean is2016 = yearOptional.filter(y -> y == 2016).isPresent(); + boolean is2016 = yearOptional.filter(y -> y == 2016) + .isPresent(); assertTrue(is2016); - boolean is2017 = yearOptional.filter(y -> y == 2017).isPresent(); + boolean is2017 = yearOptional.filter(y -> y == 2017) + .isPresent(); assertFalse(is2017); } @@ -128,7 +129,11 @@ public class OptionalUnitTest { } public boolean priceIsInRange2(Modem modem2) { - return Optional.ofNullable(modem2).map(Modem::getPrice).filter(p -> p >= 10).filter(p -> p <= 15).isPresent(); + return Optional.ofNullable(modem2) + .map(Modem::getPrice) + .filter(p -> p >= 10) + .filter(p -> p <= 15) + .isPresent(); } // Transforming Value With map() @@ -137,7 +142,8 @@ public class OptionalUnitTest { List companyNames = Arrays.asList("paypal", "oracle", "", "microsoft", "", "apple"); Optional> listOptional = Optional.of(companyNames); - int size = listOptional.map(List::size).orElse(0); + int size = listOptional.map(List::size) + .orElse(0); assertEquals(6, size); } @@ -146,7 +152,8 @@ public class OptionalUnitTest { String name = "baeldung"; Optional nameOptional = Optional.of(name); - int len = nameOptional.map(String::length).orElse(0); + int len = nameOptional.map(String::length) + .orElse(0); assertEquals(8, len); } @@ -154,10 +161,13 @@ public class OptionalUnitTest { public void givenOptional_whenMapWorksWithFilter_thenCorrect() { String password = " password "; Optional passOpt = Optional.of(password); - boolean correctPassword = passOpt.filter(pass -> pass.equals("password")).isPresent(); + boolean correctPassword = passOpt.filter(pass -> pass.equals("password")) + .isPresent(); assertFalse(correctPassword); - correctPassword = passOpt.map(String::trim).filter(pass -> pass.equals("password")).isPresent(); + correctPassword = passOpt.map(String::trim) + .filter(pass -> pass.equals("password")) + .isPresent(); assertTrue(correctPassword); } @@ -172,7 +182,8 @@ public class OptionalUnitTest { String name1 = nameOptional.orElseThrow(IllegalArgumentException::new); assertEquals("john", name1); - String name = personOptional.flatMap(Person::getName).orElseThrow(IllegalArgumentException::new); + String name = personOptional.flatMap(Person::getName) + .orElseThrow(IllegalArgumentException::new); assertEquals("john", name); } @@ -182,7 +193,9 @@ public class OptionalUnitTest { person.setPassword("password"); Optional personOptional = Optional.of(person); - String password = personOptional.flatMap(Person::getPassword).filter(cleanPass -> cleanPass.equals("password")).orElseThrow(IllegalArgumentException::new); + String password = personOptional.flatMap(Person::getPassword) + .filter(cleanPass -> cleanPass.equals("password")) + .orElseThrow(IllegalArgumentException::new); assertEquals("password", password); } @@ -190,7 +203,8 @@ public class OptionalUnitTest { @Test public void whenOrElseWorks_thenCorrect() { String nullName = null; - String name = Optional.ofNullable(nullName).orElse("john"); + String name = Optional.ofNullable(nullName) + .orElse("john"); assertEquals("john", name); } @@ -198,7 +212,8 @@ public class OptionalUnitTest { @Test public void whenOrElseGetWorks_thenCorrect() { String nullName = null; - String name = Optional.ofNullable(nullName).orElseGet(() -> "john"); + String name = Optional.ofNullable(nullName) + .orElseGet(() -> "john"); assertEquals("john", name); } @@ -207,11 +222,13 @@ public class OptionalUnitTest { public void whenOrElseGetAndOrElseOverlap_thenCorrect() { String text = null; LOG.debug("Using orElseGet:"); - String defaultText = Optional.ofNullable(text).orElseGet(this::getMyDefault); + String defaultText = Optional.ofNullable(text) + .orElseGet(this::getMyDefault); assertEquals("Default Value", defaultText); LOG.debug("Using orElse:"); - defaultText = Optional.ofNullable(text).orElse(getMyDefault()); + defaultText = Optional.ofNullable(text) + .orElse(getMyDefault()); assertEquals("Default Value", defaultText); } @@ -219,11 +236,13 @@ public class OptionalUnitTest { public void whenOrElseGetAndOrElseDiffer_thenCorrect() { String text = "Text present"; LOG.debug("Using orElseGet:"); - String defaultText = Optional.ofNullable(text).orElseGet(this::getMyDefault); + String defaultText = Optional.ofNullable(text) + .orElseGet(this::getMyDefault); assertEquals("Text present", defaultText); LOG.debug("Using orElse:"); - defaultText = Optional.ofNullable(text).orElse(getMyDefault()); + defaultText = Optional.ofNullable(text) + .orElse(getMyDefault()); assertEquals("Text present", defaultText); } @@ -231,7 +250,8 @@ public class OptionalUnitTest { @Test(expected = IllegalArgumentException.class) public void whenOrElseThrowWorks_thenCorrect() { String nullName = null; - String name = Optional.ofNullable(nullName).orElseThrow(IllegalArgumentException::new); + String name = Optional.ofNullable(nullName) + .orElseThrow(IllegalArgumentException::new); } public String getMyDefault() { diff --git a/core-java/src/test/java/com/baeldung/strategy/StrategyDesignPatternUnitTest.java b/core-java-8/src/test/java/com/baeldung/strategy/StrategyDesignPatternUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/strategy/StrategyDesignPatternUnitTest.java rename to core-java-8/src/test/java/com/baeldung/strategy/StrategyDesignPatternUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/stream/InfiniteStreamUnitTest.java b/core-java-8/src/test/java/com/baeldung/stream/InfiniteStreamUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stream/InfiniteStreamUnitTest.java rename to core-java-8/src/test/java/com/baeldung/stream/InfiniteStreamUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/stream/StreamAddUnitTest.java b/core-java-8/src/test/java/com/baeldung/stream/StreamAddUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stream/StreamAddUnitTest.java rename to core-java-8/src/test/java/com/baeldung/stream/StreamAddUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/stream/StreamApiTest.java b/core-java-8/src/test/java/com/baeldung/stream/StreamApiTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stream/StreamApiTest.java rename to core-java-8/src/test/java/com/baeldung/stream/StreamApiTest.java diff --git a/core-java/src/test/java/com/baeldung/stream/StreamToImmutableTest.java b/core-java-8/src/test/java/com/baeldung/stream/StreamToImmutableTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stream/StreamToImmutableTest.java rename to core-java-8/src/test/java/com/baeldung/stream/StreamToImmutableTest.java diff --git a/core-java-8/src/test/java/com/baeldung/stream/SupplierStreamTest.java b/core-java-8/src/test/java/com/baeldung/stream/SupplierStreamTest.java new file mode 100644 index 0000000000..d78c9fca35 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/stream/SupplierStreamTest.java @@ -0,0 +1,35 @@ +package com.baeldung.stream; + +import static org.junit.Assert.fail; + +import java.util.Optional; +import java.util.function.Supplier; +import java.util.stream.Stream; + +import org.junit.Test; + +public class SupplierStreamTest { + + @Test(expected = IllegalStateException.class) + public void givenStream_whenStreamUsedTwice_thenThrowException() { + Stream stringStream = Stream.of("A", "B", "C", "D"); + Optional result1 = stringStream.findAny(); + System.out.println(result1.get()); + Optional result2 = stringStream.findFirst(); + System.out.println(result2.get()); + } + + @Test + public void givenStream_whenUsingSupplier_thenNoExceptionIsThrown() { + try { + Supplier> streamSupplier = () -> Stream.of("A", "B", "C", "D"); + Optional result1 = streamSupplier.get().findAny(); + System.out.println(result1.get()); + Optional result2 = streamSupplier.get().findFirst(); + System.out.println(result2.get()); + } catch (IllegalStateException e) { + fail(); + } + } + +} \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/stream/mycollectors/MyImmutableListCollector.java b/core-java-8/src/test/java/com/baeldung/stream/mycollectors/MyImmutableListCollector.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stream/mycollectors/MyImmutableListCollector.java rename to core-java-8/src/test/java/com/baeldung/stream/mycollectors/MyImmutableListCollector.java diff --git a/core-java/src/test/java/com/baeldung/string/JoinerSplitterUnitTest.java b/core-java-8/src/test/java/com/baeldung/string/JoinerSplitterUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/string/JoinerSplitterUnitTest.java rename to core-java-8/src/test/java/com/baeldung/string/JoinerSplitterUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterTest.java b/core-java-8/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterTest.java rename to core-java-8/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterTest.java diff --git a/core-java/src/test/java/com/baeldung/temporaladjusters/TemporalAdjustersTest.java b/core-java-8/src/test/java/com/baeldung/temporaladjusters/TemporalAdjustersTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/temporaladjusters/TemporalAdjustersTest.java rename to core-java-8/src/test/java/com/baeldung/temporaladjusters/TemporalAdjustersTest.java diff --git a/core-java/src/test/java/com/baeldung/util/CurrentDateTimeUnitTest.java b/core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/util/CurrentDateTimeUnitTest.java rename to core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeUnitTest.java diff --git a/core-java-8/src/test/resources/.gitignore b/core-java-8/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/core-java-8/src/test/resources/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/core-java-9/README.md b/core-java-9/README.md index 22d6903f06..f0b2e3f206 100644 --- a/core-java-9/README.md +++ b/core-java-9/README.md @@ -8,7 +8,7 @@ - [Java 9 Stream API Improvements](http://www.baeldung.com/java-9-stream-api) - [Java 9 Convenience Factory Methods for Collections](http://www.baeldung.com/java-9-collections-factory-methods) - [New Stream Collectors in Java 9](http://www.baeldung.com/java9-stream-collectors) -- [Java 9 CompletableFuture API Improvements](http://www.baeldung.com/java9-completablefuture-api-improvements/) +- [Java 9 CompletableFuture API Improvements](http://www.baeldung.com/java-9-completablefuture) - [Spring Security – Redirect to the Previous URL After Login](http://www.baeldung.com/spring-security-redirect-login) - [Java 9 Process API Improvements](http://www.baeldung.com/java-9-process-api) - [Introduction to Java 9 StackWalking API](http://www.baeldung.com/java-9-stackwalking-api) @@ -16,3 +16,4 @@ - [Java 9 Optional API Additions](http://www.baeldung.com/java-9-optional) - [Java 9 Reactive Streams](http://www.baeldung.com/java-9-reactive-streams) - [How to Get All Dates Between Two Dates?](http://www.baeldung.com/java-between-dates) +- [Java 9 java.util.Objects Additions](http://www.baeldung.com/java-9-objects-new) diff --git a/core-java-9/src/main/java/com/baeldung/java9/compactstring/CompactStringDemo.java b/core-java-9/src/main/java/com/baeldung/java9/compactstring/CompactStringDemo.java new file mode 100644 index 0000000000..cb24511f72 --- /dev/null +++ b/core-java-9/src/main/java/com/baeldung/java9/compactstring/CompactStringDemo.java @@ -0,0 +1,24 @@ +package com.baeldung.java9.compactstring; + +import java.util.List; +import static java.util.stream.Collectors.toList; +import java.util.stream.IntStream; + +public class CompactStringDemo { + + public static void main(String[] args) { + long startTime = System.currentTimeMillis(); + List strings = IntStream.rangeClosed(1, 10_000_000) + .mapToObj(Integer::toString).collect(toList()); + long totalTime = System.currentTimeMillis() - startTime; + System.out.println("Generated " + strings.size() + " strings in " + + totalTime + " ms."); + + startTime = System.currentTimeMillis(); + String appended = (String) strings.stream().limit(100_000) + .reduce("", (left, right) -> left.toString() + right.toString()); + totalTime = System.currentTimeMillis() - startTime; + System.out.println("Created string of length " + appended.length() + + " in " + totalTime + " ms."); + } +} diff --git a/core-java-concurrency/.gitignore b/core-java-concurrency/.gitignore new file mode 100644 index 0000000000..3de4cc647e --- /dev/null +++ b/core-java-concurrency/.gitignore @@ -0,0 +1,26 @@ +*.class + +0.* + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* +.resourceCache + +# Packaged files # +*.jar +*.war +*.ear + +# Files generated by integration tests +*.txt +backup-pom.xml +/bin/ +/temp + +#IntelliJ specific +.idea/ +*.iml \ No newline at end of file diff --git a/core-java-concurrency/README.md b/core-java-concurrency/README.md new file mode 100644 index 0000000000..f1d95482d4 --- /dev/null +++ b/core-java-concurrency/README.md @@ -0,0 +1,32 @@ +========= + +## Core Java Concurrency Examples + +### Relevant Articles: +- [Guide To CompletableFuture](http://www.baeldung.com/java-completablefuture) +- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial) +- [Introduction to Thread Pools in Java](http://www.baeldung.com/thread-pool-java-and-guava) +- [Guide to java.util.concurrent.Future](http://www.baeldung.com/java-future) +- [Guide to java.util.concurrent.BlockingQueue](http://www.baeldung.com/java-blocking-queue) +- [Guide to CountDownLatch in Java](http://www.baeldung.com/java-countdown-latch) +- [A Guide to ConcurrentMap](http://www.baeldung.com/java-concurrent-map) +- [Guide to PriorityBlockingQueue in Java](http://www.baeldung.com/java-priority-blocking-queue) +- [Avoiding the ConcurrentModificationException in Java](http://www.baeldung.com/java-concurrentmodificationexception) +- [Custom Thread Pools In Java 8 Parallel Streams](http://www.baeldung.com/java-8-parallel-streams-custom-threadpool) +- [Guide to java.util.concurrent.Locks](http://www.baeldung.com/java-concurrent-locks) +- [An Introduction to ThreadLocal in Java](http://www.baeldung.com/java-threadlocal) +- [Guide to DelayQueue](http://www.baeldung.com/java-delay-queue) +- [A Guide to Java SynchronousQueue](http://www.baeldung.com/java-synchronous-queue) +- [Guide to the Java TransferQueue](http://www.baeldung.com/java-transfer-queue) +- [Guide to the ConcurrentSkipListMap](http://www.baeldung.com/java-concurrent-skip-list-map) +- [Difference Between Wait and Sleep in Java](http://www.baeldung.com/java-wait-and-sleep) +- [LongAdder and LongAccumulator in Java](http://www.baeldung.com/java-longadder-and-longaccumulator) +- [The Dining Philosophers Problem in Java](http://www.baeldung.com/java-dining-philoshophers) +- [Guide to CopyOnWriteArrayList](http://www.baeldung.com/java-copy-on-write-arraylist) +- [Guide to the Java Phaser](http://www.baeldung.com/java-phaser) +- [Guide to Synchronized Keyword in Java](http://www.baeldung.com/java-synchronized) +- [An Introduction to Atomic Variables in Java](http://www.baeldung.com/java-atomic-variables) +- [CyclicBarrier in Java](http://www.baeldung.com/java-cyclic-barrier) +- [Guide to Volatile Keyword in Java](http://www.baeldung.com/java-volatile) +- [Overview of the java.util.concurrent](http://www.baeldung.com/java-util-concurrent) +- [Semaphores in Java](http://www.baeldung.com/java-semaphore) diff --git a/core-java-concurrency/pom.xml b/core-java-concurrency/pom.xml new file mode 100644 index 0000000000..bf858047e9 --- /dev/null +++ b/core-java-concurrency/pom.xml @@ -0,0 +1,237 @@ + + 4.0.0 + com.baeldung + core-java-concurrency + 0.1.0-SNAPSHOT + jar + + core-java-concurrency + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + + + com.google.guava + guava + ${guava.version} + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + + commons-io + commons-io + ${commons-io.version} + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + + + + + org.assertj + assertj-core + ${assertj.version} + test + + + + com.jayway.awaitility + awaitility + ${avaitility.version} + test + + + + + + core-java-concurrency + + + src/main/resources + true + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + prepare-package + + copy-dependencies + + + ${project.build.directory}/libs + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + libs/ + org.baeldung.executable.ExecutableMavenJar + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + ${project.basedir} + + + org.baeldung.executable.ExecutableMavenJar + + + + jar-with-dependencies + + + + + + + org.apache.maven.plugins + maven-shade-plugin + + + + shade + + + true + + + org.baeldung.executable.ExecutableMavenJar + + + + + + + + com.jolira + onejar-maven-plugin + + + + org.baeldung.executable.ExecutableMavenJar + true + ${project.build.finalName}-onejar.${project.packaging} + + + one-jar + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + spring-boot + org.baeldung.executable.ExecutableMavenJar + + + + + + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*ManualTest.java + + + **/*IntegrationTest.java + + + + + + + json + + + + + + + + + + + + 21.0 + 3.5 + 3.6.1 + 2.5 + 4.1 + 4.01 + + + 3.6.1 + 1.7.0 + + + diff --git a/core-java/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java similarity index 67% rename from core-java/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java index 38633011bf..e3a1629ce1 100644 --- a/core-java/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java @@ -3,11 +3,11 @@ package com.baeldung.concurrent.atomic; public class SafeCounterWithLock { private volatile int counter; - public int getValue() { + int getValue() { return counter; } - public synchronized void increment() { + synchronized void increment() { counter++; } } diff --git a/core-java/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java similarity index 85% rename from core-java/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java index 41e10789a6..18ade35efb 100644 --- a/core-java/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java @@ -5,11 +5,11 @@ import java.util.concurrent.atomic.AtomicInteger; public class SafeCounterWithoutLock { private final AtomicInteger counter = new AtomicInteger(0); - public int getValue() { + int getValue() { return counter.get(); } - public void increment() { + void increment() { while(true) { int existingValue = getValue(); int newValue = existingValue + 1; diff --git a/core-java/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java similarity index 60% rename from core-java/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java index 8a72788842..500ef5bd7e 100644 --- a/core-java/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java @@ -1,13 +1,13 @@ package com.baeldung.concurrent.atomic; public class UnsafeCounter { - int counter; + private int counter; - public int getValue() { + int getValue() { return counter; } - public void increment() { + void increment() { counter++; } } diff --git a/core-java/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersConsumer.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersConsumer.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersConsumer.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersConsumer.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersProducer.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersProducer.java similarity index 85% rename from core-java/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersProducer.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersProducer.java index 9dcd0a3e47..b301e994d5 100644 --- a/core-java/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersProducer.java +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersProducer.java @@ -19,13 +19,15 @@ public class NumbersProducer implements Runnable { try { generateNumbers(); } catch (InterruptedException e) { - Thread.currentThread().interrupt(); + Thread.currentThread() + .interrupt(); } } private void generateNumbers() throws InterruptedException { for (int i = 0; i < 100; i++) { - numbersQueue.put(ThreadLocalRandom.current().nextInt(100)); + numbersQueue.put(ThreadLocalRandom.current() + .nextInt(100)); } for (int j = 0; j < poisonPillPerProducer; j++) { numbersQueue.put(poisonPill); diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/callable/FactorialTask.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/callable/FactorialTask.java new file mode 100644 index 0000000000..8663609d2d --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/callable/FactorialTask.java @@ -0,0 +1,30 @@ +package com.baeldung.concurrent.callable; + + +import java.util.concurrent.Callable; + +public class FactorialTask implements Callable { + int number; + + public FactorialTask(int number) { + this.number = number; + } + + public Integer call() throws InvalidParamaterException { + int fact=1; + if(number < 0) + throw new InvalidParamaterException("Number must be positive"); + + for(int count=number;count>1;count--){ + fact=fact * count; + } + + return fact; + } + + private class InvalidParamaterException extends Exception { + public InvalidParamaterException(String message) { + super(message); + } + } +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/countdownlatch/BrokenWorker.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/BrokenWorker.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/countdownlatch/BrokenWorker.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/BrokenWorker.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/countdownlatch/WaitingWorker.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/WaitingWorker.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/countdownlatch/WaitingWorker.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/WaitingWorker.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/countdownlatch/Worker.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/Worker.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/countdownlatch/Worker.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/countdownlatch/Worker.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierDemo.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierDemo.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierDemo.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierExample.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierExample.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierExample.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/cyclicbarrier/Task.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/Task.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/cyclicbarrier/Task.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/cyclicbarrier/Task.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/delayqueue/DelayObject.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayObject.java similarity index 86% rename from core-java/src/main/java/com/baeldung/concurrent/delayqueue/DelayObject.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayObject.java index 5f72758e71..312eb929ed 100644 --- a/core-java/src/main/java/com/baeldung/concurrent/delayqueue/DelayObject.java +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayObject.java @@ -27,9 +27,6 @@ public class DelayObject implements Delayed { @Override public String toString() { - return "{" + - "data='" + data + '\'' + - ", startTime=" + startTime + - '}'; + return "{" + "data='" + data + '\'' + ", startTime=" + startTime + '}'; } } \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueConsumer.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueConsumer.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueConsumer.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueConsumer.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueProducer.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueProducer.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueProducer.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueProducer.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/diningphilosophers/DiningPhilosophers.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/diningphilosophers/DiningPhilosophers.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/diningphilosophers/DiningPhilosophers.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/diningphilosophers/DiningPhilosophers.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/diningphilosophers/Philosopher.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/diningphilosophers/Philosopher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/diningphilosophers/Philosopher.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/diningphilosophers/Philosopher.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/executor/ExecutorDemo.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/executor/ExecutorDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/executor/ExecutorDemo.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/executor/ExecutorDemo.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/executor/Invoker.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/executor/Invoker.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/executor/Invoker.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/executor/Invoker.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/executorservice/ExecutorServiceDemo.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/executorservice/ExecutorServiceDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/executorservice/ExecutorServiceDemo.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/executorservice/ExecutorServiceDemo.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/executorservice/Task.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/executorservice/Task.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/executorservice/Task.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/executorservice/Task.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/future/FactorialSquareCalculator.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/future/FactorialSquareCalculator.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/future/FactorialSquareCalculator.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/future/FactorialSquareCalculator.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/future/FutureDemo.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/future/FutureDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/future/FutureDemo.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/future/FutureDemo.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/phaser/LongRunningAction.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/phaser/LongRunningAction.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/phaser/LongRunningAction.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/phaser/LongRunningAction.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/runnable/EventLoggingTask.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/runnable/EventLoggingTask.java new file mode 100644 index 0000000000..d65f79202e --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/runnable/EventLoggingTask.java @@ -0,0 +1,17 @@ +package com.baeldung.concurrent.runnable; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class EventLoggingTask implements Runnable{ + private Logger logger = LoggerFactory.getLogger(EventLoggingTask.class); + + @Override + public void run() { + + String messge="Message read from the event queue"; + logger.info("Message read from event queue is "+messge); + + } +} diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/runnable/TaskRunner.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/runnable/TaskRunner.java new file mode 100644 index 0000000000..8fd98e77b8 --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/runnable/TaskRunner.java @@ -0,0 +1,25 @@ +package com.baeldung.concurrent.runnable; + + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +public class TaskRunner { + + private static ExecutorService executorService; + + public static void main(String[] args) { + executeTask(); + } + + private static void executeTask() { + executorService= Executors.newSingleThreadExecutor(); + + EventLoggingTask task = new EventLoggingTask(); + + Future future = executorService.submit(task); + + executorService.shutdown(); + } +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/semaphore/SemaPhoreDemo.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphore/SemaPhoreDemo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/semaphore/SemaPhoreDemo.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphore/SemaPhoreDemo.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/semaphores/CounterUsingMutex.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphores/CounterUsingMutex.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/semaphores/CounterUsingMutex.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphores/CounterUsingMutex.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/semaphores/DelayQueueUsingTimedSemaphore.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphores/DelayQueueUsingTimedSemaphore.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/semaphores/DelayQueueUsingTimedSemaphore.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphores/DelayQueueUsingTimedSemaphore.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/semaphores/LoginQueueUsingSemaphore.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphores/LoginQueueUsingSemaphore.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/semaphores/LoginQueueUsingSemaphore.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/semaphores/LoginQueueUsingSemaphore.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/skiplist/Event.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/skiplist/Event.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/skiplist/Event.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/skiplist/Event.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/skiplist/EventWindowSort.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/skiplist/EventWindowSort.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/skiplist/EventWindowSort.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/skiplist/EventWindowSort.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/sleepwait/ThreadA.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/sleepwait/ThreadA.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/sleepwait/ThreadA.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/sleepwait/ThreadA.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/sleepwait/ThreadB.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/sleepwait/ThreadB.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/sleepwait/ThreadB.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/sleepwait/ThreadB.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/sleepwait/WaitSleepExample.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/sleepwait/WaitSleepExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/sleepwait/WaitSleepExample.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/sleepwait/WaitSleepExample.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedBlocks.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedBlocks.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedBlocks.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedBlocks.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedMethods.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedMethods.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedMethods.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizedMethods.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/threadfactory/BaeldungThreadFactory.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/threadfactory/BaeldungThreadFactory.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/threadfactory/BaeldungThreadFactory.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/threadfactory/BaeldungThreadFactory.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/threadfactory/Demo.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/threadfactory/Demo.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/threadfactory/Demo.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/threadfactory/Demo.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/threadfactory/Task.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/threadfactory/Task.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/threadfactory/Task.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/threadfactory/Task.java diff --git a/core-java/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java similarity index 100% rename from core-java/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java diff --git a/core-java/src/main/java/com/baeldung/threadlocal/Context.java b/core-java-concurrency/src/main/java/com/baeldung/threadlocal/Context.java similarity index 65% rename from core-java/src/main/java/com/baeldung/threadlocal/Context.java rename to core-java-concurrency/src/main/java/com/baeldung/threadlocal/Context.java index 241fb2f1e0..88b78fb259 100644 --- a/core-java/src/main/java/com/baeldung/threadlocal/Context.java +++ b/core-java-concurrency/src/main/java/com/baeldung/threadlocal/Context.java @@ -4,14 +4,14 @@ package com.baeldung.threadlocal; public class Context { private final String userName; - public Context(String userName) { + Context(String userName) { this.userName = userName; } @Override public String toString() { return "Context{" + - "userNameSecret='" + userName + '\'' + - '}'; + "userNameSecret='" + userName + '\'' + + '}'; } } diff --git a/core-java/src/main/java/com/baeldung/threadlocal/SharedMapWithUserContext.java b/core-java-concurrency/src/main/java/com/baeldung/threadlocal/SharedMapWithUserContext.java similarity index 76% rename from core-java/src/main/java/com/baeldung/threadlocal/SharedMapWithUserContext.java rename to core-java-concurrency/src/main/java/com/baeldung/threadlocal/SharedMapWithUserContext.java index e5854e218a..8cb4b3968f 100644 --- a/core-java/src/main/java/com/baeldung/threadlocal/SharedMapWithUserContext.java +++ b/core-java-concurrency/src/main/java/com/baeldung/threadlocal/SharedMapWithUserContext.java @@ -5,11 +5,11 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class SharedMapWithUserContext implements Runnable { - public final static Map userContextPerUserId = new ConcurrentHashMap<>(); + final static Map userContextPerUserId = new ConcurrentHashMap<>(); private final Integer userId; private UserRepository userRepository = new UserRepository(); - public SharedMapWithUserContext(Integer userId) { + SharedMapWithUserContext(Integer userId) { this.userId = userId; } diff --git a/core-java/src/main/java/com/baeldung/threadlocal/ThreadLocalWithUserContext.java b/core-java-concurrency/src/main/java/com/baeldung/threadlocal/ThreadLocalWithUserContext.java similarity index 92% rename from core-java/src/main/java/com/baeldung/threadlocal/ThreadLocalWithUserContext.java rename to core-java-concurrency/src/main/java/com/baeldung/threadlocal/ThreadLocalWithUserContext.java index de7e4a0369..d4ab906c30 100644 --- a/core-java/src/main/java/com/baeldung/threadlocal/ThreadLocalWithUserContext.java +++ b/core-java-concurrency/src/main/java/com/baeldung/threadlocal/ThreadLocalWithUserContext.java @@ -10,7 +10,7 @@ public class ThreadLocalWithUserContext implements Runnable { private final Integer userId; private UserRepository userRepository = new UserRepository(); - public ThreadLocalWithUserContext(Integer userId) { + ThreadLocalWithUserContext(Integer userId) { this.userId = userId; } diff --git a/core-java/src/main/java/com/baeldung/threadlocal/UserRepository.java b/core-java-concurrency/src/main/java/com/baeldung/threadlocal/UserRepository.java similarity index 71% rename from core-java/src/main/java/com/baeldung/threadlocal/UserRepository.java rename to core-java-concurrency/src/main/java/com/baeldung/threadlocal/UserRepository.java index 3fe76f75c0..2597594940 100644 --- a/core-java/src/main/java/com/baeldung/threadlocal/UserRepository.java +++ b/core-java-concurrency/src/main/java/com/baeldung/threadlocal/UserRepository.java @@ -4,7 +4,7 @@ import java.util.UUID; public class UserRepository { - public String getUserNameForUserId(Integer userId) { + String getUserNameForUserId(Integer userId) { return UUID.randomUUID().toString(); } } diff --git a/core-java/src/main/java/com/baeldung/threadpool/CountingTask.java b/core-java-concurrency/src/main/java/com/baeldung/threadpool/CountingTask.java similarity index 56% rename from core-java/src/main/java/com/baeldung/threadpool/CountingTask.java rename to core-java-concurrency/src/main/java/com/baeldung/threadpool/CountingTask.java index effdf54916..a7447d040f 100644 --- a/core-java/src/main/java/com/baeldung/threadpool/CountingTask.java +++ b/core-java-concurrency/src/main/java/com/baeldung/threadpool/CountingTask.java @@ -2,19 +2,21 @@ package com.baeldung.threadpool; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.RecursiveTask; -import java.util.stream.Collectors; public class CountingTask extends RecursiveTask { private final TreeNode node; - public CountingTask(TreeNode node) { + CountingTask(TreeNode node) { this.node = node; } @Override protected Integer compute() { - return node.value + node.children.stream().map(childNode -> new CountingTask(childNode).fork()).collect(Collectors.summingInt(ForkJoinTask::join)); + return node.getValue() + node.getChildren().stream() + .map(childNode -> new CountingTask(childNode).fork()) + .mapToInt(ForkJoinTask::join) + .sum(); } } diff --git a/core-java/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java b/core-java-concurrency/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java rename to core-java-concurrency/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/threadpool/TreeNode.java b/core-java-concurrency/src/main/java/com/baeldung/threadpool/TreeNode.java new file mode 100644 index 0000000000..a3283cf930 --- /dev/null +++ b/core-java-concurrency/src/main/java/com/baeldung/threadpool/TreeNode.java @@ -0,0 +1,25 @@ +package com.baeldung.threadpool; + +import com.google.common.collect.Sets; + +import java.util.Set; + +public class TreeNode { + + private int value; + + private Set children; + + TreeNode(int value, TreeNode... children) { + this.value = value; + this.children = Sets.newHashSet(children); + } + + public int getValue() { + return value; + } + + public Set getChildren() { + return children; + } +} \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/transferqueue/Consumer.java b/core-java-concurrency/src/main/java/com/baeldung/transferqueue/Consumer.java similarity index 83% rename from core-java/src/main/java/com/baeldung/transferqueue/Consumer.java rename to core-java-concurrency/src/main/java/com/baeldung/transferqueue/Consumer.java index a5f70d9df5..f3be6a030e 100644 --- a/core-java/src/main/java/com/baeldung/transferqueue/Consumer.java +++ b/core-java-concurrency/src/main/java/com/baeldung/transferqueue/Consumer.java @@ -11,10 +11,10 @@ public class Consumer implements Runnable { private final TransferQueue transferQueue; private final String name; - private final int numberOfMessagesToConsume; - public final AtomicInteger numberOfConsumedMessages = new AtomicInteger(); + final int numberOfMessagesToConsume; + final AtomicInteger numberOfConsumedMessages = new AtomicInteger(); - public Consumer(TransferQueue transferQueue, String name, int numberOfMessagesToConsume) { + Consumer(TransferQueue transferQueue, String name, int numberOfMessagesToConsume) { this.transferQueue = transferQueue; this.name = name; this.numberOfMessagesToConsume = numberOfMessagesToConsume; diff --git a/core-java/src/main/java/com/baeldung/transferqueue/Producer.java b/core-java-concurrency/src/main/java/com/baeldung/transferqueue/Producer.java similarity index 84% rename from core-java/src/main/java/com/baeldung/transferqueue/Producer.java rename to core-java-concurrency/src/main/java/com/baeldung/transferqueue/Producer.java index c7df7c410a..b73cf5ac19 100644 --- a/core-java/src/main/java/com/baeldung/transferqueue/Producer.java +++ b/core-java-concurrency/src/main/java/com/baeldung/transferqueue/Producer.java @@ -12,10 +12,10 @@ public class Producer implements Runnable { private final TransferQueue transferQueue; private final String name; - private final Integer numberOfMessagesToProduce; - public final AtomicInteger numberOfProducedMessages = new AtomicInteger(); + final Integer numberOfMessagesToProduce; + final AtomicInteger numberOfProducedMessages = new AtomicInteger(); - public Producer(TransferQueue transferQueue, String name, Integer numberOfMessagesToProduce) { + Producer(TransferQueue transferQueue, String name, Integer numberOfMessagesToProduce) { this.transferQueue = transferQueue; this.name = name; this.numberOfMessagesToProduce = numberOfMessagesToProduce; diff --git a/core-java-concurrency/src/main/java/log4j.properties b/core-java-concurrency/src/main/java/log4j.properties new file mode 100644 index 0000000000..5fe42d854c --- /dev/null +++ b/core-java-concurrency/src/main/java/log4j.properties @@ -0,0 +1,9 @@ +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n diff --git a/couchbase-sdk/src/main/resources/logback.xml b/core-java-concurrency/src/main/resources/logback.xml similarity index 100% rename from couchbase-sdk/src/main/resources/logback.xml rename to core-java-concurrency/src/main/resources/logback.xml diff --git a/core-java/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java similarity index 82% rename from core-java/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java rename to core-java-concurrency/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java index 0c3a13d176..45d2ec68e4 100644 --- a/core-java/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/completablefuture/CompletableFutureLongRunningUnitTest.java @@ -4,7 +4,11 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.*; +import java.util.concurrent.CancellationException; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -15,7 +19,6 @@ public class CompletableFutureLongRunningUnitTest { private static final Logger LOG = LoggerFactory.getLogger(CompletableFutureLongRunningUnitTest.class); - @Test public void whenRunningCompletableFutureAsynchronously_thenGetMethodWaitsForResult() throws InterruptedException, ExecutionException { Future completableFuture = calculateAsync(); @@ -27,11 +30,12 @@ public class CompletableFutureLongRunningUnitTest { private Future calculateAsync() throws InterruptedException { CompletableFuture completableFuture = new CompletableFuture<>(); - Executors.newCachedThreadPool().submit(() -> { - Thread.sleep(500); - completableFuture.complete("Hello"); - return null; - }); + Executors.newCachedThreadPool() + .submit(() -> { + Thread.sleep(500); + completableFuture.complete("Hello"); + return null; + }); return completableFuture; } @@ -47,11 +51,12 @@ public class CompletableFutureLongRunningUnitTest { private Future calculateAsyncWithCancellation() throws InterruptedException { CompletableFuture completableFuture = new CompletableFuture<>(); - Executors.newCachedThreadPool().submit(() -> { - Thread.sleep(500); - completableFuture.cancel(false); - return null; - }); + Executors.newCachedThreadPool() + .submit(() -> { + Thread.sleep(500); + completableFuture.cancel(false); + return null; + }); return completableFuture; } @@ -98,21 +103,24 @@ public class CompletableFutureLongRunningUnitTest { @Test public void whenUsingThenCompose_thenFuturesExecuteSequentially() throws ExecutionException, InterruptedException { - CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> "Hello").thenCompose(s -> CompletableFuture.supplyAsync(() -> s + " World")); + CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> "Hello") + .thenCompose(s -> CompletableFuture.supplyAsync(() -> s + " World")); assertEquals("Hello World", completableFuture.get()); } @Test public void whenUsingThenCombine_thenWaitForExecutionOfBothFutures() throws ExecutionException, InterruptedException { - CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> "Hello").thenCombine(CompletableFuture.supplyAsync(() -> " World"), (s1, s2) -> s1 + s2); + CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> "Hello") + .thenCombine(CompletableFuture.supplyAsync(() -> " World"), (s1, s2) -> s1 + s2); assertEquals("Hello World", completableFuture.get()); } @Test public void whenUsingThenAcceptBoth_thenWaitForExecutionOfBothFutures() throws ExecutionException, InterruptedException { - CompletableFuture.supplyAsync(() -> "Hello").thenAcceptBoth(CompletableFuture.supplyAsync(() -> " World"), (s1, s2) -> LOG.debug(s1 + s2)); + CompletableFuture.supplyAsync(() -> "Hello") + .thenAcceptBoth(CompletableFuture.supplyAsync(() -> " World"), (s1, s2) -> LOG.debug(s1 + s2)); } @Test @@ -131,7 +139,9 @@ public class CompletableFutureLongRunningUnitTest { assertTrue(future2.isDone()); assertTrue(future3.isDone()); - String combined = Stream.of(future1, future2, future3).map(CompletableFuture::join).collect(Collectors.joining(" ")); + String combined = Stream.of(future1, future2, future3) + .map(CompletableFuture::join) + .collect(Collectors.joining(" ")); assertEquals("Hello Beautiful World", combined); } @@ -147,7 +157,8 @@ public class CompletableFutureLongRunningUnitTest { throw new RuntimeException("Computation error!"); } return "Hello, " + name; - }).handle((s, t) -> s != null ? s : "Hello, Stranger!"); + }) + .handle((s, t) -> s != null ? s : "Hello, Stranger!"); assertEquals("Hello, Stranger!", completableFuture.get()); } diff --git a/core-java/src/test/java/com/baeldung/concurrent/accumulator/LongAccumulatorUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/accumulator/LongAccumulatorUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/accumulator/LongAccumulatorUnitTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/accumulator/LongAccumulatorUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/concurrent/adder/LongAdderUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/adder/LongAdderUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/adder/LongAdderUnitTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/adder/LongAdderUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterTest.java diff --git a/core-java/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/callable/FactorialTaskManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/callable/FactorialTaskManualTest.java new file mode 100644 index 0000000000..c55e04af94 --- /dev/null +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/callable/FactorialTaskManualTest.java @@ -0,0 +1,48 @@ +package com.baeldung.concurrent.callable; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import static junit.framework.Assert.assertEquals; + +public class FactorialTaskManualTest { + + private ExecutorService executorService; + + @Before + public void setup(){ + executorService = Executors.newSingleThreadExecutor(); + } + + @Test + public void whenTaskSubmitted_ThenFutureResultObtained() throws ExecutionException, InterruptedException { + FactorialTask task = new FactorialTask(5); + Future future= executorService.submit(task); + assertEquals(120,future.get().intValue()); + } + + @Test(expected = ExecutionException.class) + public void whenException_ThenCallableThrowsIt() throws ExecutionException, InterruptedException { + FactorialTask task = new FactorialTask(-5); + Future future= executorService.submit(task); + Integer result=future.get().intValue(); + } + + @Test + public void whenException_ThenCallableDoesntThrowsItIfGetIsNotCalled(){ + FactorialTask task = new FactorialTask(-5); + Future future= executorService.submit(task); + assertEquals(false,future.isDone()); + } + + @After + public void cleanup(){ + executorService.shutdown(); + } +} diff --git a/core-java/src/test/java/com/baeldung/concurrent/copyonwrite/CopyOnWriteArrayListUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/copyonwrite/CopyOnWriteArrayListUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/copyonwrite/CopyOnWriteArrayListUnitTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/copyonwrite/CopyOnWriteArrayListUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchExampleIntegrationTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchExampleIntegrationTest.java similarity index 91% rename from core-java/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchExampleIntegrationTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchExampleIntegrationTest.java index fc343e4cee..d49a8b8590 100644 --- a/core-java/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchExampleIntegrationTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/countdownlatch/CountdownLatchExampleIntegrationTest.java @@ -18,7 +18,9 @@ public class CountdownLatchExampleIntegrationTest { // Given List outputScraper = Collections.synchronizedList(new ArrayList<>()); CountDownLatch countDownLatch = new CountDownLatch(5); - List workers = Stream.generate(() -> new Thread(new Worker(outputScraper, countDownLatch))).limit(5).collect(toList()); + List workers = Stream.generate(() -> new Thread(new Worker(outputScraper, countDownLatch))) + .limit(5) + .collect(toList()); // When workers.forEach(Thread::start); @@ -26,7 +28,6 @@ public class CountdownLatchExampleIntegrationTest { outputScraper.add("Latch released"); // Then - outputScraper.forEach(Object::toString); assertThat(outputScraper).containsExactly("Counted down", "Counted down", "Counted down", "Counted down", "Counted down", "Latch released"); } @@ -35,7 +36,9 @@ public class CountdownLatchExampleIntegrationTest { // Given List outputScraper = Collections.synchronizedList(new ArrayList<>()); CountDownLatch countDownLatch = new CountDownLatch(5); - List workers = Stream.generate(() -> new Thread(new BrokenWorker(outputScraper, countDownLatch))).limit(5).collect(toList()); + List workers = Stream.generate(() -> new Thread(new BrokenWorker(outputScraper, countDownLatch))) + .limit(5) + .collect(toList()); // When workers.forEach(Thread::start); @@ -63,7 +66,6 @@ public class CountdownLatchExampleIntegrationTest { outputScraper.add("Workers complete"); // Then - outputScraper.forEach(Object::toString); assertThat(outputScraper).containsExactly("Workers ready", "Counted down", "Counted down", "Counted down", "Counted down", "Counted down", "Workers complete"); } diff --git a/core-java/src/test/java/com/baeldung/concurrent/delayqueue/DelayQueueIntegrationTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/delayqueue/DelayQueueIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/delayqueue/DelayQueueIntegrationTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/delayqueue/DelayQueueIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/concurrent/future/FactorialSquareCalculatorUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/future/FactorialSquareCalculatorUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/future/FactorialSquareCalculatorUnitTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/future/FactorialSquareCalculatorUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/concurrent/future/SquareCalculatorIntegrationTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/future/SquareCalculatorIntegrationTest.java similarity index 99% rename from core-java/src/test/java/com/baeldung/concurrent/future/SquareCalculatorIntegrationTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/future/SquareCalculatorIntegrationTest.java index 5f8b05a974..c2513f38c1 100644 --- a/core-java/src/test/java/com/baeldung/concurrent/future/SquareCalculatorIntegrationTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/future/SquareCalculatorIntegrationTest.java @@ -22,7 +22,6 @@ public class SquareCalculatorIntegrationTest { private static final Logger LOG = LoggerFactory.getLogger(SquareCalculatorIntegrationTest.class); - @Rule public TestName name = new TestName(); diff --git a/core-java/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java diff --git a/core-java/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java similarity index 94% rename from core-java/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java index 3014ae38b2..f3ced219f7 100644 --- a/core-java/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java @@ -49,9 +49,7 @@ public class SynchronizedHashMapWithRWLockManualTest { private void executeReaderThreads(SynchronizedHashMapWithRWLock object, int threadCount, ExecutorService service) { for (int i = 0; i < threadCount; i++) - service.execute(() -> { - object.get("key" + threadCount); - }); + service.execute(() -> object.get("key" + threadCount)); } } diff --git a/core-java/src/test/java/com/baeldung/concurrent/phaser/PhaserUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/phaser/PhaserUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/phaser/PhaserUnitTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/phaser/PhaserUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/concurrent/priorityblockingqueue/PriorityBlockingQueueIntegrationTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/priorityblockingqueue/PriorityBlockingQueueIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/priorityblockingqueue/PriorityBlockingQueueIntegrationTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/priorityblockingqueue/PriorityBlockingQueueIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/semaphores/SemaphoresManualTest.java diff --git a/core-java/src/test/java/com/baeldung/concurrent/skiplist/ConcurrentSkipListSetIntegrationTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/skiplist/ConcurrentSkipListSetIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/skiplist/ConcurrentSkipListSetIntegrationTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/skiplist/ConcurrentSkipListSetIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSychronizedBlockTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSychronizedBlockTest.java similarity index 90% rename from core-java/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSychronizedBlockTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSychronizedBlockTest.java index 1f8e8d681a..9c56fa64be 100644 --- a/core-java/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSychronizedBlockTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSychronizedBlockTest.java @@ -18,7 +18,7 @@ public class BaeldungSychronizedBlockTest { IntStream.range(0, 1000) .forEach(count -> service.submit(synchronizedBlocks::performSynchronisedTask)); - service.awaitTermination(100, TimeUnit.MILLISECONDS); + service.awaitTermination(500, TimeUnit.MILLISECONDS); assertEquals(1000, synchronizedBlocks.getCount()); } @@ -29,7 +29,7 @@ public class BaeldungSychronizedBlockTest { IntStream.range(0, 1000) .forEach(count -> service.submit(BaeldungSynchronizedBlocks::performStaticSyncTask)); - service.awaitTermination(100, TimeUnit.MILLISECONDS); + service.awaitTermination(500, TimeUnit.MILLISECONDS); assertEquals(1000, BaeldungSynchronizedBlocks.getStaticCount()); } diff --git a/core-java/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizeMethodsTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizeMethodsTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizeMethodsTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/synchronize/BaeldungSynchronizeMethodsTest.java diff --git a/core-java/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java diff --git a/core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapAggregateStatusManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapAggregateStatusManualTest.java similarity index 94% rename from core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapAggregateStatusManualTest.java rename to core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapAggregateStatusManualTest.java index ec865f71c4..2971f14c41 100644 --- a/core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapAggregateStatusManualTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapAggregateStatusManualTest.java @@ -47,7 +47,8 @@ public class ConcurrentMapAggregateStatusManualTest { executorService.awaitTermination(1, TimeUnit.MINUTES); for (int i = 1; i <= MAX_SIZE; i++) { - assertEquals("map size should be consistently reliable", i, mapSizes.get(i - 1).intValue()); + assertEquals("map size should be consistently reliable", i, mapSizes.get(i - 1) + .intValue()); } assertEquals(MAX_SIZE, concurrentMap.size()); } @@ -69,7 +70,8 @@ public class ConcurrentMapAggregateStatusManualTest { executorService.shutdown(); executorService.awaitTermination(1, TimeUnit.MINUTES); - assertNotEquals("map size collected with concurrent updates not reliable", MAX_SIZE, mapSizes.get(MAX_SIZE - 1).intValue()); + assertNotEquals("map size collected with concurrent updates not reliable", MAX_SIZE, mapSizes.get(MAX_SIZE - 1) + .intValue()); assertEquals(MAX_SIZE, concurrentMap.size()); } diff --git a/core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapNullKeyValueManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapNullKeyValueManualTest.java similarity index 99% rename from core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapNullKeyValueManualTest.java rename to core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapNullKeyValueManualTest.java index 33e3326427..cbac6e7f4c 100644 --- a/core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapNullKeyValueManualTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapNullKeyValueManualTest.java @@ -12,7 +12,7 @@ import static org.junit.Assert.assertNull; public class ConcurrentMapNullKeyValueManualTest { - ConcurrentMap concurrentMap; + private ConcurrentMap concurrentMap; @Before public void setup() { diff --git a/core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapPerformanceManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapPerformanceManualTest.java similarity index 62% rename from core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapPerformanceManualTest.java rename to core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapPerformanceManualTest.java index 5c1612ca60..3f36d0df5d 100644 --- a/core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapPerformanceManualTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapPerformanceManualTest.java @@ -1,27 +1,31 @@ package com.baeldung.java.concurrentmap; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.util.Collections; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; -import java.util.concurrent.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import org.junit.Test; public class ConcurrentMapPerformanceManualTest { @Test public void givenMaps_whenGetPut500KTimes_thenConcurrentMapFaster() throws Exception { - Map hashtable = new Hashtable<>(); - Map synchronizedHashMap = Collections.synchronizedMap(new HashMap<>()); - Map concurrentHashMap = new ConcurrentHashMap<>(); + final Map hashtable = new Hashtable<>(); + final Map synchronizedHashMap = Collections.synchronizedMap(new HashMap<>()); + final Map concurrentHashMap = new ConcurrentHashMap<>(); - long hashtableAvgRuntime = timeElapseForGetPut(hashtable); - long syncHashMapAvgRuntime = timeElapseForGetPut(synchronizedHashMap); - long concurrentHashMapAvgRuntime = timeElapseForGetPut(concurrentHashMap); + final long hashtableAvgRuntime = timeElapseForGetPut(hashtable); + final long syncHashMapAvgRuntime = timeElapseForGetPut(synchronizedHashMap); + final long concurrentHashMapAvgRuntime = timeElapseForGetPut(concurrentHashMap); System.out.println(String.format("Hashtable: %s, syncHashMap: %s, ConcurrentHashMap: %s", hashtableAvgRuntime, syncHashMapAvgRuntime, concurrentHashMapAvgRuntime)); @@ -31,13 +35,13 @@ public class ConcurrentMapPerformanceManualTest { } private long timeElapseForGetPut(Map map) throws InterruptedException { - ExecutorService executorService = Executors.newFixedThreadPool(4); - long startTime = System.nanoTime(); + final ExecutorService executorService = Executors.newFixedThreadPool(4); + final long startTime = System.nanoTime(); for (int i = 0; i < 4; i++) { executorService.execute(() -> { for (int j = 0; j < 500_000; j++) { - int value = ThreadLocalRandom.current().nextInt(10000); - String key = String.valueOf(value); + final int value = ThreadLocalRandom.current().nextInt(10000); + final String key = String.valueOf(value); map.put(key, value); map.get(key); } @@ -56,11 +60,11 @@ public class ConcurrentMapPerformanceManualTest { return 1; } } - int executeTimes = 5000; + final int executeTimes = 5000; - Map mapOfSameHash = new ConcurrentHashMap<>(); + final Map mapOfSameHash = new ConcurrentHashMap<>(); ExecutorService executorService = Executors.newFixedThreadPool(2); - long sameHashStartTime = System.currentTimeMillis(); + final long sameHashStartTime = System.currentTimeMillis(); for (int i = 0; i < 2; i++) { executorService.execute(() -> { for (int j = 0; j < executeTimes; j++) { @@ -71,10 +75,10 @@ public class ConcurrentMapPerformanceManualTest { executorService.shutdown(); executorService.awaitTermination(5, TimeUnit.SECONDS); - long mapOfSameHashDuration = System.currentTimeMillis() - sameHashStartTime; - Map mapOfDefaultHash = new ConcurrentHashMap<>(); + final long mapOfSameHashDuration = System.currentTimeMillis() - sameHashStartTime; + final Map mapOfDefaultHash = new ConcurrentHashMap<>(); executorService = Executors.newFixedThreadPool(2); - long defaultHashStartTime = System.currentTimeMillis(); + final long defaultHashStartTime = System.currentTimeMillis(); for (int i = 0; i < 2; i++) { executorService.execute(() -> { for (int j = 0; j < executeTimes; j++) { @@ -85,11 +89,11 @@ public class ConcurrentMapPerformanceManualTest { executorService.shutdown(); executorService.awaitTermination(5, TimeUnit.SECONDS); - long mapOfDefaultHashDuration = System.currentTimeMillis() - defaultHashStartTime; + final long mapOfDefaultHashDuration = System.currentTimeMillis() - defaultHashStartTime; assertEquals(executeTimes * 2, mapOfDefaultHash.size()); assertEquals(executeTimes * 2, mapOfSameHash.size()); System.out.println(String.format("same-hash: %s, default-hash: %s", mapOfSameHashDuration, mapOfDefaultHashDuration)); - assertTrue("same hashCode() should greatly degrade performance", mapOfSameHashDuration > mapOfDefaultHashDuration * 10); + assertTrue("same hashCode() should greatly degrade performance", mapOfSameHashDuration > (mapOfDefaultHashDuration * 10)); } } diff --git a/core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurrentNavigableMapManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentNavigableMapManualTest.java similarity index 80% rename from core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurrentNavigableMapManualTest.java rename to core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentNavigableMapManualTest.java index 768c31ee80..c0753db513 100644 --- a/core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurrentNavigableMapManualTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentNavigableMapManualTest.java @@ -18,7 +18,7 @@ public class ConcurrentNavigableMapManualTest { public void givenSkipListMap_whenAccessInMultiThreads_thenOrderingStable() throws InterruptedException { NavigableMap skipListMap = new ConcurrentSkipListMap<>(); - updateMapConcurrently(skipListMap, 4); + updateMapConcurrently(skipListMap); Iterator skipListIter = skipListMap.keySet().iterator(); int previous = skipListIter.next(); @@ -28,9 +28,9 @@ public class ConcurrentNavigableMapManualTest { } } - private void updateMapConcurrently(NavigableMap navigableMap, int concurrencyLevel) throws InterruptedException { - ExecutorService executorService = Executors.newFixedThreadPool(concurrencyLevel); - for (int i = 0; i < concurrencyLevel; i++) { + private void updateMapConcurrently(NavigableMap navigableMap) throws InterruptedException { + ExecutorService executorService = Executors.newFixedThreadPool(4); + for (int i = 0; i < 4; i++) { executorService.execute(() -> { ThreadLocalRandom random = ThreadLocalRandom.current(); for (int j = 0; j < 10000; j++) { @@ -45,26 +45,26 @@ public class ConcurrentNavigableMapManualTest { @Test public void givenSkipListMap_whenNavConcurrently_thenCountCorrect() throws InterruptedException { NavigableMap skipListMap = new ConcurrentSkipListMap<>(); - int count = countMapElementByPollingFirstEntry(skipListMap, 10000, 4); + int count = countMapElementByPollingFirstEntry(skipListMap); assertEquals(10000 * 4, count); } @Test public void givenTreeMap_whenNavConcurrently_thenCountError() throws InterruptedException { NavigableMap treeMap = new TreeMap<>(); - int count = countMapElementByPollingFirstEntry(treeMap, 10000, 4); + int count = countMapElementByPollingFirstEntry(treeMap); assertNotEquals(10000 * 4, count); } - private int countMapElementByPollingFirstEntry(NavigableMap navigableMap, int elementCount, int concurrencyLevel) throws InterruptedException { - for (int i = 0; i < elementCount * concurrencyLevel; i++) { + private int countMapElementByPollingFirstEntry(NavigableMap navigableMap) throws InterruptedException { + for (int i = 0; i < 10000 * 4; i++) { navigableMap.put(i, i); } AtomicInteger counter = new AtomicInteger(0); - ExecutorService executorService = Executors.newFixedThreadPool(concurrencyLevel); - for (int j = 0; j < concurrencyLevel; j++) { + ExecutorService executorService = Executors.newFixedThreadPool(4); + for (int j = 0; j < 4; j++) { executorService.execute(() -> { - for (int i = 0; i < elementCount; i++) { + for (int i = 0; i < 10000; i++) { if (navigableMap.pollFirstEntry() != null) { counter.incrementAndGet(); } diff --git a/core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurretMapMemoryConsistencyManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurretMapMemoryConsistencyManualTest.java similarity index 76% rename from core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurretMapMemoryConsistencyManualTest.java rename to core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurretMapMemoryConsistencyManualTest.java index 43cbb2d293..e4fac66fe3 100644 --- a/core-java/src/test/java/com/baeldung/java/concurrentmap/ConcurretMapMemoryConsistencyManualTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurretMapMemoryConsistencyManualTest.java @@ -16,8 +16,12 @@ public class ConcurretMapMemoryConsistencyManualTest { public void givenConcurrentMap_whenSumParallel_thenCorrect() throws Exception { Map map = new ConcurrentHashMap<>(); List sumList = parallelSum100(map, 1000); - assertEquals(1, sumList.stream().distinct().count()); - long wrongResultCount = sumList.stream().filter(num -> num != 100).count(); + assertEquals(1, sumList.stream() + .distinct() + .count()); + long wrongResultCount = sumList.stream() + .filter(num -> num != 100) + .count(); assertEquals(0, wrongResultCount); } @@ -25,8 +29,12 @@ public class ConcurretMapMemoryConsistencyManualTest { public void givenHashtable_whenSumParallel_thenCorrect() throws Exception { Map map = new Hashtable<>(); List sumList = parallelSum100(map, 1000); - assertEquals(1, sumList.stream().distinct().count()); - long wrongResultCount = sumList.stream().filter(num -> num != 100).count(); + assertEquals(1, sumList.stream() + .distinct() + .count()); + long wrongResultCount = sumList.stream() + .filter(num -> num != 100) + .count(); assertEquals(0, wrongResultCount); } @@ -34,8 +42,12 @@ public class ConcurretMapMemoryConsistencyManualTest { public void givenHashMap_whenSumParallel_thenError() throws Exception { Map map = new HashMap<>(); List sumList = parallelSum100(map, 100); - assertNotEquals(1, sumList.stream().distinct().count()); - long wrongResultCount = sumList.stream().filter(num -> num != 100).count(); + assertNotEquals(1, sumList.stream() + .distinct() + .count()); + long wrongResultCount = sumList.stream() + .filter(num -> num != 100) + .count(); assertTrue(wrongResultCount > 0); } diff --git a/core-java/src/test/java/com/baeldung/java/concurrentmodification/ConcurrentModificationUnitTest.java b/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmodification/ConcurrentModificationUnitTest.java similarity index 89% rename from core-java/src/test/java/com/baeldung/java/concurrentmodification/ConcurrentModificationUnitTest.java rename to core-java-concurrency/src/test/java/com/baeldung/java/concurrentmodification/ConcurrentModificationUnitTest.java index f7a7bd5fe0..9cdac72d59 100644 --- a/core-java/src/test/java/com/baeldung/java/concurrentmodification/ConcurrentModificationUnitTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmodification/ConcurrentModificationUnitTest.java @@ -2,7 +2,6 @@ package com.baeldung.java.concurrentmodification; import org.junit.Test; -import java.util.ArrayList; import java.util.Collection; import java.util.ConcurrentModificationException; import java.util.Iterator; @@ -28,9 +27,9 @@ public class ConcurrentModificationUnitTest { List integers = newArrayList(1, 2, 3); - for (Iterator iterator = integers.iterator(); iterator.hasNext();) { + for (Iterator iterator = integers.iterator(); iterator.hasNext(); ) { Integer integer = iterator.next(); - if(integer == 2) { + if (integer == 2) { iterator.remove(); } } @@ -45,7 +44,7 @@ public class ConcurrentModificationUnitTest { List toRemove = newArrayList(); for (Integer integer : integers) { - if(integer == 2) { + if (integer == 2) { toRemove.add(integer); } } @@ -69,10 +68,10 @@ public class ConcurrentModificationUnitTest { Collection integers = newArrayList(1, 2, 3); List collected = integers - .stream() - .filter(i -> i != 2) - .map(Object::toString) - .collect(toList()); + .stream() + .filter(i -> i != 2) + .map(Object::toString) + .collect(toList()); assertThat(collected).containsExactly("1", "3"); } diff --git a/core-java/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java b/core-java-concurrency/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java similarity index 98% rename from core-java/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java rename to core-java-concurrency/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java index 41eb864fd9..a1f5b6f1e2 100644 --- a/core-java/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java +++ b/core-java-concurrency/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java @@ -72,7 +72,7 @@ public class Java8ExecutorServiceIntegrationTest { assertTrue(threadPoolExecutor.isShutdown()); assertFalse(notExecutedTasks.isEmpty()); - assertTrue(notExecutedTasks.size() > 0 && notExecutedTasks.size() < 98); + assertTrue(notExecutedTasks.size() < 98); } private List smartShutdown(ExecutorService executorService) { diff --git a/core-java/src/test/java/com/baeldung/synchronousqueue/SynchronousQueueIntegrationTest.java b/core-java-concurrency/src/test/java/com/baeldung/synchronousqueue/SynchronousQueueIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/synchronousqueue/SynchronousQueueIntegrationTest.java rename to core-java-concurrency/src/test/java/com/baeldung/synchronousqueue/SynchronousQueueIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/threadlocal/ThreadLocalIntegrationTest.java b/core-java-concurrency/src/test/java/com/baeldung/threadlocal/ThreadLocalIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/threadlocal/ThreadLocalIntegrationTest.java rename to core-java-concurrency/src/test/java/com/baeldung/threadlocal/ThreadLocalIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/threadpool/CoreThreadPoolIntegrationTest.java b/core-java-concurrency/src/test/java/com/baeldung/threadpool/CoreThreadPoolIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/threadpool/CoreThreadPoolIntegrationTest.java rename to core-java-concurrency/src/test/java/com/baeldung/threadpool/CoreThreadPoolIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/threadpool/GuavaThreadPoolIntegrationTest.java b/core-java-concurrency/src/test/java/com/baeldung/threadpool/GuavaThreadPoolIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/threadpool/GuavaThreadPoolIntegrationTest.java rename to core-java-concurrency/src/test/java/com/baeldung/threadpool/GuavaThreadPoolIntegrationTest.java diff --git a/core-java/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java b/core-java-concurrency/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java rename to core-java-concurrency/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java diff --git a/core-java/src/test/java/org/baeldung/java/streams/ThreadPoolInParallelStreamIntegrationTest.java b/core-java-concurrency/src/test/java/org/baeldung/java/streams/ThreadPoolInParallelStreamIntegrationTest.java similarity index 88% rename from core-java/src/test/java/org/baeldung/java/streams/ThreadPoolInParallelStreamIntegrationTest.java rename to core-java-concurrency/src/test/java/org/baeldung/java/streams/ThreadPoolInParallelStreamIntegrationTest.java index 42e85fc586..502672dea1 100644 --- a/core-java/src/test/java/org/baeldung/java/streams/ThreadPoolInParallelStreamIntegrationTest.java +++ b/core-java-concurrency/src/test/java/org/baeldung/java/streams/ThreadPoolInParallelStreamIntegrationTest.java @@ -23,7 +23,10 @@ public class ThreadPoolInParallelStreamIntegrationTest { List aList = LongStream.rangeClosed(firstNum, lastNum).boxed().collect(Collectors.toList()); ForkJoinPool customThreadPool = new ForkJoinPool(4); - long actualTotal = customThreadPool.submit(() -> aList.parallelStream().reduce(0L, Long::sum)).get(); + long actualTotal = customThreadPool + .submit(() -> aList.parallelStream() + .reduce(0L, Long::sum)) + .get(); assertEquals((lastNum + firstNum) * lastNum / 2, actualTotal); } diff --git a/core-java-concurrency/src/test/resources/.gitignore b/core-java-concurrency/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/core-java-concurrency/src/test/resources/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/core-java/README.md b/core-java/README.md index dabf6f39be..a251de1daa 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -22,22 +22,11 @@ - [Guide to the Java ArrayList](http://www.baeldung.com/java-arraylist) - [Guide to Java Reflection](http://www.baeldung.com/java-reflection) - [A Guide to Java Sockets](http://www.baeldung.com/a-guide-to-java-sockets) -- [Java 8 Collectors](http://www.baeldung.com/java-8-collectors) -- [Guide To CompletableFuture](http://www.baeldung.com/java-completablefuture) -- [Guide to Java 8’s Functional Interfaces](http://www.baeldung.com/java-8-functional-interfaces) - [Convert char to String in Java](http://www.baeldung.com/java-convert-char-to-string) - [Random List Element](http://www.baeldung.com/java-random-list-element) - [Convert String to int or Integer in Java](http://www.baeldung.com/java-convert-string-to-int-or-integer) -- [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) - [Java – Directory Size](http://www.baeldung.com/java-folder-size) - [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources) -- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial) -- [Java 8 New Features](http://www.baeldung.com/java-8-new-features) -- [Lambda Expressions and Functional Interfaces: Tips and Best Practices](http://www.baeldung.com/java-8-lambda-expressions-tips) -- [The Double Colon Operator in Java 8](http://www.baeldung.com/java-8-double-colon-operator) -- [Java 8 Streams Advanced](http://www.baeldung.com/java-8-streams) -- [Introduction to Thread Pools in Java](http://www.baeldung.com/thread-pool-java-and-guava) -- [Introduction to Java 8 Streams](http://www.baeldung.com/java-8-streams-introduction) - [Guide to the Fork/Join Framework in Java](http://www.baeldung.com/java-fork-join) - [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java) - [How to Convert String to different data types in Java](http://www.baeldung.com/java-string-conversions) @@ -57,41 +46,23 @@ - [The Basics of Java Generics](http://www.baeldung.com/java-generics) - [The Traveling Salesman Problem in Java](http://www.baeldung.com/java-simulated-annealing-for-traveling-salesman) - [How to Create an Executable JAR with Maven](http://www.baeldung.com/executable-jar-with-maven) -- [Guide to java.util.concurrent.Future](http://www.baeldung.com/java-future) -- [Guide to java.util.concurrent.BlockingQueue](http://www.baeldung.com/java-blocking-queue) -- [Guide to CountDownLatch in Java](http://www.baeldung.com/java-countdown-latch) - [How to Design a Genetic Algorithm in Java](http://www.baeldung.com/java-genetic-algorithm) -- [A Guide to ConcurrentMap](http://www.baeldung.com/java-concurrent-map) -- [Guide to PriorityBlockingQueue in Java](http://www.baeldung.com/java-priority-blocking-queue) -- [Guide to Java 8 groupingBy Collector](http://www.baeldung.com/java-groupingby-collector) -- [Avoiding the ConcurrentModificationException in Java](http://www.baeldung.com/java-concurrentmodificationexception) - [Guide to WeakHashMap in Java](http://www.baeldung.com/java-weakhashmap) -- [Strategy Design Pattern in Java 8](http://www.baeldung.com/java-strategy-pattern) -- [Java 8 and Infinite Streams](http://www.baeldung.com/java-inifinite-streams) -- [Custom Thread Pools In Java 8 Parallel Streams](http://www.baeldung.com/java-8-parallel-streams-custom-threadpool) -- [String Operations with Java Streams](http://www.baeldung.com/java-stream-operations-on-strings) - [Spring Security – Cache Control Headers](http://www.baeldung.com/spring-security-cache-control-headers) - [Basic Introduction to JMX](http://www.baeldung.com/java-management-extensions) - [AWS Lambda With Java](http://www.baeldung.com/java-aws-lambda) - [Introduction to Nashorn](http://www.baeldung.com/java-nashorn) -- [Exceptions in Java 8 Lambda Expressions](http://www.baeldung.com/java-lambda-exceptions) - [Guide to the Guava BiMap](http://www.baeldung.com/guava-bimap) - [Iterable to Stream in Java](http://www.baeldung.com/java-iterable-to-stream) -- [Java 8 Stream findFirst() vs. findAny()](http://www.baeldung.com/java-stream-findfirst-vs-findany) - [Chained Exceptions in Java](http://www.baeldung.com/java-chained-exceptions) - [The Java HashMap Under the Hood](http://www.baeldung.com/java-hashmap) - [A Guide to LinkedHashMap in Java](http://www.baeldung.com/java-linked-hashmap) - [A Guide to TreeMap in Java](http://www.baeldung.com/java-treemap) - [A Quick JUnit vs TestNG Comparison](http://www.baeldung.com/junit-vs-testng) -- [Finding Max/Min of a List or Collection](http://www.baeldung.com/java-collection-min-max) -- [Guide to java.util.concurrent.Locks](http://www.baeldung.com/java-concurrent-locks) - [Java Primitive Conversions](http://www.baeldung.com/java-primitive-conversions) - [Java Money and the Currency API](http://www.baeldung.com/java-money-and-currency) -- [Guide to Java 8 Comparator.comparing()](http://www.baeldung.com/java-8-comparator-comparing) -- [Avoiding ConcurrentModificationException when iterating and removing](http://www.baeldung.com/avoiding-concurrentmodificationexception-when-iterating-and-removing) - [Removing all nulls from a List in Java](http://www.baeldung.com/java-remove-nulls-from-list) - [Removing all duplicates from a List in Java](http://www.baeldung.com/java-remove-duplicates-from-list) -- [An Introduction to ThreadLocal in Java](http://www.baeldung.com/java-threadlocal) - [Using Math.pow in Java](http://www.baeldung.com/java-math-pow) - [Converting Strings to Enums in Java](http://www.baeldung.com/java-string-to-enum) - [Flattening Nested Collections in Java](http://www.baeldung.com/java-flatten-nested-collections) @@ -101,20 +72,12 @@ - [HashSet and TreeSet Comparison](http://www.baeldung.com/java-hashset-vs-treeset) - [How to Perform a Simple HTTP Request in Java](http://www.baeldung.com/java-http-request) - [Call Methods at Runtime Using Java Reflection](http://www.baeldung.com/java-method-reflection) -- [Guide to DelayQueue](http://www.baeldung.com/java-delay-queue) - [Guide to UUID in JAVA](http://www.baeldung.com/guide-to-uuid-in-java) - [Comparing getPath(), getAbsolutePath(), and getCanonicalPath() in Java](http://www.baeldung.com/java-path) - [How to Add a Single Element to a Stream](http://www.baeldung.com/java-stream-append-prepend) - [Iterating Over Enum Values in Java](http://www.baeldung.com/java-enum-iteration) -- [A Guide to Java SynchronousQueue](http://www.baeldung.com/java-synchronous-queue) -- [Guide to the Java TransferQueue](http://www.baeldung.com/java-transfer-queue) - [Kotlin Java Interoperability](http://www.baeldung.com/kotlin-java-interoperability) -- [Guide to the ConcurrentSkipListMap](http://www.baeldung.com/java-concurrent-skip-list-map) -- [Difference Between Wait and Sleep in Java](http://www.baeldung.com/java-wait-and-sleep) -- [LongAdder and LongAccumulator in Java](http://www.baeldung.com/java-longadder-and-longaccumulator) - [Using Java MappedByteBuffer](http://www.baeldung.com/java-mapped-byte-buffer) -- [The Dining Philosophers Problem in Java](http://www.baeldung.com/java-dining-philoshophers) -- [The Difference Between map() and flatMap()](http://www.baeldung.com/java-difference-map-and-flatmap) - [How to Round a Number to N Decimal Places in Java](http://www.baeldung.com/java-round-decimal-number) - [Changing Annotation Parameters At Runtime](http://www.baeldung.com/java-reflection-change-annotation-params) - [How to Find all Getters Returning Null](http://www.baeldung.com/java-getters-returning-null) @@ -122,22 +85,25 @@ - [Changing the Order in a Sum Operation Can Produce Different Results?](http://www.baeldung.com/java-floating-point-sum-order) - [How to Get a Name of a Method Being Executed?](http://www.baeldung.com/java-name-of-executing-method) - [Iterate over a Map in Java](http://www.baeldung.com/java-iterate-map) -- [CyclicBarrier in Java](http://www.baeldung.com/java-cyclic-barrier) - [Dynamic Proxies in Java](http://www.baeldung.com/java-dynamic-proxies) - [How to Copy an Array in Java](http://www.baeldung.com/java-array-copy) - [Introduction to JDBC](http://www.baeldung.com/java-jdbc) -- [Guide to CopyOnWriteArrayList](http://www.baeldung.com/java-copy-on-write-arraylist) - [Period and Duration in Java](http://www.baeldung.com/java-period-duration) - [Converting a Stack Trace to a String in Java](http://www.baeldung.com/java-stacktrace-to-string) -- [Guide to the Java Phaser](http://www.baeldung.com/java-phaser) - [Count Occurrences of a Char in a String](http://www.baeldung.com/java-count-chars) - [Java Double Brace Initialization](http://www.baeldung.com/java-double-brace-initialization) - [The StackOverflowError in Java](http://www.baeldung.com/java-stack-overflow-error) - [Split a String in Java](http://www.baeldung.com/java-split-string) - [Introduction to Java Serialization](http://www.baeldung.com/java-serialization) - [How to Remove the Last Character of a String?](http://www.baeldung.com/java-remove-last-character-of-string) -- [Guide to Synchronized Keyword in Java](http://www.baeldung.com/java-synchronized) - [ClassNotFoundException vs NoClassDefFoundError](http://www.baeldung.com/java-classnotfoundexception-and-noclassdeffounderror) - [Guide to UUID in Java](http://www.baeldung.com/java-uuid) -- [How to Get the Last Element of a Stream in Java?](http://www.baeldung.com/java-stream-last-element) - [Guide to Escaping Characters in Java RegExps](http://www.baeldung.com/java-regexp-escape-char) +- [Guide to hashCode() in Java](http://www.baeldung.com/java-hashcode) +- [Collect a Java Stream to an Immutable Collection](http://www.baeldung.com/java-stream-immutable-collection) +- [Difference between URL and URI](http://www.baeldung.com/java-url-vs-uri) +- [Broadcasting and Multicasting in Java](http://www.baeldung.com/java-broadcast-multicast) +- [Converting a List to String in Java](http://www.baeldung.com/java-list-to-string) +- [CharSequence vs. String in Java](http://www.baeldung.com/java-char-sequence-string) +- [Period and Duration in Java](http://www.baeldung.com/java-period-duration) +- [Guide to the Diamond Operator in Java](http://www.baeldung.com/java-diamond-operator) \ No newline at end of file diff --git a/core-java/pom.xml b/core-java/pom.xml index 422965a0ed..bb3958f36c 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -80,7 +80,7 @@
- + log4j log4j 1.2.17 @@ -186,6 +186,36 @@ fscontext ${fscontext.version} + + com.codepoetics + protonpack + ${protonpack.version} + + + one.util + streamex + ${streamex.version} + + + io.vavr + vavr + ${vavr.version} + + + org.openjdk.jmh + jmh-core + 1.19 + + + org.openjdk.jmh + jmh-generator-annprocess + 1.19 + + + org.springframework + spring-web + 4.3.4.RELEASE +
@@ -214,6 +244,7 @@ maven-surefire-plugin + **/*LiveTest.java **/*IntegrationTest.java **/*LongRunningUnitTest.java **/*ManualTest.java @@ -347,6 +378,8 @@ + + @@ -381,12 +414,37 @@ + + org.codehaus.mojo + exec-maven-plugin + + + + run-benchmarks + + none + + exec + + + test + java + + -classpath + + org.openjdk.jmh.Main + .* + + + + + - + 2.8.5 @@ -408,7 +466,10 @@ 1.8.7 1.16.12 4.6-b01 - + 1.13 + 0.6.5 + 0.9.0 + 1.3 4.12 @@ -419,6 +480,5 @@ 3.6.0 2.19.1 - - + \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/designpatterns/adapter/AdapterPatternDriver.java b/core-java/src/main/java/com/baeldung/designpatterns/adapter/AdapterPatternDriver.java index 0d69d0e7ec..79f618d038 100644 --- a/core-java/src/main/java/com/baeldung/designpatterns/adapter/AdapterPatternDriver.java +++ b/core-java/src/main/java/com/baeldung/designpatterns/adapter/AdapterPatternDriver.java @@ -5,9 +5,16 @@ import static com.baeldung.designpatterns.util.LogerUtil.LOG; public class AdapterPatternDriver { public static void main(String args[]) { - LuxuryCarsSpeedAdapter luxuryCars = new LuxuryCarsSpeedAdapterImpl(); - LOG.info("Bugatti Veyron Super Sport's top speed is " + luxuryCars.bugattiVeyronInKMPH() + " Kmph."); - LOG.info("McLaren F1 top speed is " + luxuryCars.mcLarenInKMPH() + " Kmph."); - LOG.info("Aston Martin One-77 top speed is " + luxuryCars.astonMartinInKMPH() + " Kmph."); + Movable bugattiVeyron = new BugattiVeyron(); + MovableAdapter bugattiVeyronAdapter = new MovableAdapterImpl(bugattiVeyron); + LOG.info("Bugatti Veyron Super Sport's top speed is " + bugattiVeyronAdapter.getSpeed() + " Kmph."); + + Movable mcLaren = new McLaren(); + MovableAdapter mcLarenAdapter = new MovableAdapterImpl(mcLaren); + LOG.info("McLaren F1 top speed is " + mcLarenAdapter.getSpeed() + " Kmph."); + + Movable astonMartin = new AstonMartin(); + MovableAdapter astonMartinAdapter = new MovableAdapterImpl(astonMartin); + LOG.info("McLaren F1 top speed is " + astonMartinAdapter.getSpeed() + " Kmph."); } } diff --git a/core-java/src/main/java/com/baeldung/designpatterns/adapter/AstonMartin.java b/core-java/src/main/java/com/baeldung/designpatterns/adapter/AstonMartin.java new file mode 100644 index 0000000000..7dd83079a2 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/designpatterns/adapter/AstonMartin.java @@ -0,0 +1,8 @@ +package com.baeldung.designpatterns.adapter; + +public class AstonMartin implements Movable { + @Override + public double getSpeed() { + return 220; + } +} diff --git a/core-java/src/main/java/com/baeldung/designpatterns/adapter/BugattiVeyron.java b/core-java/src/main/java/com/baeldung/designpatterns/adapter/BugattiVeyron.java new file mode 100644 index 0000000000..a249d64b6f --- /dev/null +++ b/core-java/src/main/java/com/baeldung/designpatterns/adapter/BugattiVeyron.java @@ -0,0 +1,8 @@ +package com.baeldung.designpatterns.adapter; + +public class BugattiVeyron implements Movable { + @Override + public double getSpeed() { + return 268; + } +} diff --git a/core-java/src/main/java/com/baeldung/designpatterns/adapter/LuxuryCarsSpeed.java b/core-java/src/main/java/com/baeldung/designpatterns/adapter/LuxuryCarsSpeed.java deleted file mode 100644 index 278329b994..0000000000 --- a/core-java/src/main/java/com/baeldung/designpatterns/adapter/LuxuryCarsSpeed.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.designpatterns.adapter; - -public class LuxuryCarsSpeed { - public double bugattiVeyronInMPH() { - return 268; - } - - public double mcLarenInMPH() { - return 241; - } - - public double astonMartinInMPH() { - return 220; - } -} diff --git a/core-java/src/main/java/com/baeldung/designpatterns/adapter/LuxuryCarsSpeedAdapter.java b/core-java/src/main/java/com/baeldung/designpatterns/adapter/LuxuryCarsSpeedAdapter.java deleted file mode 100644 index 84f7be2729..0000000000 --- a/core-java/src/main/java/com/baeldung/designpatterns/adapter/LuxuryCarsSpeedAdapter.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.designpatterns.adapter; - -public interface LuxuryCarsSpeedAdapter { - public double bugattiVeyronInKMPH(); - public double mcLarenInKMPH(); - public double astonMartinInKMPH(); -} diff --git a/core-java/src/main/java/com/baeldung/designpatterns/adapter/LuxuryCarsSpeedAdapterImpl.java b/core-java/src/main/java/com/baeldung/designpatterns/adapter/LuxuryCarsSpeedAdapterImpl.java deleted file mode 100644 index 2767b78e38..0000000000 --- a/core-java/src/main/java/com/baeldung/designpatterns/adapter/LuxuryCarsSpeedAdapterImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baeldung.designpatterns.adapter; - -public class LuxuryCarsSpeedAdapterImpl extends LuxuryCarsSpeed implements LuxuryCarsSpeedAdapter { - - @Override - public double bugattiVeyronInKMPH() { - double mph = super.bugattiVeyronInMPH(); - return convertMPHtoKMPH(mph); - } - - @Override - public double mcLarenInKMPH() { - double mph = super.mcLarenInMPH(); - return convertMPHtoKMPH(mph); - } - - @Override - public double astonMartinInKMPH() { - double mph = super.astonMartinInMPH(); - return convertMPHtoKMPH(mph); - } - - private double convertMPHtoKMPH(double mph) { - return mph * 1.60934; - } -} diff --git a/core-java/src/main/java/com/baeldung/designpatterns/adapter/McLaren.java b/core-java/src/main/java/com/baeldung/designpatterns/adapter/McLaren.java new file mode 100644 index 0000000000..c807df67db --- /dev/null +++ b/core-java/src/main/java/com/baeldung/designpatterns/adapter/McLaren.java @@ -0,0 +1,8 @@ +package com.baeldung.designpatterns.adapter; + +public class McLaren implements Movable { + @Override + public double getSpeed() { + return 241; + } +} diff --git a/core-java/src/main/java/com/baeldung/designpatterns/adapter/Movable.java b/core-java/src/main/java/com/baeldung/designpatterns/adapter/Movable.java new file mode 100644 index 0000000000..ec94e90af0 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/designpatterns/adapter/Movable.java @@ -0,0 +1,6 @@ +package com.baeldung.designpatterns.adapter; + +public interface Movable { + // returns speed in MPH + double getSpeed(); +} \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/designpatterns/adapter/MovableAdapter.java b/core-java/src/main/java/com/baeldung/designpatterns/adapter/MovableAdapter.java new file mode 100644 index 0000000000..b9c7484446 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/designpatterns/adapter/MovableAdapter.java @@ -0,0 +1,6 @@ +package com.baeldung.designpatterns.adapter; + +public interface MovableAdapter { + // returns speed in KMPH + double getSpeed(); +} diff --git a/core-java/src/main/java/com/baeldung/designpatterns/adapter/MovableAdapterImpl.java b/core-java/src/main/java/com/baeldung/designpatterns/adapter/MovableAdapterImpl.java new file mode 100644 index 0000000000..eb74641389 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/designpatterns/adapter/MovableAdapterImpl.java @@ -0,0 +1,19 @@ +package com.baeldung.designpatterns.adapter; + +public class MovableAdapterImpl implements MovableAdapter { + private Movable luxuryCars; + + public MovableAdapterImpl(Movable luxuryCars) { + this.luxuryCars = luxuryCars; + } + + @Override + public double getSpeed() { + double mph = luxuryCars.getSpeed(); + return convertMPHtoKMPH(mph); + } + + private double convertMPHtoKMPH(double mph) { + return mph * 1.60934; + } +} diff --git a/core-java/src/main/java/com/baeldung/designpatterns/bridge/Blue.java b/core-java/src/main/java/com/baeldung/designpatterns/bridge/Blue.java index 97a4a9508c..da5d29617f 100644 --- a/core-java/src/main/java/com/baeldung/designpatterns/bridge/Blue.java +++ b/core-java/src/main/java/com/baeldung/designpatterns/bridge/Blue.java @@ -1,12 +1,8 @@ package com.baeldung.designpatterns.bridge; -import static com.baeldung.designpatterns.util.LogerUtil.LOG; - public class Blue implements Color { - @Override - public void fillColor() { - LOG.info("Color : Blue"); + public String fill() { + return "Color is Blue"; } - } diff --git a/core-java/src/main/java/com/baeldung/designpatterns/bridge/BridgePatternDriver.java b/core-java/src/main/java/com/baeldung/designpatterns/bridge/BridgePatternDriver.java index 921deadcac..e6a7fb41c1 100644 --- a/core-java/src/main/java/com/baeldung/designpatterns/bridge/BridgePatternDriver.java +++ b/core-java/src/main/java/com/baeldung/designpatterns/bridge/BridgePatternDriver.java @@ -5,10 +5,10 @@ public class BridgePatternDriver { public static void main(String[] args) { //a square with red color Shape square = new Square(new Red()); - square.drawShape(); + System.out.println(square.draw()); //a triangle with blue color Shape triangle = new Triangle(new Blue()); - triangle.drawShape(); + System.out.println(triangle.draw()); } } diff --git a/core-java/src/main/java/com/baeldung/designpatterns/bridge/Color.java b/core-java/src/main/java/com/baeldung/designpatterns/bridge/Color.java index 91d2b01609..05618e6d6e 100644 --- a/core-java/src/main/java/com/baeldung/designpatterns/bridge/Color.java +++ b/core-java/src/main/java/com/baeldung/designpatterns/bridge/Color.java @@ -1,5 +1,5 @@ package com.baeldung.designpatterns.bridge; public interface Color { - public void fillColor(); + String fill(); } diff --git a/core-java/src/main/java/com/baeldung/designpatterns/bridge/Red.java b/core-java/src/main/java/com/baeldung/designpatterns/bridge/Red.java index 8c22a94f00..bc83199591 100644 --- a/core-java/src/main/java/com/baeldung/designpatterns/bridge/Red.java +++ b/core-java/src/main/java/com/baeldung/designpatterns/bridge/Red.java @@ -1,12 +1,10 @@ package com.baeldung.designpatterns.bridge; -import static com.baeldung.designpatterns.util.LogerUtil.LOG; - public class Red implements Color { @Override - public void fillColor() { - LOG.info("Color : Red"); + public String fill() { + return "Color is Red"; } } diff --git a/core-java/src/main/java/com/baeldung/designpatterns/bridge/Shape.java b/core-java/src/main/java/com/baeldung/designpatterns/bridge/Shape.java index c4daf7a821..75cd43dbc8 100644 --- a/core-java/src/main/java/com/baeldung/designpatterns/bridge/Shape.java +++ b/core-java/src/main/java/com/baeldung/designpatterns/bridge/Shape.java @@ -7,5 +7,5 @@ public abstract class Shape { this.color = color; } - abstract public void drawShape(); + abstract public String draw(); } diff --git a/core-java/src/main/java/com/baeldung/designpatterns/bridge/Square.java b/core-java/src/main/java/com/baeldung/designpatterns/bridge/Square.java index 6b377197eb..7397f4bd47 100644 --- a/core-java/src/main/java/com/baeldung/designpatterns/bridge/Square.java +++ b/core-java/src/main/java/com/baeldung/designpatterns/bridge/Square.java @@ -1,7 +1,5 @@ package com.baeldung.designpatterns.bridge; -import static com.baeldung.designpatterns.util.LogerUtil.LOG; - public class Square extends Shape { public Square(Color color) { @@ -9,8 +7,7 @@ public class Square extends Shape { } @Override - public void drawShape() { - LOG.info("Square drawn. "); - color.fillColor(); + public String draw() { + return "Square drawn. " + color.fill(); } } diff --git a/core-java/src/main/java/com/baeldung/designpatterns/bridge/Triangle.java b/core-java/src/main/java/com/baeldung/designpatterns/bridge/Triangle.java index 900e78cf2b..46db66ee42 100644 --- a/core-java/src/main/java/com/baeldung/designpatterns/bridge/Triangle.java +++ b/core-java/src/main/java/com/baeldung/designpatterns/bridge/Triangle.java @@ -1,7 +1,5 @@ package com.baeldung.designpatterns.bridge; -import static com.baeldung.designpatterns.util.LogerUtil.LOG; - public class Triangle extends Shape { public Triangle(Color color) { @@ -9,8 +7,7 @@ public class Triangle extends Shape { } @Override - public void drawShape() { - LOG.info("Triangle drawn. "); - color.fillColor(); + public String draw() { + return "Triangle drawn. "+ color.fill(); } } diff --git a/core-java/src/main/java/com/baeldung/designpatterns/decorator/ChristmasTree.java b/core-java/src/main/java/com/baeldung/designpatterns/decorator/ChristmasTree.java index 80a0865567..e5dca41dd8 100644 --- a/core-java/src/main/java/com/baeldung/designpatterns/decorator/ChristmasTree.java +++ b/core-java/src/main/java/com/baeldung/designpatterns/decorator/ChristmasTree.java @@ -1,5 +1,5 @@ package com.baeldung.designpatterns.decorator; public interface ChristmasTree { - public String decorate(); -} + String decorate(); +} \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/designpatterns/decorator/DecoratorPatternDriver.java b/core-java/src/main/java/com/baeldung/designpatterns/decorator/DecoratorPatternDriver.java index f70991da6b..70b4f801cd 100644 --- a/core-java/src/main/java/com/baeldung/designpatterns/decorator/DecoratorPatternDriver.java +++ b/core-java/src/main/java/com/baeldung/designpatterns/decorator/DecoratorPatternDriver.java @@ -5,16 +5,14 @@ import static com.baeldung.designpatterns.util.LogerUtil.LOG; public class DecoratorPatternDriver { public static void main(String[] args) { - //christmas tree with just one Garland + // christmas tree with just one Garland ChristmasTree tree1 = new Garland(new ChristmasTreeImpl()); LOG.info(tree1.decorate()); - - //christmas tree with two Garlands and one Bubble lights - ChristmasTree tree2 = new BubbleLights(new Garland( - new Garland(new ChristmasTreeImpl())) - ); + + // christmas tree with two Garlands and one Bubble lights + ChristmasTree tree2 = new BubbleLights(new Garland(new Garland(new ChristmasTreeImpl()))); LOG.info(tree2.decorate()); - + } } diff --git a/core-java/src/main/java/com/baeldung/designpatterns/proxy/ExpensiveObject.java b/core-java/src/main/java/com/baeldung/designpatterns/proxy/ExpensiveObject.java index 96a6bfb878..256b31bc84 100644 --- a/core-java/src/main/java/com/baeldung/designpatterns/proxy/ExpensiveObject.java +++ b/core-java/src/main/java/com/baeldung/designpatterns/proxy/ExpensiveObject.java @@ -1,5 +1,5 @@ package com.baeldung.designpatterns.proxy; public interface ExpensiveObject { - public void process(); + void process(); } diff --git a/core-java/src/main/java/com/baeldung/designpatterns/proxy/ExpensiveObjectImpl.java b/core-java/src/main/java/com/baeldung/designpatterns/proxy/ExpensiveObjectImpl.java index 7014d3811c..de31e22b30 100644 --- a/core-java/src/main/java/com/baeldung/designpatterns/proxy/ExpensiveObjectImpl.java +++ b/core-java/src/main/java/com/baeldung/designpatterns/proxy/ExpensiveObjectImpl.java @@ -7,14 +7,14 @@ public class ExpensiveObjectImpl implements ExpensiveObject { public ExpensiveObjectImpl() { heavyInitialConfiguration(); } - + @Override public void process() { LOG.info("processing complete."); } - + private void heavyInitialConfiguration() { LOG.info("Loading initial configuration..."); } - + } \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java b/core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java index ae79787570..ebe59e33b1 100644 --- a/core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java +++ b/core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java @@ -43,6 +43,7 @@ public class CustomRecursiveAction extends RecursiveAction { private void processing(String work) { String result = work.toUpperCase(); - logger.info("This result - (" + result + ") - was processed by " + Thread.currentThread().getName()); + logger.info("This result - (" + result + ") - was processed by " + Thread.currentThread() + .getName()); } } diff --git a/core-java/src/main/java/com/baeldung/java/reflection/Greeter.java b/core-java/src/main/java/com/baeldung/java/reflection/Greeter.java index ede269528a..57aefdd169 100644 --- a/core-java/src/main/java/com/baeldung/java/reflection/Greeter.java +++ b/core-java/src/main/java/com/baeldung/java/reflection/Greeter.java @@ -5,6 +5,6 @@ import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) public @interface Greeter { - - public String greet() default ""; + + public String greet() default ""; } diff --git a/core-java/src/main/java/com/baeldung/map/iteration/MapIteration.java b/core-java/src/main/java/com/baeldung/map/iteration/MapIteration.java index 2bc078cdb0..b0c32e1487 100644 --- a/core-java/src/main/java/com/baeldung/map/iteration/MapIteration.java +++ b/core-java/src/main/java/com/baeldung/map/iteration/MapIteration.java @@ -44,7 +44,8 @@ public class MapIteration { } public void iterateUsingIteratorAndEntry(Map map) { - Iterator> iterator = map.entrySet().iterator(); + Iterator> iterator = map.entrySet() + .iterator(); while (iterator.hasNext()) { Map.Entry pair = iterator.next(); System.out.println(pair.getKey() + ":" + pair.getValue()); @@ -58,7 +59,9 @@ public class MapIteration { } public void iterateUsingStreamAPI(Map map) { - map.entrySet().stream().forEach(e -> System.out.println(e.getKey() + ":" + e.getValue())); + map.entrySet() + .stream() + .forEach(e -> System.out.println(e.getKey() + ":" + e.getValue())); } public void iterateKeys(Map map) { diff --git a/core-java/src/main/java/com/baeldung/maths/BigIntegerImpl.java b/core-java/src/main/java/com/baeldung/maths/BigIntegerImpl.java index dc509429f9..9f46345e04 100644 --- a/core-java/src/main/java/com/baeldung/maths/BigIntegerImpl.java +++ b/core-java/src/main/java/com/baeldung/maths/BigIntegerImpl.java @@ -8,7 +8,7 @@ public class BigIntegerImpl { BigInteger numStarsMilkyWay = new BigInteger("8731409320171337804361260816606476"); BigInteger numStarsAndromeda = new BigInteger("5379309320171337804361260816606476"); - + BigInteger totalStars = numStarsMilkyWay.add(numStarsAndromeda); } diff --git a/core-java/src/main/java/com/baeldung/networking/cookies/PersistentCookieStore.java b/core-java/src/main/java/com/baeldung/networking/cookies/PersistentCookieStore.java index 5d30491cfe..4f34972b1e 100644 --- a/core-java/src/main/java/com/baeldung/networking/cookies/PersistentCookieStore.java +++ b/core-java/src/main/java/com/baeldung/networking/cookies/PersistentCookieStore.java @@ -9,7 +9,8 @@ public class PersistentCookieStore implements CookieStore, Runnable { public PersistentCookieStore() { store = new CookieManager().getCookieStore(); // deserialize cookies into store - Runtime.getRuntime().addShutdownHook(new Thread(this)); + Runtime.getRuntime() + .addShutdownHook(new Thread(this)); } @Override diff --git a/core-java/src/main/java/com/baeldung/numberofdigits/Benchmarking.java b/core-java/src/main/java/com/baeldung/numberofdigits/Benchmarking.java new file mode 100755 index 0000000000..737654ccf5 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/numberofdigits/Benchmarking.java @@ -0,0 +1,67 @@ +package com.baeldung.numberofdigits; + +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.runner.RunnerException; + +public class Benchmarking { + public static void main(String[] args) throws RunnerException, IOException { + org.openjdk.jmh.Main.main(args); + } + + @State(Scope.Thread) + public static class ExecutionPlan { + public int number = Integer.MAX_VALUE; + public int length = 0; + public NumberOfDigits numberOfDigits= new NumberOfDigits(); + } + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + @OutputTimeUnit(TimeUnit.NANOSECONDS) + public void stringBasedSolution(ExecutionPlan plan) { + plan.length = plan.numberOfDigits.stringBasedSolution(plan.number); + } + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + @OutputTimeUnit(TimeUnit.NANOSECONDS) + public void logarithmicApproach(ExecutionPlan plan) { + plan.length = plan.numberOfDigits.logarithmicApproach(plan.number); + } + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + @OutputTimeUnit(TimeUnit.NANOSECONDS) + public void repeatedMultiplication(ExecutionPlan plan) { + plan.length = plan.numberOfDigits.repeatedMultiplication(plan.number); + } + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + @OutputTimeUnit(TimeUnit.NANOSECONDS) + public void shiftOperators(ExecutionPlan plan) { + plan.length = plan.numberOfDigits.shiftOperators(plan.number); + } + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + @OutputTimeUnit(TimeUnit.NANOSECONDS) + public void dividingWithPowersOf2(ExecutionPlan plan) { + plan.length = plan.numberOfDigits.dividingWithPowersOf2(plan.number); + } + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + @OutputTimeUnit(TimeUnit.NANOSECONDS) + public void divideAndConquer(ExecutionPlan plan) { + plan.length = plan.numberOfDigits.divideAndConquer(plan.number); + } +} diff --git a/core-java/src/main/java/com/baeldung/numberofdigits/NumberOfDigits.java b/core-java/src/main/java/com/baeldung/numberofdigits/NumberOfDigits.java new file mode 100755 index 0000000000..1abf74d405 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/numberofdigits/NumberOfDigits.java @@ -0,0 +1,97 @@ +package com.baeldung.numberofdigits; + +public class NumberOfDigits { + public int stringBasedSolution(int number) { + int length = String.valueOf(number).length(); + return length; + } + + public int logarithmicApproach(int number) { + int length = (int) Math.log10(number) + 1; + return length; + } + + public int repeatedMultiplication(int number) { + int length = 0; + long temp = 1; + while(temp <= number) { + length++; + temp *= 10; + } + return length; + } + + public int shiftOperators(int number) { + int length = 0; + long temp = 1; + while(temp <= number) { + length++; + temp = (temp << 3) + (temp << 1); + } + return length; + } + + public int dividingWithPowersOf2(int number) { + int length = 1; + if (number >= 100000000) { + length += 8; + number /= 100000000; + } + if (number >= 10000) { + length += 4; + number /= 10000; + } + if (number >= 100) { + length += 2; + number /= 100; + } + if (number >= 10) { + length += 1; + } + return length; + } + + public int divideAndConquer(int number) { + if (number < 100000){ + // 5 digits or less + if (number < 100){ + // 1 or 2 + if (number < 10) + return 1; + else + return 2; + }else{ + // 3 to 5 digits + if (number < 1000) + return 3; + else{ + // 4 or 5 digits + if (number < 10000) + return 4; + else + return 5; + } + } + } else { + // 6 digits or more + if (number < 10000000) { + // 6 or 7 digits + if (number < 1000000) + return 6; + else + return 7; + } else { + // 8 to 10 digits + if (number < 100000000) + return 8; + else { + // 9 or 10 digits + if (number < 1000000000) + return 9; + else + return 10; + } + } + } + } +} diff --git a/core-java/src/main/java/com/baeldung/numberofdigits/NumberOfDigitsDriver.java b/core-java/src/main/java/com/baeldung/numberofdigits/NumberOfDigitsDriver.java new file mode 100755 index 0000000000..32d3051327 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/numberofdigits/NumberOfDigitsDriver.java @@ -0,0 +1,33 @@ +package com.baeldung.numberofdigits; + +import static com.baeldung.designpatterns.util.LogerUtil.LOG; + +public class NumberOfDigitsDriver { + private static NumberOfDigits numberOfDigits; + + static { + numberOfDigits = new NumberOfDigits(); + } + + public static void main(String[] args) { + LOG.info("Testing all methods..."); + + long length = numberOfDigits.stringBasedSolution(602); + LOG.info("String Based Solution : " + length); + + length = numberOfDigits.logarithmicApproach(602); + LOG.info("Logarithmic Approach : " + length); + + length = numberOfDigits.repeatedMultiplication(602); + LOG.info("Repeated Multiplication : " + length); + + length = numberOfDigits.shiftOperators(602); + LOG.info("Shift Operators : " + length); + + length = numberOfDigits.dividingWithPowersOf2(602); + LOG.info("Dividing with Powers of 2 : " + length); + + length = numberOfDigits.divideAndConquer(602); + LOG.info("Divide And Conquer : " + length); + } +} diff --git a/core-java/src/main/java/com/baeldung/printscreen/Screenshot.java b/core-java/src/main/java/com/baeldung/printscreen/Screenshot.java index 7f87b47476..11716b961d 100644 --- a/core-java/src/main/java/com/baeldung/printscreen/Screenshot.java +++ b/core-java/src/main/java/com/baeldung/printscreen/Screenshot.java @@ -14,7 +14,8 @@ public class Screenshot { } public void getScreenshot(int timeToWait) throws Exception { - Rectangle rectangle = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); + Rectangle rectangle = new Rectangle(Toolkit.getDefaultToolkit() + .getScreenSize()); Robot robot = new Robot(); BufferedImage img = robot.createScreenCapture(rectangle); ImageIO.write(img, "jpg", new File(path)); diff --git a/core-java/src/main/java/com/baeldung/sneakythrows/SneakyRunnable.java b/core-java/src/main/java/com/baeldung/sneakythrows/SneakyRunnable.java new file mode 100644 index 0000000000..88a8696053 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/sneakythrows/SneakyRunnable.java @@ -0,0 +1,23 @@ +package com.baeldung.sneakythrows; + +import lombok.SneakyThrows; + +public class SneakyRunnable implements Runnable { + + @SneakyThrows + public void run() { + try { + throw new InterruptedException(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + try { + new SneakyRunnable().run(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/core-java/src/main/java/com/baeldung/sneakythrows/SneakyThrows.java b/core-java/src/main/java/com/baeldung/sneakythrows/SneakyThrows.java new file mode 100644 index 0000000000..847aaa7249 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/sneakythrows/SneakyThrows.java @@ -0,0 +1,25 @@ +package com.baeldung.sneakythrows; + +import java.io.IOException; + +public class SneakyThrows { + + + public static void sneakyThrow(Throwable e) throws E { + throw (E) e; + } + + public static void throwsSneakyIOException() { + sneakyThrow(new IOException("sneaky")); + } + + + public static void main(String[] args) { + try { + throwsSneakyIOException(); + } catch (Exception ex) { + ex.printStackTrace(); + } + + } +} diff --git a/core-java/src/main/java/com/baeldung/stream/StreamIndices.java b/core-java/src/main/java/com/baeldung/stream/StreamIndices.java new file mode 100644 index 0000000000..34768a725a --- /dev/null +++ b/core-java/src/main/java/com/baeldung/stream/StreamIndices.java @@ -0,0 +1,62 @@ +package com.baeldung.stream; + +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import com.codepoetics.protonpack.Indexed; +import com.codepoetics.protonpack.StreamUtils; + +import io.vavr.collection.Stream; +import one.util.streamex.EntryStream; + +public class StreamIndices { + + public static List getEvenIndexedStrings(String[] names) { + List evenIndexedNames = IntStream.range(0, names.length) + .filter(i -> i % 2 == 0) + .mapToObj(i -> names[i]) + .collect(Collectors.toList()); + return evenIndexedNames; + } + + public List getEvenIndexedStringsVersionTwo(List names) { + List evenIndexedNames = EntryStream.of(names) + .filterKeyValue((index, name) -> index % 2 == 0) + .values() + .toList(); + return evenIndexedNames; + } + + public static List> getEvenIndexedStrings(List names) { + List> list = StreamUtils.zipWithIndex(names.stream()) + .filter(i -> i.getIndex() % 2 == 0) + .collect(Collectors.toList()); + return list; + } + + public static List> getOddIndexedStrings(List names) { + List> list = StreamUtils.zipWithIndex(names.stream()) + .filter(i -> i.getIndex() % 2 == 1) + .collect(Collectors.toList()); + return list; + } + + public static List getOddIndexedStrings(String[] names) { + List oddIndexedNames = IntStream.range(0, names.length) + .filter(i -> i % 2 == 1) + .mapToObj(i -> names[i]) + .collect(Collectors.toList()); + return oddIndexedNames; + } + + public static List getOddIndexedStringsVersionTwo(String[] names) { + List oddIndexedNames = Stream.of(names) + .zipWithIndex() + .filter(tuple -> tuple._2 % 2 == 1) + .map(tuple -> tuple._1) + .toJavaList(); + return oddIndexedNames; + } + +} \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/string/StringBufferStringBuilder.java b/core-java/src/main/java/com/baeldung/string/StringBufferStringBuilder.java new file mode 100644 index 0000000000..74f489d57f --- /dev/null +++ b/core-java/src/main/java/com/baeldung/string/StringBufferStringBuilder.java @@ -0,0 +1,46 @@ +package com.baeldung.string; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.RunnerException; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +public class StringBufferStringBuilder { + + public static void main(String[] args) throws RunnerException { + + Options opt = new OptionsBuilder() + .include(StringBufferStringBuilder.class.getSimpleName()) + .build(); + + new Runner(opt).run(); + } + + @State(Scope.Benchmark) + public static class MyState { + int iterations = 1000; + String initial = "abc"; + String suffix = "def"; + } + + @Benchmark + public StringBuffer benchmarkStringBuffer(MyState state) { + StringBuffer stringBuffer = new StringBuffer(state.initial); + for (int i = 0; i < state.iterations; i++) { + stringBuffer.append(state.suffix); + } + return stringBuffer; + } + + @Benchmark + public StringBuilder benchmarkStringBuilder(MyState state) { + StringBuilder stringBuilder = new StringBuilder(state.initial); + for (int i = 0; i < state.iterations; i++) { + stringBuilder.append(state.suffix); + } + return stringBuilder; + } +} \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/threadpool/TreeNode.java b/core-java/src/main/java/com/baeldung/threadpool/TreeNode.java deleted file mode 100644 index 9b43152074..0000000000 --- a/core-java/src/main/java/com/baeldung/threadpool/TreeNode.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.threadpool; - -import java.util.Set; - -import com.google.common.collect.Sets; - -public class TreeNode { - - int value; - - Set children; - - public TreeNode(int value, TreeNode... children) { - this.value = value; - this.children = Sets.newHashSet(children); - } - -} diff --git a/core-java/src/main/java/com/baeldung/uuid/UUIDGenerator.java b/core-java/src/main/java/com/baeldung/uuid/UUIDGenerator.java index 23baf5d5b4..dcf186de93 100644 --- a/core-java/src/main/java/com/baeldung/uuid/UUIDGenerator.java +++ b/core-java/src/main/java/com/baeldung/uuid/UUIDGenerator.java @@ -6,16 +6,16 @@ import java.security.NoSuchAlgorithmException; import java.util.UUID; public class UUIDGenerator { - + /** * These are predefined UUID for name spaces */ - private static final String NAMESPACE_DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; - private static final String NAMESPACE_URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"; - private static final String NAMESPACE_OID = "6ba7b812-9dad-11d1-80b4-00c04fd430c8"; - private static final String NAMESPACE_X500 = "6ba7b814-9dad-11d1-80b4-00c04fd430c8"; + private static final String NAMESPACE_DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; + private static final String NAMESPACE_URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"; + private static final String NAMESPACE_OID = "6ba7b812-9dad-11d1-80b4-00c04fd430c8"; + private static final String NAMESPACE_X500 = "6ba7b814-9dad-11d1-80b4-00c04fd430c8"; - private static final char[] hexArray = "0123456789ABCDEF".toCharArray(); + private static final char[] hexArray = "0123456789ABCDEF".toCharArray(); public static void main(String[] args) { try { @@ -35,7 +35,7 @@ public class UUIDGenerator { UUID uuid = UUID.randomUUID(); return uuid; } - + /** * Type 3 UUID Generation * @@ -47,7 +47,7 @@ public class UUIDGenerator { UUID uuid = UUID.nameUUIDFromBytes(bytes); return uuid; } - + /** * Type 5 UUID Generation * @@ -59,8 +59,7 @@ public class UUIDGenerator { UUID uuid = type5UUIDFromBytes(bytes); return uuid; } - - + public static UUID type5UUIDFromBytes(byte[] name) { MessageDigest md; try { @@ -69,27 +68,26 @@ public class UUIDGenerator { throw new InternalError("MD5 not supported", nsae); } byte[] bytes = md.digest(name); - bytes[6] &= 0x0f; /* clear version */ - bytes[6] |= 0x50; /* set to version 5 */ - bytes[8] &= 0x3f; /* clear variant */ - bytes[8] |= 0x80; /* set to IETF variant */ + bytes[6] &= 0x0f; /* clear version */ + bytes[6] |= 0x50; /* set to version 5 */ + bytes[8] &= 0x3f; /* clear variant */ + bytes[8] |= 0x80; /* set to IETF variant */ return constructType5UUID(bytes); } - + private static UUID constructType5UUID(byte[] data) { long msb = 0; long lsb = 0; assert data.length == 16 : "data must be 16 bytes in length"; - - for (int i=0; i<8; i++) + + for (int i = 0; i < 8; i++) msb = (msb << 8) | (data[i] & 0xff); - - for (int i=8; i<16; i++) + + for (int i = 8; i < 16; i++) lsb = (lsb << 8) | (data[i] & 0xff); return new UUID(msb, lsb); } - /** * Unique Keys Generation Using Message Digest and Type 4 UUID * diff --git a/couchbase-sdk/src/main/resources/application.properties b/core-java/src/main/resources/META-INF/BenchmarkList old mode 100644 new mode 100755 similarity index 100% rename from couchbase-sdk/src/main/resources/application.properties rename to core-java/src/main/resources/META-INF/BenchmarkList diff --git a/core-java/src/test/java/com/baeldung/designpatterns/AdapterPatternIntegrationTest.java b/core-java/src/test/java/com/baeldung/designpatterns/AdapterPatternIntegrationTest.java index fb483a8a68..8cad1290d9 100644 --- a/core-java/src/test/java/com/baeldung/designpatterns/AdapterPatternIntegrationTest.java +++ b/core-java/src/test/java/com/baeldung/designpatterns/AdapterPatternIntegrationTest.java @@ -1,20 +1,30 @@ package com.baeldung.designpatterns; - -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.junit.Test; -import com.baeldung.designpatterns.adapter.LuxuryCarsSpeedAdapter; -import com.baeldung.designpatterns.adapter.LuxuryCarsSpeedAdapterImpl; +import com.baeldung.designpatterns.adapter.AstonMartin; +import com.baeldung.designpatterns.adapter.BugattiVeyron; +import com.baeldung.designpatterns.adapter.McLaren; +import com.baeldung.designpatterns.adapter.Movable; +import com.baeldung.designpatterns.adapter.MovableAdapter; +import com.baeldung.designpatterns.adapter.MovableAdapterImpl; public class AdapterPatternIntegrationTest { @Test - public void givenLuxuryCarsAdapter_WhenConvertingMPHToKMPH_thenSuccessfullyConverted() { - LuxuryCarsSpeedAdapter luxuryCars = new LuxuryCarsSpeedAdapterImpl(); - assertEquals(luxuryCars.bugattiVeyronInKMPH(), 431.30312, 0.00001); - assertEquals(luxuryCars.mcLarenInKMPH(), 387.85094, 0.00001); - assertEquals(luxuryCars.astonMartinInKMPH(), 354.0548, 0.00001); + public void givenMovableAdapter_WhenConvertingMPHToKMPH_thenSuccessfullyConverted() { + Movable bugattiVeyron = new BugattiVeyron(); + MovableAdapter bugattiVeyronAdapter = new MovableAdapterImpl(bugattiVeyron); + assertEquals(bugattiVeyronAdapter.getSpeed(), 431.30312, 0.00001); + + Movable mcLaren = new McLaren(); + MovableAdapter mcLarenAdapter = new MovableAdapterImpl(mcLaren); + assertEquals(mcLarenAdapter.getSpeed(), 387.85094, 0.00001); + + Movable astonMartin = new AstonMartin(); + MovableAdapter astonMartinAdapter = new MovableAdapterImpl(astonMartin); + assertEquals(astonMartinAdapter.getSpeed(), 354.0548, 0.00001); } } diff --git a/core-java/src/test/java/com/baeldung/designpatterns/BridgePatternIntegrationTest.java b/core-java/src/test/java/com/baeldung/designpatterns/BridgePatternIntegrationTest.java index 56a7a704f2..ed7eb0c453 100644 --- a/core-java/src/test/java/com/baeldung/designpatterns/BridgePatternIntegrationTest.java +++ b/core-java/src/test/java/com/baeldung/designpatterns/BridgePatternIntegrationTest.java @@ -1,14 +1,7 @@ package com.baeldung.designpatterns; -import static com.baeldung.designpatterns.util.LogerUtil.LOG; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.*; -import java.util.List; - -import org.apache.log4j.spi.LoggingEvent; -import org.junit.After; -import org.junit.Before; import org.junit.Test; import com.baeldung.designpatterns.bridge.Blue; @@ -18,35 +11,16 @@ import com.baeldung.designpatterns.bridge.Square; import com.baeldung.designpatterns.bridge.Triangle; public class BridgePatternIntegrationTest { - public static TestAppenderDP appender; - - @Before - public void setUp() { - appender = new TestAppenderDP(); - LOG.addAppender(appender); - } - + @Test public void whenBridgePatternInvoked_thenConfigSuccess() { //a square with red color Shape square = new Square(new Red()); - square.drawShape(); + assertEquals(square.draw(), "Square drawn. Color is Red"); //a triangle with blue color Shape triangle = new Triangle(new Blue()); - triangle.drawShape(); - - final List log = appender.getLog(); - - assertThat((String) log.get(0).getMessage(), is("Square drawn. ")); - assertThat((String) log.get(1).getMessage(), is("Color : Red")); - assertThat((String) log.get(2).getMessage(), is("Triangle drawn. ")); - assertThat((String) log.get(3).getMessage(), is("Color : Blue")); - } - - @After - public void tearDown() { - LOG.removeAppender(appender); + assertEquals(triangle.draw(), "Triangle drawn. Color is Blue"); } } diff --git a/core-java/src/test/java/com/baeldung/designpatterns/DecoratorPatternIntegrationTest.java b/core-java/src/test/java/com/baeldung/designpatterns/DecoratorPatternIntegrationTest.java index b3b3f988f1..de0ca8a135 100644 --- a/core-java/src/test/java/com/baeldung/designpatterns/DecoratorPatternIntegrationTest.java +++ b/core-java/src/test/java/com/baeldung/designpatterns/DecoratorPatternIntegrationTest.java @@ -10,19 +10,16 @@ import com.baeldung.designpatterns.decorator.ChristmasTreeImpl; import com.baeldung.designpatterns.decorator.Garland; public class DecoratorPatternIntegrationTest { - private ChristmasTree tree; - @Test public void givenDecoratorPattern_WhenDecoratorsInjectedAtRuntime_thenConfigSuccess() { - //christmas tree with just one Garland - tree = new Garland(new ChristmasTreeImpl()); - assertEquals(tree.decorate(), "Christmas tree with Garland"); - - //christmas tree with two Garlands and one Bubble lights - tree = new BubbleLights(new Garland( - new Garland(new ChristmasTreeImpl())) - ); - assertEquals(tree.decorate(), "Christmas tree with Garland with Garland with Bubble Lights"); + ChristmasTree tree1 = new Garland(new ChristmasTreeImpl()); + assertEquals(tree1.decorate(), + "Christmas tree with Garland"); + + ChristmasTree tree2 = new BubbleLights( + new Garland(new Garland(new ChristmasTreeImpl()))); + assertEquals(tree2.decorate(), + "Christmas tree with Garland with Garland with Bubble Lights"); } } diff --git a/core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java b/core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java index da615eef6f..c27af983d3 100644 --- a/core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java +++ b/core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java @@ -1,20 +1,23 @@ package com.baeldung.encoderdecoder; +import static java.util.stream.Collectors.joining; +import static org.hamcrest.CoreMatchers.is; + +import java.io.UnsupportedEncodingException; +import java.net.URL; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import java.io.UnsupportedEncodingException; -import java.net.*; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import static java.util.stream.Collectors.joining; -import static org.hamcrest.CoreMatchers.*; +import org.springframework.web.util.UriUtils; public class EncoderDecoderUnitTest { @@ -76,19 +79,20 @@ public class EncoderDecoderUnitTest { private String encodePath(String path) { try { - path = new URI(null, null, path, null).getPath(); - } catch (URISyntaxException e) { + path = UriUtils.encodePath(path, "UTF-8"); + } catch (UnsupportedEncodingException e) { LOGGER.error("Error encoding parameter {}", e.getMessage(), e); } return path; } @Test - public void givenPath_thenEncodeDecodePath() throws URISyntaxException { - URI uri = new URI(null, null, "/Path 1/Path+2", null); - - Assert.assertEquals("/Path 1/Path+2", uri.getPath()); - Assert.assertEquals("/Path%201/Path+2", uri.getRawPath()); + public void givenPathSegment_thenEncodeDecode() throws UnsupportedEncodingException { + String pathSegment = "/Path 1/Path+2"; + String encodedPathSegment = encodePath(pathSegment); + String decodedPathSegment = UriUtils.decode(encodedPathSegment, "UTF-8"); + Assert.assertEquals("/Path%201/Path+2", encodedPathSegment); + Assert.assertEquals("/Path 1/Path+2", decodedPathSegment); } @Test diff --git a/core-java/src/test/java/com/baeldung/java/nio/selector/NioEchoIntegrationTest.java b/core-java/src/test/java/com/baeldung/java/nio/selector/NioEchoLiveTest.java similarity index 89% rename from core-java/src/test/java/com/baeldung/java/nio/selector/NioEchoIntegrationTest.java rename to core-java/src/test/java/com/baeldung/java/nio/selector/NioEchoLiveTest.java index fc64799578..0e1afa87a5 100644 --- a/core-java/src/test/java/com/baeldung/java/nio/selector/NioEchoIntegrationTest.java +++ b/core-java/src/test/java/com/baeldung/java/nio/selector/NioEchoLiveTest.java @@ -8,10 +8,10 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -public class NioEchoIntegrationTest { +public class NioEchoLiveTest { - Process server; - EchoClient client; + private Process server; + private EchoClient client; @Before public void setup() throws IOException, InterruptedException { diff --git a/core-java/src/test/java/com/baeldung/java8/Java8GroupingByCollectorUnitTest.java b/core-java/src/test/java/com/baeldung/java8/Java8GroupingByCollectorUnitTest.java deleted file mode 100644 index 4452b4db9a..0000000000 --- a/core-java/src/test/java/com/baeldung/java8/Java8GroupingByCollectorUnitTest.java +++ /dev/null @@ -1,231 +0,0 @@ -package com.baeldung.java8; - -import com.baeldung.java_8_features.groupingby.BlogPost; -import com.baeldung.java_8_features.groupingby.BlogPostType; -import org.junit.Test; - -import java.util.*; -import java.util.concurrent.ConcurrentMap; - -import static java.util.Comparator.comparingInt; -import static java.util.stream.Collectors.*; -import static org.junit.Assert.*; - -public class Java8GroupingByCollectorUnitTest { - - private static final List posts = Arrays.asList( - new BlogPost("News item 1", "Author 1", BlogPostType.NEWS, 15), - new BlogPost("Tech review 1", "Author 2", BlogPostType.REVIEW, 5), - new BlogPost("Programming guide", "Author 1", BlogPostType.GUIDE, 20), - new BlogPost("News item 2", "Author 2", BlogPostType.NEWS, 35), - new BlogPost("Tech review 2", "Author 1", BlogPostType.REVIEW, 15)); - - @Test - public void givenAListOfPosts_whenGroupedByType_thenGetAMapBetweenTypeAndPosts() { - Map> postsPerType = posts - .stream() - .collect(groupingBy(BlogPost::getType)); - - assertEquals(2, postsPerType - .get(BlogPostType.NEWS) - .size()); - assertEquals(1, postsPerType - .get(BlogPostType.GUIDE) - .size()); - assertEquals(2, postsPerType - .get(BlogPostType.REVIEW) - .size()); - } - - @Test - public void givenAListOfPosts_whenGroupedByTypeAndTheirTitlesAreJoinedInAString_thenGetAMapBetweenTypeAndCsvTitles() { - Map postsPerType = posts - .stream() - .collect(groupingBy(BlogPost::getType, mapping(BlogPost::getTitle, joining(", ", "Post titles: [", "]")))); - - assertEquals("Post titles: [News item 1, News item 2]", postsPerType.get(BlogPostType.NEWS)); - assertEquals("Post titles: [Programming guide]", postsPerType.get(BlogPostType.GUIDE)); - assertEquals("Post titles: [Tech review 1, Tech review 2]", postsPerType.get(BlogPostType.REVIEW)); - } - - @Test - public void givenAListOfPosts_whenGroupedByTypeAndSumTheLikes_thenGetAMapBetweenTypeAndPostLikes() { - Map likesPerType = posts - .stream() - .collect(groupingBy(BlogPost::getType, summingInt(BlogPost::getLikes))); - - assertEquals(50, likesPerType - .get(BlogPostType.NEWS) - .intValue()); - assertEquals(20, likesPerType - .get(BlogPostType.REVIEW) - .intValue()); - assertEquals(20, likesPerType - .get(BlogPostType.GUIDE) - .intValue()); - } - - @Test - public void givenAListOfPosts_whenGroupedByTypeInAnEnumMap_thenGetAnEnumMapBetweenTypeAndPosts() { - EnumMap> postsPerType = posts - .stream() - .collect(groupingBy(BlogPost::getType, () -> new EnumMap<>(BlogPostType.class), toList())); - - assertEquals(2, postsPerType - .get(BlogPostType.NEWS) - .size()); - assertEquals(1, postsPerType - .get(BlogPostType.GUIDE) - .size()); - assertEquals(2, postsPerType - .get(BlogPostType.REVIEW) - .size()); - } - - @Test - public void givenAListOfPosts_whenGroupedByTypeInSets_thenGetAMapBetweenTypesAndSetsOfPosts() { - Map> postsPerType = posts - .stream() - .collect(groupingBy(BlogPost::getType, toSet())); - - assertEquals(2, postsPerType - .get(BlogPostType.NEWS) - .size()); - assertEquals(1, postsPerType - .get(BlogPostType.GUIDE) - .size()); - assertEquals(2, postsPerType - .get(BlogPostType.REVIEW) - .size()); - } - - @Test - public void givenAListOfPosts_whenGroupedByTypeConcurrently_thenGetAMapBetweenTypeAndPosts() { - ConcurrentMap> postsPerType = posts - .parallelStream() - .collect(groupingByConcurrent(BlogPost::getType)); - - assertEquals(2, postsPerType - .get(BlogPostType.NEWS) - .size()); - assertEquals(1, postsPerType - .get(BlogPostType.GUIDE) - .size()); - assertEquals(2, postsPerType - .get(BlogPostType.REVIEW) - .size()); - } - - @Test - public void givenAListOfPosts_whenGroupedByTypeAndAveragingLikes_thenGetAMapBetweenTypeAndAverageNumberOfLikes() { - Map averageLikesPerType = posts - .stream() - .collect(groupingBy(BlogPost::getType, averagingInt(BlogPost::getLikes))); - - assertEquals(25, averageLikesPerType - .get(BlogPostType.NEWS) - .intValue()); - assertEquals(20, averageLikesPerType - .get(BlogPostType.GUIDE) - .intValue()); - assertEquals(10, averageLikesPerType - .get(BlogPostType.REVIEW) - .intValue()); - } - - @Test - public void givenAListOfPosts_whenGroupedByTypeAndCounted_thenGetAMapBetweenTypeAndNumberOfPosts() { - Map numberOfPostsPerType = posts - .stream() - .collect(groupingBy(BlogPost::getType, counting())); - - assertEquals(2, numberOfPostsPerType - .get(BlogPostType.NEWS) - .intValue()); - assertEquals(1, numberOfPostsPerType - .get(BlogPostType.GUIDE) - .intValue()); - assertEquals(2, numberOfPostsPerType - .get(BlogPostType.REVIEW) - .intValue()); - } - - @Test - public void givenAListOfPosts_whenGroupedByTypeAndMaxingLikes_thenGetAMapBetweenTypeAndMaximumNumberOfLikes() { - Map> maxLikesPerPostType = posts - .stream() - .collect(groupingBy(BlogPost::getType, maxBy(comparingInt(BlogPost::getLikes)))); - - assertTrue(maxLikesPerPostType - .get(BlogPostType.NEWS) - .isPresent()); - assertEquals(35, maxLikesPerPostType - .get(BlogPostType.NEWS) - .get() - .getLikes()); - - assertTrue(maxLikesPerPostType - .get(BlogPostType.GUIDE) - .isPresent()); - assertEquals(20, maxLikesPerPostType - .get(BlogPostType.GUIDE) - .get() - .getLikes()); - - assertTrue(maxLikesPerPostType - .get(BlogPostType.REVIEW) - .isPresent()); - assertEquals(15, maxLikesPerPostType - .get(BlogPostType.REVIEW) - .get() - .getLikes()); - } - - @Test - public void givenAListOfPosts_whenGroupedByAuthorAndThenByType_thenGetAMapBetweenAuthorAndMapsBetweenTypeAndBlogPosts() { - Map>> map = posts - .stream() - .collect(groupingBy(BlogPost::getAuthor, groupingBy(BlogPost::getType))); - - assertEquals(1, map - .get("Author 1") - .get(BlogPostType.NEWS) - .size()); - assertEquals(1, map - .get("Author 1") - .get(BlogPostType.GUIDE) - .size()); - assertEquals(1, map - .get("Author 1") - .get(BlogPostType.REVIEW) - .size()); - - assertEquals(1, map - .get("Author 2") - .get(BlogPostType.NEWS) - .size()); - assertEquals(1, map - .get("Author 2") - .get(BlogPostType.REVIEW) - .size()); - assertNull(map - .get("Author 2") - .get(BlogPostType.GUIDE)); - } - - @Test - public void givenAListOfPosts_whenGroupedByTypeAndSummarizingLikes_thenGetAMapBetweenTypeAndSummary() { - Map likeStatisticsPerType = posts - .stream() - .collect(groupingBy(BlogPost::getType, summarizingInt(BlogPost::getLikes))); - - IntSummaryStatistics newsLikeStatistics = likeStatisticsPerType.get(BlogPostType.NEWS); - - assertEquals(2, newsLikeStatistics.getCount()); - assertEquals(50, newsLikeStatistics.getSum()); - assertEquals(25.0, newsLikeStatistics.getAverage(), 0.001); - assertEquals(35, newsLikeStatistics.getMax()); - assertEquals(15, newsLikeStatistics.getMin()); - } - -} diff --git a/core-java/src/test/java/com/baeldung/java8/Java8MapAndFlatMap.java b/core-java/src/test/java/com/baeldung/java8/Java8MapAndFlatMap.java index 7098f88f30..a0bd1cf093 100644 --- a/core-java/src/test/java/com/baeldung/java8/Java8MapAndFlatMap.java +++ b/core-java/src/test/java/com/baeldung/java8/Java8MapAndFlatMap.java @@ -17,8 +17,8 @@ public class Java8MapAndFlatMap { @Test public void givenStream_whenCalledMap_thenProduceList() { List myList = Stream.of("a", "b") - .map(String::toUpperCase) - .collect(Collectors.toList()); + .map(String::toUpperCase) + .collect(Collectors.toList()); assertEquals(asList("A", "B"), myList); } @@ -27,9 +27,9 @@ public class Java8MapAndFlatMap { List> list = Arrays.asList(Arrays.asList("a"), Arrays.asList("b")); System.out.println(list); - System.out.println(list - .stream().flatMap(Collection::stream) - .collect(Collectors.toList())); + System.out.println(list.stream() + .flatMap(Collection::stream) + .collect(Collectors.toList())); } @Test @@ -40,13 +40,11 @@ public class Java8MapAndFlatMap { @Test public void givenOptional_whenCalledFlatMap_thenProduceFlattenedOptional() { - assertEquals(Optional.of(Optional.of("STRING")), Optional - .of("string") - .map(s -> Optional.of("STRING"))); + assertEquals(Optional.of(Optional.of("STRING")), Optional.of("string") + .map(s -> Optional.of("STRING"))); - assertEquals(Optional.of("STRING"), Optional - .of("string") - .flatMap(s -> Optional.of("STRING"))); + assertEquals(Optional.of("STRING"), Optional.of("string") + .flatMap(s -> Optional.of("STRING"))); } } diff --git a/core-java/src/test/java/com/baeldung/java8/JavaFolderSizeUnitTest.java b/core-java/src/test/java/com/baeldung/java8/JavaFolderSizeUnitTest.java index 1f3b380772..7f83e379cd 100644 --- a/core-java/src/test/java/com/baeldung/java8/JavaFolderSizeUnitTest.java +++ b/core-java/src/test/java/com/baeldung/java8/JavaFolderSizeUnitTest.java @@ -55,7 +55,12 @@ public class JavaFolderSizeUnitTest { @Test public void whenGetFolderSizeUsingJava8_thenCorrect() throws IOException { final Path folder = Paths.get(path); - final long size = Files.walk(folder).filter(p -> p.toFile().isFile()).mapToLong(p -> p.toFile().length()).sum(); + final long size = Files.walk(folder) + .filter(p -> p.toFile() + .isFile()) + .mapToLong(p -> p.toFile() + .length()) + .sum(); assertEquals(EXPECTED_SIZE, size); } @@ -72,8 +77,12 @@ public class JavaFolderSizeUnitTest { public void whenGetFolderSizeUsingGuava_thenCorrect() { final File folder = new File(path); - final Iterable files = com.google.common.io.Files.fileTreeTraverser().breadthFirstTraversal(folder); - final long size = StreamSupport.stream(files.spliterator(), false).filter(File::isFile).mapToLong(File::length).sum(); + final Iterable files = com.google.common.io.Files.fileTreeTraverser() + .breadthFirstTraversal(folder); + final long size = StreamSupport.stream(files.spliterator(), false) + .filter(File::isFile) + .mapToLong(File::length) + .sum(); assertEquals(EXPECTED_SIZE, size); } diff --git a/core-java/src/test/java/com/baeldung/java8/optional/README.md b/core-java/src/test/java/com/baeldung/java8/optional/README.md deleted file mode 100644 index 129131ae45..0000000000 --- a/core-java/src/test/java/com/baeldung/java8/optional/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [Guide To Java 8 Optional](http://www.baeldung.com/java-optional) diff --git a/core-java/src/test/java/com/baeldung/jdbc/JdbcIntegrationTest.java b/core-java/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java similarity index 97% rename from core-java/src/test/java/com/baeldung/jdbc/JdbcIntegrationTest.java rename to core-java/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java index 926fdb3833..da0c6bffe5 100644 --- a/core-java/src/test/java/com/baeldung/jdbc/JdbcIntegrationTest.java +++ b/core-java/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java @@ -21,9 +21,9 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -public class JdbcIntegrationTest { +public class JdbcLiveTest { - private static final Logger LOG = Logger.getLogger(JdbcIntegrationTest.class); + private static final Logger LOG = Logger.getLogger(JdbcLiveTest.class); private Connection con; diff --git a/core-java/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java b/core-java/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java index 3c8f519082..543c680597 100644 --- a/core-java/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java +++ b/core-java/src/test/java/com/baeldung/list/flattennestedlist/FlattenNestedListUnitTest.java @@ -43,6 +43,8 @@ public class FlattenNestedListUnitTest { } private List flattenListOfListsStream(List> list) { - return list.stream().flatMap(Collection::stream).collect(Collectors.toList()); + return list.stream() + .flatMap(Collection::stream) + .collect(Collectors.toList()); } } diff --git a/core-java/src/test/java/com/baeldung/networking/udp/UDPIntegrationTest.java b/core-java/src/test/java/com/baeldung/networking/udp/UDPLiveTest.java similarity index 96% rename from core-java/src/test/java/com/baeldung/networking/udp/UDPIntegrationTest.java rename to core-java/src/test/java/com/baeldung/networking/udp/UDPLiveTest.java index 968c01d24e..7337be6e3d 100644 --- a/core-java/src/test/java/com/baeldung/networking/udp/UDPIntegrationTest.java +++ b/core-java/src/test/java/com/baeldung/networking/udp/UDPLiveTest.java @@ -9,7 +9,7 @@ import java.io.IOException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -public class UDPIntegrationTest { +public class UDPLiveTest { private EchoClient client; @Before diff --git a/core-java/src/test/java/com/baeldung/networking/udp/broadcast/BroadcastIntegrationTest.java b/core-java/src/test/java/com/baeldung/networking/udp/broadcast/BroadcastLiveTest.java similarity index 96% rename from core-java/src/test/java/com/baeldung/networking/udp/broadcast/BroadcastIntegrationTest.java rename to core-java/src/test/java/com/baeldung/networking/udp/broadcast/BroadcastLiveTest.java index c4f1e1f42c..51e5bfc669 100644 --- a/core-java/src/test/java/com/baeldung/networking/udp/broadcast/BroadcastIntegrationTest.java +++ b/core-java/src/test/java/com/baeldung/networking/udp/broadcast/BroadcastLiveTest.java @@ -7,7 +7,7 @@ import java.io.IOException; import static org.junit.Assert.assertEquals; -public class BroadcastIntegrationTest { +public class BroadcastLiveTest { private BroadcastingClient client; @Test diff --git a/core-java/src/test/java/com/baeldung/networking/udp/multicast/MulticastIntegrationTest.java b/core-java/src/test/java/com/baeldung/networking/udp/multicast/MulticastLiveTest.java similarity index 96% rename from core-java/src/test/java/com/baeldung/networking/udp/multicast/MulticastIntegrationTest.java rename to core-java/src/test/java/com/baeldung/networking/udp/multicast/MulticastLiveTest.java index 404f6c4e85..83d0482f44 100644 --- a/core-java/src/test/java/com/baeldung/networking/udp/multicast/MulticastIntegrationTest.java +++ b/core-java/src/test/java/com/baeldung/networking/udp/multicast/MulticastLiveTest.java @@ -7,7 +7,7 @@ import java.io.IOException; import static org.junit.Assert.assertEquals; -public class MulticastIntegrationTest { +public class MulticastLiveTest { private MulticastingClient client; @Test diff --git a/core-java/src/test/java/com/baeldung/numberofdigits/NumberOfDigitsIntegrationTest.java b/core-java/src/test/java/com/baeldung/numberofdigits/NumberOfDigitsIntegrationTest.java new file mode 100644 index 0000000000..b348fe01ef --- /dev/null +++ b/core-java/src/test/java/com/baeldung/numberofdigits/NumberOfDigitsIntegrationTest.java @@ -0,0 +1,106 @@ +package com.baeldung.numberofdigits; + +import org.junit.Assert; +import org.junit.Assume; +import org.junit.experimental.theories.DataPoints; +import org.junit.experimental.theories.Theories; +import org.junit.experimental.theories.Theory; +import org.junit.runner.RunWith; + +@RunWith(Theories.class) +public class NumberOfDigitsIntegrationTest { + + private static NumberOfDigits numberOfDigits; + + static { + numberOfDigits = new NumberOfDigits(); + } + + @DataPoints + public static int[][] lowestIntegers() + { + return new int[][]{ + {1, 1}, + {2, 10}, + {3, 100}, + {4, 1000}, + {5, 10000}, + {6, 100000}, + {7, 1000000}, + {8, 10000000}, + {9, 100000000}, + {10, 1000000000} + }; + } + + @DataPoints + public static int[][] highestIntegers() + { + return new int[][]{ + {1, 9}, + {2, 99}, + {3, 999}, + {4, 9999}, + {5, 99999}, + {6, 999999}, + {7, 9999999}, + {8, 99999999}, + {9, 999999999}, + {10, Integer.MAX_VALUE} + }; + } + + @DataPoints + public static int[][] randomIntegers() + { + return new int[][]{ + {1, 1}, + {2, 14}, + {3, 549}, + {4, 1136}, + {5, 25340}, + {6, 134321}, + {7, 1435432}, + {8, 54234129}, + {9, 113683912}, + {10, 1534031982} + }; + } + + @Theory + public void givenDataPoints_whenStringBasedSolutionInvoked_thenAllPointsMatch(final int[] entry) { + Assume.assumeTrue(entry[0] > 0 && entry[1] > 0); + Assert.assertEquals(entry[0], numberOfDigits.stringBasedSolution(entry[1])); + } + + @Theory + public void givenDataPoints_whenLogarithmicApproachInvoked_thenAllPointsMatch(final int[] entry) { + Assume.assumeTrue(entry[0] > 0 && entry[1] > 0); + Assert.assertEquals(entry[0], numberOfDigits.logarithmicApproach(entry[1])); + } + + @Theory + public void givenDataPoints_whenRepeatedMultiplicationInvoked_thenAllPointsMatch(final int[] entry) { + Assume.assumeTrue(entry[0] > 0 && entry[1] > 0); + Assert.assertEquals(entry[0], numberOfDigits.repeatedMultiplication(entry[1])); + } + + @Theory + public void givenDataPoints_whenShiftOperatorsInvoked_thenAllPointsMatch(final int[] entry) { + Assume.assumeTrue(entry[0] > 0 && entry[1] > 0); + Assert.assertEquals(entry[0], numberOfDigits.shiftOperators(entry[1])); + } + + @Theory + public void givenDataPoints_whenDividingWithPowersOf2Invoked_thenAllPointsMatch(final int[] entry) { + Assume.assumeTrue(entry[0] > 0 && entry[1] > 0); + Assert.assertEquals(entry[0], numberOfDigits.dividingWithPowersOf2(entry[1])); + } + + @Theory + public void givenDataPoints_whenDivideAndConquerInvoked_thenAllPointsMatch(final int[] entry) { + Assume.assumeTrue(entry[0] > 0 && entry[1] > 0); + Assert.assertEquals(entry[0], numberOfDigits.divideAndConquer(entry[1])); + } + +} \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/printscreen/ScreenshotIntegrationTest.java b/core-java/src/test/java/com/baeldung/printscreen/ScreenshotLiveTest.java similarity index 92% rename from core-java/src/test/java/com/baeldung/printscreen/ScreenshotIntegrationTest.java rename to core-java/src/test/java/com/baeldung/printscreen/ScreenshotLiveTest.java index 13609b6977..672ba9668d 100644 --- a/core-java/src/test/java/com/baeldung/printscreen/ScreenshotIntegrationTest.java +++ b/core-java/src/test/java/com/baeldung/printscreen/ScreenshotLiveTest.java @@ -7,7 +7,7 @@ import java.io.File; import static org.junit.Assert.assertTrue; -public class ScreenshotIntegrationTest { +public class ScreenshotLiveTest { private Screenshot screenshot = new Screenshot("Screenshot.jpg"); private File file = new File("Screenshot.jpg"); diff --git a/core-java/src/test/java/com/baeldung/sneakythrows/SneakyRunnableTest.java b/core-java/src/test/java/com/baeldung/sneakythrows/SneakyRunnableTest.java new file mode 100644 index 0000000000..cd31f545b9 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/sneakythrows/SneakyRunnableTest.java @@ -0,0 +1,17 @@ +package com.baeldung.sneakythrows; + +import org.junit.Test; + +import static junit.framework.TestCase.assertEquals; + +public class SneakyRunnableTest { + + @Test + public void whenCallSneakyRunnableMethod_thenThrowException() { + try { + new SneakyRunnable().run(); + } catch (Exception e) { + assertEquals(InterruptedException.class, e.getStackTrace()); + } + } +} diff --git a/core-java/src/test/java/com/baeldung/sneakythrows/SneakyThrowsTest.java b/core-java/src/test/java/com/baeldung/sneakythrows/SneakyThrowsTest.java new file mode 100644 index 0000000000..e033ca062d --- /dev/null +++ b/core-java/src/test/java/com/baeldung/sneakythrows/SneakyThrowsTest.java @@ -0,0 +1,18 @@ +package com.baeldung.sneakythrows; + +import org.junit.Test; + +import static junit.framework.TestCase.assertEquals; + +public class SneakyThrowsTest { + + @Test + public void whenCallSneakyMethod_thenThrowSneakyException() { + try { + SneakyThrows.throwsSneakyIOException(); + } catch (Exception ex) { + assertEquals("sneaky", ex.getMessage().toString()); + } + } + +} diff --git a/core-java/src/test/java/com/baeldung/socket/EchoIntegrationTest.java b/core-java/src/test/java/com/baeldung/socket/EchoIntegrationTest.java index 2bf6d142bb..70c6e88c49 100644 --- a/core-java/src/test/java/com/baeldung/socket/EchoIntegrationTest.java +++ b/core-java/src/test/java/com/baeldung/socket/EchoIntegrationTest.java @@ -14,7 +14,8 @@ public class EchoIntegrationTest { @BeforeClass public static void start() throws InterruptedException { - Executors.newSingleThreadExecutor().submit(() -> new EchoServer().start(PORT)); + Executors.newSingleThreadExecutor() + .submit(() -> new EchoServer().start(PORT)); Thread.sleep(500); } diff --git a/core-java/src/test/java/com/baeldung/socket/GreetServerIntegrationTest.java b/core-java/src/test/java/com/baeldung/socket/GreetServerIntegrationTest.java index 06b37d8539..4367ed26a2 100644 --- a/core-java/src/test/java/com/baeldung/socket/GreetServerIntegrationTest.java +++ b/core-java/src/test/java/com/baeldung/socket/GreetServerIntegrationTest.java @@ -17,7 +17,8 @@ public class GreetServerIntegrationTest { @BeforeClass public static void start() throws InterruptedException { - Executors.newSingleThreadExecutor().submit(() -> new GreetServer().start(PORT)); + Executors.newSingleThreadExecutor() + .submit(() -> new GreetServer().start(PORT)); Thread.sleep(500); } diff --git a/core-java/src/test/java/com/baeldung/stream/StreamIndicesTest.java b/core-java/src/test/java/com/baeldung/stream/StreamIndicesTest.java new file mode 100644 index 0000000000..a02ef4031e --- /dev/null +++ b/core-java/src/test/java/com/baeldung/stream/StreamIndicesTest.java @@ -0,0 +1,70 @@ +package com.baeldung.stream; + +import com.codepoetics.protonpack.Indexed; +import org.junit.Test; + +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.assertEquals; + +public class StreamIndicesTest { + + @Test + public void whenCalled_thenReturnListOfEvenIndexedStrings() { + String[] names = {"Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim"}; + List expectedResult = Arrays.asList("Afrim", "Besim", "Durim"); + List actualResult = StreamIndices.getEvenIndexedStrings(names); + + assertEquals(expectedResult, actualResult); + } + + @Test + public void whenCalled_thenReturnListOfEvenIndexedStringsVersionTwo() { + String[] names = {"Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim"}; + List expectedResult = Arrays.asList("Afrim", "Besim", "Durim"); + List actualResult = StreamIndices.getEvenIndexedStrings(names); + + assertEquals(expectedResult, actualResult); + } + + @Test + public void whenCalled_thenReturnListOfOddStrings() { + String[] names = {"Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim"}; + List expectedResult = Arrays.asList("Bashkim", "Lulzim", "Shpetim"); + List actualResult = StreamIndices.getOddIndexedStrings(names); + + assertEquals(expectedResult, actualResult); + } + + @Test + public void givenList_whenCalled_thenReturnListOfEvenIndexedStrings() { + List names = Arrays.asList("Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim"); + List> expectedResult = Arrays + .asList(Indexed.index(0, "Afrim"), Indexed.index(2, "Besim"), Indexed + .index(4, "Durim")); + List> actualResult = StreamIndices.getEvenIndexedStrings(names); + + assertEquals(expectedResult, actualResult); + } + + @Test + public void givenList_whenCalled_thenReturnListOfOddIndexedStrings() { + List names = Arrays.asList("Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim"); + List> expectedResult = Arrays + .asList(Indexed.index(1, "Bashkim"), Indexed.index(3, "Lulzim"), Indexed + .index(5, "Shpetim")); + List> actualResult = StreamIndices.getOddIndexedStrings(names); + + assertEquals(expectedResult, actualResult); + } + + @Test + public void whenCalled_thenReturnListOfOddStringsVersionTwo() { + String[] names = {"Afrim", "Bashkim", "Besim", "Lulzim", "Durim", "Shpetim"}; + List expectedResult = Arrays.asList("Bashkim", "Lulzim", "Shpetim"); + List actualResult = StreamIndices.getOddIndexedStringsVersionTwo(names); + + assertEquals(expectedResult, actualResult); + } +} \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/string/CharSequenceVsStringUnitTest.java b/core-java/src/test/java/com/baeldung/string/CharSequenceVsStringUnitTest.java new file mode 100644 index 0000000000..916a3c79ff --- /dev/null +++ b/core-java/src/test/java/com/baeldung/string/CharSequenceVsStringUnitTest.java @@ -0,0 +1,47 @@ +package com.baeldung.string; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; + +public class CharSequenceVsStringUnitTest { + + @Test + public void givenUsingString_whenInstantiatingString_thenWrong() { + CharSequence firstString = "bealdung"; + String secondString = "baeldung"; + + assertNotEquals(firstString, secondString); + } + + @Test + public void givenIdenticalCharSequences_whenCastToString_thenEqual() { + CharSequence charSequence1 = "baeldung_1"; + CharSequence charSequence2 = "baeldung_2"; + + assertTrue(charSequence1.toString().compareTo(charSequence2.toString()) < 0); + } + + @Test + public void givenString_whenAppended_thenUnmodified() { + String test = "a"; + int firstAddressOfTest = System.identityHashCode(test); + test += "b"; + int secondAddressOfTest = System.identityHashCode(test); + + assertNotEquals(firstAddressOfTest, secondAddressOfTest); + } + + @Test + public void givenStringBuilder_whenAppended_thenModified() { + StringBuilder test = new StringBuilder(); + test.append("a"); + int firstAddressOfTest = System.identityHashCode(test); + test.append("b"); + int secondAddressOfTest = System.identityHashCode(test); + + assertEquals(firstAddressOfTest, secondAddressOfTest); + } +} diff --git a/core-java/src/test/java/org/baeldung/java/JavaIoUnitTest.java b/core-java/src/test/java/org/baeldung/java/JavaIoUnitTest.java index 3ab8e1de91..5da68aa746 100644 --- a/core-java/src/test/java/org/baeldung/java/JavaIoUnitTest.java +++ b/core-java/src/test/java/org/baeldung/java/JavaIoUnitTest.java @@ -96,9 +96,12 @@ public class JavaIoUnitTest { // utils private final void logMemory() { - logger.info("Max Memory: {} Mb", Runtime.getRuntime().maxMemory() / 1048576); - logger.info("Total Memory: {} Mb", Runtime.getRuntime().totalMemory() / 1048576); - logger.info("Free Memory: {} Mb", Runtime.getRuntime().freeMemory() / 1048576); + logger.info("Max Memory: {} Mb", Runtime.getRuntime() + .maxMemory() / 1048576); + logger.info("Total Memory: {} Mb", Runtime.getRuntime() + .totalMemory() / 1048576); + logger.info("Free Memory: {} Mb", Runtime.getRuntime() + .freeMemory() / 1048576); } } diff --git a/core-java/src/test/java/org/baeldung/java/JavaRandomUnitTest.java b/core-java/src/test/java/org/baeldung/java/JavaRandomUnitTest.java index a11659547e..f17531e744 100644 --- a/core-java/src/test/java/org/baeldung/java/JavaRandomUnitTest.java +++ b/core-java/src/test/java/org/baeldung/java/JavaRandomUnitTest.java @@ -13,7 +13,6 @@ public class JavaRandomUnitTest { private static final Logger LOG = LoggerFactory.getLogger(JavaRandomUnitTest.class); - // tests - random long @Test @@ -25,7 +24,8 @@ public class JavaRandomUnitTest { @Test public void givenUsingApacheCommons_whenGeneratingRandomLongUnbounded_thenCorrect() { - final long generatedLong = new RandomDataGenerator().getRandomGenerator().nextLong(); + final long generatedLong = new RandomDataGenerator().getRandomGenerator() + .nextLong(); LOG.debug("{}", generatedLong); } @@ -68,7 +68,8 @@ public class JavaRandomUnitTest { @Test public void givenUsingApache_whenGeneratingRandomIntegerUnbounded_thenCorrect() { - final Integer generatedInteger = new RandomDataGenerator().getRandomGenerator().nextInt(); + final Integer generatedInteger = new RandomDataGenerator().getRandomGenerator() + .nextInt(); LOG.debug("{}", generatedInteger); } @@ -93,7 +94,8 @@ public class JavaRandomUnitTest { @Test public void givenUsingApache_whenGeneratingRandomFloatUnbounded_thenCorrect() { - final float generatedFloat = new RandomDataGenerator().getRandomGenerator().nextFloat(); + final float generatedFloat = new RandomDataGenerator().getRandomGenerator() + .nextFloat(); LOG.debug("{}", generatedFloat); } @@ -111,7 +113,8 @@ public class JavaRandomUnitTest { public void givenUsingApache_whenGeneratingRandomFloatBounded_thenCorrect() { final float leftLimit = 1F; final float rightLimit = 10F; - final float randomFloat = new RandomDataGenerator().getRandomGenerator().nextFloat(); + final float randomFloat = new RandomDataGenerator().getRandomGenerator() + .nextFloat(); final float generatedFloat = leftLimit + randomFloat * (rightLimit - leftLimit); LOG.debug("{}", generatedFloat); @@ -128,7 +131,8 @@ public class JavaRandomUnitTest { @Test public void givenUsingApache_whenGeneratingRandomDoubleUnbounded_thenCorrect() { - final double generatedDouble = new RandomDataGenerator().getRandomGenerator().nextDouble(); + final double generatedDouble = new RandomDataGenerator().getRandomGenerator() + .nextDouble(); LOG.debug("{}", generatedDouble); } diff --git a/core-java/src/test/java/org/baeldung/java/JavaTimerLongRunningUnitTest.java b/core-java/src/test/java/org/baeldung/java/JavaTimerLongRunningUnitTest.java index 7a03070e82..826106a09e 100644 --- a/core-java/src/test/java/org/baeldung/java/JavaTimerLongRunningUnitTest.java +++ b/core-java/src/test/java/org/baeldung/java/JavaTimerLongRunningUnitTest.java @@ -15,7 +15,6 @@ public class JavaTimerLongRunningUnitTest { private static final Logger LOG = LoggerFactory.getLogger(JavaTimerLongRunningUnitTest.class); - // tests @Test @@ -23,7 +22,8 @@ public class JavaTimerLongRunningUnitTest { final TimerTask timerTask = new TimerTask() { @Override public void run() { - LOG.debug("Task performed on: " + new Date() + "\n" + "Thread's name: " + Thread.currentThread().getName()); + LOG.debug("Task performed on: " + new Date() + "\n" + "Thread's name: " + Thread.currentThread() + .getName()); } }; final Timer timer = new Timer("Timer"); diff --git a/core-java/src/test/java/org/baeldung/java/diamond/Car.java b/core-java/src/test/java/org/baeldung/java/diamond/Car.java new file mode 100644 index 0000000000..9f923e0f3b --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/diamond/Car.java @@ -0,0 +1,5 @@ +package org.baeldung.java.diamond; + +public class Car implements Vehicle { + +} diff --git a/core-java/src/test/java/org/baeldung/java/diamond/DiamondOperatorUnitTest.java b/core-java/src/test/java/org/baeldung/java/diamond/DiamondOperatorUnitTest.java new file mode 100644 index 0000000000..f6c7f7162f --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/diamond/DiamondOperatorUnitTest.java @@ -0,0 +1,13 @@ +package org.baeldung.java.diamond; + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; + +public class DiamondOperatorUnitTest { + @Test + public void whenCreateCarUsingDiamondOperator_thenSuccess() { + Car myCar = new Car<>(); + assertNotNull(myCar); + } +} diff --git a/core-java/src/test/java/org/baeldung/java/diamond/Diesel.java b/core-java/src/test/java/org/baeldung/java/diamond/Diesel.java new file mode 100644 index 0000000000..dc4256cdae --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/diamond/Diesel.java @@ -0,0 +1,10 @@ +package org.baeldung.java.diamond; + +public class Diesel implements Engine { + + @Override + public void start() { + System.out.println("Started Diesel..."); + } + +} diff --git a/core-java/src/test/java/org/baeldung/java/diamond/Engine.java b/core-java/src/test/java/org/baeldung/java/diamond/Engine.java new file mode 100644 index 0000000000..c18a8f64b5 --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/diamond/Engine.java @@ -0,0 +1,6 @@ +package org.baeldung.java.diamond; + +public interface Engine { + + void start(); +} diff --git a/core-java/src/test/java/org/baeldung/java/diamond/Vehicle.java b/core-java/src/test/java/org/baeldung/java/diamond/Vehicle.java new file mode 100644 index 0000000000..f61cf59620 --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/diamond/Vehicle.java @@ -0,0 +1,5 @@ +package org.baeldung.java.diamond; + +public interface Vehicle { + +} diff --git a/core-java/src/test/java/org/baeldung/java/lists/ListToSTring.java b/core-java/src/test/java/org/baeldung/java/lists/ListToSTring.java new file mode 100644 index 0000000000..3fc26bcb51 --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/lists/ListToSTring.java @@ -0,0 +1,31 @@ +package org.baeldung.java.lists; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; + +public class ListToSTring { + + @Test + public void whenListToString_thenPrintDefault() { + List intLIst = Arrays.asList(1, 2, 3); + System.out.println(intLIst); + } + + @Test + public void whenCollectorsJoining_thenPrintCustom() { + List intList = Arrays.asList(1, 2, 3); + System.out.println(intList.stream() + .map(n -> String.valueOf(n)) + .collect(Collectors.joining("-", "{", "}"))); + } + + @Test + public void whenStringUtilsJoin_thenPrintCustom() { + List intList = Arrays.asList(1, 2, 3); + System.out.println(StringUtils.join(intList, "|")); + } +} diff --git a/core-java/src/test/java/org/baeldung/java/rawtypes/RawTypesTest.java b/core-java/src/test/java/org/baeldung/java/rawtypes/RawTypesTest.java new file mode 100644 index 0000000000..2b36786abf --- /dev/null +++ b/core-java/src/test/java/org/baeldung/java/rawtypes/RawTypesTest.java @@ -0,0 +1,17 @@ +package org.baeldung.java.rawtypes; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class RawTypesTest { + @Test + public void shouldCreateListUsingRawTypes() { + @SuppressWarnings("rawtypes") + List myList = new ArrayList(); + myList.add(new Object()); + myList.add("2"); + myList.add(new Integer(1)); + } +} diff --git a/core-java/src/test/java/org/baeldung/java/sorting/Employee.java b/core-java/src/test/java/org/baeldung/java/sorting/Employee.java index 477092bfcb..99af49c8d3 100644 --- a/core-java/src/test/java/org/baeldung/java/sorting/Employee.java +++ b/core-java/src/test/java/org/baeldung/java/sorting/Employee.java @@ -38,7 +38,8 @@ public class Employee implements Comparable { @Override public boolean equals(Object obj) { - return ((Employee) obj).getName().equals(getName()); + return ((Employee) obj).getName() + .equals(getName()); } @Override @@ -49,7 +50,13 @@ public class Employee implements Comparable { @Override public String toString() { - return new StringBuffer().append("(").append(getName()).append(getAge()).append(",").append(getSalary()).append(")").toString(); + return new StringBuffer().append("(") + .append(getName()) + .append(getAge()) + .append(",") + .append(getSalary()) + .append(")") + .toString(); } } diff --git a/core-java/src/test/java/org/baeldung/java/sorting/JavaSortingUnitTest.java b/core-java/src/test/java/org/baeldung/java/sorting/JavaSortingUnitTest.java index 277e037615..ca9c9b4b5d 100644 --- a/core-java/src/test/java/org/baeldung/java/sorting/JavaSortingUnitTest.java +++ b/core-java/src/test/java/org/baeldung/java/sorting/JavaSortingUnitTest.java @@ -113,7 +113,8 @@ public class JavaSortingUnitTest { sortedMap.put(entry.getKey(), entry.getValue()); } - assertTrue(Arrays.equals(sortedMap.keySet().toArray(), sortedKeys)); + assertTrue(Arrays.equals(sortedMap.keySet() + .toArray(), sortedKeys)); } @Test @@ -127,7 +128,8 @@ public class JavaSortingUnitTest { sortedMap.put(entry.getKey(), entry.getValue()); } - assertTrue(Arrays.equals(sortedMap.values().toArray(), sortedValues)); + assertTrue(Arrays.equals(sortedMap.values() + .toArray(), sortedValues)); } @Test diff --git a/kotlin/README.md b/core-kotlin/README.md similarity index 87% rename from kotlin/README.md rename to core-kotlin/README.md index 91933e94dc..720187dc44 100644 --- a/kotlin/README.md +++ b/core-kotlin/README.md @@ -13,4 +13,7 @@ - [Overview of Kotlin Collections API](http://www.baeldung.com/kotlin-collections-api) - [Converting a List to Map in Kotlin](http://www.baeldung.com/kotlin-list-to-map) - [Data Classes in Kotlin](http://www.baeldung.com/kotlin-data-classes) +- [Delegated Properties in Kotlin](http://www.baeldung.com/kotlin-delegated-properties) +- [Sealed Classes in Kotlin](http://www.baeldung.com/kotlin-sealed-classes) + diff --git a/kotlin/pom.xml b/core-kotlin/pom.xml similarity index 99% rename from kotlin/pom.xml rename to core-kotlin/pom.xml index e88013ab69..856a37ded0 100644 --- a/kotlin/pom.xml +++ b/core-kotlin/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - kotlin + core-kotlin 1.0-SNAPSHOT diff --git a/kotlin/src/main/java/com/baeldung/dataclass/Movie.java b/core-kotlin/src/main/java/com/baeldung/dataclass/Movie.java similarity index 100% rename from kotlin/src/main/java/com/baeldung/dataclass/Movie.java rename to core-kotlin/src/main/java/com/baeldung/dataclass/Movie.java diff --git a/kotlin/src/main/java/com/baeldung/java/ArrayExample.java b/core-kotlin/src/main/java/com/baeldung/java/ArrayExample.java similarity index 100% rename from kotlin/src/main/java/com/baeldung/java/ArrayExample.java rename to core-kotlin/src/main/java/com/baeldung/java/ArrayExample.java diff --git a/kotlin/src/main/java/com/baeldung/java/Customer.java b/core-kotlin/src/main/java/com/baeldung/java/Customer.java similarity index 100% rename from kotlin/src/main/java/com/baeldung/java/Customer.java rename to core-kotlin/src/main/java/com/baeldung/java/Customer.java diff --git a/kotlin/src/main/java/com/baeldung/java/StringUtils.java b/core-kotlin/src/main/java/com/baeldung/java/StringUtils.java similarity index 100% rename from kotlin/src/main/java/com/baeldung/java/StringUtils.java rename to core-kotlin/src/main/java/com/baeldung/java/StringUtils.java diff --git a/kotlin/src/main/java/com/baeldung/lazy/ClassWithHeavyInitialization.java b/core-kotlin/src/main/java/com/baeldung/lazy/ClassWithHeavyInitialization.java similarity index 100% rename from kotlin/src/main/java/com/baeldung/lazy/ClassWithHeavyInitialization.java rename to core-kotlin/src/main/java/com/baeldung/lazy/ClassWithHeavyInitialization.java diff --git a/kotlin/src/main/kotlin/com/baeldung/dataclass/Movie.kt b/core-kotlin/src/main/kotlin/com/baeldung/dataclass/Movie.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/dataclass/Movie.kt rename to core-kotlin/src/main/kotlin/com/baeldung/dataclass/Movie.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/dataclass/Sandbox.kt b/core-kotlin/src/main/kotlin/com/baeldung/dataclass/Sandbox.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/dataclass/Sandbox.kt rename to core-kotlin/src/main/kotlin/com/baeldung/dataclass/Sandbox.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Person.kt b/core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Person.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Person.kt rename to core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Person.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Result.kt b/core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Result.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Result.kt rename to core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Result.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt b/core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt rename to core-kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/Example1.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/Example1.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/Example1.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/Example1.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/Item.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/Item.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/Item.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/Item.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/ItemService.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/ItemService.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/ItemService.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/ItemService.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/JvmSample.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/JvmSample.kt new file mode 100644 index 0000000000..610d5282b2 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/JvmSample.kt @@ -0,0 +1,12 @@ +package com.baeldung.kotlin + +class JvmSample(text:String) { + @JvmField + val sampleText:String = text +} + +class CompanionSample { + companion object { + @JvmField val MAX_LIMIT = 20 + } +} \ No newline at end of file diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/ListExtension.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/ListExtension.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/ListExtension.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/ListExtension.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/MathematicsOperations.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/MathematicsOperations.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/MathematicsOperations.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/MathematicsOperations.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/Sealed.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/Sealed.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/Sealed.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/Sealed.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/User.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/User.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/User.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/User.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/WhenBlockTypes.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/WhenBlockTypes.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/WhenBlockTypes.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/WhenBlockTypes.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/Database.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/Database.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/Database.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/Database.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegate.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegate.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegate.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegate.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/User.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/User.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/User.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/delegates/User.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/mockito/BookService.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/mockito/BookService.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/mockito/BookService.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/mockito/BookService.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/kotlin/mockito/LendBookManager.kt b/core-kotlin/src/main/kotlin/com/baeldung/kotlin/mockito/LendBookManager.kt similarity index 100% rename from kotlin/src/main/kotlin/com/baeldung/kotlin/mockito/LendBookManager.kt rename to core-kotlin/src/main/kotlin/com/baeldung/kotlin/mockito/LendBookManager.kt diff --git a/kotlin/src/test/java/com/baeldung/kotlin/JavaCallToKotlinUnitTest.java b/core-kotlin/src/test/java/com/baeldung/kotlin/JavaCallToKotlinUnitTest.java similarity index 100% rename from kotlin/src/test/java/com/baeldung/kotlin/JavaCallToKotlinUnitTest.java rename to core-kotlin/src/test/java/com/baeldung/kotlin/JavaCallToKotlinUnitTest.java diff --git a/kotlin/src/test/java/com/baeldung/kotlin/LazyJavaUnitTest.java b/core-kotlin/src/test/java/com/baeldung/kotlin/LazyJavaUnitTest.java similarity index 100% rename from kotlin/src/test/java/com/baeldung/kotlin/LazyJavaUnitTest.java rename to core-kotlin/src/test/java/com/baeldung/kotlin/LazyJavaUnitTest.java diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/ArrayTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ArrayTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/ArrayTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/ArrayTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/CustomerTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CustomerTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/CustomerTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/CustomerTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/EqualityTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/EqualityTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/EqualityTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/EqualityTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/GenericsTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/GenericsTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/GenericsTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/GenericsTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/ItemServiceTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ItemServiceTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/ItemServiceTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/ItemServiceTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/JvmSampleTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/JvmSampleTest.kt new file mode 100644 index 0000000000..abe6edec92 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/JvmSampleTest.kt @@ -0,0 +1,26 @@ +package com.baeldung.kotlin + +import org.junit.Before +import org.junit.Test +import kotlin.test.assertTrue + +class JvmSampleTest { + + var sample = "" + + @Before + fun setUp() { + sample = JvmSample("Hello!").sampleText + } + + @Test + fun givenField_whenCheckValue_thenMatchesValue() { + assertTrue(sample == "Hello!") + } + + @Test + fun givenStaticVariable_whenCheckValue_thenMatchesValue() { + // Sample when is treated as a static variable + assertTrue(CompanionSample.MAX_LIMIT == 20) + } +} \ No newline at end of file diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/KotlinJavaInteroperabilityTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/KotlinJavaInteroperabilityTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/KotlinJavaInteroperabilityTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/KotlinJavaInteroperabilityTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/LambdaTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/LambdaTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/LambdaTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/LambdaTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/LazyUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/LazyUnitTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/LazyUnitTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/LazyUnitTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/ListExtensionTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ListExtensionTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/ListExtensionTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/ListExtensionTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/ListToMapTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ListToMapTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/ListToMapTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/ListToMapTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/NullSafetyTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/NullSafetyTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/NullSafetyTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/NullSafetyTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/SealedTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/SealedTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/SealedTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/SealedTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/WhenBlockUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/WhenBlockUnitTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/WhenBlockUnitTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/WhenBlockUnitTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegatesTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegatesTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegatesTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/delegates/DatabaseDelegatesTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/mockito/LendBookManagerTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/mockito/LendBookManagerTest.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/mockito/LendBookManagerTest.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/mockito/LendBookManagerTest.kt diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/mockito/LendBookManagerTestMockitoKotlin.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/mockito/LendBookManagerTestMockitoKotlin.kt similarity index 100% rename from kotlin/src/test/kotlin/com/baeldung/kotlin/mockito/LendBookManagerTestMockitoKotlin.kt rename to core-kotlin/src/test/kotlin/com/baeldung/kotlin/mockito/LendBookManagerTestMockitoKotlin.kt diff --git a/couchbase/.gitignore b/couchbase/.gitignore new file mode 100644 index 0000000000..f6867e01bd --- /dev/null +++ b/couchbase/.gitignore @@ -0,0 +1,6 @@ +# Created by .ignore support plugin (hsz.mobi) + +# IntelliJ project files +.idea +*.iml +/target/ diff --git a/couchbase-sdk/README.md b/couchbase/README.md similarity index 100% rename from couchbase-sdk/README.md rename to couchbase/README.md diff --git a/couchbase-sdk/mvnw b/couchbase/mvnw old mode 100755 new mode 100644 similarity index 100% rename from couchbase-sdk/mvnw rename to couchbase/mvnw diff --git a/couchbase-sdk/mvnw.cmd b/couchbase/mvnw.cmd similarity index 100% rename from couchbase-sdk/mvnw.cmd rename to couchbase/mvnw.cmd diff --git a/couchbase-sdk/pom.xml b/couchbase/pom.xml similarity index 88% rename from couchbase-sdk/pom.xml rename to couchbase/pom.xml index fd9e1b08f6..c79ce853d0 100644 --- a/couchbase-sdk/pom.xml +++ b/couchbase/pom.xml @@ -6,7 +6,7 @@ couchbase-sdk 0.1-SNAPSHOT jar - couchbase-sdk + couchbase Couchbase SDK Tutorials @@ -23,6 +23,12 @@ ${couchbase.client.version} + + com.fasterxml.jackson.core + jackson-databind + ${jackson-version} + + org.springframework @@ -67,9 +73,10 @@ 1.8 UTF-8 - 2.4.0 + 2.5.0 4.3.5.RELEASE 3.5 + 2.9.1 diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/CouchbaseEntity.java b/couchbase/src/main/java/com/baeldung/couchbase/async/CouchbaseEntity.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/CouchbaseEntity.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/CouchbaseEntity.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/person/Person.java b/couchbase/src/main/java/com/baeldung/couchbase/async/person/Person.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/person/Person.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/person/Person.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/person/PersonCrudService.java b/couchbase/src/main/java/com/baeldung/couchbase/async/person/PersonCrudService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/person/PersonCrudService.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/person/PersonCrudService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/person/PersonDocumentConverter.java b/couchbase/src/main/java/com/baeldung/couchbase/async/person/PersonDocumentConverter.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/person/PersonDocumentConverter.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/person/PersonDocumentConverter.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/person/RegistrationService.java b/couchbase/src/main/java/com/baeldung/couchbase/async/person/RegistrationService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/person/RegistrationService.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/person/RegistrationService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/AbstractBucketService.java b/couchbase/src/main/java/com/baeldung/couchbase/async/service/AbstractBucketService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/AbstractBucketService.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/service/AbstractBucketService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/AbstractCrudService.java b/couchbase/src/main/java/com/baeldung/couchbase/async/service/AbstractCrudService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/AbstractCrudService.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/service/AbstractCrudService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/BucketService.java b/couchbase/src/main/java/com/baeldung/couchbase/async/service/BucketService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/BucketService.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/service/BucketService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/ClusterService.java b/couchbase/src/main/java/com/baeldung/couchbase/async/service/ClusterService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/ClusterService.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/service/ClusterService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/ClusterServiceImpl.java b/couchbase/src/main/java/com/baeldung/couchbase/async/service/ClusterServiceImpl.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/ClusterServiceImpl.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/service/ClusterServiceImpl.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/CrudService.java b/couchbase/src/main/java/com/baeldung/couchbase/async/service/CrudService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/CrudService.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/service/CrudService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/JsonDocumentConverter.java b/couchbase/src/main/java/com/baeldung/couchbase/async/service/JsonDocumentConverter.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/JsonDocumentConverter.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/service/JsonDocumentConverter.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/TutorialBucketService.java b/couchbase/src/main/java/com/baeldung/couchbase/async/service/TutorialBucketService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/async/service/TutorialBucketService.java rename to couchbase/src/main/java/com/baeldung/couchbase/async/service/TutorialBucketService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/intro/CodeSnippets.java b/couchbase/src/main/java/com/baeldung/couchbase/intro/CodeSnippets.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/intro/CodeSnippets.java rename to couchbase/src/main/java/com/baeldung/couchbase/intro/CodeSnippets.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/CouchbaseKeyGenerator.java b/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/CouchbaseKeyGenerator.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/CouchbaseKeyGenerator.java rename to couchbase/src/main/java/com/baeldung/couchbase/mapreduce/CouchbaseKeyGenerator.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/DuplicateKeyException.java b/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/DuplicateKeyException.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/DuplicateKeyException.java rename to couchbase/src/main/java/com/baeldung/couchbase/mapreduce/DuplicateKeyException.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/RandomUUIDGenerator.java b/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/RandomUUIDGenerator.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/RandomUUIDGenerator.java rename to couchbase/src/main/java/com/baeldung/couchbase/mapreduce/RandomUUIDGenerator.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/StudentGrade.java b/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGrade.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/StudentGrade.java rename to couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGrade.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeKeyGenerator.java b/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeKeyGenerator.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeKeyGenerator.java rename to couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeKeyGenerator.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeQueryBuilder.java b/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeQueryBuilder.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeQueryBuilder.java rename to couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeQueryBuilder.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeService.java b/couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeService.java rename to couchbase/src/main/java/com/baeldung/couchbase/mapreduce/StudentGradeService.java diff --git a/couchbase/src/main/java/com/baeldung/couchbase/n1ql/BucketFactory.java b/couchbase/src/main/java/com/baeldung/couchbase/n1ql/BucketFactory.java new file mode 100644 index 0000000000..98fbe17e60 --- /dev/null +++ b/couchbase/src/main/java/com/baeldung/couchbase/n1ql/BucketFactory.java @@ -0,0 +1,26 @@ +package com.baeldung.couchbase.n1ql; + +import com.couchbase.client.java.Bucket; +import com.couchbase.client.java.Cluster; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class BucketFactory { + + @Autowired + private Cluster cluster; + + private Bucket travelSampleBucket; + private Bucket testBucket; + + public Bucket getTravelSampleBucket() { + return (travelSampleBucket != null) ? + travelSampleBucket : cluster.openBucket("travel-sample"); + } + + public Bucket getTestBucket() { + return (testBucket != null) ? + testBucket : cluster.openBucket("test"); + } +} diff --git a/couchbase/src/main/java/com/baeldung/couchbase/n1ql/CodeSnippets.java b/couchbase/src/main/java/com/baeldung/couchbase/n1ql/CodeSnippets.java new file mode 100644 index 0000000000..45067911cb --- /dev/null +++ b/couchbase/src/main/java/com/baeldung/couchbase/n1ql/CodeSnippets.java @@ -0,0 +1,34 @@ +package com.baeldung.couchbase.n1ql; + +import com.couchbase.client.java.query.N1qlQueryResult; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.IOException; +import java.util.List; +import java.util.Objects; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +public class CodeSnippets { + + private static ObjectMapper objectMapper = new ObjectMapper(); + + private static final Logger logger = Logger.getLogger(CodeSnippets.class.getName()); + + public static List extractJsonResult(N1qlQueryResult result) { + return result.allRows().stream() + .map(row -> { + try { + return objectMapper.readTree(row.value().toString()); + }catch (IOException e) { + logger.log(Level.WARNING, e.getLocalizedMessage()); + return null; + } + }) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + } + +} diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/person/Person.java b/couchbase/src/main/java/com/baeldung/couchbase/spring/person/Person.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/person/Person.java rename to couchbase/src/main/java/com/baeldung/couchbase/spring/person/Person.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/person/PersonCrudService.java b/couchbase/src/main/java/com/baeldung/couchbase/spring/person/PersonCrudService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/person/PersonCrudService.java rename to couchbase/src/main/java/com/baeldung/couchbase/spring/person/PersonCrudService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/person/PersonDocumentConverter.java b/couchbase/src/main/java/com/baeldung/couchbase/spring/person/PersonDocumentConverter.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/person/PersonDocumentConverter.java rename to couchbase/src/main/java/com/baeldung/couchbase/spring/person/PersonDocumentConverter.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/person/RegistrationService.java b/couchbase/src/main/java/com/baeldung/couchbase/spring/person/RegistrationService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/person/RegistrationService.java rename to couchbase/src/main/java/com/baeldung/couchbase/spring/person/RegistrationService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/service/BucketService.java b/couchbase/src/main/java/com/baeldung/couchbase/spring/service/BucketService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/service/BucketService.java rename to couchbase/src/main/java/com/baeldung/couchbase/spring/service/BucketService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/service/ClusterService.java b/couchbase/src/main/java/com/baeldung/couchbase/spring/service/ClusterService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/service/ClusterService.java rename to couchbase/src/main/java/com/baeldung/couchbase/spring/service/ClusterService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/service/ClusterServiceImpl.java b/couchbase/src/main/java/com/baeldung/couchbase/spring/service/ClusterServiceImpl.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/service/ClusterServiceImpl.java rename to couchbase/src/main/java/com/baeldung/couchbase/spring/service/ClusterServiceImpl.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/service/CrudService.java b/couchbase/src/main/java/com/baeldung/couchbase/spring/service/CrudService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/service/CrudService.java rename to couchbase/src/main/java/com/baeldung/couchbase/spring/service/CrudService.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/service/JsonDocumentConverter.java b/couchbase/src/main/java/com/baeldung/couchbase/spring/service/JsonDocumentConverter.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/service/JsonDocumentConverter.java rename to couchbase/src/main/java/com/baeldung/couchbase/spring/service/JsonDocumentConverter.java diff --git a/couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/service/TutorialBucketService.java b/couchbase/src/main/java/com/baeldung/couchbase/spring/service/TutorialBucketService.java similarity index 100% rename from couchbase-sdk/src/main/java/com/baeldung/couchbase/spring/service/TutorialBucketService.java rename to couchbase/src/main/java/com/baeldung/couchbase/spring/service/TutorialBucketService.java diff --git a/couchbase/src/main/resources/application.properties b/couchbase/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/couchbase-sdk/src/test/resources/logback.xml b/couchbase/src/main/resources/logback.xml similarity index 100% rename from couchbase-sdk/src/test/resources/logback.xml rename to couchbase/src/main/resources/logback.xml diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTest.java b/couchbase/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTest.java similarity index 100% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTest.java rename to couchbase/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTest.java diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTestConfig.java b/couchbase/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTestConfig.java similarity index 100% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTestConfig.java rename to couchbase/src/test/java/com/baeldung/couchbase/async/AsyncIntegrationTestConfig.java diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceIntegrationTest.java b/couchbase/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceIntegrationTest.java similarity index 100% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceIntegrationTest.java rename to couchbase/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceIntegrationTest.java diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceIntegrationTest.java b/couchbase/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceIntegrationTest.java similarity index 100% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceIntegrationTest.java rename to couchbase/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceIntegrationTest.java diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/mapreduce/StudentGradeServiceIntegrationTest.java b/couchbase/src/test/java/com/baeldung/couchbase/mapreduce/StudentGradeServiceIntegrationTest.java similarity index 100% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/mapreduce/StudentGradeServiceIntegrationTest.java rename to couchbase/src/test/java/com/baeldung/couchbase/mapreduce/StudentGradeServiceIntegrationTest.java diff --git a/couchbase/src/test/java/com/baeldung/couchbase/n1ql/IntegrationTestConfig.java b/couchbase/src/test/java/com/baeldung/couchbase/n1ql/IntegrationTestConfig.java new file mode 100644 index 0000000000..ef7e31b224 --- /dev/null +++ b/couchbase/src/test/java/com/baeldung/couchbase/n1ql/IntegrationTestConfig.java @@ -0,0 +1,26 @@ +package com.baeldung.couchbase.n1ql; + +import com.couchbase.client.java.Cluster; +import com.couchbase.client.java.CouchbaseCluster; +import com.couchbase.client.java.env.CouchbaseEnvironment; +import com.couchbase.client.java.env.DefaultCouchbaseEnvironment; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +import java.util.concurrent.TimeUnit; + +@Configuration +@ComponentScan(basePackages = { "com.baeldung.couchbase.n1ql" }) +public class IntegrationTestConfig { + + @Bean + public Cluster cluster() { + CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder() + .connectTimeout(60000) + .build(); + return CouchbaseCluster.create(env, "127.0.0.1"); + } + + +} diff --git a/couchbase/src/test/java/com/baeldung/couchbase/n1ql/N1QLIntegrationTest.java b/couchbase/src/test/java/com/baeldung/couchbase/n1ql/N1QLIntegrationTest.java new file mode 100644 index 0000000000..8112d7d222 --- /dev/null +++ b/couchbase/src/test/java/com/baeldung/couchbase/n1ql/N1QLIntegrationTest.java @@ -0,0 +1,248 @@ +package com.baeldung.couchbase.n1ql; + +import com.couchbase.client.java.Bucket; +import com.couchbase.client.java.Cluster; +import com.couchbase.client.java.document.JsonDocument; +import com.couchbase.client.java.document.json.JsonArray; +import com.couchbase.client.java.document.json.JsonObject; +import com.couchbase.client.java.query.N1qlQuery; +import com.couchbase.client.java.query.N1qlQueryResult; +import com.couchbase.client.java.query.N1qlQueryRow; +import com.couchbase.client.java.query.Statement; +import com.fasterxml.jackson.databind.JsonNode; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import rx.Observable; + +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static com.baeldung.couchbase.n1ql.CodeSnippets.extractJsonResult; +import static com.couchbase.client.java.query.Select.select; +import static com.couchbase.client.java.query.dsl.Expression.*; +import static org.junit.Assert.assertNotNull; + + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { IntegrationTestConfig.class }) +public class N1QLIntegrationTest { + + + @Autowired + private Cluster cluster; + + @Autowired + private BucketFactory bucketFactory; + + @Test + public void givenAutowiredCluster_whenNotNull_thenNotNull() { + assertNotNull(cluster); + } + + @Test + public void givenBucketFactory_whenGetTestBucket_thenNotNull() { + assertNotNull(bucketFactory.getTestBucket()); + } + + @Test + public void givenBucketFactory_whenGetTravelSampleBucket_thenNotNull() { + assertNotNull(bucketFactory.getTravelSampleBucket()); + } + + @Test + public void givenDocument_whenInsert_thenResult() { + Bucket bucket = bucketFactory.getTestBucket(); + JsonObject personObj = JsonObject.create() + .put("name", "John") + .put("email", "john@doe.com") + .put("interests", JsonArray.from("Java", "Nigerian Jollof")); + + String id = UUID.randomUUID().toString(); + JsonDocument doc = JsonDocument.create(id, personObj); + bucket.insert(doc); + assertNotNull(bucket.get(id)); + } + + @Test + public void whenBasicSelectQuery_thenGetQueryResult() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + N1qlQueryResult result + = bucket.query(N1qlQuery.simple("SELECT * FROM test")); + + result.forEach(System.out::println); + + System.out.println("result count: " + result.info().resultCount()); + System.out.println("error count: " + result.info().errorCount()); + } + + @Test + public void givenSelectStatement_whenQuery_thenResult() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + String query = "SELECT name FROM `travel-sample` " + + "WHERE type = 'airport' LIMIT 100"; + N1qlQueryResult result1 = bucket.query(N1qlQuery.simple(query)); + + System.out.println("Result Count " + result1.info().resultCount()); + + N1qlQueryRow row = result1.allRows().get(0); + JsonObject rowJson = row.value(); + System.out.println("Name in First Row " + rowJson.get("name")); + + } + + @Test + public void givenSelectStatement2_whenQuery_thenResult() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + JsonObject pVal = JsonObject.create().put("type", "airport"); + String query = "SELECT * FROM `travel-sample` " + + "WHERE type = $type LIMIT 100"; + N1qlQueryResult r2 = bucket.query(N1qlQuery.parameterized(query, pVal)); + + System.out.println(r2.allRows()); + + List list = extractJsonResult(r2); + System.out.println( + list.get(0).get("travel-sample").get("airportname").asText()); + } + + @Test + public void givenSelectDSL_whenQuery_thenResult() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + Statement statement = select("*") + .from(i("travel-sample")) + .where(x("type").eq(s("airport"))) + .limit(100); + N1qlQueryResult r3 = bucket.query(N1qlQuery.simple(statement)); + + List list2 = extractJsonResult(r3); + System.out.println("First Airport Name: " + list2.get(0).get("travel-sample").get("airportname").asText()); + + } + + @Test + public void givenSelectStatementWithOperators_whenQuery_thenResult() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + String query2 = "SELECT t.city, " + + "t.airportname || \" (\" || t.faa || \")\" AS portname_faa " + + "FROM `travel-sample` t " + + "WHERE t.type=\"airport\"" + + "AND t.country LIKE '%States'" + + "AND t.geo.lat >= 70 " + + "LIMIT 2"; + N1qlQueryResult r4 = bucket.query(N1qlQuery.simple(query2)); + List list3 = extractJsonResult(r4); + System.out.println("First Doc : " + list3.get(0)); + } + + @Test + public void givenSelectStatementWithDSL2_whenQuery_thenResult() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + Statement st2 = select( + x("t.city, t.airportname") + .concat(s(" (")).concat(x("t.faa")).concat(s(")")).as("portname_faa")) + .from(i("travel-sample").as("t")) + .where( x("t.type").eq(s("airport")) + .and(x("t.country").like(s("%States"))) + .and(x("t.geo.lat").gte(70))) + .limit(2); + N1qlQueryResult r5 = bucket.query(N1qlQuery.simple(st2)); + List list5 = extractJsonResult(r5); + System.out.println("First Doc : " + list5.get(0)); + System.out.println("Query from Statement2: " + st2.toString()); + } + + @Test + public void givenInsertStatement_whenQuery_thenUpdate() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + String query = "INSERT INTO `travel-sample` (KEY, VALUE) " + + " VALUES(" + + "\"cust1293\", " + + "{\"id\":\"1293\",\"name\":\"Sample Airline\", \"type\":\"airline\"})" + + " RETURNING META().id as docid, *"; + N1qlQueryResult r1 = bucket.query(N1qlQuery.simple(query)); + r1.forEach(System.out::println); + } + + @Test + public void givenDocument_whenInsert_thenResults() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + JsonObject ob = JsonObject.create() + .put("id", "1293") + .put("name", "Sample Airline") + .put("type", "airline"); + bucket.insert(JsonDocument.create("cust1295", ob)); + } + + @Test + public void givenDocuments_whenBatchInsert_thenResult() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + + List documents = IntStream.rangeClosed(0,10) + .mapToObj( i -> { + JsonObject content = JsonObject.create() + .put("id", i) + .put("type", "airline") + .put("name", "Sample Airline " + i); + return JsonDocument.create("cust_" + i, content); + }) + .collect(Collectors.toList()); + + List r5 = Observable + .from(documents) + .flatMap(doc -> bucket.async().insert(doc)) + .toList() + .last() + .toBlocking() + .single(); + + r5.forEach(System.out::println); + } + + @Test + public void givenUpdateStatement_whenQuery_thenUpdate() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + String query2 = "UPDATE `travel-sample` USE KEYS \"cust_1\" " + + "SET name=\"Sample Airline Updated\" RETURNING name"; + N1qlQueryResult result = bucket.query(N1qlQuery.simple(query2)); + result.forEach(System.out::println); + } + + @Test + public void givenDocument_whenUpsert_thenUpdate() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + JsonObject o2 = JsonObject.create() + .put("name", "Sample Airline Updated"); + bucket.upsert(JsonDocument.create("cust_1", o2)); + } + + @Test + public void givenUnestUpdateStatement_whenQuery_thenResult() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + String query3 = "UPDATE `travel-sample` USE KEYS \"cust_2\" " + + "UNSET name RETURNING *"; + N1qlQueryResult result1 = bucket.query(N1qlQuery.simple(query3)); + result1.forEach(System.out::println); + } + + @Test + public void givenDeleteStatement_whenQuery_thenDelete() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + String query4 = "DELETE FROM `travel-sample` USE KEYS \"cust_50\""; + N1qlQueryResult result4 = bucket.query(N1qlQuery.simple(query4)); + } + + @Test + public void givenDeleteStatement2_whenQuery_thenDelete() { + Bucket bucket = bucketFactory.getTravelSampleBucket(); + String query5 = "DELETE FROM `travel-sample` WHERE id = 0 RETURNING *"; + N1qlQueryResult result5 = bucket.query(N1qlQuery.simple(query5)); + } + + +} diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/IntegrationTest.java b/couchbase/src/test/java/com/baeldung/couchbase/spring/IntegrationTest.java similarity index 100% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/IntegrationTest.java rename to couchbase/src/test/java/com/baeldung/couchbase/spring/IntegrationTest.java diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/IntegrationTestConfig.java b/couchbase/src/test/java/com/baeldung/couchbase/spring/IntegrationTestConfig.java similarity index 100% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/IntegrationTestConfig.java rename to couchbase/src/test/java/com/baeldung/couchbase/spring/IntegrationTestConfig.java diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceIntegrationTest.java b/couchbase/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceIntegrationTest.java similarity index 100% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceIntegrationTest.java rename to couchbase/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceIntegrationTest.java diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceIntegrationTest.java b/couchbase/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceIntegrationTest.java similarity index 100% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceIntegrationTest.java rename to couchbase/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceIntegrationTest.java diff --git a/couchbase/src/test/resources/logback.xml b/couchbase/src/test/resources/logback.xml new file mode 100644 index 0000000000..ec0dc2469a --- /dev/null +++ b/couchbase/src/test/resources/logback.xml @@ -0,0 +1,19 @@ + + + + + web - %date [%thread] %-5level %logger{36} - %message%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ejb/ejbclient/src/main/java/com/baeldung/ejbclient/application/TextApplication.java b/ejb/ejb-client/src/main/java/com/baeldung/ejb/wildfly/TextApplication.java similarity index 92% rename from ejb/ejbclient/src/main/java/com/baeldung/ejbclient/application/TextApplication.java rename to ejb/ejb-client/src/main/java/com/baeldung/ejb/wildfly/TextApplication.java index b65c21100d..3b63761c73 100644 --- a/ejb/ejbclient/src/main/java/com/baeldung/ejbclient/application/TextApplication.java +++ b/ejb/ejb-client/src/main/java/com/baeldung/ejb/wildfly/TextApplication.java @@ -1,7 +1,5 @@ -package com.baeldung.ejbclient.application; +package com.baeldung.ejb.wildfly; -import com.baeldung.ejbmodule.TextProcessorBean; -import com.baeldung.ejbmodule.TextProcessorRemote; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; diff --git a/ejb/ejbclient/src/test/java/com/baeldung/ejbclient/application/TextApplicationTest.java b/ejb/ejb-client/src/test/java/com/baeldung/ejb/wildfly/TextApplicationTest.java similarity index 94% rename from ejb/ejbclient/src/test/java/com/baeldung/ejbclient/application/TextApplicationTest.java rename to ejb/ejb-client/src/test/java/com/baeldung/ejb/wildfly/TextApplicationTest.java index 947c72d0b0..c0446eaea6 100644 --- a/ejb/ejbclient/src/test/java/com/baeldung/ejbclient/application/TextApplicationTest.java +++ b/ejb/ejb-client/src/test/java/com/baeldung/ejb/wildfly/TextApplicationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.ejbclient.application; +package com.baeldung.ejb.wildfly; import org.junit.AfterClass; import org.junit.BeforeClass; diff --git a/ejb/ejbmodule/src/main/java/com/baeldung/ejbmodule/TextProcessorBean.java b/ejb/ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorBean.java similarity index 85% rename from ejb/ejbmodule/src/main/java/com/baeldung/ejbmodule/TextProcessorBean.java rename to ejb/ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorBean.java index dc0db5fc53..4f0c013b0f 100644 --- a/ejb/ejbmodule/src/main/java/com/baeldung/ejbmodule/TextProcessorBean.java +++ b/ejb/ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorBean.java @@ -1,4 +1,4 @@ -package com.baeldung.ejbmodule; +package com.baeldung.ejb.wildfly; import javax.ejb.Stateless; diff --git a/ejb/ejbmodule/src/main/java/com/baeldung/ejbmodule/TextProcessorRemote.java b/ejb/ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorRemote.java similarity index 76% rename from ejb/ejbmodule/src/main/java/com/baeldung/ejbmodule/TextProcessorRemote.java rename to ejb/ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorRemote.java index 680d8f4e10..b51af8528d 100644 --- a/ejb/ejbmodule/src/main/java/com/baeldung/ejbmodule/TextProcessorRemote.java +++ b/ejb/ejb-remote/src/main/java/com/baeldung/ejb/wildfly/TextProcessorRemote.java @@ -1,4 +1,4 @@ -package com.baeldung.ejbmodule; +package com.baeldung.ejb.wildfly; import javax.ejb.Remote; diff --git a/ejb/ejbclient/src/main/resources/jboss-ejb-client.properties b/ejb/ejbclient/src/main/resources/jboss-ejb-client.properties deleted file mode 100644 index 67533b7825..0000000000 --- a/ejb/ejbclient/src/main/resources/jboss-ejb-client.properties +++ /dev/null @@ -1,8 +0,0 @@ -endpoint.name=client-endpoint -remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false -remote.connections=default -remote.connection.default.host=127.0.0.1 -remote.connection.default.port=8080 -remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false -remote.connection.default.username=myusername -remote.connection.default.password=mypassword \ No newline at end of file diff --git a/ejb/ejbmodule/src/test/java/com/baeldung/ejbmodule/TextProcessorBeanTest.java b/ejb/ejbmodule/src/test/java/com/baeldung/ejbmodule/TextProcessorBeanTest.java deleted file mode 100644 index d8693420d4..0000000000 --- a/ejb/ejbmodule/src/test/java/com/baeldung/ejbmodule/TextProcessorBeanTest.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.ejbmodule; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -public class TextProcessorBeanTest { - @Test - public void givenInputString_whenComparedToStringParsedByBean_thenSuccessful() { - TextProcessorBean textProcessor = new TextProcessorBean(); - assertEquals("TEST", textProcessor.processText("test")); - } -} \ No newline at end of file diff --git a/ejb/pom.xml b/ejb/pom.xml index b8aa32fab1..78e40a7b7c 100755 --- a/ejb/pom.xml +++ b/ejb/pom.xml @@ -81,6 +81,5 @@ ejb-remote ejb-client ejb-session-beans - ejb-session-beans-client \ No newline at end of file diff --git a/ethereumj/.gitgnore b/ethereumj/.gitgnore new file mode 100644 index 0000000000..9cff80e071 --- /dev/null +++ b/ethereumj/.gitgnore @@ -0,0 +1,6 @@ +.idea +target +database +logs +target +*.iml \ No newline at end of file diff --git a/ethereumj/README.md b/ethereumj/README.md new file mode 100644 index 0000000000..54da91b4f7 --- /dev/null +++ b/ethereumj/README.md @@ -0,0 +1,4 @@ +## EthereumJ + +### Relevant Articles: +- [Introduction to EthereumJ](http://www.baeldung.com/intro-to-ethereumj) \ No newline at end of file diff --git a/ethereumj/pom.xml b/ethereumj/pom.xml new file mode 100644 index 0000000000..c9f5924d7a --- /dev/null +++ b/ethereumj/pom.xml @@ -0,0 +1,110 @@ + + + 4.0.0 + com.baeldung.ethereumj + ethereumj + war + 1.0.0 + ethereumj + + + UTF-8 + 1.8 + 8.5.4 + + + + org.springframework.boot + spring-boot-starter-parent + 1.5.6.RELEASE + + + + + Ethereum + Ethereum + https://dl.bintray.com/ethereum/maven/ + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + + org.springframework.boot + spring-boot-starter-test + 1.5.6.RELEASE + test + + + + + org.ethereum + ethereumj-core + 1.5.0-RELEASE + + + + + javax.servlet + jstl + + + com.fasterxml.jackson.core + jackson-databind + 2.5.0 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + ethereumj + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + none + + + */EthControllerTestOne.java + + + + + + + + + + \ No newline at end of file diff --git a/ethereumj/src/main/java/com/baeldung/ethereumj/ApplicationMain.java b/ethereumj/src/main/java/com/baeldung/ethereumj/ApplicationMain.java new file mode 100644 index 0000000000..4735548bd1 --- /dev/null +++ b/ethereumj/src/main/java/com/baeldung/ethereumj/ApplicationMain.java @@ -0,0 +1,16 @@ +package com.baeldung.ethereumj; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.web.support.SpringBootServletInitializer; + +@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) +@SpringBootApplication +public class ApplicationMain extends SpringBootServletInitializer { + + public static void main(String[] args) { + SpringApplication.run(ApplicationMain.class, args); + } +} \ No newline at end of file diff --git a/ethereumj/src/main/java/com/baeldung/ethereumj/Constants.java b/ethereumj/src/main/java/com/baeldung/ethereumj/Constants.java new file mode 100644 index 0000000000..919958be35 --- /dev/null +++ b/ethereumj/src/main/java/com/baeldung/ethereumj/Constants.java @@ -0,0 +1,9 @@ +package com.baeldung.ethereumj; + +public class Constants { + + public static final String ENDPOINT_ONE = "/api/get/bestblock/"; + public static final String ENDPOINT_TWO = "/api/get/difficulty/"; + public static final String RESPONSE_TYPE ="application/json/"; + +} diff --git a/ethereumj/src/main/java/com/baeldung/ethereumj/beans/EthBean.java b/ethereumj/src/main/java/com/baeldung/ethereumj/beans/EthBean.java new file mode 100644 index 0000000000..7680473c6e --- /dev/null +++ b/ethereumj/src/main/java/com/baeldung/ethereumj/beans/EthBean.java @@ -0,0 +1,25 @@ +package com.baeldung.ethereumj.beans; + +import com.baeldung.ethereumj.listeners.EthListener; +import org.ethereum.core.Block; +import org.ethereum.facade.Ethereum; +import org.ethereum.facade.EthereumFactory; + +import java.math.BigInteger; + +public class EthBean { + private Ethereum ethereum; + + public void start() { + this.ethereum = EthereumFactory.createEthereum(); + this.ethereum.addListener(new EthListener(ethereum)); + } + + public Block getBestBlock() { + return this.ethereum.getBlockchain().getBestBlock(); + } + + public BigInteger getTotalDifficulty() { + return this.ethereum.getBlockchain().getTotalDifficulty(); + } +} \ No newline at end of file diff --git a/ethereumj/src/main/java/com/baeldung/ethereumj/config/EthConfig.java b/ethereumj/src/main/java/com/baeldung/ethereumj/config/EthConfig.java new file mode 100644 index 0000000000..8180cc3ce2 --- /dev/null +++ b/ethereumj/src/main/java/com/baeldung/ethereumj/config/EthConfig.java @@ -0,0 +1,18 @@ +package com.baeldung.ethereumj.config; + +import com.baeldung.ethereumj.beans.EthBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.concurrent.Executors; + +@Configuration +public class EthConfig { + + @Bean + EthBean ethBeanConfig() throws Exception { + EthBean eBean = new EthBean(); + Executors.newSingleThreadExecutor().submit(eBean::start); + return eBean; + } +} \ No newline at end of file diff --git a/ethereumj/src/main/java/com/baeldung/ethereumj/controllers/EthController.java b/ethereumj/src/main/java/com/baeldung/ethereumj/controllers/EthController.java new file mode 100644 index 0000000000..8240d60e30 --- /dev/null +++ b/ethereumj/src/main/java/com/baeldung/ethereumj/controllers/EthController.java @@ -0,0 +1,44 @@ +package com.baeldung.ethereumj.controllers; + +import com.baeldung.ethereumj.Constants; +import com.baeldung.ethereumj.beans.EthBean; +import com.baeldung.ethereumj.transfer.EthResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.PostConstruct; +import javax.servlet.ServletContext; + +@RestController +public class EthController { + + @Autowired + EthBean ethBean; + @Autowired + private ServletContext servletContext; + private Logger l = LoggerFactory.getLogger(EthController.class); + + @RequestMapping(Constants.ENDPOINT_ONE) + public EthResponse getBestBlock() { + l.debug("Request received - fetching best block."); + EthResponse r = new EthResponse(); + r.setResponse(ethBean.getBestBlock().toString()); + return r; + } + + @RequestMapping(Constants.ENDPOINT_TWO) + public EthResponse getTotalDifficulty() { + l.debug("Request received - calculating total difficulty."); + EthResponse r = new EthResponse(); + r.setResponse(ethBean.getTotalDifficulty().toString()); + return r; + } + + @PostConstruct + public void showIt() { + l.debug(servletContext.getContextPath()); + } +} diff --git a/ethereumj/src/main/java/com/baeldung/ethereumj/listeners/EthListener.java b/ethereumj/src/main/java/com/baeldung/ethereumj/listeners/EthListener.java new file mode 100644 index 0000000000..c3a5143fdb --- /dev/null +++ b/ethereumj/src/main/java/com/baeldung/ethereumj/listeners/EthListener.java @@ -0,0 +1,71 @@ +package com.baeldung.ethereumj.listeners; + +import org.ethereum.core.Block; +import org.ethereum.core.TransactionReceipt; +import org.ethereum.facade.Ethereum; +import org.ethereum.listener.EthereumListenerAdapter; +import org.ethereum.util.BIUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.math.BigInteger; +import java.util.List; + +public class EthListener extends EthereumListenerAdapter { + + private Logger l = LoggerFactory.getLogger(EthListener.class); + private Ethereum ethereum; + private boolean syncDone = false; + private static final int thou = 1000; + + private void out(String t) { + l.info(t); + } + + private String calcNetHashRate(Block block) { + String response = "Net hash rate not available"; + if (block.getNumber() > thou) { + long timeDelta = 0; + for (int i = 0; i < thou; ++i) { + Block parent = ethereum + .getBlockchain() + .getBlockByHash(block.getParentHash()); + timeDelta += Math.abs(block.getTimestamp() - parent.getTimestamp()); + } + response = String.valueOf(block + .getDifficultyBI() + .divide(BIUtil.toBI(timeDelta / thou)) + .divide(new BigInteger("1000000000")) + .doubleValue()) + " GH/s"; + } + return response; + } + + public EthListener(Ethereum ethereum) { + this.ethereum = ethereum; + } + + @Override + public void onBlock(Block block, List receipts) { + if (syncDone) { + out("Net hash rate: " + calcNetHashRate(block)); + out("Block difficulty: " + block.getDifficultyBI().toString()); + out("Block transactions: " + block.getTransactionsList().toString()); + out("Best block (last block): " + ethereum + .getBlockchain() + .getBestBlock().toString()); + out("Total difficulty: " + ethereum + .getBlockchain() + .getTotalDifficulty().toString()); + } + } + + @Override + public void onSyncDone(SyncState state) { + out("onSyncDone " + state); + if (!syncDone) { + out(" ** SYNC DONE ** "); + syncDone = true; + } + } +} \ No newline at end of file diff --git a/ethereumj/src/main/java/com/baeldung/ethereumj/transfer/EthResponse.java b/ethereumj/src/main/java/com/baeldung/ethereumj/transfer/EthResponse.java new file mode 100644 index 0000000000..e8cfb3113b --- /dev/null +++ b/ethereumj/src/main/java/com/baeldung/ethereumj/transfer/EthResponse.java @@ -0,0 +1,14 @@ +package com.baeldung.ethereumj.transfer; + +public class EthResponse { + + private String response; + + public String getResponse() { + return response; + } + + public void setResponse(String response) { + this.response = response; + } +} diff --git a/ethereumj/src/main/resources/application.properties b/ethereumj/src/main/resources/application.properties new file mode 100644 index 0000000000..033e543fe8 --- /dev/null +++ b/ethereumj/src/main/resources/application.properties @@ -0,0 +1,2 @@ +server.servlet-path=/ +server.port=8080 \ No newline at end of file diff --git a/ethereumj/src/test/java/com/baeldung/ethereumj/controllers/EthControllerTestOne.java b/ethereumj/src/test/java/com/baeldung/ethereumj/controllers/EthControllerTestOne.java new file mode 100644 index 0000000000..9298c34ec2 --- /dev/null +++ b/ethereumj/src/test/java/com/baeldung/ethereumj/controllers/EthControllerTestOne.java @@ -0,0 +1,72 @@ +package com.baeldung.ethereumj.controllers; + +import com.baeldung.ethereumj.ApplicationMain; +import com.baeldung.ethereumj.Constants; +import com.baeldung.ethereumj.transfer.EthResponse; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.context.embedded.LocalServerPort; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.*; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.web.client.RestTemplate; + +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ApplicationMain.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) +@TestPropertySource(properties = "server.port=8080") +public class EthControllerTestOne { + + @LocalServerPort + int port; + + private RestTemplate restTemplate = new RestTemplate(); + + private String url(String uri) { + String s = "http://localhost:" + port + uri; + System.out.println(s); + return s; + } + + @Before + public void setup() { + restTemplate = new RestTemplate(); + } + + @Test() + public void bestBlockTest() throws Exception { + + Thread.sleep(20000); + + EthResponse a = restTemplate.getForObject(url(Constants.ENDPOINT_ONE), EthResponse.class); + assertNotNull(a); + + ResponseEntity b = restTemplate.exchange( + url(Constants.ENDPOINT_ONE), + HttpMethod.GET, new HttpEntity(null, new HttpHeaders()), EthResponse.class); + + assertTrue("Status 200?", b.getStatusCode().equals(HttpStatus.OK)); + System.out.println("Status 200?: " + b.getStatusCode().equals(HttpStatus.OK)); + assertTrue("Dynamic data returned?", b.hasBody()); + System.out.println("Dynamic data returned?: " + b.hasBody()); + } + + @Test() + public void difficultyTest() throws Exception { + + Thread.sleep(20000); + + ResponseEntity a = restTemplate.exchange( + url(Constants.ENDPOINT_TWO), + HttpMethod.GET, new HttpEntity(null, new HttpHeaders()), EthResponse.class); + + assertTrue("Status 200?", a.getStatusCode().equals(HttpStatus.OK)); + System.out.println("Status 200?: " + a.getStatusCode().equals(HttpStatus.OK)); + assertTrue("Dynamic data returned?", a.hasBody()); + System.out.println("Dynamic data returned?: " + a.hasBody()); + } +} diff --git a/feign/src/main/java/com/baeldung/feign/BookControllerFeignClientBuilder.java b/feign/src/main/java/com/baeldung/feign/BookControllerFeignClientBuilder.java index 56cf4071b4..31d377622d 100644 --- a/feign/src/main/java/com/baeldung/feign/BookControllerFeignClientBuilder.java +++ b/feign/src/main/java/com/baeldung/feign/BookControllerFeignClientBuilder.java @@ -14,6 +14,12 @@ public class BookControllerFeignClientBuilder { private BookClient bookClient = createClient(BookClient.class, "http://localhost:8081/api/books"); private static T createClient(Class type, String uri) { - return Feign.builder().client(new OkHttpClient()).encoder(new GsonEncoder()).decoder(new GsonDecoder()).logger(new Slf4jLogger(type)).logLevel(Logger.Level.FULL).target(type, uri); + return Feign.builder() + .client(new OkHttpClient()) + .encoder(new GsonEncoder()) + .decoder(new GsonDecoder()) + .logger(new Slf4jLogger(type)) + .logLevel(Logger.Level.FULL) + .target(type, uri); } } diff --git a/feign/src/test/java/com/baeldung/feign/clients/BookClientLiveTest.java b/feign/src/test/java/com/baeldung/feign/clients/BookClientLiveTest.java index a17dbf7a2e..bee440bd9e 100644 --- a/feign/src/test/java/com/baeldung/feign/clients/BookClientLiveTest.java +++ b/feign/src/test/java/com/baeldung/feign/clients/BookClientLiveTest.java @@ -34,25 +34,31 @@ public class BookClientLiveTest { @Test public void givenBookClient_shouldRunSuccessfully() throws Exception { - List books = bookClient.findAll().stream().map(BookResource::getBook).collect(Collectors.toList()); + List books = bookClient.findAll() + .stream() + .map(BookResource::getBook) + .collect(Collectors.toList()); assertTrue(books.size() > 2); log.info("{}", books); } @Test public void givenBookClient_shouldFindOneBook() throws Exception { - Book book = bookClient.findByIsbn("0151072558").getBook(); + Book book = bookClient.findByIsbn("0151072558") + .getBook(); assertThat(book.getAuthor(), containsString("Orwell")); log.info("{}", book); } @Test public void givenBookClient_shouldPostBook() throws Exception { - String isbn = UUID.randomUUID().toString(); + String isbn = UUID.randomUUID() + .toString(); Book book = new Book(isbn, "Me", "It's me!", null, null); bookClient.create(book); - book = bookClient.findByIsbn(isbn).getBook(); + book = bookClient.findByIsbn(isbn) + .getBook(); assertThat(book.getAuthor(), is("Me")); log.info("{}", book); } diff --git a/geotools/README.md b/geotools/README.md new file mode 100644 index 0000000000..188ff0fddb --- /dev/null +++ b/geotools/README.md @@ -0,0 +1,3 @@ +### Relevant Articles + +[Introduction to GeoTools](http://www.baeldung.com/geo-tools) diff --git a/geotools/pom.xml b/geotools/pom.xml new file mode 100644 index 0000000000..37b4a2338a --- /dev/null +++ b/geotools/pom.xml @@ -0,0 +1,74 @@ + + 4.0.0 + + com.baeldung + geotools + 0.0.1-SNAPSHOT + jar + + geotools + http://maven.apache.org + + + + junit + junit + 4.12 + test + + + org.geotools + gt-shapefile + ${geotools-shapefile.version} + + + org.geotools + gt-epsg-hsql + ${geotools.version} + + + org.geotools + gt-swing + ${geotools-swing.version} + + + + + maven2-repository.dev.java.net + Java.net repository + http://download.java.net/maven/2 + + + osgeo + Open Source Geospatial Foundation Repository + http://download.osgeo.org/webdav/geotools/ + + + + true + + opengeo + OpenGeo Maven Repository + http://repo.opengeo.org + + + + + + true + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + 15.2 + 15.2 + 15.2 + + diff --git a/libraries/src/main/java/com/baeldung/geotools/ShapeFile.java b/geotools/src/main/java/com/baeldung/geotools/ShapeFile.java similarity index 71% rename from libraries/src/main/java/com/baeldung/geotools/ShapeFile.java rename to geotools/src/main/java/com/baeldung/geotools/ShapeFile.java index 77c67abc84..de789918cd 100644 --- a/libraries/src/main/java/com/baeldung/geotools/ShapeFile.java +++ b/geotools/src/main/java/com/baeldung/geotools/ShapeFile.java @@ -1,12 +1,8 @@ package com.baeldung.geotools; -import java.io.File; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.Point; import org.geotools.data.DataUtilities; import org.geotools.data.DefaultTransaction; import org.geotools.data.Transaction; @@ -23,9 +19,13 @@ import org.geotools.swing.data.JFileDataStoreChooser; import org.opengis.feature.simple.SimpleFeature; import org.opengis.feature.simple.SimpleFeatureType; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.Point; +import java.io.File; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; public class ShapeFile { @@ -41,22 +41,117 @@ public class ShapeFile { SimpleFeatureType CITY = createFeatureType(); - SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(CITY); - - addLocations(featureBuilder, collection); + addLocations(CITY, collection); File shapeFile = getNewShapeFile(); ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory(); Map params = new HashMap(); + + ShapefileDataStore dataStore = setDataStoreParams(dataStoreFactory, params, shapeFile, CITY); + + writeToFile(dataStore, collection); + } + + static SimpleFeatureType createFeatureType() { + + SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); + builder.setName("Location"); + builder.setCRS(DefaultGeographicCRS.WGS84); + + builder.add("Location", Point.class); + builder.length(15) + .add("Name", String.class); + + return builder.buildFeatureType(); + } + + static void addLocations(SimpleFeatureType CITY, DefaultFeatureCollection collection) { + + Map> locations = new HashMap<>(); + + double lat = 13.752222; + double lng = 100.493889; + addToLocationMap("Bangkok", lat, lng, locations); + + lat = 53.083333; + lng = -0.15; + addToLocationMap("New York", lat, lng, locations); + + lat = -33.925278; + lng = 18.423889; + addToLocationMap("Cape Town", lat, lng, locations); + + lat = -33.859972; + lng = 151.211111; + addToLocationMap("Sydney", lat, lng, locations); + + lat = 45.420833; + lng = -75.69; + addToLocationMap("Ottawa", lat, lng, locations); + + lat = 30.07708; + lng = 31.285909; + addToLocationMap("Cairo", lat, lng, locations); + + GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); + + locations.entrySet().stream() + .map(toFeature(CITY, geometryFactory)) + .forEach(collection::add); + } + + private static Function>, SimpleFeature> toFeature(SimpleFeatureType CITY, GeometryFactory geometryFactory) { + return location -> { + Point point = geometryFactory.createPoint( + new Coordinate(location.getValue() + .get(0), location.getValue().get(1))); + + SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(CITY); + featureBuilder.add(point); + featureBuilder.add(location.getKey()); + return featureBuilder.buildFeature(null); + }; + } + + private static void addToLocationMap(String name, double lat, double lng, Map> locations) { + List coordinates = new ArrayList<>(); + + coordinates.add(lat); + coordinates.add(lng); + locations.put(name, coordinates); + } + + private static File getNewShapeFile() { + String filePath = new File(".").getAbsolutePath() + FILE_NAME; + + JFileDataStoreChooser chooser = new JFileDataStoreChooser("shp"); + chooser.setDialogTitle("Save shapefile"); + chooser.setSelectedFile(new File(filePath)); + + int returnVal = chooser.showSaveDialog(null); + + if (returnVal != JFileDataStoreChooser.APPROVE_OPTION) { + System.exit(0); + } + + return chooser.getSelectedFile(); + } + + private static ShapefileDataStore setDataStoreParams(ShapefileDataStoreFactory dataStoreFactory, Map params, File shapeFile, SimpleFeatureType CITY) throws Exception { params.put("url", shapeFile.toURI() - .toURL()); + .toURL()); params.put("create spatial index", Boolean.TRUE); ShapefileDataStore dataStore = (ShapefileDataStore) dataStoreFactory.createNewDataStore(params); dataStore.createSchema(CITY); + return dataStore; + } + + private static void writeToFile(ShapefileDataStore dataStore, DefaultFeatureCollection collection) throws Exception { + // If you decide to use the TYPE type and create a Data Store with it, // You will need to uncomment this line to set the Coordinate Reference System // newDataStore.forceSchemaCRS(DefaultGeographicCRS.WGS84); @@ -73,11 +168,9 @@ public class ShapeFile { try { featureStore.addFeatures(collection); transaction.commit(); - } catch (Exception problem) { problem.printStackTrace(); transaction.rollback(); - } finally { transaction.close(); } @@ -86,102 +179,5 @@ public class ShapeFile { System.out.println(typeName + " does not support read/write access"); System.exit(1); } - } - - public static SimpleFeatureType createFeatureType() { - - SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); - builder.setName("Location"); - builder.setCRS(DefaultGeographicCRS.WGS84); - - builder.add("Location", Point.class); - builder.length(15) - .add("Name", String.class); - - SimpleFeatureType CITY = builder.buildFeatureType(); - - return CITY; - } - - public static void addLocations(SimpleFeatureBuilder featureBuilder, DefaultFeatureCollection collection) { - - Map> locations = new HashMap<>(); - - double lat = 13.752222; - double lng = 100.493889; - String name = "Bangkok"; - addToLocationMap(name, lat, lng, locations); - - lat = 53.083333; - lng = -0.15; - name = "New York"; - addToLocationMap(name, lat, lng, locations); - - lat = -33.925278; - lng = 18.423889; - name = "Cape Town"; - addToLocationMap(name, lat, lng, locations); - - lat = -33.859972; - lng = 151.211111; - name = "Sydney"; - addToLocationMap(name, lat, lng, locations); - - lat = 45.420833; - lng = -75.69; - name = "Ottawa"; - addToLocationMap(name, lat, lng, locations); - - lat = 30.07708; - lng = 31.285909; - name = "Cairo"; - addToLocationMap(name, lat, lng, locations); - - GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); - - for (Map.Entry> location : locations.entrySet()) { - Point point = geometryFactory.createPoint(new Coordinate(location.getValue() - .get(0), - location.getValue() - .get(1))); - featureBuilder.add(point); - featureBuilder.add(name); - SimpleFeature feature = featureBuilder.buildFeature(null); - collection.add(feature); - } - - } - - private static void addToLocationMap(String name, double lat, double lng, Map> locations) { - List coordinates = new ArrayList<>(); - - coordinates.add(lat); - coordinates.add(lng); - locations.put(name, coordinates); - } - - private static File getNewShapeFile() { - String filePath = new File(".").getAbsolutePath() + FILE_NAME; - - - JFileDataStoreChooser chooser = new JFileDataStoreChooser("shp"); - chooser.setDialogTitle("Save shapefile"); - chooser.setSelectedFile(new File(filePath)); - - int returnVal = chooser.showSaveDialog(null); - - if (returnVal != JFileDataStoreChooser.APPROVE_OPTION) { - System.exit(0); - } - - File shapeFile = chooser.getSelectedFile(); - if (shapeFile.equals(filePath)) { - System.out.println("Error: cannot replace " + filePath); - System.exit(0); - } - - return shapeFile; - } - } diff --git a/libraries/src/test/java/com/baeldung/geotools/GeoToolsUnitTestTest.java b/geotools/src/test/java/com/baeldung/geotools/GeoToolsUnitTest.java similarity index 75% rename from libraries/src/test/java/com/baeldung/geotools/GeoToolsUnitTestTest.java rename to geotools/src/test/java/com/baeldung/geotools/GeoToolsUnitTest.java index 44cd47edc3..053932b2a7 100644 --- a/libraries/src/test/java/com/baeldung/geotools/GeoToolsUnitTestTest.java +++ b/geotools/src/test/java/com/baeldung/geotools/GeoToolsUnitTest.java @@ -7,21 +7,16 @@ import org.geotools.feature.simple.SimpleFeatureBuilder; import org.junit.Test; import org.opengis.feature.simple.SimpleFeatureType; -public class GeoToolsUnitTestTest { +public class GeoToolsUnitTest { @Test public void givenFeatureType_whenAddLocations_returnFeatureCollection() { - DefaultFeatureCollection collection = new DefaultFeatureCollection(); SimpleFeatureType CITY = ShapeFile.createFeatureType(); - SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(CITY); - - ShapeFile.addLocations(featureBuilder, collection); + ShapeFile.addLocations(CITY, collection); assertNotNull(collection); - } - } diff --git a/graphql/graphql-java/payload-examples/createUser.json b/graphql/graphql-java/payload-examples/createUser.json new file mode 100644 index 0000000000..3ade405b16 --- /dev/null +++ b/graphql/graphql-java/payload-examples/createUser.json @@ -0,0 +1,8 @@ +{ + "query": "mutation($name: String! $email: String! $age: String! ){ createUser ( name: $name email: $email age: $age) { id name email age } }", + "parameters": { + "name": "John", + "email": "john@email.com", + "age": 34 + } +} \ No newline at end of file diff --git a/graphql/graphql-java/payload-examples/deleteUser.json b/graphql/graphql-java/payload-examples/deleteUser.json new file mode 100644 index 0000000000..204496f19b --- /dev/null +++ b/graphql/graphql-java/payload-examples/deleteUser.json @@ -0,0 +1,6 @@ +{ + "query": "mutation($name: String! ){ deleteUser ( id: $id) { id name email age} }", + "parameters": { + "id": 2 + } +} \ No newline at end of file diff --git a/graphql/graphql-java/payload-examples/listUsers.json b/graphql/graphql-java/payload-examples/listUsers.json new file mode 100644 index 0000000000..dde887bb07 --- /dev/null +++ b/graphql/graphql-java/payload-examples/listUsers.json @@ -0,0 +1,4 @@ +{ + "query": "{ listUsers{ id name email age}}", + "parameters": {} +} \ No newline at end of file diff --git a/graphql/graphql-java/payload-examples/retrieveUser.json b/graphql/graphql-java/payload-examples/retrieveUser.json new file mode 100644 index 0000000000..27b5f422eb --- /dev/null +++ b/graphql/graphql-java/payload-examples/retrieveUser.json @@ -0,0 +1,6 @@ +{ + "query": "query($id: String!){ retrieveUser ( id: $id) { id name email} }", + "parameters": { + "id": 1 + } +} \ No newline at end of file diff --git a/graphql/graphql-java/payload-examples/searchName.json b/graphql/graphql-java/payload-examples/searchName.json new file mode 100644 index 0000000000..df8f080b86 --- /dev/null +++ b/graphql/graphql-java/payload-examples/searchName.json @@ -0,0 +1,6 @@ +{ + "query": "query($id: String!){ searchName ( id: $id) { id name email} }", + "parameters": { + "id": 2 + } +} \ No newline at end of file diff --git a/graphql/graphql-java/payload-examples/updateUser.json b/graphql/graphql-java/payload-examples/updateUser.json new file mode 100644 index 0000000000..aa68151111 --- /dev/null +++ b/graphql/graphql-java/payload-examples/updateUser.json @@ -0,0 +1,9 @@ +{ + "query": "mutation($id: String! $name: String! $email: String! $age: String! ){ updateUser ( id: $id name: $name email: $email age: $age) { id name email age} }", + "parameters": { + "id": 1, + "name":"John updated", + "email": "johnupdate@email.com", + "age": 50 + } +} \ No newline at end of file diff --git a/graphql/graphql-java/pom.xml b/graphql/graphql-java/pom.xml new file mode 100644 index 0000000000..c031ddc694 --- /dev/null +++ b/graphql/graphql-java/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + + com.baeldung.graphql + graphql-java + 1.0 + + graphql-java + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + com.graphql-java + graphql-java-annotations + 3.0.3 + + + io.ratpack + ratpack-core + 1.4.6 + + + \ No newline at end of file diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/Application.java b/graphql/graphql-java/src/main/java/com/baeldung/graphql/Application.java new file mode 100644 index 0000000000..6e9b2a5c80 --- /dev/null +++ b/graphql/graphql-java/src/main/java/com/baeldung/graphql/Application.java @@ -0,0 +1,17 @@ +package com.baeldung.graphql; + +import ratpack.server.RatpackServer; + +import com.baeldung.graphql.handler.UserHandler; + +public class Application { + public static void main(String[] args) throws Exception { + new Application(); + } + + private Application() throws Exception { + final RatpackServer server = RatpackServer.of(s -> s.handlers(chain -> chain.post("users", new UserHandler()))); + server.start(); + } + +} diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/entity/User.java b/graphql/graphql-java/src/main/java/com/baeldung/graphql/entity/User.java new file mode 100644 index 0000000000..a4a776cfff --- /dev/null +++ b/graphql/graphql-java/src/main/java/com/baeldung/graphql/entity/User.java @@ -0,0 +1,78 @@ +package com.baeldung.graphql.entity; + +import java.util.List; + +import com.baeldung.graphql.handler.UserHandler; +import com.baeldung.graphql.utils.SchemaUtils; + +import graphql.annotations.GraphQLField; +import graphql.annotations.GraphQLName; + +@GraphQLName(SchemaUtils.USER) +public class User { + + @GraphQLField + private Long id; + @GraphQLField + private String name; + @GraphQLField + private String email; + @GraphQLField + private Integer age; + + public User(String name, String email, Integer age) { + this.id = genId(); + this.name = name; + this.email = email; + this.age = age; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getEmail() { + return email; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getAge() { + return age; + } + + public void setAge(Integer age) { + this.age = age; + } + + public static Long genId() { + Long id = 1L; + try { + List users = new UserHandler().getUsers(); + for (User user : users) + id = (user.getId() > id ? user.getId() : id) + 1; + + } catch (Exception e) { + e.printStackTrace(); + } + return id; + } + + public String toString() { + return "[id=" + id + ", name=" + name + ", email="+email+ ", age="+ age +"]"; + } +} \ No newline at end of file diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/handler/UserHandler.java b/graphql/graphql-java/src/main/java/com/baeldung/graphql/handler/UserHandler.java new file mode 100644 index 0000000000..a6d474a70d --- /dev/null +++ b/graphql/graphql-java/src/main/java/com/baeldung/graphql/handler/UserHandler.java @@ -0,0 +1,56 @@ +package com.baeldung.graphql.handler; + +import graphql.ExecutionResult; +import graphql.GraphQL; +import graphql.schema.DataFetchingEnvironment; +import ratpack.handling.Context; +import ratpack.handling.Handler; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import com.baeldung.graphql.entity.User; +import com.baeldung.graphql.schema.UserSchema; +import com.baeldung.graphql.utils.SchemaUtils; + +import static ratpack.jackson.Jackson.json; + +public class UserHandler implements Handler { + private static final Logger LOGGER = Logger.getLogger(UserHandler.class.getSimpleName()); + private GraphQL graphql; + private static List users = new ArrayList<>(); + + public UserHandler() throws Exception { + graphql = new GraphQL(new UserSchema().getSchema()); + } + + @Override + public void handle(Context context) throws Exception { + context.parse(Map.class) + .then(payload -> { + Map parameters = (Map) payload.get("parameters"); + ExecutionResult executionResult = graphql.execute(payload.get(SchemaUtils.QUERY) + .toString(), null, this, parameters); + Map result = new LinkedHashMap<>(); + if (executionResult.getErrors() + .isEmpty()) { + result.put(SchemaUtils.DATA, executionResult.getData()); + } else { + result.put(SchemaUtils.ERRORS, executionResult.getErrors()); + LOGGER.warning("Errors: " + executionResult.getErrors()); + } + context.render(json(result)); + }); + } + + public static List getUsers() { + return users; + } + + public static List getUsers(DataFetchingEnvironment env) { + return ((UserHandler) env.getSource()).getUsers(); + } +} diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/mutation/UserMutation.java b/graphql/graphql-java/src/main/java/com/baeldung/graphql/mutation/UserMutation.java new file mode 100644 index 0000000000..3c6f53a382 --- /dev/null +++ b/graphql/graphql-java/src/main/java/com/baeldung/graphql/mutation/UserMutation.java @@ -0,0 +1,57 @@ +package com.baeldung.graphql.mutation; + +import graphql.annotations.GraphQLField; +import graphql.annotations.GraphQLName; +import graphql.schema.DataFetchingEnvironment; + +import javax.validation.constraints.NotNull; + +import com.baeldung.graphql.entity.User; +import com.baeldung.graphql.utils.SchemaUtils; + +import java.util.List; +import java.util.Optional; + +import static com.baeldung.graphql.handler.UserHandler.getUsers; + +@GraphQLName(SchemaUtils.MUTATION) +public class UserMutation { + @GraphQLField + public static User createUser(final DataFetchingEnvironment env, @NotNull @GraphQLName(SchemaUtils.NAME) final String name, @NotNull @GraphQLName(SchemaUtils.EMAIL) final String email, @NotNull @GraphQLName(SchemaUtils.AGE) final String age) { + List users = getUsers(env); + final User user = new User(name, email, Integer.valueOf(age)); + users.add(user); + return user; + } + + @GraphQLField + public static User updateUser(final DataFetchingEnvironment env, @NotNull @GraphQLName(SchemaUtils.ID) final String id, @NotNull @GraphQLName(SchemaUtils.NAME) final String name, @NotNull @GraphQLName(SchemaUtils.EMAIL) final String email, + @NotNull @GraphQLName(SchemaUtils.AGE) final String age) { + final Optional user = getUsers(env).stream() + .filter(c -> c.getId() == Long.parseLong(id)) + .findFirst(); + if (!user.isPresent()) { + return null; + } + user.get() + .setName(name); + user.get() + .setEmail(email); + user.get() + .setAge(Integer.valueOf(age)); + return user.get(); + } + + @GraphQLField + public static User deleteUser(final DataFetchingEnvironment env, @NotNull @GraphQLName(SchemaUtils.ID) final String id) { + final List users = getUsers(env); + final Optional user = users.stream() + .filter(c -> c.getId() == Long.parseLong(id)) + .findFirst(); + if (!user.isPresent()) { + return null; + } + users.removeIf(c -> c.getId() == Long.parseLong(id)); + return user.get(); + } +} diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/query/UserQuery.java b/graphql/graphql-java/src/main/java/com/baeldung/graphql/query/UserQuery.java new file mode 100644 index 0000000000..6f1521c5cf --- /dev/null +++ b/graphql/graphql-java/src/main/java/com/baeldung/graphql/query/UserQuery.java @@ -0,0 +1,42 @@ +package com.baeldung.graphql.query; + +import graphql.annotations.GraphQLField; +import graphql.annotations.GraphQLName; +import graphql.schema.DataFetchingEnvironment; + +import javax.validation.constraints.NotNull; + +import com.baeldung.graphql.entity.User; +import com.baeldung.graphql.utils.SchemaUtils; + +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +import static com.baeldung.graphql.handler.UserHandler.getUsers; + +@GraphQLName(SchemaUtils.QUERY) +public class UserQuery { + + @GraphQLField + public static User retrieveUser(final DataFetchingEnvironment env, @NotNull @GraphQLName(SchemaUtils.ID) final String id) { + final Optional any = getUsers(env).stream() + .filter(c -> c.getId() == Long.parseLong(id)) + .findFirst(); + return any.orElse(null); + } + + @GraphQLField + public static List searchName(final DataFetchingEnvironment env, @NotNull @GraphQLName(SchemaUtils.NAME) final String name) { + return getUsers(env).stream() + .filter(c -> c.getName() + .contains(name)) + .collect(Collectors.toList()); + } + + @GraphQLField + public static List listUsers(final DataFetchingEnvironment env) { + return getUsers(env); + } + +} \ No newline at end of file diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/schema/UserSchema.java b/graphql/graphql-java/src/main/java/com/baeldung/graphql/schema/UserSchema.java new file mode 100644 index 0000000000..ebb3569aac --- /dev/null +++ b/graphql/graphql-java/src/main/java/com/baeldung/graphql/schema/UserSchema.java @@ -0,0 +1,24 @@ +package com.baeldung.graphql.schema; + +import graphql.annotations.GraphQLAnnotations; +import graphql.schema.GraphQLSchema; + +import static graphql.schema.GraphQLSchema.newSchema; + +import com.baeldung.graphql.mutation.UserMutation; +import com.baeldung.graphql.query.UserQuery; + +public class UserSchema { + + private final GraphQLSchema schema; + + public UserSchema() throws IllegalAccessException, NoSuchMethodException, InstantiationException { + schema = newSchema().query(GraphQLAnnotations.object(UserQuery.class)) + .mutation(GraphQLAnnotations.object(UserMutation.class)) + .build(); + } + + public GraphQLSchema getSchema() { + return schema; + } +} diff --git a/graphql/graphql-java/src/main/java/com/baeldung/graphql/utils/SchemaUtils.java b/graphql/graphql-java/src/main/java/com/baeldung/graphql/utils/SchemaUtils.java new file mode 100644 index 0000000000..680d7e3ea9 --- /dev/null +++ b/graphql/graphql-java/src/main/java/com/baeldung/graphql/utils/SchemaUtils.java @@ -0,0 +1,14 @@ +package com.baeldung.graphql.utils; + +public class SchemaUtils { + public static final String USER = "user"; + public static final String ID = "id"; + public static final String NAME = "name"; + public static final String EMAIL = "email"; + public static final String AGE = "age"; + + public static final String MUTATION = "mutation"; + public static final String QUERY = "query"; + public static final String ERRORS = "errors"; + public static final String DATA = "data"; +} diff --git a/grpc/README.md b/grpc/README.md new file mode 100644 index 0000000000..5a60ca2e7e --- /dev/null +++ b/grpc/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Introduction to gRPC](http://www.baeldung.com/grpc-introduction) diff --git a/guest/core-java-9/pom.xml b/guest/core-java-9/pom.xml new file mode 100644 index 0000000000..d588df4abc --- /dev/null +++ b/guest/core-java-9/pom.xml @@ -0,0 +1,27 @@ + + 4.0.0 + com.stackify + core-java-9 + 0.0.1-SNAPSHOT + + + + junit + junit + 4.12 + + + + + + + maven-compiler-plugin + 3.6.2 + + 1.9 + 1.9 + + + + + \ No newline at end of file diff --git a/guest/core-java-9/src/main/java/com/stackify/optional/User.java b/guest/core-java-9/src/main/java/com/stackify/optional/User.java new file mode 100644 index 0000000000..903e75f6f6 --- /dev/null +++ b/guest/core-java-9/src/main/java/com/stackify/optional/User.java @@ -0,0 +1,28 @@ +package com.stackify.optional; + +public class User { + private String email; + private String password; + + public User(String email, String password) { + super(); + this.email = email; + this.password = password; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/guest/core-java-9/src/test/java/com/stackify/optional/OptionalTest.java b/guest/core-java-9/src/test/java/com/stackify/optional/OptionalTest.java new file mode 100644 index 0000000000..4c3503b811 --- /dev/null +++ b/guest/core-java-9/src/test/java/com/stackify/optional/OptionalTest.java @@ -0,0 +1,41 @@ +package com.stackify.optional; + +import org.junit.Test; +import java.util.Optional; +import java.util.List; + +import static org.junit.Assert.*; +import java.util.stream.Collectors; + +public class OptionalTest { + + private User user; + + @Test + public void whenEmptyOptional_thenGetValueFromOr() { + User result = Optional.ofNullable(user) + .or( () -> Optional.of(new User("default","1234"))).get(); + + assertEquals(result.getEmail(), "default"); + } + + @Test + public void whenIfPresentOrElse_thenOk() { + Optional.ofNullable(user) + .ifPresentOrElse( u -> System.out.println("User is:" + u.getEmail()), () -> System.out.println("User not found")); + } + + @Test + public void whenGetStream_thenOk() { + User user = new User("john@gmail.com", "1234"); + List emails = Optional.ofNullable(user) + .stream() + .filter(u -> u.getEmail() != null && u.getEmail().contains("@")) + .map( u -> u.getEmail()) + .collect(Collectors.toList()); + + assertTrue(emails.size() == 1); + assertEquals(emails.get(0), user.getEmail()); + } + +} diff --git a/guest/core-java/pom.xml b/guest/core-java/pom.xml new file mode 100644 index 0000000000..548d5c663b --- /dev/null +++ b/guest/core-java/pom.xml @@ -0,0 +1,36 @@ + + 4.0.0 + com.stackify + core-java + 0.0.1-SNAPSHOT + + + + junit + junit + 4.12 + + + org.apache.logging.log4j + log4j-core + ${log4j2.version} + + + + + + + maven-compiler-plugin + 3.5 + + 1.8 + 1.8 + + + + + + 2.8.2 + + \ No newline at end of file diff --git a/guest/core-java/src/main/java/com/stackify/optional/Address.java b/guest/core-java/src/main/java/com/stackify/optional/Address.java new file mode 100644 index 0000000000..f54c999920 --- /dev/null +++ b/guest/core-java/src/main/java/com/stackify/optional/Address.java @@ -0,0 +1,40 @@ +package com.stackify.optional; + +public class Address { + private String addressLine; + private String city; + private Country country; + + public Address(String addressLine, String city, Country country) { + super(); + this.addressLine = addressLine; + this.city = city; + this.country = country; + } + + public String getAddressLine() { + return addressLine; + } + + public void setAddressLine(String addressLine) { + this.addressLine = addressLine; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public Country getCountry() { + return country; + } + + public void setCountry(Country country) { + this.country = country; + } + + +} diff --git a/guest/core-java/src/main/java/com/stackify/optional/Country.java b/guest/core-java/src/main/java/com/stackify/optional/Country.java new file mode 100644 index 0000000000..bf97ef7b6d --- /dev/null +++ b/guest/core-java/src/main/java/com/stackify/optional/Country.java @@ -0,0 +1,29 @@ +package com.stackify.optional; + +public class Country { + private String name; + private String isocode; + + public Country(String name, String isocode) { + super(); + this.name = name; + this.isocode = isocode; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getIsocode() { + return isocode; + } + + public void setIsocode(String isocode) { + this.isocode = isocode; + } + +} diff --git a/guest/core-java/src/main/java/com/stackify/optional/User.java b/guest/core-java/src/main/java/com/stackify/optional/User.java new file mode 100644 index 0000000000..910f2605dd --- /dev/null +++ b/guest/core-java/src/main/java/com/stackify/optional/User.java @@ -0,0 +1,51 @@ +package com.stackify.optional; + +import java.util.Optional; + +public class User { + private String email; + private String password; + + private Address address; + + private String position; + + public User(String email, String password) { + super(); + this.email = email; + this.password = password; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Address getAddress() { + return address; + } + + public void setAddress(Address address) { + this.address = address; + } + + public Optional getPosition() { + return Optional.ofNullable(position); + } + + public void setPosition(String position) { + this.position = position; + } + +} diff --git a/guest/core-java/src/main/java/com/stackify/optional/chaining/Address.java b/guest/core-java/src/main/java/com/stackify/optional/chaining/Address.java new file mode 100644 index 0000000000..1e10c67c39 --- /dev/null +++ b/guest/core-java/src/main/java/com/stackify/optional/chaining/Address.java @@ -0,0 +1,38 @@ +package com.stackify.optional.chaining; + +import java.util.Optional; + +public class Address { + private String addressLine; + private String city; + private Country country; + + public Address(String addressLine, String city) { + this.addressLine = addressLine; + this.city = city; + } + + public String getAddressLine() { + return addressLine; + } + + public void setAddressLine(String addressLine) { + this.addressLine = addressLine; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public Optional getCountry() { + return Optional.ofNullable(country); + } + + public void setCountry(Country country) { + this.country = country; + } +} diff --git a/guest/core-java/src/main/java/com/stackify/optional/chaining/Country.java b/guest/core-java/src/main/java/com/stackify/optional/chaining/Country.java new file mode 100644 index 0000000000..89e85a9b43 --- /dev/null +++ b/guest/core-java/src/main/java/com/stackify/optional/chaining/Country.java @@ -0,0 +1,28 @@ +package com.stackify.optional.chaining; + +public class Country { + private String name; + private String isocode; + + public Country(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getIsocode() { + return isocode; + } + + public void setIsocode(String isocode) { + this.isocode = isocode; + } + + +} \ No newline at end of file diff --git a/guest/core-java/src/main/java/com/stackify/optional/chaining/User.java b/guest/core-java/src/main/java/com/stackify/optional/chaining/User.java new file mode 100644 index 0000000000..07eb398abe --- /dev/null +++ b/guest/core-java/src/main/java/com/stackify/optional/chaining/User.java @@ -0,0 +1,50 @@ +package com.stackify.optional.chaining; + +import java.util.Optional; + +public class User { + private String email; + private String password; + + private Address address; + + private String position; + + public User(String email, String password) { + this.email = email; + this.password = password; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Optional
getAddress() { + return Optional.ofNullable(address); + } + + public void setAddress(Address address) { + this.address = address; + } + + public Optional getPosition() { + return Optional.ofNullable(position); + } + + public void setPosition(String position) { + this.position = position; + } + +} diff --git a/guest/core-java/src/main/resources/log4j2.xml b/guest/core-java/src/main/resources/log4j2.xml new file mode 100644 index 0000000000..a67aae6aa6 --- /dev/null +++ b/guest/core-java/src/main/resources/log4j2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/guest/core-java/src/test/java/com/stackify/optional/OptionalTest.java b/guest/core-java/src/test/java/com/stackify/optional/OptionalTest.java new file mode 100644 index 0000000000..c6e6ddb15d --- /dev/null +++ b/guest/core-java/src/test/java/com/stackify/optional/OptionalTest.java @@ -0,0 +1,166 @@ +package com.stackify.optional; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Optional; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.Test; + +public class OptionalTest { + + private User user; + + private Logger logger = LogManager.getLogger(OptionalTest.class); + + @Test(expected = NullPointerException.class) + public void testNull() { + String isocode = user.getAddress().getCountry().getIsocode().toUpperCase(); + } + + @Test + public void test() { + + if (user != null) { + Address address = user.getAddress(); + if (address != null) { + Country country = address.getCountry(); + if (country != null) { + String isocode = country.getIsocode(); + if (isocode != null) { + isocode = isocode.toUpperCase(); + } + } + } + } + + } + + @Test(expected = NoSuchElementException.class) + public void whenCreateEmptyOptional_thenNull() { + Optional emptyOpt = Optional.empty(); + emptyOpt.get(); + } + + @Test(expected = NullPointerException.class) + public void whenCreateOfEmptyOptional_thenNullPointerException() { + Optional opt = Optional.of(user); + } + + @Test + public void whenCreateOfNullableOptional_thenOk() { + String name = "John"; + Optional opt = Optional.ofNullable(name); + assertEquals("John", opt.get()); + } + + @Test + public void whenCheckIsPresent_thenOk() { + user = new User("john@gmail.com", "1234"); + Optional opt = Optional.ofNullable(user); + assertTrue(opt.isPresent()); + + assertEquals(user.getEmail(), opt.get().getEmail()); + } + + @Test + public void whenCheckIfPresent_thenOk() { + user = new User("john@gmail.com", "1234"); + Optional opt = Optional.ofNullable(user); + assertTrue(opt.isPresent()); + + opt.ifPresent(u -> assertEquals(user.getEmail(), u.getEmail())); + } + + @Test + public void whenEmptyValue_thenReturnDefault() { + User user = null; + User user2 = new User("anna@gmail.com", "1234"); + User result = Optional.ofNullable(user).orElse(user2); + + assertEquals("anna@gmail.com", result.getEmail()); + } + + @Test + public void whenValueNotNull_thenIgnoreDefault() { + User user = new User("john@gmail.com", "1234"); + User user2 = new User("anna@gmail.com", "1234"); + User result = Optional.ofNullable(user).orElse(user2); + + assertEquals("john@gmail.com", result.getEmail()); + } + + @Test + public void whenSetDefaultOrElseGet_thenOk() { + User user = null; + User user2 = new User("anna@gmail.com", "1234"); + User result = Optional.ofNullable(user).orElseGet(() -> user2); + + assertEquals("anna@gmail.com", result.getEmail()); + } + + @Test + public void givenPresentValue_whenCompare_thenOk() { + User user = new User("john@gmail.com", "1234"); + logger.info("Using orElse"); + User result = Optional.ofNullable(user).orElse(createNewUser()); + logger.info("Using orElseGet"); + User result2 = Optional.ofNullable(user).orElseGet(() -> createNewUser()); + } + + private User createNewUser() { + logger.info("Creating New User"); + return new User("extra@gmail.com", "1234"); + } + + @Test + public void givenEmptyValue_whenCompare_thenOk() { + User user = null; + logger.info("Using orElse"); + User result = Optional.ofNullable(user).orElse(createNewUser()); + logger.info("Using orElseGet"); + User result2 = Optional.ofNullable(user).orElseGet(() -> createNewUser()); + } + + @Test(expected = IllegalArgumentException.class) + public void whenThrowException_thenOk() { + User result = Optional.ofNullable(user).orElseThrow(() -> new IllegalArgumentException()); + } + + @Test + public void whenMap_thenOk() { + user = new User("anna@gmail.com", "1234"); + String email = Optional.ofNullable(user).map(u -> u.getEmail()).orElse("default@gmail.com"); + assertEquals(email, user.getEmail()); + + } + + @Test + public void whenFlatMap_thenOk() { + user = new User("anna@gmail.com", "1234"); + user.setPosition("Developer"); + String position = Optional.ofNullable(user).flatMap(u -> u.getPosition()).orElse("default"); + assertEquals(position, user.getPosition().get()); + + } + + @Test + public void whenFilter_thenOk() { + user = new User("anna@gmail.com", "1234"); + Optional result = Optional.ofNullable(user).filter(u -> u.getEmail() != null && u.getEmail().contains("@")); + + assertTrue(result.isPresent()); + } + + @Test + public void whenStream_thenOk() { + List users = new ArrayList<>(); + User user = users.stream().findFirst().orElse(new User("default", "1234")); + assertEquals(user.getEmail(), "default"); + } + +} diff --git a/guest/core-java/src/test/java/com/stackify/optional/chaining/OptionalChainingTest.java b/guest/core-java/src/test/java/com/stackify/optional/chaining/OptionalChainingTest.java new file mode 100644 index 0000000000..660497c367 --- /dev/null +++ b/guest/core-java/src/test/java/com/stackify/optional/chaining/OptionalChainingTest.java @@ -0,0 +1,36 @@ +package com.stackify.optional.chaining; + +import static org.junit.Assert.*; + +import java.util.Optional; + +import org.junit.Test; + +public class OptionalChainingTest { + + @Test + public void whenChaining_thenOk() { + User user = new User("anna@gmail.com", "1234"); + + String result = Optional.ofNullable(user) + .flatMap(u -> u.getAddress()) + .flatMap(a -> a.getCountry()) + .map(c -> c.getIsocode()) + .orElse("default"); + + assertEquals(result, "default"); + } + + @Test + public void whenChainingWithMethodReferences_thenOk() { + User user = new User("anna@gmail.com", "1234"); + + String result = Optional.ofNullable(user) + .flatMap(User::getAddress) + .flatMap(Address::getCountry) + .map(Country::getIsocode) + .orElse("default"); + + assertEquals(result, "default"); + } +} diff --git a/guest/tomcat-app/WebContent/META-INF/MANIFEST.MF b/guest/tomcat-app/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..254272e1c0 --- /dev/null +++ b/guest/tomcat-app/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/guest/tomcat-app/WebContent/WEB-INF/web.xml b/guest/tomcat-app/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000000..efc7c9ae0d --- /dev/null +++ b/guest/tomcat-app/WebContent/WEB-INF/web.xml @@ -0,0 +1,28 @@ + + + tomcat-app + + tomcat-app + org.glassfish.jersey.servlet.ServletContainer + + javax.ws.rs.Application + com.stackify.ApplicationInitializer + + 1 + + + tomcat-app + /* + + + javamelody + net.bull.javamelody.MonitoringFilter + + gzip-compression-disabled + true + + + \ No newline at end of file diff --git a/guest/tomcat-app/pom.xml b/guest/tomcat-app/pom.xml new file mode 100644 index 0000000000..e62c6f78d8 --- /dev/null +++ b/guest/tomcat-app/pom.xml @@ -0,0 +1,70 @@ + + 4.0.0 + com.stackify + tomcat-app + 0.0.1-SNAPSHOT + war + + + + org.glassfish.jersey.containers + jersey-container-servlet + 2.25.1 + + + org.glassfish.jersey.media + jersey-media-moxy + 2.25.1 + + + io.rest-assured + rest-assured + 3.0.3 + + + junit + junit + 4.12 + + + + com.h2database + h2 + 1.4.195 + + + + org.apache.logging.log4j + log4j-core + 2.8.2 + + + + net.bull.javamelody + javamelody-core + 1.69.0 + + + + + + + + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + maven-war-plugin + 3.0.0 + + WebContent + + + + + \ No newline at end of file diff --git a/guest/tomcat-app/src/main/java/com/stackify/ApplicationInitializer.java b/guest/tomcat-app/src/main/java/com/stackify/ApplicationInitializer.java new file mode 100644 index 0000000000..6d864e859e --- /dev/null +++ b/guest/tomcat-app/src/main/java/com/stackify/ApplicationInitializer.java @@ -0,0 +1,9 @@ +package com.stackify; + +import org.glassfish.jersey.server.ResourceConfig; + +public class ApplicationInitializer extends ResourceConfig { + public ApplicationInitializer() { + packages("com.stackify.services"); + } +} diff --git a/guest/tomcat-app/src/main/java/com/stackify/daos/UserDAO.java b/guest/tomcat-app/src/main/java/com/stackify/daos/UserDAO.java new file mode 100644 index 0000000000..b57b230135 --- /dev/null +++ b/guest/tomcat-app/src/main/java/com/stackify/daos/UserDAO.java @@ -0,0 +1,67 @@ +package com.stackify.daos; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import com.stackify.models.User; +import com.stackify.utils.ConnectionUtil; + +public class UserDAO { + + private Logger logger = LogManager.getLogger(UserDAO.class); + + public void createTable() { + try (Connection con = ConnectionUtil.getConnection()) { + String createQuery = "CREATE TABLE IF NOT EXISTS users(email varchar(50) primary key, name varchar(50))"; + PreparedStatement pstmt = con.prepareStatement(createQuery); + + pstmt.execute(); + } catch (SQLException exc) { + logger.error(exc.getMessage()); + } + + } + + public void add(User user) { + try (Connection con = ConnectionUtil.getConnection()) { + + String insertQuery = "INSERT INTO users(email,name) VALUES(?,?)"; + PreparedStatement pstmt = con.prepareStatement(insertQuery); + pstmt.setString(1, user.getEmail()); + pstmt.setString(2, user.getName()); + + pstmt.executeUpdate(); + } catch (SQLException exc) { + logger.error(exc.getMessage()); + } + } + + public List findAll() { + List users = new ArrayList<>(); + + try (Connection con = ConnectionUtil.getConnection()) { + String query = "SELECT * FROM users"; + PreparedStatement pstmt = con.prepareStatement(query); + + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) { + User user = new User(); + user.setEmail(rs.getString("email")); + user.setName(rs.getString("name")); + users.add(user); + } + } catch (SQLException exc) { + logger.error(exc.getMessage()); + } + + return users; + } + +} diff --git a/guest/tomcat-app/src/main/java/com/stackify/models/User.java b/guest/tomcat-app/src/main/java/com/stackify/models/User.java new file mode 100644 index 0000000000..8c8073357d --- /dev/null +++ b/guest/tomcat-app/src/main/java/com/stackify/models/User.java @@ -0,0 +1,43 @@ +package com.stackify.models; + +import javax.ws.rs.core.Link; + +public class User { + private String email; + private String name; + private Link link; + + public User() { + } + + public User(String email, String name) { + super(); + this.email = email; + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Link getLink() { + return link; + } + + public void setLink(Link link) { + this.link = link; + } + +} diff --git a/guest/tomcat-app/src/main/java/com/stackify/services/CorsFilter.java b/guest/tomcat-app/src/main/java/com/stackify/services/CorsFilter.java new file mode 100644 index 0000000000..267aa6fd61 --- /dev/null +++ b/guest/tomcat-app/src/main/java/com/stackify/services/CorsFilter.java @@ -0,0 +1,19 @@ +package com.stackify.services; + +import java.io.IOException; + +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerResponseContext; +import javax.ws.rs.container.ContainerResponseFilter; +import javax.ws.rs.ext.Provider; + +@Provider +public class CorsFilter implements ContainerResponseFilter { + + @Override + public void filter(final ContainerRequestContext requestContext, + final ContainerResponseContext response) throws IOException { + response.getHeaders().add("Access-Control-Allow-Origin", "*"); + response.getHeaders().add("Access-Control-Allow-Headers", "origin, content-type, accept"); + } +} diff --git a/guest/tomcat-app/src/main/java/com/stackify/services/UserService.java b/guest/tomcat-app/src/main/java/com/stackify/services/UserService.java new file mode 100644 index 0000000000..6cdb3eb55f --- /dev/null +++ b/guest/tomcat-app/src/main/java/com/stackify/services/UserService.java @@ -0,0 +1,37 @@ +package com.stackify.services; + +import java.util.List; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import com.stackify.daos.UserDAO; +import com.stackify.models.User; + +@Path("/users") +public class UserService { + private UserDAO userDao = new UserDAO(); + + public UserService (){ + userDao.createTable(); + } + + @POST + @Consumes(MediaType.APPLICATION_JSON) + public Response addUser(User user) { + userDao.add(user); + return Response.ok() + .build(); + } + + @GET + @Produces(MediaType.APPLICATION_JSON) + public List getUsers() { + return userDao.findAll(); + } +} diff --git a/guest/tomcat-app/src/main/java/com/stackify/utils/ConnectionUtil.java b/guest/tomcat-app/src/main/java/com/stackify/utils/ConnectionUtil.java new file mode 100644 index 0000000000..e7734f64a7 --- /dev/null +++ b/guest/tomcat-app/src/main/java/com/stackify/utils/ConnectionUtil.java @@ -0,0 +1,38 @@ +package com.stackify.utils; + +import java.sql.Connection; +import java.sql.SQLException; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.sql.DataSource; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ConnectionUtil { + + private static Logger logger = LogManager.getLogger(ConnectionUtil.class); + + public static Connection getConnection() { + try { + String jndiName = "java:/comp/env/jdbc/MyDataSource"; + + Context initialContext = new InitialContext(); + DataSource datasource = (DataSource)initialContext.lookup(jndiName); + if (datasource != null) { + return datasource.getConnection(); + } + else { + logger.error("Failed to lookup datasource."); + } + } + + catch (NamingException | SQLException exc) { + logger.error(exc.getMessage()); + } + return null; + } + +} diff --git a/hazelcast/pom.xml b/hazelcast/pom.xml index 5b467af655..2811bf8b12 100644 --- a/hazelcast/pom.xml +++ b/hazelcast/pom.xml @@ -22,7 +22,7 @@ com.hazelcast hazelcast-client - 3.7.2 + ${hazelcast.version} @@ -39,7 +39,7 @@ - 3.7.4 + 3.8.4 \ No newline at end of file diff --git a/hbase/pom.xml b/hbase/pom.xml index 3f5456777e..5fe47fcdc7 100644 --- a/hbase/pom.xml +++ b/hbase/pom.xml @@ -31,7 +31,7 @@ - 1.3.0 + 1.3.1 diff --git a/immutables/pom.xml b/immutables/pom.xml index 9b623c85e7..884ebc0c61 100644 --- a/immutables/pom.xml +++ b/immutables/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung immutables 1.0.0-SNAPSHOT @@ -34,7 +33,7 @@ - 2.3.10 + 2.5.6 3.6.1 0.9.6 diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Author.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Author.java index 0330498089..db8b594509 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Author.java +++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Author.java @@ -9,7 +9,8 @@ public class Author extends Person { List items = new ArrayList<>(); - public Author(){} + public Author() { + } public Author(String firstName, String lastName) { super(firstName, lastName); diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Person.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Person.java index 3add362007..9ba91e9170 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Person.java +++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Person.java @@ -11,7 +11,7 @@ public class Person { private String firstName; private String lastName; - public Person(){ + public Person() { } diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsoncreator/Author.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsoncreator/Author.java index 34fbd16c1c..d48c95b255 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsoncreator/Author.java +++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsoncreator/Author.java @@ -1,6 +1,5 @@ package com.baeldung.jackson.deserialization.jsoncreator; - import com.baeldung.jackson.domain.Person; import com.baeldung.jackson.domain.Item; import com.fasterxml.jackson.annotation.JsonCreator; @@ -14,9 +13,7 @@ public class Author extends Person { List items = new ArrayList<>(); @JsonCreator - public Author( - @JsonProperty("christianName") String firstName, - @JsonProperty("surname") String lastName) { + public Author(@JsonProperty("christianName") String firstName, @JsonProperty("surname") String lastName) { super(firstName, lastName); } diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Book.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Book.java index 8e93ab5ce7..dc0d0ee623 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Book.java +++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Book.java @@ -13,7 +13,8 @@ public class Book extends Item { private Date published; private BigDecimal pages; - public Book() {} + public Book() { + } public Book(String title, Author author) { super(title, author); diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/CustomDateDeserializer.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/CustomDateDeserializer.java index c9d6ae39fa..93bbfd0069 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/CustomDateDeserializer.java +++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/CustomDateDeserializer.java @@ -11,8 +11,7 @@ import java.util.Date; public class CustomDateDeserializer extends StdDeserializer { - private static SimpleDateFormat formatter = - new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); + private static SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); public CustomDateDeserializer() { this(null); @@ -23,8 +22,7 @@ public class CustomDateDeserializer extends StdDeserializer { } @Override - public Date deserialize(JsonParser jsonparser, DeserializationContext context) - throws IOException { + public Date deserialize(JsonParser jsonparser, DeserializationContext context) throws IOException { String date = jsonparser.getText(); try { return formatter.parse(date); diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Item.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Item.java index ab4689dec8..fc27a586ac 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Item.java +++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Item.java @@ -19,7 +19,8 @@ public class Item { private List authors = new ArrayList<>(); private float price; - public Item(){} + public Item() { + } public Item(String title, Author author) { this.id = UUID.randomUUID(); diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonsetter/Author.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonsetter/Author.java index c63b63f515..3f9ae70a88 100644 --- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonsetter/Author.java +++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonsetter/Author.java @@ -18,7 +18,8 @@ public class Author extends Person { private List items = new ArrayList<>(); - public Author(){} + public Author() { + } public Author(String firstName, String lastName) { super(firstName, lastName); diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Book.java b/jackson/src/main/java/com/baeldung/jackson/domain/Book.java index 6e486ffbd3..a5963e33ba 100644 --- a/jackson/src/main/java/com/baeldung/jackson/domain/Book.java +++ b/jackson/src/main/java/com/baeldung/jackson/domain/Book.java @@ -15,7 +15,7 @@ public class Book extends Item { private Date published; private BigDecimal pages; - public Book(){ + public Book() { } public Book(String title, Author author) { diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Course.java b/jackson/src/main/java/com/baeldung/jackson/domain/Course.java index 15049ded09..672b0bc250 100644 --- a/jackson/src/main/java/com/baeldung/jackson/domain/Course.java +++ b/jackson/src/main/java/com/baeldung/jackson/domain/Course.java @@ -10,7 +10,9 @@ import java.util.List; */ public class Course extends Item { - public enum Medium {CLASSROOM, ONLINE} + public enum Medium { + CLASSROOM, ONLINE + } public enum Level { BEGINNER("Beginner", 1), INTERMEDIATE("Intermediate", 2), ADVANCED("Advanced", 3); diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Item.java b/jackson/src/main/java/com/baeldung/jackson/domain/Item.java index fc861d2f3c..d9d1350a8e 100644 --- a/jackson/src/main/java/com/baeldung/jackson/domain/Item.java +++ b/jackson/src/main/java/com/baeldung/jackson/domain/Item.java @@ -17,7 +17,8 @@ public class Item { private List authors = new ArrayList<>(); private float price; - public Item(){} + public Item() { + } public Item(String title, Author author) { this.id = UUID.randomUUID(); diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Person.java b/jackson/src/main/java/com/baeldung/jackson/domain/Person.java index 2f66a1acfe..785efff755 100644 --- a/jackson/src/main/java/com/baeldung/jackson/domain/Person.java +++ b/jackson/src/main/java/com/baeldung/jackson/domain/Person.java @@ -14,7 +14,8 @@ public class Person { private String firstName; private String lastName; - public Person(){} + public Person() { + } public Person(String firstName, String lastName) { this.id = UUID.randomUUID(); diff --git a/jackson/src/main/java/com/baeldung/jackson/entities/ClassWithAMap.java b/jackson/src/main/java/com/baeldung/jackson/entities/ClassWithAMap.java index 54ebff8a56..107d75eb0d 100644 --- a/jackson/src/main/java/com/baeldung/jackson/entities/ClassWithAMap.java +++ b/jackson/src/main/java/com/baeldung/jackson/entities/ClassWithAMap.java @@ -9,16 +9,16 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; public class ClassWithAMap { - @JsonProperty("map") - @JsonDeserialize(keyUsing = MyPairDeserializer.class) - private final Map map; + @JsonProperty("map") + @JsonDeserialize(keyUsing = MyPairDeserializer.class) + private final Map map; - @JsonCreator - public ClassWithAMap(Map map) { - this.map = map; - } + @JsonCreator + public ClassWithAMap(Map map) { + this.map = map; + } - public Map getMap() { - return map; - } + public Map getMap() { + return map; + } } \ No newline at end of file diff --git a/jackson/src/main/java/com/baeldung/jackson/entities/MyPair.java b/jackson/src/main/java/com/baeldung/jackson/entities/MyPair.java index ebe41890fe..ca5960e0cf 100644 --- a/jackson/src/main/java/com/baeldung/jackson/entities/MyPair.java +++ b/jackson/src/main/java/com/baeldung/jackson/entities/MyPair.java @@ -4,77 +4,77 @@ import com.fasterxml.jackson.annotation.JsonValue; public class MyPair { - private String first; - private String second; + private String first; + private String second; - public MyPair(String first, String second) { - this.first = first; - this.second = second; - } + public MyPair(String first, String second) { + this.first = first; + this.second = second; + } - public MyPair(String both) { - String[] pairs = both.split("and"); - this.first = pairs[0].trim(); - this.second = pairs[1].trim(); - } + public MyPair(String both) { + String[] pairs = both.split("and"); + this.first = pairs[0].trim(); + this.second = pairs[1].trim(); + } - @Override - @JsonValue - public String toString() { - return first + " and " + second; - } + @Override + @JsonValue + public String toString() { + return first + " and " + second; + } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((first == null) ? 0 : first.hashCode()); - result = prime * result + ((second == null) ? 0 : second.hashCode()); - return result; - } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((first == null) ? 0 : first.hashCode()); + result = prime * result + ((second == null) ? 0 : second.hashCode()); + return result; + } - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof MyPair)) { - return false; - } - MyPair other = (MyPair) obj; - if (first == null) { - if (other.first != null) { - return false; - } - } else if (!first.equals(other.first)) { - return false; - } - if (second == null) { - if (other.second != null) { - return false; - } - } else if (!second.equals(other.second)) { - return false; - } - return true; - } + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof MyPair)) { + return false; + } + MyPair other = (MyPair) obj; + if (first == null) { + if (other.first != null) { + return false; + } + } else if (!first.equals(other.first)) { + return false; + } + if (second == null) { + if (other.second != null) { + return false; + } + } else if (!second.equals(other.second)) { + return false; + } + return true; + } - public String getFirst() { - return first; - } + public String getFirst() { + return first; + } - public void setFirst(String first) { - this.first = first; - } + public void setFirst(String first) { + this.first = first; + } - public String getSecond() { - return second; - } + public String getSecond() { + return second; + } - public void setSecond(String second) { - this.second = second; - } + public void setSecond(String second) { + this.second = second; + } } \ No newline at end of file diff --git a/jackson/src/main/java/com/baeldung/jackson/format/User.java b/jackson/src/main/java/com/baeldung/jackson/format/User.java index 101ef09a4a..e655deb93b 100755 --- a/jackson/src/main/java/com/baeldung/jackson/format/User.java +++ b/jackson/src/main/java/com/baeldung/jackson/format/User.java @@ -13,28 +13,25 @@ public class User extends Person { private String firstName; private String lastName; - @JsonFormat(shape = JsonFormat.Shape.STRING, - pattern = "yyyy-MM-dd@HH:mm:ss.SSSZ") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd@HH:mm:ss.SSSZ") private Date createdDate; - public User(String firstName,String lastName) { - super(firstName, lastName); - this.createdDate = new Date(); + public User(String firstName, String lastName) { + super(firstName, lastName); + this.createdDate = new Date(); } public Date getCreatedDate() { return createdDate; } - @JsonFormat(shape = JsonFormat.Shape.STRING, - pattern = "yyyy-MM-dd@HH:mm:ss.SSSZ", - locale = "en_GB") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd@HH:mm:ss.SSSZ", locale = "en_GB") public Date getCurrentDate() { - return new Date(); + return new Date(); } @JsonFormat(shape = JsonFormat.Shape.NUMBER) public Date getDateNum() { - return new Date(); + return new Date(); } } diff --git a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignore/Person.java b/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignore/Person.java index 8c18522627..0037d83148 100644 --- a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignore/Person.java +++ b/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignore/Person.java @@ -17,7 +17,8 @@ public class Person { private String firstName; private String lastName; - public Person(){} + public Person() { + } public Person(String firstName, String lastName) { this.id = UUID.randomUUID(); diff --git a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignoreproperties/Course.java b/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignoreproperties/Course.java index e6d62eee3d..70b4dd9842 100644 --- a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignoreproperties/Course.java +++ b/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignoreproperties/Course.java @@ -12,10 +12,12 @@ import java.util.List; * @author Alex Theedom www.readlearncode.com * @version 1.0 */ -@JsonIgnoreProperties({"medium"}) +@JsonIgnoreProperties({ "medium" }) public class Course extends Item { - public enum Medium {CLASSROOM, ONLINE} + public enum Medium { + CLASSROOM, ONLINE + } public enum Level { BEGINNER("Beginner", 1), INTERMEDIATE("Intermediate", 2), ADVANCED("Advanced", 3); diff --git a/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdAddedToUser.java b/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdAddedToUser.java index 11aa8ddb1a..db0412b09b 100644 --- a/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdAddedToUser.java +++ b/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdAddedToUser.java @@ -12,10 +12,7 @@ public class ItemIdAddedToUser extends Event { private final Long quantity; @JsonCreator - public ItemIdAddedToUser(@JsonProperty("id") String id, - @JsonProperty("timestamp") Long timestamp, - @JsonProperty("itemId") String itemId, - @JsonProperty("quantity") Long quantity) { + public ItemIdAddedToUser(@JsonProperty("id") String id, @JsonProperty("timestamp") Long timestamp, @JsonProperty("itemId") String itemId, @JsonProperty("quantity") Long quantity) { super(id, timestamp); this.itemId = itemId; this.quantity = quantity; diff --git a/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUser.java b/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUser.java index 682394ddf3..ab3b9bf34f 100644 --- a/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUser.java +++ b/jackson/src/main/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUser.java @@ -10,10 +10,7 @@ public class ItemIdRemovedFromUser extends Event { private final Long quantity; @JsonCreator - public ItemIdRemovedFromUser(@JsonProperty("id") String id, - @JsonProperty("timestamp") Long timestamp, - @JsonProperty("itemId") String itemId, - @JsonProperty("quantity") Long quantity) { + public ItemIdRemovedFromUser(@JsonProperty("id") String id, @JsonProperty("timestamp") Long timestamp, @JsonProperty("itemId") String itemId, @JsonProperty("quantity") Long quantity) { super(id, timestamp); this.itemId = itemId; this.quantity = quantity; diff --git a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Course.java b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Course.java index 8825677e86..a44492b9f7 100644 --- a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Course.java +++ b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Course.java @@ -13,7 +13,9 @@ import java.util.List; @CustomCourseAnnotation public class Course extends Item { - public enum Medium {CLASSROOM, ONLINE} + public enum Medium { + CLASSROOM, ONLINE + } public enum Level { BEGINNER("Beginner", 1), INTERMEDIATE("Intermediate", 2), ADVANCED("Advanced", 3); diff --git a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/CustomCourseAnnotation.java b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/CustomCourseAnnotation.java index 37b0bf357e..d7f72ca6ec 100644 --- a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/CustomCourseAnnotation.java +++ b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/CustomCourseAnnotation.java @@ -14,7 +14,7 @@ import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotationsInside @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"title", "price", "id", "duration", "authors", "level"}) -@JsonIgnoreProperties({"prerequisite"}) +@JsonPropertyOrder({ "title", "price", "id", "duration", "authors", "level" }) +@JsonIgnoreProperties({ "prerequisite" }) public @interface CustomCourseAnnotation { } diff --git a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Item.java b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Item.java index 930c4afb58..6625283dec 100644 --- a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Item.java +++ b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Item.java @@ -20,7 +20,8 @@ public class Item { private List authors = new ArrayList<>(); private float price; - public Item(){} + public Item() { + } public Item(String title, Author author) { this.id = UUID.randomUUID(); diff --git a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/disable/Author.java b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/disable/Author.java index 8df3aec051..0638e32925 100644 --- a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/disable/Author.java +++ b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/disable/Author.java @@ -16,7 +16,7 @@ import java.util.List; * @version 1.0 */ @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"lastName", "items", "firstName", "id"}) +@JsonPropertyOrder({ "lastName", "items", "firstName", "id" }) public class Author extends Person { @JsonIgnore diff --git a/jackson/src/main/java/com/baeldung/jackson/polymorphism/Order.java b/jackson/src/main/java/com/baeldung/jackson/polymorphism/Order.java index 1eab9f5d02..1813148b2b 100644 --- a/jackson/src/main/java/com/baeldung/jackson/polymorphism/Order.java +++ b/jackson/src/main/java/com/baeldung/jackson/polymorphism/Order.java @@ -18,12 +18,8 @@ public class Order { private Type type; private int internalAudit; - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "ordertype") - @JsonSubTypes({ - @JsonSubTypes.Type(value = InternalType.class, name = "internal") - }) + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ordertype") + @JsonSubTypes({ @JsonSubTypes.Type(value = InternalType.class, name = "internal") }) public static class Type { public long id; public String name; diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/ActorJacksonSerializer.java b/jackson/src/main/java/com/baeldung/jackson/serialization/ActorJacksonSerializer.java index 32a6358003..2340de5957 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/ActorJacksonSerializer.java +++ b/jackson/src/main/java/com/baeldung/jackson/serialization/ActorJacksonSerializer.java @@ -24,8 +24,11 @@ public class ActorJacksonSerializer extends StdSerializer { jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("imdbId", actor.getImdbId()); jsonGenerator.writeObjectField("dateOfBirth", actor.getDateOfBirth() != null ? sdf.format(actor.getDateOfBirth()) : null); - jsonGenerator.writeNumberField("N° Film: ", actor.getFilmography() != null ? actor.getFilmography().size() : null); - jsonGenerator.writeStringField("filmography", actor.getFilmography().stream().collect(Collectors.joining("-"))); + jsonGenerator.writeNumberField("N° Film: ", actor.getFilmography() != null ? actor.getFilmography() + .size() : null); + jsonGenerator.writeStringField("filmography", actor.getFilmography() + .stream() + .collect(Collectors.joining("-"))); jsonGenerator.writeEndObject(); } } \ No newline at end of file diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/MyPairDeserializer.java b/jackson/src/main/java/com/baeldung/jackson/serialization/MyPairDeserializer.java index 0aa6db98d0..43bdc1c500 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/MyPairDeserializer.java +++ b/jackson/src/main/java/com/baeldung/jackson/serialization/MyPairDeserializer.java @@ -9,10 +9,9 @@ import com.fasterxml.jackson.databind.KeyDeserializer; public class MyPairDeserializer extends KeyDeserializer { - @Override - public MyPair deserializeKey(String key, DeserializationContext ctxt) - throws IOException, JsonProcessingException { + @Override + public MyPair deserializeKey(String key, DeserializationContext ctxt) throws IOException, JsonProcessingException { - return new MyPair(key); - } + return new MyPair(key); + } } \ No newline at end of file diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/MyPairSerializer.java b/jackson/src/main/java/com/baeldung/jackson/serialization/MyPairSerializer.java index 68afb6c193..fee1cafe16 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/MyPairSerializer.java +++ b/jackson/src/main/java/com/baeldung/jackson/serialization/MyPairSerializer.java @@ -12,14 +12,12 @@ import com.fasterxml.jackson.databind.SerializerProvider; public class MyPairSerializer extends JsonSerializer { - private final ObjectMapper mapper = new ObjectMapper(); + private final ObjectMapper mapper = new ObjectMapper(); - @Override - public void serialize(MyPair value, JsonGenerator gen, - SerializerProvider serializers) throws IOException, - JsonProcessingException { - StringWriter writer = new StringWriter(); - mapper.writeValue(writer, value); - gen.writeFieldName(writer.toString()); - } + @Override + public void serialize(MyPair value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException { + StringWriter writer = new StringWriter(); + mapper.writeValue(writer, value); + gen.writeFieldName(writer.toString()); + } } \ No newline at end of file diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/jsongetter/Author.java b/jackson/src/main/java/com/baeldung/jackson/serialization/jsongetter/Author.java index 13453edeb2..8d89fefce7 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/jsongetter/Author.java +++ b/jackson/src/main/java/com/baeldung/jackson/serialization/jsongetter/Author.java @@ -1,6 +1,5 @@ package com.baeldung.jackson.serialization.jsongetter; - import com.baeldung.jackson.domain.Item; import com.baeldung.jackson.domain.Person; import com.fasterxml.jackson.annotation.JsonGetter; diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonpropertyorder/Author.java b/jackson/src/main/java/com/baeldung/jackson/serialization/jsonpropertyorder/Author.java index c5214f3305..dadf893cf9 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonpropertyorder/Author.java +++ b/jackson/src/main/java/com/baeldung/jackson/serialization/jsonpropertyorder/Author.java @@ -1,6 +1,5 @@ package com.baeldung.jackson.serialization.jsonpropertyorder; - import com.baeldung.jackson.domain.Item; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -13,7 +12,7 @@ import java.util.List; * @author Alex Theedom www.readlearncode.com * @version 1.0 */ -@JsonPropertyOrder({"items", "firstName", "lastName", "id"}) +@JsonPropertyOrder({ "items", "firstName", "lastName", "id" }) public class Author extends Person { List items = new ArrayList<>(); diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonserialize/Book.java b/jackson/src/main/java/com/baeldung/jackson/serialization/jsonserialize/Book.java index e682f7c394..0ecc4e72ce 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonserialize/Book.java +++ b/jackson/src/main/java/com/baeldung/jackson/serialization/jsonserialize/Book.java @@ -19,7 +19,8 @@ public class Book extends Item { private Date published; private BigDecimal pages; - public Book(){} + public Book() { + } public Book(String title, Author author) { super(title, author); diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonserialize/CustomDateSerializer.java b/jackson/src/main/java/com/baeldung/jackson/serialization/jsonserialize/CustomDateSerializer.java index 8e6d20cfe0..131f4f3695 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonserialize/CustomDateSerializer.java +++ b/jackson/src/main/java/com/baeldung/jackson/serialization/jsonserialize/CustomDateSerializer.java @@ -17,8 +17,7 @@ import java.util.Date; */ public class CustomDateSerializer extends StdSerializer { - private static SimpleDateFormat formatter = - new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); + private static SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); public CustomDateSerializer() { this(null); @@ -29,8 +28,7 @@ public class CustomDateSerializer extends StdSerializer { } @Override - public void serialize(Date value, JsonGenerator gen, SerializerProvider arg2) - throws IOException, JsonProcessingException { + public void serialize(Date value, JsonGenerator gen, SerializerProvider arg2) throws IOException, JsonProcessingException { gen.writeString(formatter.format(value)); } } diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonserialize/Item.java b/jackson/src/main/java/com/baeldung/jackson/serialization/jsonserialize/Item.java index ed6ac25184..56cfa85793 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonserialize/Item.java +++ b/jackson/src/main/java/com/baeldung/jackson/serialization/jsonserialize/Item.java @@ -19,7 +19,8 @@ public class Item { private List authors = new ArrayList<>(); private float price; - public Item(){} + public Item() { + } public Item(String title, Author author) { this.id = UUID.randomUUID(); diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonvalue/Course.java b/jackson/src/main/java/com/baeldung/jackson/serialization/jsonvalue/Course.java index eb7cb097e5..a3fdc2d8eb 100644 --- a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonvalue/Course.java +++ b/jackson/src/main/java/com/baeldung/jackson/serialization/jsonvalue/Course.java @@ -14,7 +14,9 @@ import java.util.List; */ public class Course extends Item { - public enum Medium {CLASSROOM, ONLINE} + public enum Medium { + CLASSROOM, ONLINE + } public enum Level { BEGINNER("Beginner", 1), INTERMEDIATE("Intermediate", 2), ADVANCED("Advanced", 3); diff --git a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/ExtraAnnotationUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/annotation/extra/ExtraAnnotationUnitTest.java index c4e0a2ecdb..647c451659 100644 --- a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/ExtraAnnotationUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/annotation/extra/ExtraAnnotationUnitTest.java @@ -47,9 +47,10 @@ public class ExtraAnnotationUnitTest { ObjectMapper mapper = new ObjectMapper(); BeanWithoutAppend bean = new BeanWithoutAppend(2, "Bean Without Append Annotation"); - ObjectWriter writer = mapper.writerFor(BeanWithoutAppend.class).withAttribute("version", "1.0"); + ObjectWriter writer = mapper.writerFor(BeanWithoutAppend.class) + .withAttribute("version", "1.0"); String jsonString = writer.writeValueAsString(bean); - + assertThat(jsonString, not(containsString("version"))); assertThat(jsonString, not(containsString("1.0"))); } @@ -59,9 +60,10 @@ public class ExtraAnnotationUnitTest { ObjectMapper mapper = new ObjectMapper(); BeanWithAppend bean = new BeanWithAppend(2, "Bean With Append Annotation"); - ObjectWriter writer = mapper.writerFor(BeanWithAppend.class).withAttribute("version", "1.0"); + ObjectWriter writer = mapper.writerFor(BeanWithAppend.class) + .withAttribute("version", "1.0"); String jsonString = writer.writeValueAsString(bean); - + assertThat(jsonString, containsString("version")); assertThat(jsonString, containsString("1.0")); } @@ -71,7 +73,7 @@ public class ExtraAnnotationUnitTest { ObjectMapper mapper = new ObjectMapper(); NamingBean bean = new NamingBean(3, "Naming Bean"); String jsonString = mapper.writeValueAsString(bean); - + assertThat(jsonString, containsString("bean_name")); } diff --git a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/IdentityReferenceBeans.java b/jackson/src/test/java/com/baeldung/jackson/annotation/extra/IdentityReferenceBeans.java index 495bb7de43..0a8736d9a5 100644 --- a/jackson/src/test/java/com/baeldung/jackson/annotation/extra/IdentityReferenceBeans.java +++ b/jackson/src/test/java/com/baeldung/jackson/annotation/extra/IdentityReferenceBeans.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.JsonIdentityReference; import com.fasterxml.jackson.annotation.ObjectIdGenerators; - public class IdentityReferenceBeans { @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id") public static class BeanWithoutIdentityReference { @@ -32,7 +31,7 @@ public class IdentityReferenceBeans { this.name = name; } } - + @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id") @JsonIdentityReference(alwaysAsId = true) public static class BeanWithIdentityReference { diff --git a/jackson/src/test/java/com/baeldung/jackson/bidirection/CustomListSerializer.java b/jackson/src/test/java/com/baeldung/jackson/bidirection/CustomListSerializer.java index 75e0a4ecb7..c6babdee01 100644 --- a/jackson/src/test/java/com/baeldung/jackson/bidirection/CustomListSerializer.java +++ b/jackson/src/test/java/com/baeldung/jackson/bidirection/CustomListSerializer.java @@ -20,6 +20,7 @@ public class CustomListSerializer extends StdSerializer public CustomListSerializer(final Class> t) { super(t); } + @Override public void serialize(final List items, final JsonGenerator generator, final SerializerProvider provider) throws IOException, JsonProcessingException { final List ids = new ArrayList(); diff --git a/jackson/src/test/java/com/baeldung/jackson/date/CustomLocalDateTimeSerializer.java b/jackson/src/test/java/com/baeldung/jackson/date/CustomLocalDateTimeSerializer.java index dbcf42488e..ac7d772f0f 100644 --- a/jackson/src/test/java/com/baeldung/jackson/date/CustomLocalDateTimeSerializer.java +++ b/jackson/src/test/java/com/baeldung/jackson/date/CustomLocalDateTimeSerializer.java @@ -11,7 +11,6 @@ import com.fasterxml.jackson.databind.ser.std.StdSerializer; public class CustomLocalDateTimeSerializer extends StdSerializer { - private static final long serialVersionUID = -7449444168934819290L; private static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializer.java b/jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializer.java index e9c89b8c78..bbc3f31a6c 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializer.java +++ b/jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializer.java @@ -28,9 +28,11 @@ public class ItemDeserializer extends StdDeserializer { */ @Override public Item deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException { - final JsonNode node = jp.getCodec().readTree(jp); + final JsonNode node = jp.getCodec() + .readTree(jp); final int id = (Integer) ((IntNode) node.get("id")).numberValue(); - final String itemName = node.get("itemName").asText(); + final String itemName = node.get("itemName") + .asText(); final int userId = (Integer) ((IntNode) node.get("createdBy")).numberValue(); return new Item(id, itemName, new User(userId, null)); diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializerOnClass.java b/jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializerOnClass.java index 2036780e99..eaba9a7173 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializerOnClass.java +++ b/jackson/src/test/java/com/baeldung/jackson/deserialization/ItemDeserializerOnClass.java @@ -28,9 +28,11 @@ public class ItemDeserializerOnClass extends StdDeserializer */ @Override public ItemWithSerializer deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException { - final JsonNode node = jp.getCodec().readTree(jp); + final JsonNode node = jp.getCodec() + .readTree(jp); final int id = (Integer) ((IntNode) node.get("id")).numberValue(); - final String itemName = node.get("itemName").asText(); + final String itemName = node.get("itemName") + .asText(); final int userId = (Integer) ((IntNode) node.get("owner")).numberValue(); return new ItemWithSerializer(id, itemName, new User(userId, null)); diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/JacksonMapDeserializeUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/deserialization/JacksonMapDeserializeUnitTest.java index 4d5db699a0..1c3e95241a 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/JacksonMapDeserializeUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/deserialization/JacksonMapDeserializeUnitTest.java @@ -16,54 +16,49 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class JacksonMapDeserializeUnitTest { - private Map map; - private Map cmap; - final ObjectMapper mapper = new ObjectMapper(); + private Map map; + private Map cmap; + final ObjectMapper mapper = new ObjectMapper(); - @Test - public void whenSimpleMapDeserialize_thenCorrect() - throws JsonParseException, JsonMappingException, IOException { + @Test + public void whenSimpleMapDeserialize_thenCorrect() throws JsonParseException, JsonMappingException, IOException { - final String jsonInput = "{\"key\": \"value\"}"; - TypeReference> typeRef = new TypeReference>() { - }; + final String jsonInput = "{\"key\": \"value\"}"; + TypeReference> typeRef = new TypeReference>() { + }; - final Map map = mapper.readValue(jsonInput, typeRef); + final Map map = mapper.readValue(jsonInput, typeRef); - Assert.assertEquals("value", map.get("key")); - } + Assert.assertEquals("value", map.get("key")); + } - @Test - public void whenObjectStringMapDeserialize_thenCorrect() - throws JsonParseException, JsonMappingException, IOException { + @Test + public void whenObjectStringMapDeserialize_thenCorrect() throws JsonParseException, JsonMappingException, IOException { - final String jsonInput = "{\"Abbott and Costello\":\"Comedy\"}"; + final String jsonInput = "{\"Abbott and Costello\":\"Comedy\"}"; - TypeReference> typeRef = new TypeReference>() { - }; + TypeReference> typeRef = new TypeReference>() { + }; - map = mapper.readValue(jsonInput, typeRef); + map = mapper.readValue(jsonInput, typeRef); - Assert.assertEquals("Comedy", map.get(new MyPair("Abbott", "Costello"))); + Assert.assertEquals("Comedy", map.get(new MyPair("Abbott", "Costello"))); - ClassWithAMap classWithMap = mapper.readValue(jsonInput, - ClassWithAMap.class); + ClassWithAMap classWithMap = mapper.readValue(jsonInput, ClassWithAMap.class); - Assert.assertEquals("Comedy", - classWithMap.getMap().get(new MyPair("Abbott", "Costello"))); - } + Assert.assertEquals("Comedy", classWithMap.getMap() + .get(new MyPair("Abbott", "Costello"))); + } - @Test - public void whenObjectObjectMapDeserialize_thenCorrect() - throws JsonParseException, JsonMappingException, IOException { + @Test + public void whenObjectObjectMapDeserialize_thenCorrect() throws JsonParseException, JsonMappingException, IOException { - final String jsonInput = "{\"Abbott and Costello\" : \"Comedy and 1940s\"}"; - TypeReference> typeRef = new TypeReference>() { - }; + final String jsonInput = "{\"Abbott and Costello\" : \"Comedy and 1940s\"}"; + TypeReference> typeRef = new TypeReference>() { + }; - cmap = mapper.readValue(jsonInput, typeRef); + cmap = mapper.readValue(jsonInput, typeRef); - Assert.assertEquals(new MyPair("Comedy", "1940s"), - cmap.get(new MyPair("Abbott", "Costello"))); - } + Assert.assertEquals(new MyPair("Comedy", "1940s"), cmap.get(new MyPair("Abbott", "Costello"))); + } } diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/jacksoninject/JacksonInjectUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/deserialization/jacksoninject/JacksonInjectUnitTest.java index 81bb14c533..96dbff6f3c 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/jacksoninject/JacksonInjectUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/deserialization/jacksoninject/JacksonInjectUnitTest.java @@ -27,7 +27,9 @@ public class JacksonInjectUnitTest { // act InjectableValues inject = new InjectableValues.Std().addValue(UUID.class, id); - Author author = new ObjectMapper().reader(inject).forType(Author.class).readValue(authorJson); + Author author = new ObjectMapper().reader(inject) + .forType(Author.class) + .readValue(authorJson); // assert assertThat(author.getId()).isEqualTo(id); diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/jsonanysetter/JsonAnySetterUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/deserialization/jsonanysetter/JsonAnySetterUnitTest.java index 7c338696e7..2e1f94bc3c 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/jsonanysetter/JsonAnySetterUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/deserialization/jsonanysetter/JsonAnySetterUnitTest.java @@ -23,15 +23,28 @@ public class JsonAnySetterUnitTest { String json = "{\"USA\":10.00,\"UK\":15.00,\"China\":23.00,\"Brazil\":12.00,\"France\":8.00,\"Russia\":18.00}"; // act - Inventory inventory = new ObjectMapper().readerFor(Inventory.class).readValue(json); + Inventory inventory = new ObjectMapper().readerFor(Inventory.class) + .readValue(json); // assert - assertThat(from(json).getMap(".").get("USA")).isEqualTo(inventory.getCountryDeliveryCost().get("USA")); - assertThat(from(json).getMap(".").get("UK")).isEqualTo(inventory.getCountryDeliveryCost().get("UK")); - assertThat(from(json).getMap(".").get("China")).isEqualTo(inventory.getCountryDeliveryCost().get("China")); - assertThat(from(json).getMap(".").get("Brazil")).isEqualTo(inventory.getCountryDeliveryCost().get("Brazil")); - assertThat(from(json).getMap(".").get("France")).isEqualTo(inventory.getCountryDeliveryCost().get("France")); - assertThat(from(json).getMap(".").get("Russia")).isEqualTo(inventory.getCountryDeliveryCost().get("Russia")); + assertThat(from(json).getMap(".") + .get("USA")).isEqualTo(inventory.getCountryDeliveryCost() + .get("USA")); + assertThat(from(json).getMap(".") + .get("UK")).isEqualTo(inventory.getCountryDeliveryCost() + .get("UK")); + assertThat(from(json).getMap(".") + .get("China")).isEqualTo(inventory.getCountryDeliveryCost() + .get("China")); + assertThat(from(json).getMap(".") + .get("Brazil")).isEqualTo(inventory.getCountryDeliveryCost() + .get("Brazil")); + assertThat(from(json).getMap(".") + .get("France")).isEqualTo(inventory.getCountryDeliveryCost() + .get("France")); + assertThat(from(json).getMap(".") + .get("Russia")).isEqualTo(inventory.getCountryDeliveryCost() + .get("Russia")); } } \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/jsoncreator/JsonCreatorUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/deserialization/jsoncreator/JsonCreatorUnitTest.java index cc6b2a28aa..cc245dab66 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/jsoncreator/JsonCreatorUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/deserialization/jsoncreator/JsonCreatorUnitTest.java @@ -20,14 +20,11 @@ public class JsonCreatorUnitTest { public void whenDeserializingUsingJsonCreator_thenCorrect() throws IOException { // arrange - String authorJson = - "{" + - " \"christianName\": \"Alex\"," + - " \"surname\": \"Theedom\"" + - "}"; + String authorJson = "{" + " \"christianName\": \"Alex\"," + " \"surname\": \"Theedom\"" + "}"; // act - final Author author = new ObjectMapper().readerFor(Author.class).readValue(authorJson); + final Author author = new ObjectMapper().readerFor(Author.class) + .readValue(authorJson); // assert assertThat(from(authorJson).getString("christianName")).isEqualTo(author.getFirstName()); diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/jsondeserialize/JsonDeserializeUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/deserialization/jsondeserialize/JsonDeserializeUnitTest.java index dca2252431..1bcde998d6 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/jsondeserialize/JsonDeserializeUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/deserialization/jsondeserialize/JsonDeserializeUnitTest.java @@ -24,7 +24,8 @@ public class JsonDeserializeUnitTest { String bookJson = "{\"id\":\"957c43f2-fa2e-42f9-bf75-6e3d5bb6960a\",\"title\":\"Effective Java\",\"authors\":[{\"id\":\"9bcd817d-0141-42e6-8f04-e5aaab0980b6\",\"firstName\":\"Joshua\",\"lastName\":\"Bloch\"}],\"price\":0,\"published\":\"25-12-2017 13:30:25\",\"pages\":null,\"isbn\":null}"; // act - Book book = new ObjectMapper().readerFor(Book.class).readValue(bookJson); + Book book = new ObjectMapper().readerFor(Book.class) + .readValue(bookJson); // assert SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); diff --git a/jackson/src/test/java/com/baeldung/jackson/deserialization/jsonsetter/JsonSetterUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/deserialization/jsonsetter/JsonSetterUnitTest.java index 42e105cd52..4379fe376c 100644 --- a/jackson/src/test/java/com/baeldung/jackson/deserialization/jsonsetter/JsonSetterUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/deserialization/jsonsetter/JsonSetterUnitTest.java @@ -23,10 +23,13 @@ public class JsonSetterUnitTest { String json = "{\"firstName\":\"Alex\",\"lastName\":\"Theedom\",\"publications\":[{\"title\":\"Professional Java EE Design Patterns\"}]}"; // act - Author author = new ObjectMapper().readerFor(Author.class).readValue(json); + Author author = new ObjectMapper().readerFor(Author.class) + .readValue(json); // assert - assertThat(from(json).getList("publications").size()).isEqualTo(author.getItems().size()); + assertThat(from(json).getList("publications") + .size()).isEqualTo(author.getItems() + .size()); } } \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Address.java b/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Address.java index c2d2e84d45..daca85f66a 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Address.java +++ b/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Address.java @@ -1,6 +1,5 @@ package com.baeldung.jackson.dynamicIgnore; - public class Address implements Hidable { private String city; private String country; diff --git a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Hidable.java b/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Hidable.java index edca786432..a32e6844a6 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Hidable.java +++ b/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Hidable.java @@ -2,7 +2,6 @@ package com.baeldung.jackson.dynamicIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - @JsonIgnoreProperties("hidden") public interface Hidable { boolean isHidden(); diff --git a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Person.java b/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Person.java index 366f611edf..daa62b4be6 100644 --- a/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Person.java +++ b/jackson/src/test/java/com/baeldung/jackson/dynamicIgnore/Person.java @@ -1,6 +1,5 @@ package com.baeldung.jackson.dynamicIgnore; - public class Person implements Hidable { private String name; private Address address; @@ -13,7 +12,6 @@ public class Person implements Hidable { this.hidden = hidden; } - public String getName() { return name; } @@ -29,6 +27,7 @@ public class Person implements Hidable { public void setAddress(final Address address) { this.address = address; } + @Override public boolean isHidden() { return hidden; diff --git a/jackson/src/test/java/com/baeldung/jackson/format/JsonFormatUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/format/JsonFormatUnitTest.java index 7ce03ff625..cf166fdc36 100755 --- a/jackson/src/test/java/com/baeldung/jackson/format/JsonFormatUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/format/JsonFormatUnitTest.java @@ -22,18 +22,16 @@ public class JsonFormatUnitTest { @Test public void whenSerializedDateFormat_thenCorrect() throws JsonProcessingException { - User user = new User("Jay", "Sridhar"); + User user = new User("Jay", "Sridhar"); - String result = new ObjectMapper().writeValueAsString(user); + String result = new ObjectMapper().writeValueAsString(user); - // Expected to match: "2016-12-19@09:34:42.628+0000" - assertThat(from(result).getString("createdDate")) - .matches("\\d{4}\\-\\d{2}\\-\\d{2}@\\d{2}:\\d{2}:\\d{2}\\.\\d{3}\\+\\d{4}"); + // Expected to match: "2016-12-19@09:34:42.628+0000" + assertThat(from(result).getString("createdDate")).matches("\\d{4}\\-\\d{2}\\-\\d{2}@\\d{2}:\\d{2}:\\d{2}\\.\\d{3}\\+\\d{4}"); - // Expected to be close to current time - long now = new Date().getTime(); - assertThat(from(result).getLong("dateNum")) - .isCloseTo(now, withPercentage(10.0)); + // Expected to be close to current time + long now = new Date().getTime(); + assertThat(from(result).getLong("dateNum")).isCloseTo(now, withPercentage(10.0)); } } diff --git a/jackson/src/test/java/com/baeldung/jackson/general/jsonfilter/JsonFilterUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/general/jsonfilter/JsonFilterUnitTest.java index 3eeec8dcee..6fcc57faa7 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/jsonfilter/JsonFilterUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/jsonfilter/JsonFilterUnitTest.java @@ -23,11 +23,11 @@ public class JsonFilterUnitTest { // arrange Author author = new Author("Alex", "Theedom"); - FilterProvider filters = new SimpleFilterProvider() - .addFilter("authorFilter", SimpleBeanPropertyFilter.filterOutAllExcept("lastName")); + FilterProvider filters = new SimpleFilterProvider().addFilter("authorFilter", SimpleBeanPropertyFilter.filterOutAllExcept("lastName")); // act - String result = new ObjectMapper().writer(filters).writeValueAsString(author); + String result = new ObjectMapper().writer(filters) + .writeValueAsString(author); // assert assertThat(from(result).getList("items")).isNull(); diff --git a/jackson/src/test/java/com/baeldung/jackson/general/jsonformat/Book.java b/jackson/src/test/java/com/baeldung/jackson/general/jsonformat/Book.java index cacd11c804..e2eb4aa48a 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/jsonformat/Book.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/jsonformat/Book.java @@ -17,9 +17,7 @@ public class Book extends Item { private String ISBN; - @JsonFormat( - shape = JsonFormat.Shape.STRING, - pattern = "dd-MM-yyyy HH:mm:ss") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy HH:mm:ss") private Date published; private BigDecimal pages; diff --git a/jackson/src/test/java/com/baeldung/jackson/general/jsonformat/JsonFormatUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/general/jsonformat/JsonFormatUnitTest.java index 0fcfe94cf8..1fe217cef6 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/jsonformat/JsonFormatUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/jsonformat/JsonFormatUnitTest.java @@ -31,10 +31,7 @@ public class JsonFormatUnitTest { String toParse = "20-12-2014 14:30:00"; Date date = df.parse(toParse); - Book book = new Book( - "Design Patterns: Elements of Reusable Object-oriented Software", - new Author("The", "GoF") - ); + Book book = new Book("Design Patterns: Elements of Reusable Object-oriented Software", new Author("The", "GoF")); book.setPublished(date); // act diff --git a/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Author.java b/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Author.java index ebe1a69c4e..1f36b95b2a 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Author.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Author.java @@ -12,9 +12,7 @@ import java.util.List; * @author Alex Theedom www.readlearncode.com * @version 1.0 */ -@JsonIdentityInfo( - generator = ObjectIdGenerators.PropertyGenerator.class, - property = "id") +@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id") public class Author extends Person { private List items = new ArrayList<>(); diff --git a/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Course.java b/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Course.java index 3db6d3dddb..80dd9c275e 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Course.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Course.java @@ -1,6 +1,5 @@ package com.baeldung.jackson.general.jsonidentityinfo; - import java.util.List; /** @@ -11,7 +10,9 @@ import java.util.List; */ public class Course extends Item { - public enum Medium {CLASSROOM, ONLINE} + public enum Medium { + CLASSROOM, ONLINE + } public enum Level { BEGINNER("Beginner", 1), INTERMEDIATE("Intermediate", 2), ADVANCED("Advanced", 3); diff --git a/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Item.java b/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Item.java index f252da4b1b..bad6562122 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Item.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Item.java @@ -13,9 +13,7 @@ import java.util.UUID; * @author Alex Theedom www.readlearncode.com * @version 1.0 */ -@JsonIdentityInfo( - generator = ObjectIdGenerators.PropertyGenerator.class, - property = "id") +@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id") public class Item { private UUID id; @@ -23,7 +21,8 @@ public class Item { private List authors = new ArrayList<>(); private float price; - public Item(){} + public Item() { + } public Item(String title, Author author) { this.id = UUID.randomUUID(); diff --git a/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Person.java b/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Person.java index 8a5b4b75e1..ea80814124 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Person.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/jsonidentityinfo/Person.java @@ -14,7 +14,8 @@ public class Person { private String firstName; private String lastName; - public Person(){} + public Person() { + } public Person(String firstName, String lastName) { this.id = UUID.randomUUID(); diff --git a/jackson/src/test/java/com/baeldung/jackson/general/jsonproperty/Item.java b/jackson/src/test/java/com/baeldung/jackson/general/jsonproperty/Item.java index 1deae26b21..d7ee430d51 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/jsonproperty/Item.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/jsonproperty/Item.java @@ -19,7 +19,8 @@ public class Item { private List authors = new ArrayList<>(); private float price; - public Item(){} + public Item() { + } public Item(String title, Author author) { this.id = UUID.randomUUID(); diff --git a/jackson/src/test/java/com/baeldung/jackson/general/jsonproperty/JsonPropertyUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/general/jsonproperty/JsonPropertyUnitTest.java index 94046f8a56..0b88e7fc47 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/jsonproperty/JsonPropertyUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/jsonproperty/JsonPropertyUnitTest.java @@ -21,10 +21,7 @@ public class JsonPropertyUnitTest { public void whenSerializingUsingJsonProperty_thenCorrect() throws JsonProcessingException { // arrange - Book book = new Book( - "Design Patterns: Elements of Reusable Object-oriented Software", - new Author("The", "GoF") - ); + Book book = new Book("Design Patterns: Elements of Reusable Object-oriented Software", new Author("The", "GoF")); book.configureBinding("Hardback"); // act @@ -62,12 +59,12 @@ public class JsonPropertyUnitTest { String result = "{\"id\":\"cd941587-d1ae-4c2a-9a36-29533bf50411\",\"title\":\"Design Patterns: Elements of Reusable Object-oriented Software\",\"authors\":[{\"id\":\"c8e26318-2f5b-4fa2-9fdc-6e99be021fca\",\"firstName\":\"The\",\"lastName\":\"GoF\"}],\"binding\":\"Hardback\"}"; // act - Book book = new ObjectMapper().readerFor(Book.class).readValue(result); + Book book = new ObjectMapper().readerFor(Book.class) + .readValue(result); // assert assertThat(book.coverBinding()).isEqualTo("Hardback"); } - } \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/general/jsonunwrapped/JsonUnwrappedUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/general/jsonunwrapped/JsonUnwrappedUnitTest.java index 491f706db4..5130e037d5 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/jsonunwrapped/JsonUnwrappedUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/jsonunwrapped/JsonUnwrappedUnitTest.java @@ -1,6 +1,5 @@ package com.baeldung.jackson.general.jsonunwrapped; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Test; diff --git a/jackson/src/test/java/com/baeldung/jackson/general/jsonview/JsonViewUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/general/jsonview/JsonViewUnitTest.java index 8ac10cac8b..ab609008ce 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/jsonview/JsonViewUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/jsonview/JsonViewUnitTest.java @@ -22,7 +22,8 @@ public class JsonViewUnitTest { Order order = new Order(120); // act - String result = new ObjectMapper().writerWithView(Views.Internal.class).writeValueAsString(order); + String result = new ObjectMapper().writerWithView(Views.Internal.class) + .writeValueAsString(order); // assert assertThat(from(result).getUUID("id")).isNotNull(); @@ -49,7 +50,8 @@ public class JsonViewUnitTest { Order order = new Order(120); // act - String result = new ObjectMapper().writerWithView(Views.Public.class).writeValueAsString(order); + String result = new ObjectMapper().writerWithView(Views.Public.class) + .writeValueAsString(order); // assert assertThat(from(result).getUUID("id")).isNotNull(); @@ -68,5 +70,4 @@ public class JsonViewUnitTest { } - } \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/general/reference/Course.java b/jackson/src/test/java/com/baeldung/jackson/general/reference/Course.java index 9d99d632e7..251d25a517 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/reference/Course.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/reference/Course.java @@ -1,6 +1,5 @@ package com.baeldung.jackson.general.reference; - import java.util.List; /** @@ -11,7 +10,9 @@ import java.util.List; */ public class Course extends Item { - public enum Medium {CLASSROOM, ONLINE} + public enum Medium { + CLASSROOM, ONLINE + } public enum Level { BEGINNER("Beginner", 1), INTERMEDIATE("Intermediate", 2), ADVANCED("Advanced", 3); diff --git a/jackson/src/test/java/com/baeldung/jackson/general/reference/Item.java b/jackson/src/test/java/com/baeldung/jackson/general/reference/Item.java index 08bada3646..5dd66a8ca3 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/reference/Item.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/reference/Item.java @@ -21,7 +21,8 @@ public class Item { private List authors = new ArrayList<>(); private float price; - public Item(){} + public Item() { + } public Item(String title, Author author) { this.id = UUID.randomUUID(); diff --git a/jackson/src/test/java/com/baeldung/jackson/general/reference/Person.java b/jackson/src/test/java/com/baeldung/jackson/general/reference/Person.java index 5bb20f7aff..95c0b35b8b 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/reference/Person.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/reference/Person.java @@ -14,7 +14,8 @@ public class Person { private String firstName; private String lastName; - public Person(){} + public Person() { + } public Person(String firstName, String lastName) { this.id = UUID.randomUUID(); diff --git a/jackson/src/test/java/com/baeldung/jackson/general/reference/ReferenceUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/general/reference/ReferenceUnitTest.java index c0aece9636..7a52a69656 100644 --- a/jackson/src/test/java/com/baeldung/jackson/general/reference/ReferenceUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/general/reference/ReferenceUnitTest.java @@ -36,7 +36,7 @@ public class ReferenceUnitTest { /* Without references defined it throws StackOverflowError. Authors excluded. - + { "id": "9c45d9b3-4888-4c24-8b74-65ef35627cd7", "firstName": "Alex", diff --git a/jackson/src/test/java/com/baeldung/jackson/inclusion/jsonautodetect/JsonAutoDetectUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/inclusion/jsonautodetect/JsonAutoDetectUnitTest.java index ef9d6e0e29..a3e29776a9 100644 --- a/jackson/src/test/java/com/baeldung/jackson/inclusion/jsonautodetect/JsonAutoDetectUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/inclusion/jsonautodetect/JsonAutoDetectUnitTest.java @@ -37,7 +37,7 @@ public class JsonAutoDetectUnitTest { }, "internalAudit": 1234567890 } - + Without @JsonAutoDetect { "id": "c94774d9-de8f-4244-85d5-624bd3a4567a", diff --git a/jackson/src/test/java/com/baeldung/jackson/inclusion/jsoninclude/JsonIncludeUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/inclusion/jsoninclude/JsonIncludeUnitTest.java index f85dd66764..ca4c4b751a 100644 --- a/jackson/src/test/java/com/baeldung/jackson/inclusion/jsoninclude/JsonIncludeUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/inclusion/jsoninclude/JsonIncludeUnitTest.java @@ -28,7 +28,6 @@ public class JsonIncludeUnitTest { assertThat(from(result).getString("firstName")).isEqualTo("Alex"); assertThat(result).doesNotContain("lastName"); - /* { "id": "e8bb4802-6e0c-4fa5-9f68-c233272399cd", diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUserUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUserUnitTest.java index a0ba23fb71..0f312ec37e 100644 --- a/jackson/src/test/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUserUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/inheritance/ItemIdRemovedFromUserUnitTest.java @@ -12,29 +12,29 @@ import static org.junit.Assert.assertTrue; public class ItemIdRemovedFromUserUnitTest { @Test public void givenRemoveItemJson_whenDeserialize_shouldHaveProperClassType() throws IOException { - //given + // given Event event = new ItemIdRemovedFromUser("1", 12345567L, "item_1", 2L); ObjectMapper objectMapper = new ObjectMapper(); String eventJson = objectMapper.writeValueAsString(event); - //when + // when Event result = new ObjectMapper().readValue(eventJson, Event.class); - //then + // then assertTrue(result instanceof ItemIdRemovedFromUser); assertEquals("item_1", ((ItemIdRemovedFromUser) result).getItemId()); } @Test public void givenAdddItemJson_whenSerialize_shouldIgnoreIdPropertyFromSuperclass() throws IOException { - //given + // given Event event = new ItemIdAddedToUser("1", 12345567L, "item_1", 2L); ObjectMapper objectMapper = new ObjectMapper(); - //when + // when String eventJson = objectMapper.writeValueAsString(event); - //then + // then assertFalse(eventJson.contains("id")); } diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/SubTypeHandlingUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/inheritance/SubTypeHandlingUnitTest.java index a8c1e94e9b..b5b81fa4a3 100644 --- a/jackson/src/test/java/com/baeldung/jackson/inheritance/SubTypeHandlingUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/inheritance/SubTypeHandlingUnitTest.java @@ -21,12 +21,12 @@ public class SubTypeHandlingUnitTest { assertEquals("Mercedes-Benz", truck.getMake()); assertEquals("S500", truck.getModel()); } - + @Test - public void givenSubType_whenNotUsingNoArgsConstructors_thenSucceed() throws IOException{ + public void givenSubType_whenNotUsingNoArgsConstructors_thenSucceed() throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.enableDefaultTyping(); - + SubTypeConstructorStructure.Car car = new SubTypeConstructorStructure.Car("Mercedes-Benz", "S500", 5, 250.0); SubTypeConstructorStructure.Truck truck = new SubTypeConstructorStructure.Truck("Isuzu", "NQR", 7500.0); diff --git a/jackson/src/test/java/com/baeldung/jackson/inheritance/TypeInfoInclusionUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/inheritance/TypeInfoInclusionUnitTest.java index b436eda6e0..02297b9ee8 100644 --- a/jackson/src/test/java/com/baeldung/jackson/inheritance/TypeInfoInclusionUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/inheritance/TypeInfoInclusionUnitTest.java @@ -30,8 +30,10 @@ public class TypeInfoInclusionUnitTest { String jsonDataString = mapper.writeValueAsString(serializedFleet); TypeInfoStructure.Fleet deserializedFleet = mapper.readValue(jsonDataString, TypeInfoStructure.Fleet.class); - assertThat(deserializedFleet.getVehicles().get(0), instanceOf(TypeInfoStructure.Car.class)); - assertThat(deserializedFleet.getVehicles().get(1), instanceOf(TypeInfoStructure.Truck.class)); + assertThat(deserializedFleet.getVehicles() + .get(0), instanceOf(TypeInfoStructure.Car.class)); + assertThat(deserializedFleet.getVehicles() + .get(1), instanceOf(TypeInfoStructure.Truck.class)); } @Test @@ -51,7 +53,9 @@ public class TypeInfoInclusionUnitTest { String jsonDataString = mapper.writeValueAsString(serializedFleet); TypeInfoAnnotatedStructure.Fleet deserializedFleet = mapper.readValue(jsonDataString, TypeInfoAnnotatedStructure.Fleet.class); - assertThat(deserializedFleet.getVehicles().get(0), instanceOf(TypeInfoAnnotatedStructure.Car.class)); - assertThat(deserializedFleet.getVehicles().get(1), instanceOf(TypeInfoAnnotatedStructure.Truck.class)); + assertThat(deserializedFleet.getVehicles() + .get(0), instanceOf(TypeInfoAnnotatedStructure.Car.class)); + assertThat(deserializedFleet.getVehicles() + .get(1), instanceOf(TypeInfoAnnotatedStructure.Truck.class)); } } \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/node/ExampleStructure.java b/jackson/src/test/java/com/baeldung/jackson/node/ExampleStructure.java index 14f9024d0b..a472c7af15 100644 --- a/jackson/src/test/java/com/baeldung/jackson/node/ExampleStructure.java +++ b/jackson/src/test/java/com/baeldung/jackson/node/ExampleStructure.java @@ -10,7 +10,8 @@ public class ExampleStructure { private static ObjectMapper mapper = new ObjectMapper(); static JsonNode getExampleRoot() throws IOException { - InputStream exampleInput = ExampleStructure.class.getClassLoader().getResourceAsStream("node_example.json"); + InputStream exampleInput = ExampleStructure.class.getClassLoader() + .getResourceAsStream("node_example.json"); JsonNode rootNode = mapper.readTree(exampleInput); return rootNode; } diff --git a/jackson/src/test/java/com/baeldung/jackson/node/NodeOperationUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/node/NodeOperationUnitTest.java index 3539f388f9..73328f465e 100644 --- a/jackson/src/test/java/com/baeldung/jackson/node/NodeOperationUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/node/NodeOperationUnitTest.java @@ -28,8 +28,10 @@ public class NodeOperationUnitTest { final JsonNode node = mapper.valueToTree(fromValue); - assertEquals(2016, node.get("id").intValue()); - assertEquals("baeldung.com", node.get("name").textValue()); + assertEquals(2016, node.get("id") + .intValue()); + assertEquals("baeldung.com", node.get("name") + .textValue()); } @Test @@ -72,12 +74,21 @@ public class NodeOperationUnitTest { public void givenANode_whenAddingIntoATree_thenCorrect() throws IOException { final JsonNode rootNode = ExampleStructure.getExampleRoot(); final ObjectNode addedNode = ((ObjectNode) rootNode).putObject("address"); - addedNode.put("city", "Seattle").put("state", "Washington").put("country", "United States"); + addedNode.put("city", "Seattle") + .put("state", "Washington") + .put("country", "United States"); - assertFalse(rootNode.path("address").isMissingNode()); - assertEquals("Seattle", rootNode.path("address").path("city").textValue()); - assertEquals("Washington", rootNode.path("address").path("state").textValue()); - assertEquals("United States", rootNode.path("address").path("country").textValue()); + assertFalse(rootNode.path("address") + .isMissingNode()); + assertEquals("Seattle", rootNode.path("address") + .path("city") + .textValue()); + assertEquals("Washington", rootNode.path("address") + .path("state") + .textValue()); + assertEquals("United States", rootNode.path("address") + .path("country") + .textValue()); } @Test @@ -88,8 +99,12 @@ public class NodeOperationUnitTest { final JsonNode rootNode = ExampleStructure.getExampleRoot(); ((ObjectNode) rootNode).set("name", newNode); - assertFalse(rootNode.path("name").path("nick").isMissingNode()); - assertEquals("cowtowncoder", rootNode.path("name").path("nick").textValue()); + assertFalse(rootNode.path("name") + .path("nick") + .isMissingNode()); + assertEquals("cowtowncoder", rootNode.path("name") + .path("nick") + .textValue()); } @Test @@ -97,7 +112,8 @@ public class NodeOperationUnitTest { final JsonNode rootNode = ExampleStructure.getExampleRoot(); ((ObjectNode) rootNode).remove("company"); - assertTrue(rootNode.path("company").isMissingNode()); + assertTrue(rootNode.path("company") + .isMissingNode()); } } diff --git a/jackson/src/test/java/com/baeldung/jackson/objectmapper/CustomCarDeserializer.java b/jackson/src/test/java/com/baeldung/jackson/objectmapper/CustomCarDeserializer.java index a3d0b377c6..10b22b8365 100644 --- a/jackson/src/test/java/com/baeldung/jackson/objectmapper/CustomCarDeserializer.java +++ b/jackson/src/test/java/com/baeldung/jackson/objectmapper/CustomCarDeserializer.java @@ -25,8 +25,6 @@ public class CustomCarDeserializer extends StdDeserializer { super(vc); } - - @Override public Car deserialize(final JsonParser parser, final DeserializationContext deserializer) throws IOException { final Car car = new Car(); diff --git a/jackson/src/test/java/com/baeldung/jackson/objectmapper/CustomCarSerializer.java b/jackson/src/test/java/com/baeldung/jackson/objectmapper/CustomCarSerializer.java index 37bae829b7..9db09c5081 100644 --- a/jackson/src/test/java/com/baeldung/jackson/objectmapper/CustomCarSerializer.java +++ b/jackson/src/test/java/com/baeldung/jackson/objectmapper/CustomCarSerializer.java @@ -8,8 +8,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; -public class CustomCarSerializer extends StdSerializer -{ +public class CustomCarSerializer extends StdSerializer { private static final long serialVersionUID = 1396140685442227917L; @@ -22,8 +21,7 @@ public class CustomCarSerializer extends StdSerializer } @Override - public void serialize(final Car car, final JsonGenerator jsonGenerator, final SerializerProvider serializer) throws IOException, JsonProcessingException - { + public void serialize(final Car car, final JsonGenerator jsonGenerator, final SerializerProvider serializer) throws IOException, JsonProcessingException { jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("model: ", car.getType()); jsonGenerator.writeEndObject(); diff --git a/jackson/src/test/java/com/baeldung/jackson/objectmapper/JavaReadWriteJsonExampleUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/objectmapper/JavaReadWriteJsonExampleUnitTest.java index e6da19f440..2745e4f767 100644 --- a/jackson/src/test/java/com/baeldung/jackson/objectmapper/JavaReadWriteJsonExampleUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/objectmapper/JavaReadWriteJsonExampleUnitTest.java @@ -40,7 +40,8 @@ public class JavaReadWriteJsonExampleUnitTest { final ObjectMapper objectMapper = new ObjectMapper(); final JsonNode jsonNode = objectMapper.readTree(EXAMPLE_JSON); assertNotNull(jsonNode); - assertThat(jsonNode.get("color").asText(), containsString("Black")); + assertThat(jsonNode.get("color") + .asText(), containsString("Black")); } @Test diff --git a/jackson/src/test/java/com/baeldung/jackson/objectmapper/SerializationDeserializationFeatureUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/objectmapper/SerializationDeserializationFeatureUnitTest.java index 4ffec72a61..fcfee98123 100644 --- a/jackson/src/test/java/com/baeldung/jackson/objectmapper/SerializationDeserializationFeatureUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/objectmapper/SerializationDeserializationFeatureUnitTest.java @@ -18,7 +18,7 @@ import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; -public class SerializationDeserializationFeatureUnitTest { +public class SerializationDeserializationFeatureUnitTest { final String EXAMPLE_JSON = "{ \"color\" : \"Black\", \"type\" : \"BMW\" }"; final String JSON_CAR = "{ \"color\" : \"Black\", \"type\" : \"Fiat\", \"year\" : \"1970\" }"; final String JSON_ARRAY = "[{ \"color\" : \"Black\", \"type\" : \"BMW\" }, { \"color\" : \"Red\", \"type\" : \"BMW\" }]"; diff --git a/jackson/src/test/java/com/baeldung/jackson/polymorphism/PolymorphismUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/polymorphism/PolymorphismUnitTest.java index 5d2ba69767..e922cf9976 100644 --- a/jackson/src/test/java/com/baeldung/jackson/polymorphism/PolymorphismUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/polymorphism/PolymorphismUnitTest.java @@ -53,12 +53,14 @@ public class PolymorphismUnitTest { String orderJson = "{\"type\":{\"ordertype\":\"internal\",\"id\":100,\"name\":\"directors\"}}"; // act - Order order = new ObjectMapper().readerFor(Order.class).readValue(orderJson); + Order order = new ObjectMapper().readerFor(Order.class) + .readValue(orderJson); - // assert + // assert assertThat(from(orderJson).getString("type.ordertype")).isEqualTo("internal"); assertThat(((Order.InternalType) order.getType()).name).isEqualTo("directors"); assertThat(((Order.InternalType) order.getType()).id).isEqualTo(100); - assertThat(order.getType().getClass()).isEqualTo(Order.InternalType.class); + assertThat(order.getType() + .getClass()).isEqualTo(Order.InternalType.class); } } \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/sandbox/JacksonPrettyPrintUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/sandbox/JacksonPrettyPrintUnitTest.java index a68af20f15..a75e8ef831 100644 --- a/jackson/src/test/java/com/baeldung/jackson/sandbox/JacksonPrettyPrintUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/sandbox/JacksonPrettyPrintUnitTest.java @@ -33,7 +33,8 @@ public class JacksonPrettyPrintUnitTest { final ObjectMapper mapper = new ObjectMapper(); try { final Object json = mapper.readValue(readFile(fileName, StandardCharsets.UTF_8), Object.class); - System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(json)); + System.out.println(mapper.writerWithDefaultPrettyPrinter() + .writeValueAsString(json)); } catch (final IOException e) { e.printStackTrace(); } @@ -42,7 +43,8 @@ public class JacksonPrettyPrintUnitTest { static String readFile(final String path, final Charset encoding) throws IOException { final byte[] encoded = Files.readAllBytes(Paths.get(path)); - return encoding.decode(ByteBuffer.wrap(encoded)).toString(); + return encoding.decode(ByteBuffer.wrap(encoded)) + .toString(); } } diff --git a/jackson/src/test/java/com/baeldung/jackson/sandbox/SandboxUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/sandbox/SandboxUnitTest.java index 33aca2a1ed..6f22e2fa01 100644 --- a/jackson/src/test/java/com/baeldung/jackson/sandbox/SandboxUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/sandbox/SandboxUnitTest.java @@ -17,7 +17,10 @@ public class SandboxUnitTest { testElement.setX(10); testElement.setY("adasd"); final ObjectMapper om = new ObjectMapper(); - om.setVisibility(om.getSerializationConfig().getDefaultVisibilityChecker().withFieldVisibility(JsonAutoDetect.Visibility.ANY).withGetterVisibility(JsonAutoDetect.Visibility.NONE)); + om.setVisibility(om.getSerializationConfig() + .getDefaultVisibilityChecker() + .withFieldVisibility(JsonAutoDetect.Visibility.ANY) + .withGetterVisibility(JsonAutoDetect.Visibility.NONE)); final String serialized = om.writeValueAsString(testElement); System.err.println(serialized); diff --git a/jackson/src/test/java/com/baeldung/jackson/serialization/JacksonMapSerializeUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/serialization/JacksonMapSerializeUnitTest.java index 4935d35791..e67336f6f3 100644 --- a/jackson/src/test/java/com/baeldung/jackson/serialization/JacksonMapSerializeUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/serialization/JacksonMapSerializeUnitTest.java @@ -14,57 +14,53 @@ import com.fasterxml.jackson.databind.ser.std.MapSerializer; public class JacksonMapSerializeUnitTest { - @JsonSerialize(keyUsing = MyPairSerializer.class) - private Map map; + @JsonSerialize(keyUsing = MyPairSerializer.class) + private Map map; - @JsonSerialize(keyUsing = MapSerializer.class) - private Map cmap; + @JsonSerialize(keyUsing = MapSerializer.class) + private Map cmap; - @JsonSerialize(keyUsing = MyPairSerializer.class) - private MyPair mapKey; + @JsonSerialize(keyUsing = MyPairSerializer.class) + private MyPair mapKey; - @JsonSerialize(keyUsing = MyPairSerializer.class) - private MyPair mapValue; + @JsonSerialize(keyUsing = MyPairSerializer.class) + private MyPair mapValue; - final ObjectMapper mapper = new ObjectMapper(); + final ObjectMapper mapper = new ObjectMapper(); - @Test - public void whenSimpleMapSerialize_thenCorrect() - throws JsonProcessingException { + @Test + public void whenSimpleMapSerialize_thenCorrect() throws JsonProcessingException { - Map map = new HashMap<>(); - map.put("key", "value"); + Map map = new HashMap<>(); + map.put("key", "value"); - final String jsonResult = mapper.writeValueAsString(map); + final String jsonResult = mapper.writeValueAsString(map); - Assert.assertEquals("{\"key\":\"value\"}", jsonResult); - } + Assert.assertEquals("{\"key\":\"value\"}", jsonResult); + } - @Test - public void whenCustomObjectStringMapSerialize_thenCorrect() - throws JsonProcessingException { + @Test + public void whenCustomObjectStringMapSerialize_thenCorrect() throws JsonProcessingException { - map = new HashMap<>(); - MyPair key = new MyPair("Abbott", "Costello"); - map.put(key, "Comedy"); + map = new HashMap<>(); + MyPair key = new MyPair("Abbott", "Costello"); + map.put(key, "Comedy"); - final String jsonResult = mapper.writeValueAsString(map); + final String jsonResult = mapper.writeValueAsString(map); - Assert.assertEquals("{\"Abbott and Costello\":\"Comedy\"}", jsonResult); - } + Assert.assertEquals("{\"Abbott and Costello\":\"Comedy\"}", jsonResult); + } - @Test - public void whenCustomObjectObjectMapSerialize_thenCorrect() - throws JsonProcessingException { + @Test + public void whenCustomObjectObjectMapSerialize_thenCorrect() throws JsonProcessingException { - cmap = new HashMap<>(); - mapKey = new MyPair("Abbott", "Costello"); - mapValue = new MyPair("Comedy", "1940's"); - cmap.put(mapKey, mapValue); + cmap = new HashMap<>(); + mapKey = new MyPair("Abbott", "Costello"); + mapValue = new MyPair("Comedy", "1940's"); + cmap.put(mapKey, mapValue); - final String jsonResult = mapper.writeValueAsString(cmap); + final String jsonResult = mapper.writeValueAsString(cmap); - Assert.assertEquals("{\"Abbott and Costello\":\"Comedy and 1940's\"}", - jsonResult); - } + Assert.assertEquals("{\"Abbott and Costello\":\"Comedy and 1940's\"}", jsonResult); + } } diff --git a/jackson/src/test/java/com/baeldung/jackson/serialization/JacksonSerializeUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/serialization/JacksonSerializeUnitTest.java index fa6364ff92..a003c5b526 100644 --- a/jackson/src/test/java/com/baeldung/jackson/serialization/JacksonSerializeUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/serialization/JacksonSerializeUnitTest.java @@ -48,10 +48,13 @@ public class JacksonSerializeUnitTest { module.addSerializer(new ActorJacksonSerializer(ActorJackson.class)); final ObjectMapper mapper = new ObjectMapper(); - final String jsonResult = mapper.registerModule(module).writer(new DefaultPrettyPrinter()).writeValueAsString(movieWithNullValue); + final String jsonResult = mapper.registerModule(module) + .writer(new DefaultPrettyPrinter()) + .writeValueAsString(movieWithNullValue); final Object json = mapper.readValue("{\"actors\":[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":\"21-09-1982\",\"N° Film: \":3,\"filmography\":\"Apocalypto-Beatdown-Wind Walkers\"}],\"imdbID\":null}", Object.class); - final String expectedOutput = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(json); + final String expectedOutput = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT) + .writeValueAsString(json); Assert.assertEquals(jsonResult, expectedOutput); } diff --git a/jackson/src/test/java/com/baeldung/jackson/serialization/jsonrawvalue/JsonRawValueUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/serialization/jsonrawvalue/JsonRawValueUnitTest.java index 0671441d9a..f0f0913aee 100644 --- a/jackson/src/test/java/com/baeldung/jackson/serialization/jsonrawvalue/JsonRawValueUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/serialization/jsonrawvalue/JsonRawValueUnitTest.java @@ -28,7 +28,6 @@ public class JsonRawValueUnitTest { // assert assertThat(result.contains(customerConfig)); - /* { "firstName": "Alex", diff --git a/jackson/src/test/java/com/baeldung/jackson/streaming/JacksonStreamingAPIUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/streaming/JacksonStreamingAPIUnitTest.java index 2f8cf52afb..ff22682f37 100644 --- a/jackson/src/test/java/com/baeldung/jackson/streaming/JacksonStreamingAPIUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/streaming/JacksonStreamingAPIUnitTest.java @@ -1,6 +1,5 @@ package com.baeldung.jackson.streaming; - import com.fasterxml.jackson.core.*; import org.junit.Test; @@ -18,12 +17,12 @@ public class JacksonStreamingAPIUnitTest { @Test public void givenJsonGenerator_whenAppendJsonToIt_thenGenerateJson() throws IOException { - //given + // given ByteArrayOutputStream stream = new ByteArrayOutputStream(); JsonFactory jfactory = new JsonFactory(); JsonGenerator jGenerator = jfactory.createGenerator(stream, JsonEncoding.UTF8); - //when + // when jGenerator.writeStartObject(); jGenerator.writeStringField("name", "Tom"); jGenerator.writeNumberField("age", 25); @@ -35,14 +34,14 @@ public class JacksonStreamingAPIUnitTest { jGenerator.writeEndObject(); jGenerator.close(); - //then + // then String json = new String(stream.toByteArray(), "UTF-8"); assertEquals(json, "{\"name\":\"Tom\",\"age\":25,\"address\":[\"Poland\",\"5th avenue\"]}"); } @Test public void givenJson_whenReadItUsingStreamAPI_thenShouldCreateProperJsonObject() throws IOException { - //given + // given String json = "{\"name\":\"Tom\",\"age\":25,\"address\":[\"Poland\",\"5th avenue\"]}"; JsonFactory jfactory = new JsonFactory(); JsonParser jParser = jfactory.createParser(json); @@ -51,7 +50,7 @@ public class JacksonStreamingAPIUnitTest { Integer parsedAge = null; List addresses = new LinkedList<>(); - //when + // when while (jParser.nextToken() != JsonToken.END_OBJECT) { String fieldname = jParser.getCurrentName(); @@ -78,7 +77,7 @@ public class JacksonStreamingAPIUnitTest { } jParser.close(); - //then + // then assertEquals(parsedName, "Tom"); assertEquals(parsedAge, (Integer) 25); assertEquals(addresses, Arrays.asList("Poland", "5th avenue")); @@ -87,7 +86,7 @@ public class JacksonStreamingAPIUnitTest { @Test public void givenJson_whenWantToExtractPartOfIt_thenShouldExtractOnlyNeededFieldWithoutGoingThroughWholeJSON() throws IOException { - //given + // given String json = "{\"name\":\"Tom\",\"age\":25,\"address\":[\"Poland\",\"5th avenue\"]}"; JsonFactory jfactory = new JsonFactory(); JsonParser jParser = jfactory.createParser(json); @@ -96,7 +95,7 @@ public class JacksonStreamingAPIUnitTest { Integer parsedAge = null; List addresses = new LinkedList<>(); - //when + // when while (jParser.nextToken() != JsonToken.END_OBJECT) { String fieldname = jParser.getCurrentName(); @@ -110,7 +109,7 @@ public class JacksonStreamingAPIUnitTest { } jParser.close(); - //then + // then assertNull(parsedName); assertEquals(parsedAge, (Integer) 25); assertTrue(addresses.isEmpty()); diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonAnnotationUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/test/JacksonAnnotationUnitTest.java index e544ab670a..935777bad1 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonAnnotationUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/test/JacksonAnnotationUnitTest.java @@ -124,7 +124,8 @@ public class JacksonAnnotationUnitTest { public void whenDeserializingUsingJsonCreator_thenCorrect() throws IOException { final String json = "{\"id\":1,\"theName\":\"My bean\"}"; - final BeanWithCreator bean = new ObjectMapper().readerFor(BeanWithCreator.class).readValue(json); + final BeanWithCreator bean = new ObjectMapper().readerFor(BeanWithCreator.class) + .readValue(json); assertEquals("My bean", bean.name); } @@ -133,7 +134,9 @@ public class JacksonAnnotationUnitTest { final String json = "{\"name\":\"My bean\"}"; final InjectableValues inject = new InjectableValues.Std().addValue(int.class, 1); - final BeanWithInject bean = new ObjectMapper().reader(inject).forType(BeanWithInject.class).readValue(json); + final BeanWithInject bean = new ObjectMapper().reader(inject) + .forType(BeanWithInject.class) + .readValue(json); assertEquals("My bean", bean.name); assertEquals(1, bean.id); } @@ -142,16 +145,19 @@ public class JacksonAnnotationUnitTest { public void whenDeserializingUsingJsonAnySetter_thenCorrect() throws IOException { final String json = "{\"name\":\"My bean\",\"attr2\":\"val2\",\"attr1\":\"val1\"}"; - final ExtendableBean bean = new ObjectMapper().readerFor(ExtendableBean.class).readValue(json); + final ExtendableBean bean = new ObjectMapper().readerFor(ExtendableBean.class) + .readValue(json); assertEquals("My bean", bean.name); - assertEquals("val2", bean.getProperties().get("attr2")); + assertEquals("val2", bean.getProperties() + .get("attr2")); } @Test public void whenDeserializingUsingJsonSetter_thenCorrect() throws IOException { final String json = "{\"id\":1,\"name\":\"My bean\"}"; - final BeanWithGetter bean = new ObjectMapper().readerFor(BeanWithGetter.class).readValue(json); + final BeanWithGetter bean = new ObjectMapper().readerFor(BeanWithGetter.class) + .readValue(json); assertEquals("My bean", bean.getTheName()); } @@ -161,7 +167,8 @@ public class JacksonAnnotationUnitTest { final SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss"); - final EventWithSerializer event = new ObjectMapper().readerFor(EventWithSerializer.class).readValue(json); + final EventWithSerializer event = new ObjectMapper().readerFor(EventWithSerializer.class) + .readValue(json); assertEquals("20-12-2014 02:30:00", df.format(event.eventDate)); } @@ -232,7 +239,8 @@ public class JacksonAnnotationUnitTest { public void whenDeserializingPolymorphic_thenCorrect() throws IOException { final String json = "{\"animal\":{\"name\":\"lacy\",\"type\":\"cat\"}}"; - final Zoo zoo = new ObjectMapper().readerFor(Zoo.class).readValue(json); + final Zoo zoo = new ObjectMapper().readerFor(Zoo.class) + .readValue(json); assertEquals("lacy", zoo.animal.name); assertEquals(Zoo.Cat.class, zoo.animal.getClass()); @@ -247,7 +255,8 @@ public class JacksonAnnotationUnitTest { assertThat(result, containsString("My bean")); assertThat(result, containsString("1")); - final BeanWithGetter resultBean = new ObjectMapper().readerFor(BeanWithGetter.class).readValue(result); + final BeanWithGetter resultBean = new ObjectMapper().readerFor(BeanWithGetter.class) + .readValue(result); assertEquals("My bean", resultBean.getTheName()); } @@ -278,7 +287,8 @@ public class JacksonAnnotationUnitTest { public void whenSerializingUsingJsonView_thenCorrect() throws JsonProcessingException, JsonProcessingException { final Item item = new Item(2, "book", "John"); - final String result = new ObjectMapper().writerWithView(Views.Public.class).writeValueAsString(item); + final String result = new ObjectMapper().writerWithView(Views.Public.class) + .writeValueAsString(item); assertThat(result, containsString("book")); assertThat(result, containsString("2")); @@ -317,7 +327,8 @@ public class JacksonAnnotationUnitTest { final FilterProvider filters = new SimpleFilterProvider().addFilter("myFilter", SimpleBeanPropertyFilter.filterOutAllExcept("name")); - final String result = new ObjectMapper().writer(filters).writeValueAsString(bean); + final String result = new ObjectMapper().writer(filters) + .writeValueAsString(bean); assertThat(result, containsString("My bean")); assertThat(result, not(containsString("id"))); diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonBidirectionRelationUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/test/JacksonBidirectionRelationUnitTest.java index 523b42a96c..e55ca55ac9 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonBidirectionRelationUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/test/JacksonBidirectionRelationUnitTest.java @@ -93,7 +93,8 @@ public class JacksonBidirectionRelationUnitTest { public void givenBidirectionRelation_whenDeserializingUsingIdentity_thenCorrect() throws JsonProcessingException, IOException { final String json = "{\"id\":2,\"itemName\":\"book\",\"owner\":{\"id\":1,\"name\":\"John\",\"userItems\":[2]}}"; - final ItemWithIdentity item = new ObjectMapper().readerFor(ItemWithIdentity.class).readValue(json); + final ItemWithIdentity item = new ObjectMapper().readerFor(ItemWithIdentity.class) + .readValue(json); assertEquals(2, item.id); assertEquals("book", item.itemName); @@ -104,7 +105,8 @@ public class JacksonBidirectionRelationUnitTest { public void givenBidirectionRelation_whenUsingCustomDeserializer_thenCorrect() throws JsonProcessingException, IOException { final String json = "{\"id\":2,\"itemName\":\"book\",\"owner\":{\"id\":1,\"name\":\"John\",\"userItems\":[2]}}"; - final ItemWithSerializer item = new ObjectMapper().readerFor(ItemWithSerializer.class).readValue(json); + final ItemWithSerializer item = new ObjectMapper().readerFor(ItemWithSerializer.class) + .readValue(json); assertEquals(2, item.id); assertEquals("book", item.itemName); assertEquals("John", item.owner.name); @@ -116,7 +118,8 @@ public class JacksonBidirectionRelationUnitTest { final ItemWithView item = new ItemWithView(2, "book", user); user.addItem(item); - final String result = new ObjectMapper().writerWithView(Views.Public.class).writeValueAsString(item); + final String result = new ObjectMapper().writerWithView(Views.Public.class) + .writeValueAsString(item); assertThat(result, containsString("book")); assertThat(result, containsString("John")); @@ -129,7 +132,8 @@ public class JacksonBidirectionRelationUnitTest { final ItemWithView item = new ItemWithView(2, "book", user); user.addItem(item); - new ObjectMapper().writerWithView(Views.Internal.class).writeValueAsString(item); + new ObjectMapper().writerWithView(Views.Internal.class) + .writeValueAsString(item); } } \ No newline at end of file diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonCollectionDeserializationUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/test/JacksonCollectionDeserializationUnitTest.java index cd166386e6..0de3a1de82 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonCollectionDeserializationUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/test/JacksonCollectionDeserializationUnitTest.java @@ -66,7 +66,8 @@ public class JacksonCollectionDeserializationUnitTest { final String jsonArray = mapper.writeValueAsString(listOfDtos); // [{"stringValue":"a","intValue":1,"booleanValue":true},{"stringValue":"bc","intValue":3,"booleanValue":false}] - final CollectionType javaType = mapper.getTypeFactory().constructCollectionType(List.class, MyDto.class); + final CollectionType javaType = mapper.getTypeFactory() + .constructCollectionType(List.class, MyDto.class); final List asList = mapper.readValue(jsonArray, javaType); assertThat(asList.get(0), instanceOf(MyDto.class)); } diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonDateUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/test/JacksonDateUnitTest.java index f713494ac8..390030d0d4 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonDateUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/test/JacksonDateUnitTest.java @@ -130,7 +130,8 @@ public class JacksonDateUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.setDateFormat(df); - final Event event = mapper.readerFor(Event.class).readValue(json); + final Event event = mapper.readerFor(Event.class) + .readValue(json); assertEquals("20-12-2014 02:30:00", df.format(event.eventDate)); } @@ -141,7 +142,8 @@ public class JacksonDateUnitTest { final SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss"); final ObjectMapper mapper = new ObjectMapper(); - final EventWithSerializer event = mapper.readerFor(EventWithSerializer.class).readValue(json); + final EventWithSerializer event = mapper.readerFor(EventWithSerializer.class) + .readValue(json); assertEquals("20-12-2014 02:30:00", df.format(event.eventDate)); } diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonExceptionsUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/test/JacksonExceptionsUnitTest.java index 4549a752eb..cd2c2925d6 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonExceptionsUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/test/JacksonExceptionsUnitTest.java @@ -34,7 +34,9 @@ public class JacksonExceptionsUnitTest { final String json = "{\"animal\":{\"name\":\"lacy\"}}"; final ObjectMapper mapper = new ObjectMapper(); - mapper.reader().forType(Zoo.class).readValue(json); + mapper.reader() + .forType(Zoo.class) + .readValue(json); } @Test @@ -42,7 +44,9 @@ public class JacksonExceptionsUnitTest { final String json = "{\"animal\":{\"name\":\"lacy\"}}"; final ObjectMapper mapper = new ObjectMapper(); - mapper.reader().forType(ZooConfigured.class).readValue(json); + mapper.reader() + .forType(ZooConfigured.class) + .readValue(json); } // JsonMappingException: No serializer found for class @@ -51,7 +55,8 @@ public class JacksonExceptionsUnitTest { final UserWithPrivateFields user = new UserWithPrivateFields(1, "John"); final ObjectMapper mapper = new ObjectMapper(); - mapper.writer().writeValueAsString(user); + mapper.writer() + .writeValueAsString(user); } @Test @@ -61,7 +66,8 @@ public class JacksonExceptionsUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); - final String result = mapper.writer().writeValueAsString(user); + final String result = mapper.writer() + .writeValueAsString(user); assertThat(result, containsString("John")); } @@ -71,7 +77,9 @@ public class JacksonExceptionsUnitTest { final String json = "{\"id\":1,\"name\":\"John\"}"; final ObjectMapper mapper = new ObjectMapper(); - mapper.reader().forType(User.class).readValue(json); + mapper.reader() + .forType(User.class) + .readValue(json); } @Test @@ -79,7 +87,9 @@ public class JacksonExceptionsUnitTest { final String json = "{\"id\":1,\"name\":\"John\"}"; final ObjectMapper mapper = new ObjectMapper(); - final com.baeldung.jackson.dtos.User user = mapper.reader().forType(com.baeldung.jackson.dtos.User.class).readValue(json); + final com.baeldung.jackson.dtos.User user = mapper.reader() + .forType(com.baeldung.jackson.dtos.User.class) + .readValue(json); assertEquals("John", user.name); } @@ -91,7 +101,9 @@ public class JacksonExceptionsUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - mapper.reader().forType(com.baeldung.jackson.dtos.User.class).readValue(json); + mapper.reader() + .forType(com.baeldung.jackson.dtos.User.class) + .readValue(json); } @Test @@ -101,7 +113,9 @@ public class JacksonExceptionsUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - final UserWithRoot user = mapper.reader().forType(UserWithRoot.class).readValue(json); + final UserWithRoot user = mapper.reader() + .forType(UserWithRoot.class) + .readValue(json); assertEquals("John", user.name); } @@ -111,7 +125,9 @@ public class JacksonExceptionsUnitTest { final String json = "[{\"id\":1,\"name\":\"John\"},{\"id\":2,\"name\":\"Adam\"}]"; final ObjectMapper mapper = new ObjectMapper(); - mapper.reader().forType(com.baeldung.jackson.dtos.User.class).readValue(json); + mapper.reader() + .forType(com.baeldung.jackson.dtos.User.class) + .readValue(json); } @Test @@ -119,8 +135,10 @@ public class JacksonExceptionsUnitTest { final String json = "[{\"id\":1,\"name\":\"John\"},{\"id\":2,\"name\":\"Adam\"}]"; final ObjectMapper mapper = new ObjectMapper(); - final List users = mapper.reader().forType(new TypeReference>() { - }).readValue(json); + final List users = mapper.reader() + .forType(new TypeReference>() { + }) + .readValue(json); assertEquals(2, users.size()); } @@ -131,7 +149,9 @@ public class JacksonExceptionsUnitTest { final String json = "{\"id\":1,\"name\":\"John\", \"checked\":true}"; final ObjectMapper mapper = new ObjectMapper(); - mapper.reader().forType(com.baeldung.jackson.dtos.User.class).readValue(json); + mapper.reader() + .forType(com.baeldung.jackson.dtos.User.class) + .readValue(json); } @Test @@ -141,7 +161,9 @@ public class JacksonExceptionsUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - final com.baeldung.jackson.dtos.User user = mapper.reader().forType(com.baeldung.jackson.dtos.User.class).readValue(json); + final com.baeldung.jackson.dtos.User user = mapper.reader() + .forType(com.baeldung.jackson.dtos.User.class) + .readValue(json); assertEquals("John", user.name); } @@ -151,7 +173,9 @@ public class JacksonExceptionsUnitTest { final String json = "{'id':1,'name':'John'}"; final ObjectMapper mapper = new ObjectMapper(); - mapper.reader().forType(com.baeldung.jackson.dtos.User.class).readValue(json); + mapper.reader() + .forType(com.baeldung.jackson.dtos.User.class) + .readValue(json); } @Test @@ -162,7 +186,9 @@ public class JacksonExceptionsUnitTest { factory.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES); final ObjectMapper mapper = new ObjectMapper(factory); - final com.baeldung.jackson.dtos.User user = mapper.reader().forType(com.baeldung.jackson.dtos.User.class).readValue(json); + final com.baeldung.jackson.dtos.User user = mapper.reader() + .forType(com.baeldung.jackson.dtos.User.class) + .readValue(json); assertEquals("John", user.name); } diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonJsonViewUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/test/JacksonJsonViewUnitTest.java index dd2690876c..7930195ab0 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonJsonViewUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/test/JacksonJsonViewUnitTest.java @@ -28,7 +28,8 @@ public class JacksonJsonViewUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.disable(MapperFeature.DEFAULT_VIEW_INCLUSION); - final String result = mapper.writerWithView(Views.Public.class).writeValueAsString(user); + final String result = mapper.writerWithView(Views.Public.class) + .writeValueAsString(user); assertThat(result, containsString("John")); assertThat(result, not(containsString("1"))); @@ -39,7 +40,8 @@ public class JacksonJsonViewUnitTest { final Item item = new Item(2, "book", "John"); final ObjectMapper mapper = new ObjectMapper(); - final String result = mapper.writerWithView(Views.Public.class).writeValueAsString(item); + final String result = mapper.writerWithView(Views.Public.class) + .writeValueAsString(item); assertThat(result, containsString("book")); assertThat(result, containsString("2")); @@ -52,7 +54,8 @@ public class JacksonJsonViewUnitTest { final Item item = new Item(2, "book", "John"); final ObjectMapper mapper = new ObjectMapper(); - final String result = mapper.writerWithView(Views.Internal.class).writeValueAsString(item); + final String result = mapper.writerWithView(Views.Internal.class) + .writeValueAsString(item); assertThat(result, containsString("book")); assertThat(result, containsString("2")); @@ -66,7 +69,9 @@ public class JacksonJsonViewUnitTest { final ObjectMapper mapper = new ObjectMapper(); - final User user = mapper.readerWithView(Views.Public.class).forType(User.class).readValue(json); + final User user = mapper.readerWithView(Views.Public.class) + .forType(User.class) + .readValue(json); assertEquals(1, user.getId()); assertEquals("John", user.getName()); } @@ -79,7 +84,8 @@ public class JacksonJsonViewUnitTest { final ObjectMapper mapper = new ObjectMapper(); mapper.setSerializerFactory(serializerFactory); - final String result = mapper.writerWithView(Views.Public.class).writeValueAsString(user); + final String result = mapper.writerWithView(Views.Public.class) + .writeValueAsString(user); assertThat(result, containsString("JOHN")); assertThat(result, containsString("1")); } diff --git a/jackson/src/test/java/com/baeldung/jackson/test/JacksonSerializationIgnoreUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/test/JacksonSerializationIgnoreUnitTest.java index bc0e24cdfa..4230420132 100644 --- a/jackson/src/test/java/com/baeldung/jackson/test/JacksonSerializationIgnoreUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/test/JacksonSerializationIgnoreUnitTest.java @@ -109,7 +109,8 @@ public class JacksonSerializationIgnoreUnitTest { final MyDtoWithFilter dtoObject = new MyDtoWithFilter(); dtoObject.setIntValue(12); - final String dtoAsString = mapper.writer(filters).writeValueAsString(dtoObject); + final String dtoAsString = mapper.writer(filters) + .writeValueAsString(dtoObject); assertThat(dtoAsString, not(containsString("intValue"))); assertThat(dtoAsString, containsString("booleanValue")); @@ -123,7 +124,8 @@ public class JacksonSerializationIgnoreUnitTest { @Override public final void serializeAsField(final Object pojo, final JsonGenerator jgen, final SerializerProvider provider, final PropertyWriter writer) throws Exception { if (include(writer)) { - if (!writer.getName().equals("intValue")) { + if (!writer.getName() + .equals("intValue")) { writer.serializeAsField(pojo, jgen, provider); return; } @@ -153,7 +155,8 @@ public class JacksonSerializationIgnoreUnitTest { dtoObject.setIntValue(-1); final ObjectMapper mapper = new ObjectMapper(); - final String dtoAsString = mapper.writer(filters).writeValueAsString(dtoObject); + final String dtoAsString = mapper.writer(filters) + .writeValueAsString(dtoObject); assertThat(dtoAsString, not(containsString("intValue"))); assertThat(dtoAsString, containsString("booleanValue")); @@ -229,7 +232,8 @@ public class JacksonSerializationIgnoreUnitTest { @Test public final void givenAllowingMapObjectWithNullKey_whenWriting_thenCorrect() throws JsonProcessingException { final ObjectMapper mapper = new ObjectMapper(); - mapper.getSerializerProvider().setNullKeySerializer(new MyDtoNullKeySerializer()); + mapper.getSerializerProvider() + .setNullKeySerializer(new MyDtoNullKeySerializer()); final MyDto dtoObject1 = new MyDto(); dtoObject1.setStringValue("dtoObjectString1"); @@ -251,7 +255,8 @@ public class JacksonSerializationIgnoreUnitTest { @Test public final void givenAllowingMapObjectOneNullKey_whenWritingMapObjectWithTwoNullKeys_thenOverride() throws JsonProcessingException { final ObjectMapper mapper = new ObjectMapper(); - mapper.getSerializerProvider().setNullKeySerializer(new MyDtoNullKeySerializer()); + mapper.getSerializerProvider() + .setNullKeySerializer(new MyDtoNullKeySerializer()); final MyDto dtoObject1 = new MyDto(); dtoObject1.setStringValue("dtoObject1String"); diff --git a/jackson/src/test/java/com/baeldung/jackson/try1/RestLoaderRequestDeserializer.java b/jackson/src/test/java/com/baeldung/jackson/try1/RestLoaderRequestDeserializer.java index 529c05ddcc..52bb65033f 100644 --- a/jackson/src/test/java/com/baeldung/jackson/try1/RestLoaderRequestDeserializer.java +++ b/jackson/src/test/java/com/baeldung/jackson/try1/RestLoaderRequestDeserializer.java @@ -25,8 +25,10 @@ public class RestLoaderRequestDeserializer extends StdDeserializer clazz = Class.forName(className); diff --git a/jackson/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java index b5e3449c68..adb0fe0413 100644 --- a/jackson/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java +++ b/jackson/src/test/java/com/baeldung/jackson/xml/XMLSerializeDeserializeUnitTest.java @@ -35,8 +35,7 @@ public class XMLSerializeDeserializeUnitTest { @Test public void whenJavaGotFromXmlStr_thenCorrect() throws IOException { XmlMapper xmlMapper = new XmlMapper(); - SimpleBean value = xmlMapper.readValue( - "12", SimpleBean.class); + SimpleBean value = xmlMapper.readValue("12", SimpleBean.class); assertTrue(value.getX() == 1 && value.getY() == 2); } diff --git a/java-difference-date/README.md b/java-difference-date/README.md new file mode 100644 index 0000000000..2a024c27a2 --- /dev/null +++ b/java-difference-date/README.md @@ -0,0 +1,5 @@ +## Relevant articles: + +- [Period and Duration in Java](http://www.baeldung.com/java-period-duration) +- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro) +- [Migrating to the New Java 8 Date Time API](http://www.baeldung.com/migrating-to-java-8-date-time-api) \ No newline at end of file diff --git a/java-difference-date/pom.xml b/java-difference-date/pom.xml new file mode 100644 index 0000000000..388753de90 --- /dev/null +++ b/java-difference-date/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + + com.baeldung + java-difference-date + 0.0.1-SNAPSHOT + jar + + java-difference-date + Difference between two dates in java + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + joda-time + joda-time + ${joda-time.version} + + + com.darwinsys + hirondelle-date4j + ${hirondelle-date4j.version} + + + junit + junit + ${junit.version} + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + 1.8 + 4.12 + 2.9.9 + 1.5.1 + + diff --git a/java-difference-date/src/test/java/com/baeldung/DateDiffTest.java b/java-difference-date/src/test/java/com/baeldung/DateDiffTest.java new file mode 100644 index 0000000000..4203f7ef38 --- /dev/null +++ b/java-difference-date/src/test/java/com/baeldung/DateDiffTest.java @@ -0,0 +1,61 @@ +package com.baeldung; + +import org.joda.time.DateTime; +import org.junit.Test; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.Duration; +import java.time.ZonedDateTime; +import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; + +public class DateDiffTest { + @Test + public void givenTwoDatesBeforeJava8_whenDifferentiating_thenWeGetSix() throws ParseException { + SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH); + Date firstDate = sdf.parse("06/24/2017"); + Date secondDate = sdf.parse("06/30/2017"); + + long diffInMillies = Math.abs(secondDate.getTime() - firstDate.getTime()); + long diff = TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS); + + assertEquals(diff, 6); + } + + @Test + public void givenTwoDatesInJava8_whenDifferentiating_thenWeGetSix() { + ZonedDateTime now = ZonedDateTime.now(); + ZonedDateTime sixDaysBehind = now.minusDays(6); + + Duration duration = Duration.between(now, sixDaysBehind); + long diff = Math.abs(duration.toDays()); + + assertEquals(diff, 6); + } + + @Test + public void givenTwoDatesInJodaTime_whenDifferentiating_thenWeGetSix() { + DateTime now = DateTime.now(); + DateTime sixDaysBehind = now.minusDays(6); + + org.joda.time.Duration duration = new org.joda.time.Duration(now, sixDaysBehind); + long diff = Math.abs(duration.getStandardDays()); + + assertEquals(diff, 6); + } + + @Test + public void givenTwoDatesInDate4j_whenDifferentiating_thenWeGetSix() { + hirondelle.date4j.DateTime now = hirondelle.date4j.DateTime.now(TimeZone.getDefault()); + hirondelle.date4j.DateTime sixDaysBehind = now.minusDays(6); + + long diff = Math.abs(now.numDaysFrom(sixDaysBehind)); + + assertEquals(diff, 6); + } +} \ No newline at end of file diff --git a/javaxval/bean-validation/pom.xml b/javaxval/bean-validation/pom.xml new file mode 100644 index 0000000000..cdb5a814e2 --- /dev/null +++ b/javaxval/bean-validation/pom.xml @@ -0,0 +1,42 @@ + + 4.0.0 + + com.baeldung.beanvalidation + beanvalidation + 1.0 + jar + beanvalidation + http://maven.apache.org + + UTF-8 + + + + junit + junit + 4.12 + test + + + javax.validation + validation-api + 2.0.0.Final + + + org.hibernate + hibernate-validator + 6.0.2.Final + + + javax.el + javax.el-api + 3.0.0 + + + org.glassfish.web + javax.el + 2.2.4 + + + diff --git a/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/application/Application.java b/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/application/Application.java new file mode 100644 index 0000000000..7966b1046c --- /dev/null +++ b/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/application/Application.java @@ -0,0 +1,17 @@ +package com.baeldung.beanvalidation.application; + +import javax.validation.Validation; +import javax.validation.Validator; +import com.baeldung.beanvalidation.model.User; + +public class Application { + + public static void main( String[] args ) { + Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); + User user = new User(); + user.setName("Mary"); + user.setEmail("no-email"); + user.setAge(36); + validator.validate(user).stream().forEach(violation -> System.out.println(violation.getMessage())); + } +} diff --git a/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/container/IntegerContainer.java b/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/container/IntegerContainer.java new file mode 100644 index 0000000000..a6006067cc --- /dev/null +++ b/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/container/IntegerContainer.java @@ -0,0 +1,13 @@ +package com.baeldung.beanvalidation.container; + +import java.util.Optional; +import javax.validation.constraints.Positive; + +public class IntegerContainer { + + private Optional<@Positive(message = "Value must be a positive integer") Integer> container = Optional.empty(); + + public void addElement(int element) { + container = Optional.of(element); + } +} diff --git a/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/container/StringContainer.java b/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/container/StringContainer.java new file mode 100644 index 0000000000..eced996263 --- /dev/null +++ b/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/container/StringContainer.java @@ -0,0 +1,14 @@ +package com.baeldung.beanvalidation.container; + +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.NotNull; + +public class StringContainer { + + private List<@NotNull String> container = new ArrayList<>(); + + public void addElement(String element) { + container.add(element); + } +} diff --git a/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/model/User.java b/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/model/User.java new file mode 100644 index 0000000000..2a019c37b3 --- /dev/null +++ b/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/model/User.java @@ -0,0 +1,48 @@ +package com.baeldung.beanvalidation.model; + +import java.io.Serializable; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import org.hibernate.validator.constraints.Email; + +public class User implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull(message = "Name cannot be null") + @Size(min = 2, max = 32, message = "Name must be between 2 and 32 characters") + private String name; + + @Email(message = "Email must be a well-formed email address") + private String email; + + @Min(value = 1, message = "Age must not be lesser than 1") + @Max(value = 99, message = "Age must not be greater than 99") + private int age; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } +} diff --git a/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/service/EntityService.java b/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/service/EntityService.java new file mode 100644 index 0000000000..5362e7fbda --- /dev/null +++ b/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/service/EntityService.java @@ -0,0 +1,8 @@ +package com.baeldung.beanvalidation.service; + +public interface EntityService { + + public String toString(); + + public void processEntity(); +} diff --git a/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/service/UserService.java b/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/service/UserService.java new file mode 100644 index 0000000000..7aae5b3077 --- /dev/null +++ b/javaxval/bean-validation/src/main/java/com/baeldung/beanvalidation/service/UserService.java @@ -0,0 +1,45 @@ +package com.baeldung.beanvalidation.service; + +import java.io.Serializable; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import com.baeldung.beanvalidation.model.User; + +public class UserService implements EntityService, Serializable { + + private static final long serialVersionUID = 1L; + + @Valid + private User user; + + @NotNull(message = "FileName cannot be null") + @Size(min = 5, max = 10, message = "FileName must be between 5 and 10 characters") + private String fileName; + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + @Override + public void processEntity() { + // process the user here + } + + @Override + public String toString() { + return "UserService [user=" + user + ", fileName=" + fileName + "]"; + } +} diff --git a/javaxval/bean-validation/src/test/java/com/baeldung/beanvalidation/ValidationTest.java b/javaxval/bean-validation/src/test/java/com/baeldung/beanvalidation/ValidationTest.java new file mode 100644 index 0000000000..1d36cf21f0 --- /dev/null +++ b/javaxval/bean-validation/src/test/java/com/baeldung/beanvalidation/ValidationTest.java @@ -0,0 +1,134 @@ +package com.baeldung.beanvalidation; + +import javax.validation.ConstraintViolation; +import javax.validation.Validation; +import javax.validation.Validator; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import com.baeldung.beanvalidation.container.IntegerContainer; +import com.baeldung.beanvalidation.container.StringContainer; +import com.baeldung.beanvalidation.model.User; +import com.baeldung.beanvalidation.service.UserService; +import java.util.Set; +import java.util.stream.Collectors; +import static org.junit.Assert.*; + +public class ValidationTest { + + private static Validator validator; + private static User user; + + @BeforeClass + public static void setUpHibernateValidatorInstance() { + validator = Validation.buildDefaultValidatorFactory().getValidator(); + } + + @BeforeClass + public static void setUpUserInstance() { + user = new User(); + } + + @AfterClass + public static void tearDownHibernateValidatorInstance() { + validator = null; + } + + @AfterClass + public static void tearDownUserInstance() { + user = null; + } + + @Test + public void givenNullName_whenValidated_thenMessageDescriptorForName() { + user.setName(null); + user.setEmail("mary@domain.com"); + user.setAge(36); + assertEquals("Name cannot be null", validator.validate(user).stream().map(violation -> violation.getMessage()).collect(Collectors.joining())); + } + + @Test + public void givenInvalidEmail_whenValidated_thenMessageDescriptorforEmail() { + user.setName("Mary"); + user.setEmail("no-email"); + user.setAge(36); + assertEquals("Email must be a well-formed email address", validator.validate(user).stream().map(violation -> violation.getMessage()).collect(Collectors.joining())); + } + + @Test + public void givenAgeLesserThanLowerBound_whenValidated_thenMessageDescriptorforAge() { + user.setName("Mary"); + user.setEmail("mary@domain.com"); + user.setAge(0); + assertEquals("Age must not be lesser than 1", validator.validate(user).stream().map(violation -> violation.getMessage()).collect(Collectors.joining())); + } + + @Test + public void givenAgeGreaterThanUpperBound_whenValidated_thenMessageDescriptorforAge() { + user.setName("Mary"); + user.setEmail("mary@domain.com"); + user.setAge(100); + assertEquals("Age must not be greater than 99", validator.validate(user).stream().map(violation -> violation.getMessage()).collect(Collectors.joining())); + } + + @Test + public void givenNullFileName_whenValidated_thenMessageDescriptorforFileName() { + user.setName("Mary"); + user.setEmail("mary@domain.com"); + user.setAge(36); + UserService userService = new UserService(); + userService.setFileName(null); + userService.setUser(user); + assertEquals("FileName cannot be null", validator.validate(userService).stream().map(violation -> violation.getMessage()).collect(Collectors.joining())); + } + + @Test + public void givenFileNameShortherThanLowerBound_whenValidated_thenMessageDescriptorforFileName() { + user.setName("Mary"); + user.setEmail("mary@domain.com"); + user.setAge(36); + UserService userService = new UserService(); + userService.setFileName(""); + userService.setUser(user); + assertEquals("FileName must be between 5 and 10 characters", validator.validate(userService).stream().map(violation -> violation.getMessage()).collect(Collectors.joining())); + } + + @Test + public void givenFileNameLongerThanUpperBound_whenValidated_thenMessageDescriptorforFileName() { + user.setName("Mary"); + user.setEmail("mary@domain.com"); + user.setAge(36); + UserService userService = new UserService(); + userService.setFileName("waytoolongfilename"); + userService.setUser(user); + assertEquals("FileName must be between 5 and 10 characters", validator.validate(userService).stream().map(violation -> violation.getMessage()).collect(Collectors.joining())); + } + + @Test + public void givenNullUserAndNullFileName_whenValidated_thenTwoConstraintViolations() { + user.setName(null); + user.setEmail("mary@domain.com"); + user.setAge(36); + UserService userService = new UserService(); + userService.setFileName(null); + userService.setUser(user); + Set> constraintViolations = validator.validate(userService); + assertEquals(2, constraintViolations.size()); + } + + @Test + public void givenNullElement_whenValidated_thenOneConstraintViolation() { + StringContainer container = new StringContainer(); + container.addElement(null); + Set> constraintViolations = validator.validate(container); + assertEquals(1, constraintViolations.size()); + } + + @Test + public void givenNegativeInteger_whenValidated_thenOneConstraintViolation() { + IntegerContainer container = new IntegerContainer(); + container.addElement(-1); + Set> constraintViolations = validator.validate(container); + assertEquals(1, constraintViolations.size()); + } +} diff --git a/jee7/README.md b/jee7/README.md index a2493e561b..08a180cfa3 100644 --- a/jee7/README.md +++ b/jee7/README.md @@ -5,3 +5,4 @@ - [Introduction to JAX-WS](http://www.baeldung.com/jax-ws) - [A Guide to Java EE Web-Related Annotations](http://www.baeldung.com/javaee-web-annotations) - [Introduction to Testing with Arquillian](http://www.baeldung.com/arquillian) +- [Securing Java EE with Spring Security](http://www.baeldung.com/java-ee-spring-security) diff --git a/jee7/src/test/java/com/baeldung/arquillan/ArquillianTest.java b/jee7/src/test/java/com/baeldung/arquillan/ArquillianLiveTest.java similarity index 98% rename from jee7/src/test/java/com/baeldung/arquillan/ArquillianTest.java rename to jee7/src/test/java/com/baeldung/arquillan/ArquillianLiveTest.java index 5219f221ca..9807162606 100644 --- a/jee7/src/test/java/com/baeldung/arquillan/ArquillianTest.java +++ b/jee7/src/test/java/com/baeldung/arquillan/ArquillianLiveTest.java @@ -22,7 +22,7 @@ import com.baeldung.arquillian.Component; import com.baeldung.arquillian.ConvertToLowerCase; @RunWith(Arquillian.class) -public class ArquillianTest { +public class ArquillianLiveTest { @Deployment public static JavaArchive createDeployment() { diff --git a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/config/JWTCsrfTokenRepository.java b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/config/JWTCsrfTokenRepository.java index bf88b8aff1..4462c012e3 100644 --- a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/config/JWTCsrfTokenRepository.java +++ b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/config/JWTCsrfTokenRepository.java @@ -16,7 +16,8 @@ import java.util.UUID; public class JWTCsrfTokenRepository implements CsrfTokenRepository { - private static final String DEFAULT_CSRF_TOKEN_ATTR_NAME = CSRFConfig.class.getName().concat(".CSRF_TOKEN"); + private static final String DEFAULT_CSRF_TOKEN_ATTR_NAME = CSRFConfig.class.getName() + .concat(".CSRF_TOKEN"); private static final Logger log = LoggerFactory.getLogger(JWTCsrfTokenRepository.class); private byte[] secret; @@ -27,10 +28,12 @@ public class JWTCsrfTokenRepository implements CsrfTokenRepository { @Override public CsrfToken generateToken(HttpServletRequest request) { - String id = UUID.randomUUID().toString().replace("-", ""); + String id = UUID.randomUUID() + .toString() + .replace("-", ""); Date now = new Date(); - Date exp = new Date(System.currentTimeMillis() + (1000*30)); // 30 seconds + Date exp = new Date(System.currentTimeMillis() + (1000 * 30)); // 30 seconds String token = Jwts.builder() .setId(id) @@ -50,8 +53,7 @@ public class JWTCsrfTokenRepository implements CsrfTokenRepository { if (session != null) { session.removeAttribute(DEFAULT_CSRF_TOKEN_ATTR_NAME); } - } - else { + } else { HttpSession session = request.getSession(); session.setAttribute(DEFAULT_CSRF_TOKEN_ATTR_NAME, token); } diff --git a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/config/WebSecurityConfig.java b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/config/WebSecurityConfig.java index 94e2c6ddc5..687a827448 100644 --- a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/config/WebSecurityConfig.java +++ b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/config/WebSecurityConfig.java @@ -30,23 +30,18 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { SecretService secretService; // ordered so we can use binary search below - private String[] ignoreCsrfAntMatchers = { - "/dynamic-builder-compress", - "/dynamic-builder-general", - "/dynamic-builder-specific", - "/set-secrets" - }; + private String[] ignoreCsrfAntMatchers = { "/dynamic-builder-compress", "/dynamic-builder-general", "/dynamic-builder-specific", "/set-secrets" }; @Override protected void configure(HttpSecurity http) throws Exception { - http - .addFilterAfter(new JwtCsrfValidatorFilter(), CsrfFilter.class) + http.addFilterAfter(new JwtCsrfValidatorFilter(), CsrfFilter.class) .csrf() - .csrfTokenRepository(jwtCsrfTokenRepository) - .ignoringAntMatchers(ignoreCsrfAntMatchers) - .and().authorizeRequests() - .antMatchers("/**") - .permitAll(); + .csrfTokenRepository(jwtCsrfTokenRepository) + .ignoringAntMatchers(ignoreCsrfAntMatchers) + .and() + .authorizeRequests() + .antMatchers("/**") + .permitAll(); } private class JwtCsrfValidatorFilter extends OncePerRequestFilter { @@ -58,13 +53,12 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { CsrfToken token = (CsrfToken) request.getAttribute("_csrf"); if ( - // only care if it's a POST - "POST".equals(request.getMethod()) && - // ignore if the request path is in our list + // only care if it's a POST + "POST".equals(request.getMethod()) && + // ignore if the request path is in our list Arrays.binarySearch(ignoreCsrfAntMatchers, request.getServletPath()) < 0 && // make sure we have a token - token != null - ) { + token != null) { // CsrfFilter already made sure the token matched. Here, we'll make sure it's not expired try { Jwts.parser() diff --git a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/BaseController.java b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/BaseController.java index e1e195c6ab..3e2309d43c 100644 --- a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/BaseController.java +++ b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/BaseController.java @@ -11,12 +11,13 @@ import org.springframework.web.bind.annotation.ResponseStatus; public class BaseController { @ResponseStatus(HttpStatus.BAD_REQUEST) - @ExceptionHandler({SignatureException.class, MalformedJwtException.class, JwtException.class}) + @ExceptionHandler({ SignatureException.class, MalformedJwtException.class, JwtException.class }) public JwtResponse exception(Exception e) { JwtResponse response = new JwtResponse(); response.setStatus(JwtResponse.Status.ERROR); response.setMessage(e.getMessage()); - response.setExceptionType(e.getClass().getName()); + response.setExceptionType(e.getClass() + .getName()); return response; } diff --git a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/DynamicJWTController.java b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/DynamicJWTController.java index c03c63dd80..3d157827d1 100644 --- a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/DynamicJWTController.java +++ b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/DynamicJWTController.java @@ -27,25 +27,19 @@ public class DynamicJWTController extends BaseController { @RequestMapping(value = "/dynamic-builder-general", method = POST) public JwtResponse dynamicBuilderGeneric(@RequestBody Map claims) throws UnsupportedEncodingException { - String jws = Jwts.builder() + String jws = Jwts.builder() .setClaims(claims) - .signWith( - SignatureAlgorithm.HS256, - secretService.getHS256SecretBytes() - ) + .signWith(SignatureAlgorithm.HS256, secretService.getHS256SecretBytes()) .compact(); return new JwtResponse(jws); } @RequestMapping(value = "/dynamic-builder-compress", method = POST) public JwtResponse dynamicBuildercompress(@RequestBody Map claims) throws UnsupportedEncodingException { - String jws = Jwts.builder() + String jws = Jwts.builder() .setClaims(claims) .compressWith(CompressionCodecs.DEFLATE) - .signWith( - SignatureAlgorithm.HS256, - secretService.getHS256SecretBytes() - ) + .signWith(SignatureAlgorithm.HS256, secretService.getHS256SecretBytes()) .compact(); return new JwtResponse(jws); } @@ -56,36 +50,36 @@ public class DynamicJWTController extends BaseController { claims.forEach((key, value) -> { switch (key) { - case "iss": - ensureType(key, value, String.class); - builder.setIssuer((String) value); - break; - case "sub": - ensureType(key, value, String.class); - builder.setSubject((String) value); - break; - case "aud": - ensureType(key, value, String.class); - builder.setAudience((String) value); - break; - case "exp": - ensureType(key, value, Long.class); - builder.setExpiration(Date.from(Instant.ofEpochSecond(Long.parseLong(value.toString())))); - break; - case "nbf": - ensureType(key, value, Long.class); - builder.setNotBefore(Date.from(Instant.ofEpochSecond(Long.parseLong(value.toString())))); - break; - case "iat": - ensureType(key, value, Long.class); - builder.setIssuedAt(Date.from(Instant.ofEpochSecond(Long.parseLong(value.toString())))); - break; - case "jti": - ensureType(key, value, String.class); - builder.setId((String) value); - break; - default: - builder.claim(key, value); + case "iss": + ensureType(key, value, String.class); + builder.setIssuer((String) value); + break; + case "sub": + ensureType(key, value, String.class); + builder.setSubject((String) value); + break; + case "aud": + ensureType(key, value, String.class); + builder.setAudience((String) value); + break; + case "exp": + ensureType(key, value, Long.class); + builder.setExpiration(Date.from(Instant.ofEpochSecond(Long.parseLong(value.toString())))); + break; + case "nbf": + ensureType(key, value, Long.class); + builder.setNotBefore(Date.from(Instant.ofEpochSecond(Long.parseLong(value.toString())))); + break; + case "iat": + ensureType(key, value, Long.class); + builder.setIssuedAt(Date.from(Instant.ofEpochSecond(Long.parseLong(value.toString())))); + break; + case "jti": + ensureType(key, value, String.class); + builder.setId((String) value); + break; + default: + builder.claim(key, value); } }); @@ -95,13 +89,11 @@ public class DynamicJWTController extends BaseController { } private void ensureType(String registeredClaim, Object value, Class expectedType) { - boolean isCorrectType = - expectedType.isInstance(value) || - expectedType == Long.class && value instanceof Integer; + boolean isCorrectType = expectedType.isInstance(value) || expectedType == Long.class && value instanceof Integer; if (!isCorrectType) { - String msg = "Expected type: " + expectedType.getCanonicalName() + " for registered claim: '" + - registeredClaim + "', but got value: " + value + " of type: " + value.getClass().getCanonicalName(); + String msg = "Expected type: " + expectedType.getCanonicalName() + " for registered claim: '" + registeredClaim + "', but got value: " + value + " of type: " + value.getClass() + .getCanonicalName(); throw new JwtException(msg); } } diff --git a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/HomeController.java b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/HomeController.java index 57cd14385e..00bc1fb386 100644 --- a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/HomeController.java +++ b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/HomeController.java @@ -11,22 +11,16 @@ public class HomeController { @RequestMapping("/") public String home(HttpServletRequest req) { String requestUrl = getUrl(req); - return "Available commands (assumes httpie - https://github.com/jkbrzt/httpie):\n\n" + - " http " + requestUrl + "/\n\tThis usage message\n\n" + - " http " + requestUrl + "/static-builder\n\tbuild JWT from hardcoded claims\n\n" + - " http POST " + requestUrl + "/dynamic-builder-general claim-1=value-1 ... [claim-n=value-n]\n\tbuild JWT from passed in claims (using general claims map)\n\n" + - " http POST " + requestUrl + "/dynamic-builder-specific claim-1=value-1 ... [claim-n=value-n]\n\tbuild JWT from passed in claims (using specific claims methods)\n\n" + - " http POST " + requestUrl + "/dynamic-builder-compress claim-1=value-1 ... [claim-n=value-n]\n\tbuild DEFLATE compressed JWT from passed in claims\n\n" + - " http " + requestUrl + "/parser?jwt=\n\tParse passed in JWT\n\n" + - " http " + requestUrl + "/parser-enforce?jwt=\n\tParse passed in JWT enforcing the 'iss' registered claim and the 'hasMotorcycle' custom claim\n\n" + - " http " + requestUrl + "/get-secrets\n\tShow the signing keys currently in use.\n\n" + - " http " + requestUrl + "/refresh-secrets\n\tGenerate new signing keys and show them.\n\n" + - " http POST " + requestUrl + "/set-secrets HS256=base64-encoded-value HS384=base64-encoded-value HS512=base64-encoded-value\n\tExplicitly set secrets to use in the application."; + return "Available commands (assumes httpie - https://github.com/jkbrzt/httpie):\n\n" + " http " + requestUrl + "/\n\tThis usage message\n\n" + " http " + requestUrl + "/static-builder\n\tbuild JWT from hardcoded claims\n\n" + " http POST " + + requestUrl + "/dynamic-builder-general claim-1=value-1 ... [claim-n=value-n]\n\tbuild JWT from passed in claims (using general claims map)\n\n" + " http POST " + requestUrl + + "/dynamic-builder-specific claim-1=value-1 ... [claim-n=value-n]\n\tbuild JWT from passed in claims (using specific claims methods)\n\n" + " http POST " + requestUrl + + "/dynamic-builder-compress claim-1=value-1 ... [claim-n=value-n]\n\tbuild DEFLATE compressed JWT from passed in claims\n\n" + " http " + requestUrl + "/parser?jwt=\n\tParse passed in JWT\n\n" + " http " + requestUrl + + "/parser-enforce?jwt=\n\tParse passed in JWT enforcing the 'iss' registered claim and the 'hasMotorcycle' custom claim\n\n" + " http " + requestUrl + "/get-secrets\n\tShow the signing keys currently in use.\n\n" + " http " + requestUrl + + "/refresh-secrets\n\tGenerate new signing keys and show them.\n\n" + " http POST " + requestUrl + + "/set-secrets HS256=base64-encoded-value HS384=base64-encoded-value HS512=base64-encoded-value\n\tExplicitly set secrets to use in the application."; } private String getUrl(HttpServletRequest req) { - return req.getScheme() + "://" + - req.getServerName() + - ((req.getServerPort() == 80 || req.getServerPort() == 443) ? "" : ":" + req.getServerPort()); + return req.getScheme() + "://" + req.getServerName() + ((req.getServerPort() == 80 || req.getServerPort() == 443) ? "" : ":" + req.getServerPort()); } } diff --git a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/StaticJWTController.java b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/StaticJWTController.java index 83f5336978..efafa4b1b7 100644 --- a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/StaticJWTController.java +++ b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/StaticJWTController.java @@ -30,12 +30,9 @@ public class StaticJWTController extends BaseController { .setSubject("msilverman") .claim("name", "Micah Silverman") .claim("scope", "admins") - .setIssuedAt(Date.from(Instant.ofEpochSecond(1466796822L))) // Fri Jun 24 2016 15:33:42 GMT-0400 (EDT) + .setIssuedAt(Date.from(Instant.ofEpochSecond(1466796822L))) // Fri Jun 24 2016 15:33:42 GMT-0400 (EDT) .setExpiration(Date.from(Instant.ofEpochSecond(4622470422L))) // Sat Jun 24 2116 15:33:42 GMT-0400 (EDT) - .signWith( - SignatureAlgorithm.HS256, - secretService.getHS256SecretBytes() - ) + .signWith(SignatureAlgorithm.HS256, secretService.getHS256SecretBytes()) .compact(); return new JwtResponse(jws); diff --git a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/model/JwtResponse.java b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/model/JwtResponse.java index 491f003289..a18cad7e71 100644 --- a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/model/JwtResponse.java +++ b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/model/JwtResponse.java @@ -16,7 +16,8 @@ public class JwtResponse { SUCCESS, ERROR } - public JwtResponse() {} + public JwtResponse() { + } public JwtResponse(String jwt) { this.jwt = jwt; diff --git a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/service/SecretService.java b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/service/SecretService.java index 4311afa592..0165d10c83 100644 --- a/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/service/SecretService.java +++ b/jjwt/src/main/java/io/jsonwebtoken/jjwtfun/service/SecretService.java @@ -61,7 +61,6 @@ public class SecretService { return TextCodec.BASE64.decode(secrets.get(SignatureAlgorithm.HS384.getValue())); } - public Map refreshSecrets() { SecretKey key = MacProvider.generateKey(SignatureAlgorithm.HS256); secrets.put(SignatureAlgorithm.HS256.getValue(), TextCodec.BASE64.encode(key.getEncoded())); diff --git a/jpa-storedprocedure/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureIntegrationTest.java b/jpa-storedprocedure/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureIntegrationTest.java index c93d59fe30..c0fb5485aa 100644 --- a/jpa-storedprocedure/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureIntegrationTest.java +++ b/jpa-storedprocedure/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureIntegrationTest.java @@ -50,13 +50,17 @@ public class StoredProcedureIntegrationTest { public void findCarsByYearNamedProcedure() { final StoredProcedureQuery findByYearProcedure = entityManager.createNamedStoredProcedureQuery("findByYearProcedure"); final StoredProcedureQuery storedProcedure = findByYearProcedure.setParameter("p_year", 2015); - storedProcedure.getResultList().forEach(c -> Assert.assertEquals(new Integer(2015), ((Car) c).getYear())); + storedProcedure.getResultList() + .forEach(c -> Assert.assertEquals(new Integer(2015), ((Car) c).getYear())); } @Test public void findCarsByYearNoNamed() { - final StoredProcedureQuery storedProcedure = entityManager.createStoredProcedureQuery("FIND_CAR_BY_YEAR", Car.class).registerStoredProcedureParameter(1, Integer.class, ParameterMode.IN).setParameter(1, 2015); - storedProcedure.getResultList().forEach(c -> Assert.assertEquals(new Integer(2015), ((Car) c).getYear())); + final StoredProcedureQuery storedProcedure = entityManager.createStoredProcedureQuery("FIND_CAR_BY_YEAR", Car.class) + .registerStoredProcedureParameter(1, Integer.class, ParameterMode.IN) + .setParameter(1, 2015); + storedProcedure.getResultList() + .forEach(c -> Assert.assertEquals(new Integer(2015), ((Car) c).getYear())); } @AfterClass diff --git a/jsf/src/main/java/com/baeldung/springintegration/controllers/ELSampleBean.java b/jsf/src/main/java/com/baeldung/springintegration/controllers/ELSampleBean.java index 16d9f80d89..abc1399f88 100644 --- a/jsf/src/main/java/com/baeldung/springintegration/controllers/ELSampleBean.java +++ b/jsf/src/main/java/com/baeldung/springintegration/controllers/ELSampleBean.java @@ -27,18 +27,22 @@ public class ELSampleBean { @PostConstruct public void init() { pageCounter = randomIntGen.nextInt(); - FacesContext.getCurrentInstance().getApplication().addELContextListener(new ELContextListener() { - @Override - public void contextCreated(ELContextEvent evt) { - evt.getELContext().getImportHandler().importClass("com.baeldung.springintegration.controllers.ELSampleBean"); - } - }); + FacesContext.getCurrentInstance() + .getApplication() + .addELContextListener(new ELContextListener() { + @Override + public void contextCreated(ELContextEvent evt) { + evt.getELContext() + .getImportHandler() + .importClass("com.baeldung.springintegration.controllers.ELSampleBean"); + } + }); } public void save() { } - + public static String constantField() { return constantField; } @@ -48,7 +52,8 @@ public class ELSampleBean { } public Long multiplyValue(LambdaExpression expr) { - Long theResult = (Long) expr.invoke(FacesContext.getCurrentInstance().getELContext(), pageCounter); + Long theResult = (Long) expr.invoke(FacesContext.getCurrentInstance() + .getELContext(), pageCounter); return theResult; } diff --git a/jsf/src/main/java/com/baeldung/springintegration/dao/UserManagementDAOImpl.java b/jsf/src/main/java/com/baeldung/springintegration/dao/UserManagementDAOImpl.java index 56cbdd7b88..d135fba2b7 100644 --- a/jsf/src/main/java/com/baeldung/springintegration/dao/UserManagementDAOImpl.java +++ b/jsf/src/main/java/com/baeldung/springintegration/dao/UserManagementDAOImpl.java @@ -1,6 +1,5 @@ package com.baeldung.springintegration.dao; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Repository; @@ -34,5 +33,4 @@ public class UserManagementDAOImpl implements UserManagementDAO { public UserManagementDAOImpl() { } - } diff --git a/json-path/pom.xml b/json-path/pom.xml index 8384ba68ed..0f8ff3bd31 100644 --- a/json-path/pom.xml +++ b/json-path/pom.xml @@ -1,7 +1,6 @@ 4.0.0 - com.baeldung json-path 0.0.1-SNAPSHOT json-path diff --git a/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java b/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java index 855f524dbe..7728d2dad6 100644 --- a/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java +++ b/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java @@ -18,8 +18,11 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; public class OperationIntegrationTest { - private InputStream jsonInputStream = this.getClass().getClassLoader().getResourceAsStream("intro_api.json"); - private String jsonDataSourceString = new Scanner(jsonInputStream, "UTF-8").useDelimiter("\\Z").next(); + private InputStream jsonInputStream = this.getClass() + .getClassLoader() + .getResourceAsStream("intro_api.json"); + private String jsonDataSourceString = new Scanner(jsonInputStream, "UTF-8").useDelimiter("\\Z") + .next(); @Test public void givenJsonPathWithoutPredicates_whenReading_thenCorrect() { @@ -38,21 +41,27 @@ public class OperationIntegrationTest { @Test public void givenJsonPathWithFilterPredicate_whenReading_thenCorrect() { - Filter expensiveFilter = Filter.filter(Criteria.where("price").gt(20.00)); - List> expensive = JsonPath.parse(jsonDataSourceString).read("$['book'][?]", expensiveFilter); + Filter expensiveFilter = Filter.filter(Criteria.where("price") + .gt(20.00)); + List> expensive = JsonPath.parse(jsonDataSourceString) + .read("$['book'][?]", expensiveFilter); predicateUsageAssertionHelper(expensive); } @Test public void givenJsonPathWithCustomizedPredicate_whenReading_thenCorrect() { - Predicate expensivePredicate = context -> Float.valueOf(context.item(Map.class).get("price").toString()) > 20.00; - List> expensive = JsonPath.parse(jsonDataSourceString).read("$['book'][?]", expensivePredicate); + Predicate expensivePredicate = context -> Float.valueOf(context.item(Map.class) + .get("price") + .toString()) > 20.00; + List> expensive = JsonPath.parse(jsonDataSourceString) + .read("$['book'][?]", expensivePredicate); predicateUsageAssertionHelper(expensive); } @Test public void givenJsonPathWithInlinePredicate_whenReading_thenCorrect() { - List> expensive = JsonPath.parse(jsonDataSourceString).read("$['book'][?(@['price'] > $['price range']['medium'])]"); + List> expensive = JsonPath.parse(jsonDataSourceString) + .read("$['book'][?(@['price'] > $['price range']['medium'])]"); predicateUsageAssertionHelper(expensive); } diff --git a/json-path/src/test/java/com/baeldung/jsonpath/introduction/ServiceTest.java b/json-path/src/test/java/com/baeldung/jsonpath/introduction/ServiceTest.java index d5cfa50e80..067e5cf8ce 100644 --- a/json-path/src/test/java/com/baeldung/jsonpath/introduction/ServiceTest.java +++ b/json-path/src/test/java/com/baeldung/jsonpath/introduction/ServiceTest.java @@ -18,12 +18,16 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; public class ServiceTest { - private InputStream jsonInputStream = this.getClass().getClassLoader().getResourceAsStream("intro_service.json"); - private String jsonString = new Scanner(jsonInputStream, "UTF-8").useDelimiter("\\Z").next(); + private InputStream jsonInputStream = this.getClass() + .getClassLoader() + .getResourceAsStream("intro_service.json"); + private String jsonString = new Scanner(jsonInputStream, "UTF-8").useDelimiter("\\Z") + .next(); @Test public void givenId_whenRequestingRecordData_thenSucceed() { - Object dataObject = JsonPath.parse(jsonString).read("$[?(@.id == 2)]"); + Object dataObject = JsonPath.parse(jsonString) + .read("$[?(@.id == 2)]"); String dataString = dataObject.toString(); assertThat(dataString, containsString("2")); @@ -33,8 +37,10 @@ public class ServiceTest { @Test public void givenStarring_whenRequestingMovieTitle_thenSucceed() { - List> dataList = JsonPath.parse(jsonString).read("$[?('Eva Green' in @['starring'])]"); - String title = (String) dataList.get(0).get("title"); + List> dataList = JsonPath.parse(jsonString) + .read("$[?('Eva Green' in @['starring'])]"); + String title = (String) dataList.get(0) + .get("title"); assertEquals("Casino Royale", title); } @@ -59,8 +65,12 @@ public class ServiceTest { Arrays.sort(revenueArray); int highestRevenue = revenueArray[revenueArray.length - 1]; - Configuration pathConfiguration = Configuration.builder().options(Option.AS_PATH_LIST).build(); - List pathList = JsonPath.using(pathConfiguration).parse(jsonString).read("$[?(@['box office'] == " + highestRevenue + ")]"); + Configuration pathConfiguration = Configuration.builder() + .options(Option.AS_PATH_LIST) + .build(); + List pathList = JsonPath.using(pathConfiguration) + .parse(jsonString) + .read("$[?(@['box office'] == " + highestRevenue + ")]"); Map dataRecord = context.read(pathList.get(0)); String title = dataRecord.get("title"); @@ -83,7 +93,8 @@ public class ServiceTest { long latestTime = dateArray[dateArray.length - 1]; List> finalDataList = context.read("$[?(@['director'] == 'Sam Mendes' && @['release date'] == " + latestTime + ")]"); - String title = (String) finalDataList.get(0).get("title"); + String title = (String) finalDataList.get(0) + .get("title"); assertEquals("Spectre", title); } diff --git a/json/src/test/java/fast_json/FastJsonUnitTest.java b/json/src/test/java/fast_json/FastJsonUnitTest.java index e37f443387..6fcf1e398a 100644 --- a/json/src/test/java/fast_json/FastJsonUnitTest.java +++ b/json/src/test/java/fast_json/FastJsonUnitTest.java @@ -32,11 +32,7 @@ public class FastJsonUnitTest { @Test public void whenJavaList_thanConvertToJsonCorrect() { String personJsonFormat = JSON.toJSONString(listOfPersons); - assertEquals( - personJsonFormat, - "[{\"FIRST NAME\":\"Doe\",\"LAST NAME\":\"John\",\"DATE OF BIRTH\":" - + "\"24/07/2016\"},{\"FIRST NAME\":\"Doe\",\"LAST NAME\":\"Janette\",\"DATE OF BIRTH\":" - + "\"24/07/2016\"}]"); + assertEquals(personJsonFormat, "[{\"FIRST NAME\":\"Doe\",\"LAST NAME\":\"John\",\"DATE OF BIRTH\":" + "\"24/07/2016\"},{\"FIRST NAME\":\"Doe\",\"LAST NAME\":\"Janette\",\"DATE OF BIRTH\":" + "\"24/07/2016\"}]"); } @Test @@ -44,8 +40,10 @@ public class FastJsonUnitTest { String personJsonFormat = JSON.toJSONString(listOfPersons.get(0)); Person newPerson = JSON.parseObject(personJsonFormat, Person.class); assertEquals(newPerson.getAge(), 0); // serialize is set to false for age attribute - assertEquals(newPerson.getFirstName(), listOfPersons.get(0).getFirstName()); - assertEquals(newPerson.getLastName(), listOfPersons.get(0).getLastName()); + assertEquals(newPerson.getFirstName(), listOfPersons.get(0) + .getFirstName()); + assertEquals(newPerson.getLastName(), listOfPersons.get(0) + .getLastName()); } @Test @@ -58,18 +56,13 @@ public class FastJsonUnitTest { jsonObject.put("DATE OF BIRTH", "2016/12/12 12:12:12"); jsonArray.add(jsonObject); } - assertEquals( - jsonArray.toString(), - "[{\"LAST NAME\":\"Doe0\",\"DATE OF BIRTH\":" - + "\"2016/12/12 12:12:12\",\"FIRST NAME\":\"John0\"},{\"LAST NAME\":\"Doe1\"," - + "\"DATE OF BIRTH\":\"2016/12/12 12:12:12\",\"FIRST NAME\":\"John1\"}]"); + assertEquals(jsonArray.toString(), "[{\"LAST NAME\":\"Doe0\",\"DATE OF BIRTH\":" + "\"2016/12/12 12:12:12\",\"FIRST NAME\":\"John0\"},{\"LAST NAME\":\"Doe1\"," + "\"DATE OF BIRTH\":\"2016/12/12 12:12:12\",\"FIRST NAME\":\"John1\"}]"); } @Test public void givenContextFilter_whenJavaObject_thanJsonCorrect() { ContextValueFilter valueFilter = new ContextValueFilter() { - public Object process(BeanContext context, Object object, - String name, Object value) { + public Object process(BeanContext context, Object object, String name, Object value) { if (name.equals("DATE OF BIRTH")) { return "NOT TO DISCLOSE"; } @@ -87,18 +80,16 @@ public class FastJsonUnitTest { public void givenSerializeConfig_whenJavaObject_thanJsonCorrect() { NameFilter formatName = new NameFilter() { public String process(Object object, String name, Object value) { - return name.toLowerCase().replace(" ", "_"); + return name.toLowerCase() + .replace(" ", "_"); } }; - SerializeConfig.getGlobalInstance().addFilter(Person.class, formatName); - String jsonOutput = JSON.toJSONStringWithDateFormat(listOfPersons, - "yyyy-MM-dd"); - assertEquals( - jsonOutput, - "[{\"first_name\":\"Doe\",\"last_name\":\"John\"," - + "\"date_of_birth\":\"2016-07-24\"},{\"first_name\":\"Doe\",\"last_name\":" - + "\"Janette\",\"date_of_birth\":\"2016-07-24\"}]"); + SerializeConfig.getGlobalInstance() + .addFilter(Person.class, formatName); + String jsonOutput = JSON.toJSONStringWithDateFormat(listOfPersons, "yyyy-MM-dd"); + assertEquals(jsonOutput, "[{\"first_name\":\"Doe\",\"last_name\":\"John\"," + "\"date_of_birth\":\"2016-07-24\"},{\"first_name\":\"Doe\",\"last_name\":" + "\"Janette\",\"date_of_birth\":\"2016-07-24\"}]"); // resetting custom serializer - SerializeConfig.getGlobalInstance().put(Person.class, null); + SerializeConfig.getGlobalInstance() + .put(Person.class, null); } } diff --git a/json/src/test/java/fast_json/Person.java b/json/src/test/java/fast_json/Person.java index 0eac58cdfd..3d772348a4 100644 --- a/json/src/test/java/fast_json/Person.java +++ b/json/src/test/java/fast_json/Person.java @@ -32,10 +32,9 @@ public class Person { @Override public String toString() { - return "Person [age=" + age + ", lastName=" + lastName + ", firstName=" - + firstName + ", dateOfBirth=" + dateOfBirth + "]"; + return "Person [age=" + age + ", lastName=" + lastName + ", firstName=" + firstName + ", dateOfBirth=" + dateOfBirth + "]"; } - + public int getAge() { return age; } diff --git a/jsoup/src/test/java/com/baeldung/jsoup/JsoupParserIntegrationTest.java b/jsoup/src/test/java/com/baeldung/jsoup/JsoupParserIntegrationTest.java index dadd57b0ed..ee39f2550f 100644 --- a/jsoup/src/test/java/com/baeldung/jsoup/JsoupParserIntegrationTest.java +++ b/jsoup/src/test/java/com/baeldung/jsoup/JsoupParserIntegrationTest.java @@ -20,13 +20,15 @@ public class JsoupParserIntegrationTest { @Before public void setUp() throws IOException { - doc = Jsoup.connect("https://spring.io/blog").get(); + doc = Jsoup.connect("https://spring.io/blog") + .get(); } @Test public void loadDocument404() throws IOException { try { - doc = Jsoup.connect("https://spring.io/will-not-be-found").get(); + doc = Jsoup.connect("https://spring.io/will-not-be-found") + .get(); } catch (HttpStatusException ex) { assertEquals(404, ex.getStatusCode()); } @@ -35,13 +37,13 @@ public class JsoupParserIntegrationTest { @Test public void loadDocumentCustomized() throws IOException { doc = Jsoup.connect("https://spring.io/blog") - .userAgent("Mozilla") - .timeout(5000) - .cookie("cookiename", "val234") - .cookie("anothercookie", "ilovejsoup") - .referrer("http://google.com") - .header("headersecurity", "xyz123") - .get(); + .userAgent("Mozilla") + .timeout(5000) + .cookie("cookiename", "val234") + .cookie("anothercookie", "ilovejsoup") + .referrer("http://google.com") + .header("headersecurity", "xyz123") + .get(); } @Test @@ -77,10 +79,13 @@ public class JsoupParserIntegrationTest { @Test public void examplesExtracting() { - Element firstArticle = doc.select("article").first(); - Element timeElement = firstArticle.select("time").first(); + Element firstArticle = doc.select("article") + .first(); + Element timeElement = firstArticle.select("time") + .first(); String dateTimeOfFirstArticle = timeElement.attr("datetime"); - Element sectionDiv = firstArticle.select("section div").first(); + Element sectionDiv = firstArticle.select("section div") + .first(); String sectionDivText = sectionDiv.text(); String articleHtml = firstArticle.html(); String outerHtml = firstArticle.outerHtml(); @@ -88,24 +93,30 @@ public class JsoupParserIntegrationTest { @Test public void examplesModifying() { - Element firstArticle = doc.select("article").first(); - Element timeElement = firstArticle.select("time").first(); - Element sectionDiv = firstArticle.select("section div").first(); + Element firstArticle = doc.select("article") + .first(); + Element timeElement = firstArticle.select("time") + .first(); + Element sectionDiv = firstArticle.select("section div") + .first(); String dateTimeOfFirstArticle = timeElement.attr("datetime"); timeElement.attr("datetime", "2016-12-16 15:19:54.3"); sectionDiv.text("foo bar"); - firstArticle.select("h2").html("
"); + firstArticle.select("h2") + .html("
"); - Element link = new Element(Tag.valueOf("a"), "") - .text("Checkout this amazing website!") - .attr("href", "http://baeldung.com") - .attr("target", "_blank"); + Element link = new Element(Tag.valueOf("a"), "").text("Checkout this amazing website!") + .attr("href", "http://baeldung.com") + .attr("target", "_blank"); firstArticle.appendChild(link); - doc.select("li.navbar-link").remove(); - firstArticle.select("img").remove(); + doc.select("li.navbar-link") + .remove(); + firstArticle.select("img") + .remove(); - assertTrue(doc.html().contains("http://baeldung.com")); + assertTrue(doc.html() + .contains("http://baeldung.com")); } } diff --git a/junit5/README.md b/junit5/README.md index 49cd8e61a4..a3bb8fc1be 100644 --- a/junit5/README.md +++ b/junit5/README.md @@ -5,3 +5,5 @@ - [A Guide to @RepeatedTest in Junit 5](http://www.baeldung.com/junit-5-repeated-test) - [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests) - [A Guied to JUnit 5 Extensions](http://www.baeldung.com/junit-5-extensions) +- [Inject Parameters into JUnit Jupiter Unit Tests](http://www.baeldung.com/junit-5-parameters) + diff --git a/junit5/src/test/java/com/baeldung/AssertionUnitTest.java b/junit5/src/test/java/com/baeldung/AssertionUnitTest.java index 504931b3d7..6fefd4e06d 100644 --- a/junit5/src/test/java/com/baeldung/AssertionUnitTest.java +++ b/junit5/src/test/java/com/baeldung/AssertionUnitTest.java @@ -6,23 +6,23 @@ import org.junit.jupiter.api.Test; public class AssertionUnitTest { - @Test - public void testConvertToDoubleThrowException() { - String age = "eighteen"; - assertThrows(NumberFormatException.class, () -> { - convertToInt(age); - }); + @Test + public void testConvertToDoubleThrowException() { + String age = "eighteen"; + assertThrows(NumberFormatException.class, () -> { + convertToInt(age); + }); - assertThrows(NumberFormatException.class, () -> { - convertToInt(age); - }); - } - - private static Integer convertToInt(String str) { - if (str == null) { - return null; - } - return Integer.valueOf(str); - } + assertThrows(NumberFormatException.class, () -> { + convertToInt(age); + }); + } + + private static Integer convertToInt(String str) { + if (str == null) { + return null; + } + return Integer.valueOf(str); + } } diff --git a/junit5/src/test/java/com/baeldung/AssumptionUnitTest.java b/junit5/src/test/java/com/baeldung/AssumptionUnitTest.java index afeee642eb..7d67d93486 100644 --- a/junit5/src/test/java/com/baeldung/AssumptionUnitTest.java +++ b/junit5/src/test/java/com/baeldung/AssumptionUnitTest.java @@ -24,9 +24,6 @@ public class AssumptionUnitTest { @Test void assumptionThat() { String someString = "Just a string"; - assumingThat( - someString.equals("Just a string"), - () -> assertEquals(2 + 2, 4) - ); + assumingThat(someString.equals("Just a string"), () -> assertEquals(2 + 2, 4)); } } diff --git a/junit5/src/test/java/com/baeldung/DynamicTestsExample.java b/junit5/src/test/java/com/baeldung/DynamicTestsExample.java index fd6bb3e0a8..b684f3603f 100644 --- a/junit5/src/test/java/com/baeldung/DynamicTestsExample.java +++ b/junit5/src/test/java/com/baeldung/DynamicTestsExample.java @@ -24,40 +24,33 @@ public class DynamicTestsExample { @TestFactory Collection dynamicTestsWithCollection() { - return Arrays.asList( - DynamicTest.dynamicTest("Add test", () -> assertEquals(2, Math.addExact(1, 1))), - DynamicTest.dynamicTest("Multiply Test", () -> assertEquals(4, Math.multiplyExact(2, 2)))); + return Arrays.asList(DynamicTest.dynamicTest("Add test", () -> assertEquals(2, Math.addExact(1, 1))), DynamicTest.dynamicTest("Multiply Test", () -> assertEquals(4, Math.multiplyExact(2, 2)))); } - + @TestFactory Iterable dynamicTestsWithIterable() { - return Arrays.asList( - DynamicTest.dynamicTest("Add test", () -> assertEquals(2, Math.addExact(1, 1))), - DynamicTest.dynamicTest("Multiply Test", () -> assertEquals(4, Math.multiplyExact(2, 2)))); + return Arrays.asList(DynamicTest.dynamicTest("Add test", () -> assertEquals(2, Math.addExact(1, 1))), DynamicTest.dynamicTest("Multiply Test", () -> assertEquals(4, Math.multiplyExact(2, 2)))); } - + @TestFactory Iterator dynamicTestsWithIterator() { - return Arrays.asList( - DynamicTest.dynamicTest("Add test", () -> assertEquals(2, Math.addExact(1, 1))), - DynamicTest.dynamicTest("Multiply Test", () -> assertEquals(4, Math.multiplyExact(2, 2)))) - .iterator(); + return Arrays.asList(DynamicTest.dynamicTest("Add test", () -> assertEquals(2, Math.addExact(1, 1))), DynamicTest.dynamicTest("Multiply Test", () -> assertEquals(4, Math.multiplyExact(2, 2)))) + .iterator(); } - + @TestFactory Stream dynamicTestsFromIntStream() { - return IntStream.iterate(0, n -> n + 2).limit(10).mapToObj( - n -> DynamicTest.dynamicTest("test" + n, () -> assertTrue(n % 2 == 0))); + return IntStream.iterate(0, n -> n + 2) + .limit(10) + .mapToObj(n -> DynamicTest.dynamicTest("test" + n, () -> assertTrue(n % 2 == 0))); } - + @TestFactory Stream dynamicTestsFromStream() { // sample input and output - List inputList = - Arrays.asList("www.somedomain.com", "www.anotherdomain.com", "www.yetanotherdomain.com"); - List outputList = - Arrays.asList("154.174.10.56", "211.152.104.132", "178.144.120.156"); + List inputList = Arrays.asList("www.somedomain.com", "www.anotherdomain.com", "www.yetanotherdomain.com"); + List outputList = Arrays.asList("154.174.10.56", "211.152.104.132", "178.144.120.156"); // input generator that generates inputs using inputList Iterator inputGenerator = inputList.iterator(); @@ -75,57 +68,56 @@ public class DynamicTestsExample { // combine everything and return a Stream of DynamicTest return DynamicTest.stream(inputGenerator, displayNameGenerator, testExecutor); } - + @TestFactory Stream dynamicTestsFromStreamInJava8() { - + DomainNameResolver resolver = new DomainNameResolver(); - - List inputList = - Arrays.asList("www.somedomain.com", "www.anotherdomain.com", "www.yetanotherdomain.com"); - List outputList = - Arrays.asList("154.174.10.56", "211.152.104.132", "178.144.120.156"); - - return inputList.stream().map(dom -> DynamicTest.dynamicTest("Resolving: " + dom, () -> { - int id = inputList.indexOf(dom); - assertEquals(outputList.get(id), resolver.resolveDomain(dom)); - })); - + + List inputList = Arrays.asList("www.somedomain.com", "www.anotherdomain.com", "www.yetanotherdomain.com"); + List outputList = Arrays.asList("154.174.10.56", "211.152.104.132", "178.144.120.156"); + + return inputList.stream() + .map(dom -> DynamicTest.dynamicTest("Resolving: " + dom, () -> { + int id = inputList.indexOf(dom); + assertEquals(outputList.get(id), resolver.resolveDomain(dom)); + })); + } @TestFactory Stream dynamicTestsForEmployeeWorkflows() { - List inputList = - Arrays.asList(new Employee(1, "Fred"), new Employee(2), new Employee(3, "John")); - + List inputList = Arrays.asList(new Employee(1, "Fred"), new Employee(2), new Employee(3, "John")); + EmployeeDao dao = new EmployeeDao(); - Stream saveEmployeeStream = inputList.stream().map(emp -> - DynamicTest.dynamicTest("saveEmployee: " + emp.toString(), () -> { - Employee returned = dao.save(emp.getId()); - assertEquals(returned.getId(), emp.getId()); - })); - - Stream saveEmployeeWithFirstNameStream - = inputList.stream().filter(emp -> !emp.getFirstName().isEmpty()) + Stream saveEmployeeStream = inputList.stream() + .map(emp -> DynamicTest.dynamicTest("saveEmployee: " + emp.toString(), () -> { + Employee returned = dao.save(emp.getId()); + assertEquals(returned.getId(), emp.getId()); + })); + + Stream saveEmployeeWithFirstNameStream = inputList.stream() + .filter(emp -> !emp.getFirstName() + .isEmpty()) .map(emp -> DynamicTest.dynamicTest("saveEmployeeWithName" + emp.toString(), () -> { - Employee returned = dao.save(emp.getId(), emp.getFirstName()); - assertEquals(returned.getId(), emp.getId()); - assertEquals(returned.getFirstName(), emp.getFirstName()); - })); - + Employee returned = dao.save(emp.getId(), emp.getFirstName()); + assertEquals(returned.getId(), emp.getId()); + assertEquals(returned.getFirstName(), emp.getFirstName()); + })); + return Stream.concat(saveEmployeeStream, saveEmployeeWithFirstNameStream); } - + class DomainNameResolver { - + private Map ipByDomainName = new HashMap<>(); - + DomainNameResolver() { this.ipByDomainName.put("www.somedomain.com", "154.174.10.56"); this.ipByDomainName.put("www.anotherdomain.com", "211.152.104.132"); this.ipByDomainName.put("www.yetanotherdomain.com", "178.144.120.156"); } - + public String resolveDomain(String domainName) { return ipByDomainName.get(domainName); } diff --git a/junit5/src/test/java/com/baeldung/EmployeesTest.java b/junit5/src/test/java/com/baeldung/EmployeesTest.java index 1a6da37d72..71bb52284b 100644 --- a/junit5/src/test/java/com/baeldung/EmployeesTest.java +++ b/junit5/src/test/java/com/baeldung/EmployeesTest.java @@ -33,12 +33,14 @@ public class EmployeesTest { public void whenAddEmployee_thenGetEmployee() throws SQLException { Employee emp = new Employee(1, "john"); employeeDao.add(emp); - assertEquals(1, employeeDao.findAll().size()); + assertEquals(1, employeeDao.findAll() + .size()); } @Test public void whenGetEmployees_thenEmptyList() throws SQLException { - assertEquals(0, employeeDao.findAll().size()); + assertEquals(0, employeeDao.findAll() + .size()); } public void setLogger(Logger logger) { diff --git a/junit5/src/test/java/com/baeldung/ExceptionUnitTest.java b/junit5/src/test/java/com/baeldung/ExceptionUnitTest.java index 6ec1a4b7bd..bd57f5b3cb 100644 --- a/junit5/src/test/java/com/baeldung/ExceptionUnitTest.java +++ b/junit5/src/test/java/com/baeldung/ExceptionUnitTest.java @@ -7,19 +7,19 @@ import org.junit.jupiter.api.Test; public class ExceptionUnitTest { - @Test - void shouldThrowException() { - Throwable exception = assertThrows(UnsupportedOperationException.class, () -> { - throw new UnsupportedOperationException("Not supported"); - }); - assertEquals(exception.getMessage(), "Not supported"); - } + @Test + void shouldThrowException() { + Throwable exception = assertThrows(UnsupportedOperationException.class, () -> { + throw new UnsupportedOperationException("Not supported"); + }); + assertEquals(exception.getMessage(), "Not supported"); + } - @Test - void assertThrowsException() { - String str = null; - assertThrows(IllegalArgumentException.class, () -> { - Integer.valueOf(str); - }); - } + @Test + void assertThrowsException() { + String str = null; + assertThrows(IllegalArgumentException.class, () -> { + Integer.valueOf(str); + }); + } } diff --git a/junit5/src/test/java/com/baeldung/FirstUnitTest.java b/junit5/src/test/java/com/baeldung/FirstUnitTest.java index 78c563cf82..c47a70e52f 100644 --- a/junit5/src/test/java/com/baeldung/FirstUnitTest.java +++ b/junit5/src/test/java/com/baeldung/FirstUnitTest.java @@ -13,21 +13,16 @@ class FirstUnitTest { @Test void lambdaExpressions() { List numbers = Arrays.asList(1, 2, 3); - assertTrue(numbers - .stream() - .mapToInt(i -> i) - .sum() > 5, "Sum should be greater than 5"); + assertTrue(numbers.stream() + .mapToInt(i -> i) + .sum() > 5, "Sum should be greater than 5"); } @Disabled("test to show MultipleFailuresError") @Test void groupAssertions() { - int[] numbers = {0, 1, 2, 3, 4}; - assertAll("numbers", - () -> assertEquals(numbers[0], 1), - () -> assertEquals(numbers[3], 3), - () -> assertEquals(numbers[4], 1) - ); + int[] numbers = { 0, 1, 2, 3, 4 }; + assertAll("numbers", () -> assertEquals(numbers[0], 1), () -> assertEquals(numbers[3], 3), () -> assertEquals(numbers[4], 1)); } @Test diff --git a/junit5/src/test/java/com/baeldung/JUnit5NewFeaturesUnitTest.java b/junit5/src/test/java/com/baeldung/JUnit5NewFeaturesUnitTest.java index a4dfd610a1..311c62f425 100644 --- a/junit5/src/test/java/com/baeldung/JUnit5NewFeaturesUnitTest.java +++ b/junit5/src/test/java/com/baeldung/JUnit5NewFeaturesUnitTest.java @@ -13,38 +13,38 @@ import org.junit.jupiter.api.Test; //@RunWith(JUnitPlatform.class) public class JUnit5NewFeaturesUnitTest { - private static final Logger log = Logger.getLogger(JUnit5NewFeaturesUnitTest.class.getName()); + private static final Logger log = Logger.getLogger(JUnit5NewFeaturesUnitTest.class.getName()); - @BeforeAll - static void setup() { - log.info("@BeforeAll - executes once before all test methods in this class"); - } + @BeforeAll + static void setup() { + log.info("@BeforeAll - executes once before all test methods in this class"); + } - @BeforeEach - void init() { - log.info("@BeforeEach - executes before each test method in this class"); - } + @BeforeEach + void init() { + log.info("@BeforeEach - executes before each test method in this class"); + } - @DisplayName("Single test successful") - @Test - void testSingleSuccessTest() { - log.info("Success"); + @DisplayName("Single test successful") + @Test + void testSingleSuccessTest() { + log.info("Success"); - } + } - @Test - @Disabled("Not implemented yet.") - void testShowSomething() { - } + @Test + @Disabled("Not implemented yet.") + void testShowSomething() { + } - @AfterEach - void tearDown() { - log.info("@AfterEach - executed after each test method."); - } + @AfterEach + void tearDown() { + log.info("@AfterEach - executed after each test method."); + } - @AfterAll - static void done() { - log.info("@AfterAll - executed after all test methods."); - } + @AfterAll + static void done() { + log.info("@AfterAll - executed after all test methods."); + } } diff --git a/junit5/src/test/java/com/baeldung/LiveTest.java b/junit5/src/test/java/com/baeldung/LiveTest.java index e0e267da0b..c23eeb5afa 100644 --- a/junit5/src/test/java/com/baeldung/LiveTest.java +++ b/junit5/src/test/java/com/baeldung/LiveTest.java @@ -12,27 +12,28 @@ import org.junit.jupiter.api.TestFactory; public class LiveTest { - private List in = new ArrayList<>(Arrays.asList("Hello", "Yes", "No")); - private List out = new ArrayList<>(Arrays.asList("Cześć", "Tak", "Nie")); + private List in = new ArrayList<>(Arrays.asList("Hello", "Yes", "No")); + private List out = new ArrayList<>(Arrays.asList("Cześć", "Tak", "Nie")); - @TestFactory - public Stream translateDynamicTestsFromStream() { + @TestFactory + public Stream translateDynamicTestsFromStream() { - return in.stream().map(word -> DynamicTest.dynamicTest("Test translate " + word, () -> { - int id = in.indexOf(word); - assertEquals(out.get(id), translate(word)); - })); - } + return in.stream() + .map(word -> DynamicTest.dynamicTest("Test translate " + word, () -> { + int id = in.indexOf(word); + assertEquals(out.get(id), translate(word)); + })); + } - private String translate(String word) { - if ("Hello".equalsIgnoreCase(word)) { - return "Cześć"; - } else if ("Yes".equalsIgnoreCase(word)) { - return "Tak"; - } else if ("No".equalsIgnoreCase(word)) { - return "Nie"; - } - return "Error"; - } + private String translate(String word) { + if ("Hello".equalsIgnoreCase(word)) { + return "Cześć"; + } else if ("Yes".equalsIgnoreCase(word)) { + return "Tak"; + } else if ("No".equalsIgnoreCase(word)) { + return "Nie"; + } + return "Error"; + } } diff --git a/junit5/src/test/java/com/baeldung/RepeatedTestExample.java b/junit5/src/test/java/com/baeldung/RepeatedTestExample.java index 8674e01e5d..749d7064bc 100644 --- a/junit5/src/test/java/com/baeldung/RepeatedTestExample.java +++ b/junit5/src/test/java/com/baeldung/RepeatedTestExample.java @@ -14,36 +14,36 @@ public class RepeatedTestExample { void beforeEachTest() { System.out.println("Before Each Test"); } - + @AfterEach void afterEachTest() { System.out.println("After Each Test"); System.out.println("====================="); } - + @RepeatedTest(3) void repeatedTest(TestInfo testInfo) { System.out.println("Executing repeated test"); assertEquals(2, Math.addExact(1, 1), "1 + 1 should equal 2"); } - + @RepeatedTest(value = 3, name = RepeatedTest.LONG_DISPLAY_NAME) void repeatedTestWithLongName() { System.out.println("Executing repeated test with long name"); assertEquals(2, Math.addExact(1, 1), "1 + 1 should equal 2"); } - + @RepeatedTest(value = 3, name = RepeatedTest.SHORT_DISPLAY_NAME) void repeatedTestWithShortName() { System.out.println("Executing repeated test with long name"); assertEquals(2, Math.addExact(1, 1), "1 + 1 should equal 2"); } - + @RepeatedTest(value = 3, name = "Custom name {currentRepetition}/{totalRepetitions}") void repeatedTestWithCustomDisplayName() { assertEquals(2, Math.addExact(1, 1), "1 + 1 should equal 2"); } - + @RepeatedTest(3) void repeatedTestWithRepetitionInfo(RepetitionInfo repetitionInfo) { System.out.println("Repetition #" + repetitionInfo.getCurrentRepetition()); diff --git a/junit5/src/test/java/com/baeldung/StringUtils.java b/junit5/src/test/java/com/baeldung/StringUtils.java index c1852113bc..227f131876 100644 --- a/junit5/src/test/java/com/baeldung/StringUtils.java +++ b/junit5/src/test/java/com/baeldung/StringUtils.java @@ -2,10 +2,10 @@ package com.baeldung; public final class StringUtils { - public static Double convertToDouble(String str) { - if (str == null) { - return null; - } - return Double.valueOf(str); - } + public static Double convertToDouble(String str) { + if (str == null) { + return null; + } + return Double.valueOf(str); + } } diff --git a/junit5/src/test/java/com/baeldung/TestLauncher.java b/junit5/src/test/java/com/baeldung/TestLauncher.java index d0354e19a9..f9766d2bd9 100644 --- a/junit5/src/test/java/com/baeldung/TestLauncher.java +++ b/junit5/src/test/java/com/baeldung/TestLauncher.java @@ -25,13 +25,15 @@ public class TestLauncher { //@formatter:on - TestPlan plan = LauncherFactory.create().discover(request); + TestPlan plan = LauncherFactory.create() + .discover(request); Launcher launcher = LauncherFactory.create(); SummaryGeneratingListener summaryGeneratingListener = new SummaryGeneratingListener(); launcher.execute(request, new TestExecutionListener[] { summaryGeneratingListener }); launcher.execute(request); - summaryGeneratingListener.getSummary().printTo(new PrintWriter(System.out)); + summaryGeneratingListener.getSummary() + .printTo(new PrintWriter(System.out)); } } diff --git a/junit5/src/test/java/com/baeldung/extensions/EmployeeDaoParameterResolver.java b/junit5/src/test/java/com/baeldung/extensions/EmployeeDaoParameterResolver.java index 2626266454..4e6931a65d 100644 --- a/junit5/src/test/java/com/baeldung/extensions/EmployeeDaoParameterResolver.java +++ b/junit5/src/test/java/com/baeldung/extensions/EmployeeDaoParameterResolver.java @@ -12,7 +12,9 @@ public class EmployeeDaoParameterResolver implements ParameterResolver { @Override public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { - return parameterContext.getParameter().getType().equals(EmployeeJdbcDao.class); + return parameterContext.getParameter() + .getType() + .equals(EmployeeJdbcDao.class); } @Override diff --git a/junit5/src/test/java/com/baeldung/extensions/LoggingExtension.java b/junit5/src/test/java/com/baeldung/extensions/LoggingExtension.java index 437c5c24de..930018d576 100644 --- a/junit5/src/test/java/com/baeldung/extensions/LoggingExtension.java +++ b/junit5/src/test/java/com/baeldung/extensions/LoggingExtension.java @@ -10,7 +10,9 @@ public class LoggingExtension implements TestInstancePostProcessor { @Override public void postProcessTestInstance(Object testInstance, ExtensionContext context) throws Exception { Logger logger = LogManager.getLogger(testInstance.getClass()); - testInstance.getClass().getMethod("setLogger", Logger.class).invoke(testInstance, logger); + testInstance.getClass() + .getMethod("setLogger", Logger.class) + .invoke(testInstance, logger); } } diff --git a/junit5/src/test/java/com/baeldung/migration/junit5/AssertionsExampleTest.java b/junit5/src/test/java/com/baeldung/migration/junit5/AssertionsExampleTest.java index 642b7371de..3cfe4c59f5 100644 --- a/junit5/src/test/java/com/baeldung/migration/junit5/AssertionsExampleTest.java +++ b/junit5/src/test/java/com/baeldung/migration/junit5/AssertionsExampleTest.java @@ -30,9 +30,10 @@ public class AssertionsExampleTest { List list = Arrays.asList(1, 2, 3); Assertions.assertAll("List is not incremental", () -> Assertions.assertEquals(list.get(0) - .intValue(), 1), - () -> Assertions.assertEquals(list.get(1) - .intValue(), 2), + .intValue(), 1), () -> Assertions.assertEquals( + list.get(1) + .intValue(), + 2), () -> Assertions.assertEquals(list.get(2) .intValue(), 3)); } diff --git a/junit5/src/test/java/com/baeldung/param/InvalidPersonParameterResolver.java b/junit5/src/test/java/com/baeldung/param/InvalidPersonParameterResolver.java index 67bd47a44a..73ae2e08b7 100644 --- a/junit5/src/test/java/com/baeldung/param/InvalidPersonParameterResolver.java +++ b/junit5/src/test/java/com/baeldung/param/InvalidPersonParameterResolver.java @@ -9,42 +9,51 @@ import org.junit.jupiter.api.extension.ParameterResolver; public class InvalidPersonParameterResolver implements ParameterResolver { - /** - * The "bad" (invalid) data for testing purposes has to go somewhere, right? - */ - public static Person[] INVALID_PERSONS = { - new Person().setId(1L).setLastName("Ad_ams").setFirstName("Jill,"), - new Person().setId(2L).setLastName(",Baker").setFirstName(""), - new Person().setId(3L).setLastName(null).setFirstName(null), - new Person().setId(4L).setLastName("Daniel&").setFirstName("{Joseph}"), - new Person().setId(5L).setLastName("").setFirstName("English, Jane"), - new Person()/* .setId(6L).setLastName("Fontana").setFirstName("Enrique") */, - // TODO: ADD MORE DATA HERE - }; + /** + * The "bad" (invalid) data for testing purposes has to go somewhere, right? + */ + public static Person[] INVALID_PERSONS = { new Person().setId(1L) + .setLastName("Ad_ams") + .setFirstName("Jill,"), + new Person().setId(2L) + .setLastName(",Baker") + .setFirstName(""), + new Person().setId(3L) + .setLastName(null) + .setFirstName(null), + new Person().setId(4L) + .setLastName("Daniel&") + .setFirstName("{Joseph}"), + new Person().setId(5L) + .setLastName("") + .setFirstName("English, Jane"), + new Person()/* .setId(6L).setLastName("Fontana").setFirstName("Enrique") */, + // TODO: ADD MORE DATA HERE + }; - @Override - public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) - throws ParameterResolutionException { - Object ret = null; - // - // Return a random, valid Person object if Person.class is the type of Parameter - /// to be resolved. Otherwise return null. - if (parameterContext.getParameter().getType() == Person.class) { - ret = INVALID_PERSONS[new Random().nextInt(INVALID_PERSONS.length)]; + @Override + public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { + Object ret = null; + // + // Return a random, valid Person object if Person.class is the type of Parameter + /// to be resolved. Otherwise return null. + if (parameterContext.getParameter() + .getType() == Person.class) { + ret = INVALID_PERSONS[new Random().nextInt(INVALID_PERSONS.length)]; + } + return ret; } - return ret; - } - @Override - public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) - throws ParameterResolutionException { - boolean ret = false; - // - // If the Parameter.type == Person.class, then we support it, otherwise, get outta here! - if (parameterContext.getParameter().getType() == Person.class) { - ret = true; + @Override + public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { + boolean ret = false; + // + // If the Parameter.type == Person.class, then we support it, otherwise, get outta here! + if (parameterContext.getParameter() + .getType() == Person.class) { + ret = true; + } + return ret; } - return ret; - } } diff --git a/junit5/src/test/java/com/baeldung/param/Person.java b/junit5/src/test/java/com/baeldung/param/Person.java index 65333b5e56..7095036bd4 100644 --- a/junit5/src/test/java/com/baeldung/param/Person.java +++ b/junit5/src/test/java/com/baeldung/param/Person.java @@ -9,35 +9,35 @@ package com.baeldung.param; */ public class Person { - private Long id; - private String lastName; - private String firstName; + private Long id; + private String lastName; + private String firstName; - public Long getId() { - return id; - } + public Long getId() { + return id; + } - public Person setId(Long id) { - this.id = id; - return this; - } + public Person setId(Long id) { + this.id = id; + return this; + } - public String getLastName() { - return lastName; - } + public String getLastName() { + return lastName; + } - public Person setLastName(String lastName) { - this.lastName = lastName; - return this; - } + public Person setLastName(String lastName) { + this.lastName = lastName; + return this; + } - public String getFirstName() { - return firstName; - } + public String getFirstName() { + return firstName; + } - public Person setFirstName(String firstName) { - this.firstName = firstName; - return this; - } + public Person setFirstName(String firstName) { + this.firstName = firstName; + return this; + } } diff --git a/junit5/src/test/java/com/baeldung/param/PersonValidator.java b/junit5/src/test/java/com/baeldung/param/PersonValidator.java index 0219169aab..fbf596be8a 100644 --- a/junit5/src/test/java/com/baeldung/param/PersonValidator.java +++ b/junit5/src/test/java/com/baeldung/param/PersonValidator.java @@ -11,132 +11,122 @@ import java.util.Arrays; */ public class PersonValidator { - /** - * Contrived checked exception to illustrate one possible - * way to handle validation errors (via a checked exception). - * - * @author J Steven Perry - * - */ - public static class ValidationException extends Exception { + /** + * Contrived checked exception to illustrate one possible + * way to handle validation errors (via a checked exception). + * + * @author J Steven Perry + * + */ + public static class ValidationException extends Exception { + + /** + * + */ + private static final long serialVersionUID = -134518049431883102L; + + // Probably should implement some more constructors, but don't want + /// to tarnish the lesson... + + /** + * The one and only way to create this checked exception. + * + * @param message + * The message accompanying the exception. Should be meaningful. + */ + public ValidationException(String message) { + super(message); + + } + + } + + private static final String[] ILLEGAL_NAME_CHARACTERS = { ",", "_", "{", "}", "!" }; /** + * Validate the first name of the specified Person object. * + * @param person + * The Person object to validate. + * + * @return - returns true if the specified Person is valid + * + * @throws ValidationException + * - this Exception is thrown if any kind of validation error occurs. */ - private static final long serialVersionUID = -134518049431883102L; - - // Probably should implement some more constructors, but don't want - /// to tarnish the lesson... + public static boolean validateFirstName(Person person) throws ValidationException { + boolean ret = true; + // The validation rules go here. + // Naive: use simple ifs + if (person == null) { + throw new ValidationException("Person is null (not allowed)!"); + } + if (person.getFirstName() == null) { + throw new ValidationException("Person FirstName is null (not allowed)!"); + } + if (person.getFirstName() + .isEmpty()) { + throw new ValidationException("Person FirstName is an empty String (not allowed)!"); + } + if (!isStringValid(person.getFirstName(), ILLEGAL_NAME_CHARACTERS)) { + throw new ValidationException("Person FirstName (" + person.getFirstName() + ") may not contain any of the following characters: " + Arrays.toString(ILLEGAL_NAME_CHARACTERS) + "!"); + } + return ret; + } /** - * The one and only way to create this checked exception. + * Validate the last name of the specified Person object. Looks the same as first + * name? Look closer. Just kidding. It's the same. But real world code can (and will) diverge. * - * @param message - * The message accompanying the exception. Should be meaningful. + * @param person + * The Person object to validate. + * + * @return - returns true if the specified Person is valid + * + * @throws ValidationException + * - this Exception is thrown if any kind of validation error occurs. */ - public ValidationException(String message) { - super(message); - + public static boolean validateLastName(Person person) throws ValidationException { + boolean ret = true; + // The validation rules go here. + // Naive: use simple ifs + if (person == null) { + throw new ValidationException("Person is null (not allowed)!"); + } + if (person.getFirstName() == null) { + throw new ValidationException("Person FirstName is null (not allowed)!"); + } + if (person.getFirstName() + .isEmpty()) { + throw new ValidationException("Person FirstName is an empty String (not allowed)!"); + } + if (!isStringValid(person.getFirstName(), ILLEGAL_NAME_CHARACTERS)) { + throw new ValidationException("Person LastName (" + person.getLastName() + ") may not contain any of the following characters: " + Arrays.toString(ILLEGAL_NAME_CHARACTERS) + "!"); + } + return ret; } - } - - private static final String[] ILLEGAL_NAME_CHARACTERS = { - ",", - "_", - "{", - "}", - "!" - }; - - /** - * Validate the first name of the specified Person object. - * - * @param person - * The Person object to validate. - * - * @return - returns true if the specified Person is valid - * - * @throws ValidationException - * - this Exception is thrown if any kind of validation error occurs. - */ - public static boolean validateFirstName(Person person) throws ValidationException { - boolean ret = true; - // The validation rules go here. - // Naive: use simple ifs - if (person == null) { - throw new ValidationException("Person is null (not allowed)!"); + /** + * Validates the specified name. If it contains any of the illegalCharacters, + * this method returns false (indicating the name is illegal). Otherwise it returns true. + * + * @param candidate + * The candidate String to validate + * + * @param illegalCharacters + * The characters the String is not allowed to have + * + * @return - boolean - true if the name is valid, false otherwise. + */ + private static boolean isStringValid(String candidate, String[] illegalCharacters) { + boolean ret = true; + for (String illegalChar : illegalCharacters) { + if (candidate.contains(illegalChar)) { + ret = false; + break; + } + } + return ret; } - if (person.getFirstName() == null) { - throw new ValidationException("Person FirstName is null (not allowed)!"); - } - if (person.getFirstName().isEmpty()) { - throw new ValidationException("Person FirstName is an empty String (not allowed)!"); - } - if (!isStringValid(person.getFirstName(), ILLEGAL_NAME_CHARACTERS)) { - throw new ValidationException( - "Person FirstName (" + person.getFirstName() + ") may not contain any of the following characters: " - + Arrays.toString(ILLEGAL_NAME_CHARACTERS) - + "!"); - } - return ret; - } - - /** - * Validate the last name of the specified Person object. Looks the same as first - * name? Look closer. Just kidding. It's the same. But real world code can (and will) diverge. - * - * @param person - * The Person object to validate. - * - * @return - returns true if the specified Person is valid - * - * @throws ValidationException - * - this Exception is thrown if any kind of validation error occurs. - */ - public static boolean validateLastName(Person person) throws ValidationException { - boolean ret = true; - // The validation rules go here. - // Naive: use simple ifs - if (person == null) { - throw new ValidationException("Person is null (not allowed)!"); - } - if (person.getFirstName() == null) { - throw new ValidationException("Person FirstName is null (not allowed)!"); - } - if (person.getFirstName().isEmpty()) { - throw new ValidationException("Person FirstName is an empty String (not allowed)!"); - } - if (!isStringValid(person.getFirstName(), ILLEGAL_NAME_CHARACTERS)) { - throw new ValidationException( - "Person LastName (" + person.getLastName() + ") may not contain any of the following characters: " - + Arrays.toString(ILLEGAL_NAME_CHARACTERS) - + "!"); - } - return ret; - } - - /** - * Validates the specified name. If it contains any of the illegalCharacters, - * this method returns false (indicating the name is illegal). Otherwise it returns true. - * - * @param candidate - * The candidate String to validate - * - * @param illegalCharacters - * The characters the String is not allowed to have - * - * @return - boolean - true if the name is valid, false otherwise. - */ - private static boolean isStringValid(String candidate, String[] illegalCharacters) { - boolean ret = true; - for (String illegalChar : illegalCharacters) { - if (candidate.contains(illegalChar)) { - ret = false; - break; - } - } - return ret; - } } diff --git a/junit5/src/test/java/com/baeldung/param/PersonValidatorTest.java b/junit5/src/test/java/com/baeldung/param/PersonValidatorTest.java index 09ab03b811..cd6f2b7e4f 100644 --- a/junit5/src/test/java/com/baeldung/param/PersonValidatorTest.java +++ b/junit5/src/test/java/com/baeldung/param/PersonValidatorTest.java @@ -15,88 +15,88 @@ import org.junit.runner.RunWith; @DisplayName("Testing PersonValidator") public class PersonValidatorTest { - /** - * Nested class, uses ExtendWith - * {@link com.baeldung.param.ValidPersonParameterResolver ValidPersonParameterResolver} - * to feed Test methods with "good" data. - */ - @Nested - @DisplayName("When using Valid data") - @ExtendWith(ValidPersonParameterResolver.class) - public class ValidData { - /** - * Repeat the test ten times, that way we have a good shot at - * running all of the data through at least once. - * - * @param person - * A valid Person object to validate. + * Nested class, uses ExtendWith + * {@link com.baeldung.param.ValidPersonParameterResolver ValidPersonParameterResolver} + * to feed Test methods with "good" data. */ - @RepeatedTest(value = 10) - @DisplayName("All first names are valid") - public void validateFirstName(Person person) { - try { - assertTrue(PersonValidator.validateFirstName(person)); - } catch (PersonValidator.ValidationException e) { - fail("Exception not expected: " + e.getLocalizedMessage()); - } + @Nested + @DisplayName("When using Valid data") + @ExtendWith(ValidPersonParameterResolver.class) + public class ValidData { + + /** + * Repeat the test ten times, that way we have a good shot at + * running all of the data through at least once. + * + * @param person + * A valid Person object to validate. + */ + @RepeatedTest(value = 10) + @DisplayName("All first names are valid") + public void validateFirstName(Person person) { + try { + assertTrue(PersonValidator.validateFirstName(person)); + } catch (PersonValidator.ValidationException e) { + fail("Exception not expected: " + e.getLocalizedMessage()); + } + } + + /** + * Repeat the test ten times, that way we have a good shot at + * running all of the data through at least once. + * + * @param person + * A valid Person object to validate. + */ + @RepeatedTest(value = 10) + @DisplayName("All last names are valid") + public void validateLastName(Person person) { + try { + assertTrue(PersonValidator.validateLastName(person)); + } catch (PersonValidator.ValidationException e) { + fail("Exception not expected: " + e.getLocalizedMessage()); + } + } + } /** - * Repeat the test ten times, that way we have a good shot at - * running all of the data through at least once. - * - * @param person - * A valid Person object to validate. + * Nested class, uses ExtendWith + * {@link com.baeldung.param.InvalidPersonParameterResolver InvalidPersonParameterResolver} + * to feed Test methods with "bad" data. */ - @RepeatedTest(value = 10) - @DisplayName("All last names are valid") - public void validateLastName(Person person) { - try { - assertTrue(PersonValidator.validateLastName(person)); - } catch (PersonValidator.ValidationException e) { - fail("Exception not expected: " + e.getLocalizedMessage()); - } + @Nested + @DisplayName("When using Invalid data") + @ExtendWith(InvalidPersonParameterResolver.class) + public class InvalidData { + + /** + * Repeat the test ten times, that way we have a good shot at + * running all of the data through at least once. + * + * @param person + * An invalid Person object to validate. + */ + @RepeatedTest(value = 10) + @DisplayName("All first names are invalid") + public void validateFirstName(Person person) { + assertThrows(PersonValidator.ValidationException.class, () -> PersonValidator.validateFirstName(person)); + } + + /** + * Repeat the test ten times, that way we have a good shot at + * running all of the data through at least once. + * + * @param person + * An invalid Person object to validate. + */ + @RepeatedTest(value = 10) + @DisplayName("All first names are invalid") + public void validateLastName(Person person) { + assertThrows(PersonValidator.ValidationException.class, () -> PersonValidator.validateLastName(person)); + } + } - } - - /** - * Nested class, uses ExtendWith - * {@link com.baeldung.param.InvalidPersonParameterResolver InvalidPersonParameterResolver} - * to feed Test methods with "bad" data. - */ - @Nested - @DisplayName("When using Invalid data") - @ExtendWith(InvalidPersonParameterResolver.class) - public class InvalidData { - - /** - * Repeat the test ten times, that way we have a good shot at - * running all of the data through at least once. - * - * @param person - * An invalid Person object to validate. - */ - @RepeatedTest(value = 10) - @DisplayName("All first names are invalid") - public void validateFirstName(Person person) { - assertThrows(PersonValidator.ValidationException.class, () -> PersonValidator.validateFirstName(person)); - } - - /** - * Repeat the test ten times, that way we have a good shot at - * running all of the data through at least once. - * - * @param person - * An invalid Person object to validate. - */ - @RepeatedTest(value = 10) - @DisplayName("All first names are invalid") - public void validateLastName(Person person) { - assertThrows(PersonValidator.ValidationException.class, () -> PersonValidator.validateLastName(person)); - } - - } - } diff --git a/junit5/src/test/java/com/baeldung/param/ValidPersonParameterResolver.java b/junit5/src/test/java/com/baeldung/param/ValidPersonParameterResolver.java index abb97586eb..10d958b83c 100644 --- a/junit5/src/test/java/com/baeldung/param/ValidPersonParameterResolver.java +++ b/junit5/src/test/java/com/baeldung/param/ValidPersonParameterResolver.java @@ -9,42 +9,53 @@ import org.junit.jupiter.api.extension.ParameterResolver; public class ValidPersonParameterResolver implements ParameterResolver { - /** - * The "good" (valid) data for testing purposes has to go somewhere, right? - */ - public static Person[] VALID_PERSONS = { - new Person().setId(1L).setLastName("Adams").setFirstName("Jill"), - new Person().setId(2L).setLastName("Baker").setFirstName("James"), - new Person().setId(3L).setLastName("Carter").setFirstName("Samanta"), - new Person().setId(4L).setLastName("Daniels").setFirstName("Joseph"), - new Person().setId(5L).setLastName("English").setFirstName("Jane"), - new Person().setId(6L).setLastName("Fontana").setFirstName("Enrique"), - // TODO: ADD MORE DATA HERE - }; + /** + * The "good" (valid) data for testing purposes has to go somewhere, right? + */ + public static Person[] VALID_PERSONS = { new Person().setId(1L) + .setLastName("Adams") + .setFirstName("Jill"), + new Person().setId(2L) + .setLastName("Baker") + .setFirstName("James"), + new Person().setId(3L) + .setLastName("Carter") + .setFirstName("Samanta"), + new Person().setId(4L) + .setLastName("Daniels") + .setFirstName("Joseph"), + new Person().setId(5L) + .setLastName("English") + .setFirstName("Jane"), + new Person().setId(6L) + .setLastName("Fontana") + .setFirstName("Enrique"), + // TODO: ADD MORE DATA HERE + }; - @Override - public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) - throws ParameterResolutionException { - Object ret = null; - // - // Return a random, valid Person object if Person.class is the type of Parameter - /// to be resolved. Otherwise return null. - if (parameterContext.getParameter().getType() == Person.class) { - ret = VALID_PERSONS[new Random().nextInt(VALID_PERSONS.length)]; + @Override + public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { + Object ret = null; + // + // Return a random, valid Person object if Person.class is the type of Parameter + /// to be resolved. Otherwise return null. + if (parameterContext.getParameter() + .getType() == Person.class) { + ret = VALID_PERSONS[new Random().nextInt(VALID_PERSONS.length)]; + } + return ret; } - return ret; - } - @Override - public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) - throws ParameterResolutionException { - boolean ret = false; - // - // If the Parameter.type == Person.class, then we support it, otherwise, get outta here! - if (parameterContext.getParameter().getType() == Person.class) { - ret = true; + @Override + public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { + boolean ret = false; + // + // If the Parameter.type == Person.class, then we support it, otherwise, get outta here! + if (parameterContext.getParameter() + .getType() == Person.class) { + ret = true; + } + return ret; } - return ret; - } } diff --git a/junit5/src/test/java/com/baeldung/suites/AllTests.java b/junit5/src/test/java/com/baeldung/suites/AllTests.java index 69f28373eb..29452efc3d 100644 --- a/junit5/src/test/java/com/baeldung/suites/AllTests.java +++ b/junit5/src/test/java/com/baeldung/suites/AllTests.java @@ -6,7 +6,7 @@ import org.junit.runner.RunWith; @RunWith(JUnitPlatform.class) @SelectPackages("com.baeldung") -//@SelectClasses({AssertionTest.class, AssumptionTest.class, ExceptionTest.class}) +// @SelectClasses({AssertionTest.class, AssumptionTest.class, ExceptionTest.class}) public class AllTests { } diff --git a/libraries-data/README.md b/libraries-data/README.md new file mode 100644 index 0000000000..ca70c61146 --- /dev/null +++ b/libraries-data/README.md @@ -0,0 +1,2 @@ +### Relevant articles +- [Introduction to Reladomo](http://www.baeldung.com/reladomo) diff --git a/libraries-data/pom.xml b/libraries-data/pom.xml index 94a9ca43f4..cae8a725a6 100644 --- a/libraries-data/pom.xml +++ b/libraries-data/pom.xml @@ -14,9 +14,135 @@ com.esotericsoftware kryo ${kryo.version} + + + com.h2database + h2 + ${h2.version} + + + junit + junit + ${junit.version} + test + + + com.goldmansachs.reladomo + reladomo + ${reladomo.version} + + + com.goldmansachs.reladomo + reladomo-test-util + ${reladomo.version} + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 1.8 + 1.8 + + + + + + maven-antrun-plugin + 1.8 + + + generateMithra + generate-sources + + run + + + + + + + + + + + + + + + + + + com.goldmansachs.reladomo + reladomogen + ${reladomo.version} + + + + com.goldmansachs.reladomo + reladomo-gen-util + ${reladomo.version} + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + add-source + generate-sources + + add-source + + + + ${project.build.directory}/generated-sources/reladomo + + + + + add-resource + generate-resources + + add-resource + + + + + ${project.build.directory}/generated-db/ + + + + + + + + + + + 4.0.1 + 1.4.196 + 16.5.1 + 4.12 + 3.6.2
\ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/reladomo/Department.java b/libraries-data/src/main/java/com/baeldung/reladomo/Department.java similarity index 100% rename from libraries/src/main/java/com/baeldung/reladomo/Department.java rename to libraries-data/src/main/java/com/baeldung/reladomo/Department.java diff --git a/libraries/src/main/java/com/baeldung/reladomo/DepartmentDatabaseObject.java b/libraries-data/src/main/java/com/baeldung/reladomo/DepartmentDatabaseObject.java similarity index 100% rename from libraries/src/main/java/com/baeldung/reladomo/DepartmentDatabaseObject.java rename to libraries-data/src/main/java/com/baeldung/reladomo/DepartmentDatabaseObject.java diff --git a/libraries/src/main/java/com/baeldung/reladomo/DepartmentList.java b/libraries-data/src/main/java/com/baeldung/reladomo/DepartmentList.java similarity index 100% rename from libraries/src/main/java/com/baeldung/reladomo/DepartmentList.java rename to libraries-data/src/main/java/com/baeldung/reladomo/DepartmentList.java diff --git a/libraries/src/main/java/com/baeldung/reladomo/Employee.java b/libraries-data/src/main/java/com/baeldung/reladomo/Employee.java similarity index 100% rename from libraries/src/main/java/com/baeldung/reladomo/Employee.java rename to libraries-data/src/main/java/com/baeldung/reladomo/Employee.java diff --git a/libraries/src/main/java/com/baeldung/reladomo/EmployeeDatabaseObject.java b/libraries-data/src/main/java/com/baeldung/reladomo/EmployeeDatabaseObject.java similarity index 100% rename from libraries/src/main/java/com/baeldung/reladomo/EmployeeDatabaseObject.java rename to libraries-data/src/main/java/com/baeldung/reladomo/EmployeeDatabaseObject.java diff --git a/libraries/src/main/java/com/baeldung/reladomo/EmployeeList.java b/libraries-data/src/main/java/com/baeldung/reladomo/EmployeeList.java similarity index 100% rename from libraries/src/main/java/com/baeldung/reladomo/EmployeeList.java rename to libraries-data/src/main/java/com/baeldung/reladomo/EmployeeList.java diff --git a/libraries/src/main/java/com/baeldung/reladomo/ReladomoApplication.java b/libraries-data/src/main/java/com/baeldung/reladomo/ReladomoApplication.java similarity index 100% rename from libraries/src/main/java/com/baeldung/reladomo/ReladomoApplication.java rename to libraries-data/src/main/java/com/baeldung/reladomo/ReladomoApplication.java diff --git a/libraries/src/main/java/com/baeldung/reladomo/ReladomoConnectionManager.java b/libraries-data/src/main/java/com/baeldung/reladomo/ReladomoConnectionManager.java similarity index 100% rename from libraries/src/main/java/com/baeldung/reladomo/ReladomoConnectionManager.java rename to libraries-data/src/main/java/com/baeldung/reladomo/ReladomoConnectionManager.java diff --git a/libraries/src/main/resources/ReladomoRuntimeConfig.xml b/libraries-data/src/main/resources/ReladomoRuntimeConfig.xml similarity index 100% rename from libraries/src/main/resources/ReladomoRuntimeConfig.xml rename to libraries-data/src/main/resources/ReladomoRuntimeConfig.xml diff --git a/libraries/src/main/resources/reladomo/Department.xml b/libraries-data/src/main/resources/reladomo/Department.xml similarity index 100% rename from libraries/src/main/resources/reladomo/Department.xml rename to libraries-data/src/main/resources/reladomo/Department.xml diff --git a/libraries/src/main/resources/reladomo/Employee.xml b/libraries-data/src/main/resources/reladomo/Employee.xml similarity index 100% rename from libraries/src/main/resources/reladomo/Employee.xml rename to libraries-data/src/main/resources/reladomo/Employee.xml diff --git a/libraries/src/main/resources/reladomo/ReladomoClassList.xml b/libraries-data/src/main/resources/reladomo/ReladomoClassList.xml similarity index 100% rename from libraries/src/main/resources/reladomo/ReladomoClassList.xml rename to libraries-data/src/main/resources/reladomo/ReladomoClassList.xml diff --git a/libraries/src/test/java/com/baeldung/reladomo/ReladomoTest.java b/libraries-data/src/test/java/com/baeldung/reladomo/ReladomoTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/reladomo/ReladomoTest.java rename to libraries-data/src/test/java/com/baeldung/reladomo/ReladomoTest.java diff --git a/libraries/src/test/resources/reladomo/ReladomoTestConfig.xml b/libraries-data/src/test/resources/reladomo/ReladomoTestConfig.xml similarity index 100% rename from libraries/src/test/resources/reladomo/ReladomoTestConfig.xml rename to libraries-data/src/test/resources/reladomo/ReladomoTestConfig.xml diff --git a/libraries/src/test/resources/reladomo/test-data.txt b/libraries-data/src/test/resources/reladomo/test-data.txt similarity index 100% rename from libraries/src/test/resources/reladomo/test-data.txt rename to libraries-data/src/test/resources/reladomo/test-data.txt diff --git a/libraries/README.md b/libraries/README.md index ed6d214c7a..74766fb828 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -27,11 +27,20 @@ - [A Guide to Apache Commons DbUtils](http://www.baeldung.com/apache-commons-dbutils) - [Introduction to Awaitility](http://www.baeldung.com/awaitlity-testing) - [Guide to the HyperLogLog Algorithm](http://www.baeldung.com/java-hyperloglog) -- [Introduction to Neuroph](http://www.baeldung.com/intro-to-neuroph) +- [Introduction to Neuroph](http://www.baeldung.com/neuroph) - [Guide to Apache Commons CircularFifoQueue](http://www.baeldung.com/commons-circular-fifo-queue) - [Quick Guide to RSS with Rome](http://www.baeldung.com/rome-rss) - [Introduction to NoException](http://www.baeldung.com/intrduction-to-noexception) - +- [Introduction to PCollections](http://www.baeldung.com/java-pcollections) +- [Introduction to Hoverfly in Java](http://www.baeldung.com/hoverfly) +- [Apache Commons Chain](http://www.baeldung.com/apache-commons-chain) +- [Introduction to Eclipse Collections](http://www.baeldung.com/eclipse-collections) +- [DistinctBy in Java Stream API](http://www.baeldung.com/java-streams-distinct-by) +- [Introduction to Apache Commons CSV](http://www.baeldung.com/apache-commons-csv) +- [Difference Between Two Dates in Java](http://www.baeldung.com/java-date-difference) +- [Introduction to NoException](http://www.baeldung.com/no-exception) +- [Introduction to FunctionalJava](http://www.baeldung.com/functional-java) +- [Apache Commons IO](http://www.baeldung.com/apache-commons-io) The libraries module contains examples related to small libraries that are relatively easy to use and does not require any separate module of its own. diff --git a/libraries/pom.xml b/libraries/pom.xml index e9603b1453..01a3e7bd73 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -105,92 +105,6 @@ - - - - maven-antrun-plugin - 1.8 - - - generateMithra - generate-sources - - run - - - - - - - - - - - - - - - - - - com.goldmansachs.reladomo - reladomogen - ${reladomo.version} - - - - com.goldmansachs.reladomo - reladomo-gen-util - ${reladomo.version} - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.0.0 - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/reladomo - - - - - add-resource - generate-resources - - add-resource - - - - - ${project.build.directory}/generated-db/ - - - - - - - - @@ -221,6 +135,11 @@ commons-text ${commons-text.version} + + tec.units + unit-ri + 1.0.3 + org.apache.commons commons-collections4 @@ -275,7 +194,7 @@ io.specto hoverfly-java - 0.8.0 + 0.8.1 org.apache.httpcomponents @@ -380,22 +299,22 @@ org.datanucleus javax.jdo - 3.2.0-m6 + 3.2.0-m7 org.datanucleus datanucleus-core - 5.1.0-m1 + 5.1.1 org.datanucleus datanucleus-api-jdo - 5.1.0-m1 + 5.1.1 org.datanucleus datanucleus-rdbms - 5.1.0-m1 + 5.1.1 org.datanucleus @@ -449,7 +368,7 @@ com.zaxxer HikariCP - 2.6.1 + 2.6.3 compile @@ -568,30 +487,103 @@ vavr ${vavr.version} - - org.geotools - gt-shapefile - ${geotools.version} + + + + com.squareup.retrofit2 + retrofit + ${retrofit.version} - org.geotools - gt-epsg-hsql - ${geotools.version} + com.squareup.retrofit2 + converter-gson + ${retrofit.version} - org.geotools - gt-swing - ${geotools.version} + com.squareup.retrofit2 + adapter-rxjava + ${retrofit.version} + + + com.squareup.okhttp3 + logging-interceptor + 3.9.0 - com.goldmansachs.reladomo - reladomo - ${reladomo.version} + com.darwinsys + hirondelle-date4j + RELEASE + test - com.goldmansachs.reladomo - reladomo-test-util - ${reladomo.version} + joda-time + joda-time + ${joda-time.version} + + + com.darwinsys + hirondelle-date4j + ${hirondelle-date4j.version} + + + com.haulmont.yarg + yarg + 2.0.4 + + + net.engio + mbassador + 1.3.1 + + + org.jdeferred + jdeferred-core + 1.2.6 + + + com.codepoetics + protonpack + ${protonpack.version} + + + org.functionaljava + functionaljava + 4.7 + + + org.functionaljava + functionaljava-java8 + 4.7 + + + org.functionaljava + functionaljava-quickcheck + 4.7 + + + org.functionaljava + functionaljava-java-core + 4.7 + + + javax.cache + cache-api + ${cache.version} + + + com.hazelcast + hazelcast + ${hazelcast.version} + + + com.atlassian.jira + jira-rest-java-client-core + 4.0.0 + + + com.atlassian.fugue + fugue + 3.0.0-m007 @@ -601,23 +593,22 @@ http://download.java.net/maven/2 - osgeo - Open Source Geospatial Foundation Repository - http://download.osgeo.org/webdav/geotools/ + + false + + bintray-cuba-platform-main + bintray + http://dl.bintray.com/cuba-platform/main - - true - - opengeo - OpenGeo Maven Repository - http://repo.opengeo.org + atlassian-public + https://packages.atlassian.com/maven/repository/public 0.7.0 3.2.4 - 3.5 + 3.6 1.1 1.9.3 1.2 @@ -644,7 +635,7 @@ 1.1.3-rc.5 1.4.0 1.1.0 - 4.1.10.Final + 4.1.15.Final 4.1 4.12 0.10 @@ -659,6 +650,14 @@ 0.6.5 0.9.0 15.2 - 16.5.1 + 2.9.9 + 1.5.1 + 2.3.0 + 2.9.9 + 1.5.1 + 1.14 + 1.0.3 + 1.0.0 + 3.8.4 \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/commons/io/FileMonitor.java b/libraries/src/main/java/com/baeldung/commons/io/FileMonitor.java new file mode 100644 index 0000000000..d42323a5df --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/io/FileMonitor.java @@ -0,0 +1,43 @@ +package com.baeldung.commons.io; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.monitor.FileAlterationListener; +import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; +import org.apache.commons.io.monitor.FileAlterationMonitor; +import org.apache.commons.io.monitor.FileAlterationObserver; + +import java.io.File; + +public class FileMonitor { + + public static void main(String[] args) throws Exception { + File folder = FileUtils.getTempDirectory(); + startFileMonitor(folder); + } + + /** + * @param folder + * @throws Exception + */ + public static void startFileMonitor(File folder) throws Exception { + FileAlterationObserver observer = new FileAlterationObserver(folder); + FileAlterationMonitor monitor = new FileAlterationMonitor(5000); + + FileAlterationListener fal = new FileAlterationListenerAdaptor() { + + @Override + public void onFileCreate(File file) { + // on create action + } + + @Override + public void onFileDelete(File file) { + // on delete action + } + }; + + observer.addListener(fal); + monitor.addObserver(observer); + monitor.start(); + } +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/commons/lang3/BuilderMethods.java b/libraries/src/main/java/com/baeldung/commons/lang3/BuilderMethods.java new file mode 100644 index 0000000000..c64f7e7511 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/lang3/BuilderMethods.java @@ -0,0 +1,60 @@ +package com.baeldung.commons.lang3; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +public class BuilderMethods { + + private final int intValue; + private final String strSample; + + public BuilderMethods(final int newId, final String newName) { + this.intValue = newId; + this.strSample = newName; + } + + public int getId() { + return this.intValue; + } + + public String getName() { + return this.strSample; + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(this.intValue) + .append(this.strSample) + .toHashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof BuilderMethods == false) { + return false; + } + if (this == obj) { + return true; + } + final BuilderMethods otherObject = (BuilderMethods) obj; + + return new EqualsBuilder().append(this.intValue, otherObject.intValue) + .append(this.strSample, otherObject.strSample) + .isEquals(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("INTVALUE", this.intValue) + .append("STRINGVALUE", this.strSample) + .toString(); + } + + public static void main(final String[] arguments) { + final BuilderMethods simple1 = new BuilderMethods(1, "The First One"); + System.out.println(simple1.getName()); + System.out.println(simple1.hashCode()); + System.out.println(simple1.toString()); + } +} diff --git a/libraries/src/main/java/com/baeldung/commons/lang3/SampleLazyInitializer.java b/libraries/src/main/java/com/baeldung/commons/lang3/SampleLazyInitializer.java new file mode 100644 index 0000000000..56a49d2659 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/lang3/SampleLazyInitializer.java @@ -0,0 +1,11 @@ +package com.baeldung.commons.lang3; + +import org.apache.commons.lang3.concurrent.LazyInitializer; + +public class SampleLazyInitializer extends LazyInitializer { + + @Override + protected SampleObject initialize() { + return new SampleObject(); + } +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/commons/lang3/SampleObject.java b/libraries/src/main/java/com/baeldung/commons/lang3/SampleObject.java new file mode 100644 index 0000000000..0e61176732 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/lang3/SampleObject.java @@ -0,0 +1,7 @@ +package com.baeldung.commons.lang3; + +public class SampleObject { + + //Ignored + +} diff --git a/libraries/src/main/java/com/baeldung/fj/FunctionalJavaIOMain.java b/libraries/src/main/java/com/baeldung/fj/FunctionalJavaIOMain.java new file mode 100644 index 0000000000..ebf0fa4d2d --- /dev/null +++ b/libraries/src/main/java/com/baeldung/fj/FunctionalJavaIOMain.java @@ -0,0 +1,47 @@ +package com.baeldung.fj; + +import fj.F; +import fj.F1Functions; +import fj.Unit; +import fj.data.IO; +import fj.data.IOFunctions; + +public class FunctionalJavaIOMain { + + public static IO printLetters(final String s) { + return () -> { + for (int i = 0; i < s.length(); i++) { + System.out.println(s.charAt(i)); + } + return Unit.unit(); + }; + } + + public static void main(String[] args) { + + F> printLetters = i -> printLetters(i); + + IO lowerCase = IOFunctions + .stdoutPrintln("What's your first Name ?"); + + IO input = IOFunctions.stdoutPrint("First Name: "); + + IO userInput = IOFunctions.append(lowerCase, input); + + IO readInput = IOFunctions.stdinReadLine(); + + F toUpperCase = i -> i.toUpperCase(); + + F> transformInput = F1Functions + ., String> o(printLetters).f(toUpperCase); + + IO readAndPrintResult = IOFunctions.bind(readInput, + transformInput); + + IO program = IOFunctions.bind(userInput, + nothing -> readAndPrintResult); + + IOFunctions.toSafe(program).run(); + + } +} diff --git a/libraries/src/main/java/com/baeldung/fj/FunctionalJavaMain.java b/libraries/src/main/java/com/baeldung/fj/FunctionalJavaMain.java new file mode 100644 index 0000000000..e4d731454d --- /dev/null +++ b/libraries/src/main/java/com/baeldung/fj/FunctionalJavaMain.java @@ -0,0 +1,48 @@ +package com.baeldung.fj; + +import fj.F; +import fj.Show; +import fj.data.Array; +import fj.data.List; +import fj.data.Option; +import fj.function.Characters; +import fj.function.Integers; + +public class FunctionalJavaMain { + + public static final F isEven = i -> i % 2 == 0; + + public static void main(String[] args) { + + List fList = List.list(3, 4, 5, 6); + List evenList = fList.map(isEven); + Show.listShow(Show.booleanShow).println(evenList); + + fList = fList.map(i -> i + 1); + Show.listShow(Show.intShow).println(fList); + + Array a = Array.array(17, 44, 67, 2, 22, 80, 1, 27); + Array b = a.filter(Integers.even); + Show.arrayShow(Show.intShow).println(b); + + Array array = Array.array("Welcome", "To", "baeldung"); + Boolean isExist = array.exists(s -> List.fromString(s).forall(Characters.isLowerCase)); + System.out.println(isExist); + + Array intArray = Array.array(17, 44, 67, 2, 22, 80, 1, 27); + int sum = intArray.foldLeft(Integers.add, 0); + System.out.println(sum); + + Option n1 = Option.some(1); + Option n2 = Option.some(2); + + F> f1 = i -> i % 2 == 0 ? Option.some(i + 100) : Option.none(); + + Option result1 = n1.bind(f1); + Option result2 = n2.bind(f1); + + Show.optionShow(Show.intShow).println(result1); + Show.optionShow(Show.intShow).println(result2); + } + +} diff --git a/libraries/src/main/java/com/baeldung/jcache/SimpleCacheEntryListener.java b/libraries/src/main/java/com/baeldung/jcache/SimpleCacheEntryListener.java new file mode 100644 index 0000000000..b58182eab0 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/jcache/SimpleCacheEntryListener.java @@ -0,0 +1,34 @@ +package com.baeldung.jcache; + +import java.io.Serializable; + +import javax.cache.event.CacheEntryCreatedListener; +import javax.cache.event.CacheEntryEvent; +import javax.cache.event.CacheEntryListenerException; +import javax.cache.event.CacheEntryUpdatedListener; + +public class SimpleCacheEntryListener implements CacheEntryCreatedListener, CacheEntryUpdatedListener, Serializable { + + /** + * + */ + private static final long serialVersionUID = -712657810462878763L; + private boolean updated; + private boolean created; + + public boolean getUpdated() { + return this.updated; + } + + public boolean getCreated() { + return this.created; + } + + public void onUpdated(Iterable> events) throws CacheEntryListenerException { + this.updated = true; + } + + public void onCreated(Iterable> events) throws CacheEntryListenerException { + this.created = true; + } +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/jcache/SimpleCacheLoader.java b/libraries/src/main/java/com/baeldung/jcache/SimpleCacheLoader.java new file mode 100644 index 0000000000..77ab8fb645 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/jcache/SimpleCacheLoader.java @@ -0,0 +1,24 @@ +package com.baeldung.jcache; + +import java.util.HashMap; +import java.util.Map; + +import javax.cache.integration.CacheLoader; +import javax.cache.integration.CacheLoaderException; + +public class SimpleCacheLoader implements CacheLoader { + + @Override + public String load(Integer key) throws CacheLoaderException { + return "fromCache" + key; + } + + @Override + public Map loadAll(Iterable keys) throws CacheLoaderException { + Map data = new HashMap<>(); + for (int key : keys) { + data.put(key, load(key)); + } + return data; + } +} diff --git a/libraries/src/main/java/com/baeldung/jcache/SimpleEntryProcessor.java b/libraries/src/main/java/com/baeldung/jcache/SimpleEntryProcessor.java new file mode 100644 index 0000000000..bb585807fb --- /dev/null +++ b/libraries/src/main/java/com/baeldung/jcache/SimpleEntryProcessor.java @@ -0,0 +1,25 @@ +package com.baeldung.jcache; + +import java.io.Serializable; + +import javax.cache.processor.EntryProcessor; +import javax.cache.processor.EntryProcessorException; +import javax.cache.processor.MutableEntry; + +public class SimpleEntryProcessor implements EntryProcessor, Serializable { + + /** + * + */ + private static final long serialVersionUID = -5616476363722945132L; + + public String process(MutableEntry entry, Object... args) throws EntryProcessorException { + + if (entry.exists()) { + String current = entry.getValue(); + entry.setValue(current + " - modified"); + return current; + } + return null; + } +} diff --git a/libraries/src/main/java/com/baeldung/jdeffered/FilterDemo.java b/libraries/src/main/java/com/baeldung/jdeffered/FilterDemo.java new file mode 100644 index 0000000000..ec2c52d3b5 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/jdeffered/FilterDemo.java @@ -0,0 +1,24 @@ +package com.baeldung.jdeffered; + +import org.jdeferred.Deferred; +import org.jdeferred.Promise; +import org.jdeferred.impl.DeferredObject; + +class FilterDemo { + + private static String modifiedMsg; + + static String filter(String msg) { + + Deferred d = new DeferredObject<>(); + Promise p = d.promise(); + Promise filtered = p.then((result) -> { + modifiedMsg = "Hello " + result; + }); + + filtered.done(r -> System.out.println("filtering done")); + + d.resolve(msg); + return modifiedMsg; + } +} diff --git a/libraries/src/main/java/com/baeldung/jdeffered/PipeDemo.java b/libraries/src/main/java/com/baeldung/jdeffered/PipeDemo.java new file mode 100644 index 0000000000..95250cff76 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/jdeffered/PipeDemo.java @@ -0,0 +1,35 @@ +package com.baeldung.jdeffered; + +import org.jdeferred.Deferred; +import org.jdeferred.DonePipe; +import org.jdeferred.Promise; +import org.jdeferred.impl.DeferredObject; + +class PipeDemo { + + public enum Result { + SUCCESS, FAILURE + }; + + private static Result status; + + static Result validate(int num) { + Deferred d = new DeferredObject<>(); + Promise p = d.promise(); + + p.then((DonePipe) result -> { + if (result < 90) { + return new DeferredObject() + .resolve(result); + } else { + return new DeferredObject() + .reject(new Exception("Unacceptable value")); + } + }).done(r -> status = Result.SUCCESS) + .fail(r -> status = Result.FAILURE); + + d.resolve(num); + + return status; + } +} diff --git a/libraries/src/main/java/com/baeldung/jdeffered/PromiseDemo.java b/libraries/src/main/java/com/baeldung/jdeffered/PromiseDemo.java new file mode 100644 index 0000000000..2a9f83dc35 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/jdeffered/PromiseDemo.java @@ -0,0 +1,24 @@ +package com.baeldung.jdeffered; + +import org.jdeferred.Deferred; +import org.jdeferred.Promise; +import org.jdeferred.impl.DeferredObject; + +class PromiseDemo { + + static void startJob(String jobName) { + + Deferred deferred = new DeferredObject<>(); + Promise promise = deferred.promise(); + + promise.done(result -> System.out.println("Job done")) + .fail(rejection -> System.out.println("Job fail")) + .progress(progress -> System.out.println("Job is in progress")) + .always((state, result, rejection) -> System.out.println("Job execution started")); + + deferred.resolve(jobName); + // deferred.notify(""); + // deferred.reject("oops"); + } + +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/jdeffered/ThreadSafeDemo.java b/libraries/src/main/java/com/baeldung/jdeffered/ThreadSafeDemo.java new file mode 100644 index 0000000000..22fd51ed92 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/jdeffered/ThreadSafeDemo.java @@ -0,0 +1,38 @@ +package com.baeldung.jdeffered; + +import org.jdeferred.Deferred; +import org.jdeferred.DeferredManager; +import org.jdeferred.Promise; +import org.jdeferred.impl.DefaultDeferredManager; +import org.jdeferred.impl.DeferredObject; + +public class ThreadSafeDemo { + + public static void task() { + DeferredManager dm = new DefaultDeferredManager(); + Deferred deferred = new DeferredObject<>(); + Promise p1 = deferred.promise(); + Promise p = dm.when(p1) + .done(r -> System.out.println("done")) + .fail(r -> System.out.println("fail")); + + synchronized (p) { + while (p.isPending()) { + try { + p.wait(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + try { + p.waitSafely(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + deferred.resolve("Hello Baeldung"); + } + +} diff --git a/libraries/src/main/java/com/baeldung/jdeffered/manager/DeferredManagerDemo.java b/libraries/src/main/java/com/baeldung/jdeffered/manager/DeferredManagerDemo.java new file mode 100644 index 0000000000..d37a62e309 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/jdeffered/manager/DeferredManagerDemo.java @@ -0,0 +1,22 @@ +package com.baeldung.jdeffered.manager; + +import org.jdeferred.Deferred; +import org.jdeferred.DeferredManager; +import org.jdeferred.Promise; +import org.jdeferred.impl.DefaultDeferredManager; +import org.jdeferred.impl.DeferredObject; + +class DeferredManagerDemo { + + public static void initiate() { + Deferred deferred = new DeferredObject<>(); + DeferredManager dm = new DefaultDeferredManager(); + Promise p1 = deferred.promise(), p2 = deferred.promise(), p3 = deferred.promise(); + dm.when(p1, p2, p3).done((result) -> { + System.out.println("done"); + }).fail((result) -> { + System.out.println("fail"); + }); + deferred.resolve("Hello Baeldung"); + } +} diff --git a/libraries/src/main/java/com/baeldung/jdeffered/manager/DeferredManagerWithExecutorDemo.java b/libraries/src/main/java/com/baeldung/jdeffered/manager/DeferredManagerWithExecutorDemo.java new file mode 100644 index 0000000000..2abe9bc10f --- /dev/null +++ b/libraries/src/main/java/com/baeldung/jdeffered/manager/DeferredManagerWithExecutorDemo.java @@ -0,0 +1,24 @@ +package com.baeldung.jdeffered.manager; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import org.jdeferred.Deferred; +import org.jdeferred.DeferredManager; +import org.jdeferred.Promise; +import org.jdeferred.impl.DefaultDeferredManager; +import org.jdeferred.impl.DeferredObject; + +class DeferredManagerWithExecutorDemo { + + public static void initiate() { + ExecutorService executor = Executors.newFixedThreadPool(10); + Deferred deferred = new DeferredObject<>(); + DeferredManager dm = new DefaultDeferredManager(executor); + Promise p1 = deferred.promise(), p2 = deferred.promise(), p3 = deferred.promise(); + dm.when(p1, p2, p3) + .done(r -> System.out.println("done")) + .fail(r -> System.out.println("fail")); + deferred.resolve("done"); + } +} diff --git a/libraries/src/main/java/com/baeldung/jdeffered/manager/SimpleDeferredManagerDemo.java b/libraries/src/main/java/com/baeldung/jdeffered/manager/SimpleDeferredManagerDemo.java new file mode 100644 index 0000000000..dc2e82495f --- /dev/null +++ b/libraries/src/main/java/com/baeldung/jdeffered/manager/SimpleDeferredManagerDemo.java @@ -0,0 +1,14 @@ +package com.baeldung.jdeffered.manager; + +import org.jdeferred.DeferredManager; +import org.jdeferred.impl.DefaultDeferredManager; + +class SimpleDeferredManagerDemo { + + public static void initiate() { + DeferredManager dm = new DefaultDeferredManager(); + dm.when(() -> 1) + .done(r -> System.out.println("done")) + .fail(Throwable::printStackTrace); + } +} diff --git a/libraries/src/main/java/com/baeldung/jira/JiraClient.java b/libraries/src/main/java/com/baeldung/jira/JiraClient.java new file mode 100644 index 0000000000..26df21c8a9 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/jira/JiraClient.java @@ -0,0 +1,57 @@ +package com.baeldung.jira; + +import com.atlassian.jira.rest.client.api.JiraRestClient; +import com.atlassian.jira.rest.client.api.JiraRestClientFactory; +import com.atlassian.jira.rest.client.api.domain.Issue; +import com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +public class JiraClient { + + private static final String USERNAME = "jira.user"; + private static final String PASSWORD = "secret"; + private static final String JIRA_URL = "http://jira.company.com"; + + public static void main(String[] args) { + + final Issue issue = new JiraClient().getIssue("MYKEY-1234"); + System.out.println(issue.getDescription()); + } + + private Issue getIssue(String issueKey) { + JiraRestClient restClient = getJiraRestClient(); + Issue issue = restClient.getIssueClient().getIssue(issueKey).claim(); + + closeRestClient(restClient); + return issue; + } + + private JiraRestClient getJiraRestClient() { + JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory(); + + URI jiraServerUri = getJiraUri(); + return factory + .createWithBasicHttpAuthentication(jiraServerUri, USERNAME, PASSWORD); + } + + private URI getJiraUri() { + URI jiraServerUri = null; + try { + jiraServerUri = new URI(JIRA_URL); + } catch (URISyntaxException e) { + e.printStackTrace(); + } + return jiraServerUri; + } + + private void closeRestClient(JiraRestClient restClient) { + try { + restClient.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/libraries/src/main/java/com/baeldung/mbassador/AckMessage.java b/libraries/src/main/java/com/baeldung/mbassador/AckMessage.java new file mode 100644 index 0000000000..a42b24b605 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/mbassador/AckMessage.java @@ -0,0 +1,5 @@ +package com.baeldung.mbassador; + +public class AckMessage extends Message { + +} diff --git a/libraries/src/main/java/com/baeldung/mbassador/Message.java b/libraries/src/main/java/com/baeldung/mbassador/Message.java new file mode 100644 index 0000000000..bb773dd1a0 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/mbassador/Message.java @@ -0,0 +1,5 @@ +package com.baeldung.mbassador; + +public class Message { + +} diff --git a/libraries/src/main/java/com/baeldung/mbassador/RejectMessage.java b/libraries/src/main/java/com/baeldung/mbassador/RejectMessage.java new file mode 100644 index 0000000000..f569002edd --- /dev/null +++ b/libraries/src/main/java/com/baeldung/mbassador/RejectMessage.java @@ -0,0 +1,15 @@ +package com.baeldung.mbassador; + +public class RejectMessage extends Message { + + int code; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + +} diff --git a/libraries/src/main/java/com/baeldung/measurement/WaterTank.java b/libraries/src/main/java/com/baeldung/measurement/WaterTank.java new file mode 100644 index 0000000000..f3675ae689 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/measurement/WaterTank.java @@ -0,0 +1,26 @@ +package com.baeldung.measurement; + +import javax.measure.Quantity; +import javax.measure.quantity.Volume; + +public class WaterTank { + + private Quantity capacityMeasure; + private double capacityDouble; + + public void setCapacityMeasure(Quantity capacityMeasure) { + this.capacityMeasure = capacityMeasure; + } + + public void setCapacityDouble(double capacityDouble) { + this.capacityDouble = capacityDouble; + } + + public Quantity getCapacityMeasure() { + return capacityMeasure; + } + + public double getCapacityDouble() { + return capacityDouble; + } +} diff --git a/libraries/src/main/java/com/baeldung/protonpack/CollectorUtilsExample.java b/libraries/src/main/java/com/baeldung/protonpack/CollectorUtilsExample.java new file mode 100644 index 0000000000..016178083a --- /dev/null +++ b/libraries/src/main/java/com/baeldung/protonpack/CollectorUtilsExample.java @@ -0,0 +1,18 @@ +package com.baeldung.protonpack; + +import java.util.Optional; +import java.util.stream.Stream; + +import static com.codepoetics.protonpack.collectors.CollectorUtils.maxBy; +import static com.codepoetics.protonpack.collectors.CollectorUtils.minBy; + +public class CollectorUtilsExample { + + public void minMaxProjectionCollector() { + Stream integerStream = Stream.of("a", "bb", "ccc", "1"); + + Optional max = integerStream.collect(maxBy(String::length)); + Optional min = integerStream.collect(minBy(String::length)); + + } +} diff --git a/libraries/src/main/java/com/baeldung/protonpack/StreamUtilsExample.java b/libraries/src/main/java/com/baeldung/protonpack/StreamUtilsExample.java new file mode 100644 index 0000000000..eead34af71 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/protonpack/StreamUtilsExample.java @@ -0,0 +1,107 @@ +package com.baeldung.protonpack; + +import com.codepoetics.protonpack.Indexed; +import com.codepoetics.protonpack.StreamUtils; +import com.codepoetics.protonpack.selectors.Selectors; + +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.LongStream; +import java.util.stream.Stream; + +import static java.util.stream.Collectors.toList; + +public class StreamUtilsExample { + + public void createInfiniteIndex() { + LongStream indices = StreamUtils.indices(); + } + + public void zipAStreamWithIndex() { + Stream source = Stream.of("Foo", "Bar", "Baz"); + List> zipped = StreamUtils + .zipWithIndex(source) + .collect(Collectors.toList()); + } + + public void zipAPairOfStreams() { + Stream streamA = Stream.of("A", "B", "C"); + Stream streamB = Stream.of("Apple", "Banana", "Carrot"); + + List zipped = StreamUtils + .zip(streamA, streamB, (a, b) -> a + " is for " + b) + .collect(Collectors.toList()); + } + + public void zipThreeStreams() { + Stream streamA = Stream.of("A", "B", "C"); + Stream streamB = Stream.of("aggravating", "banausic", "complaisant"); + Stream streamC = Stream.of("Apple", "Banana", "Carrot"); + + List zipped = StreamUtils + .zip(streamA, streamB, streamC, (a, b, c) -> a + " is for " + b + " " + c) + .collect(Collectors.toList()); + } + + public void mergeThreeStreams() { + Stream streamA = Stream.of("A", "B", "C"); + Stream streamB = Stream.of("apple", "banana", "carrot", "date"); + Stream streamC = Stream.of("fritter", "split", "cake", "roll", "pastry"); + + Stream> merged = StreamUtils.mergeToList(streamA, streamB, streamC); + } + + public void interleavingStreamsUsingRoundRobin() { + Stream streamA = Stream.of("Peter", "Paul", "Mary"); + Stream streamB = Stream.of("A", "B", "C", "D", "E"); + Stream streamC = Stream.of("foo", "bar", "baz", "xyzzy"); + + Stream interleaved = StreamUtils.interleave(Selectors.roundRobin(), streamA, streamB, streamC); + } + + public void takeWhileAndTakeUntilStream() { + Stream infiniteInts = Stream.iterate(0, i -> i + 1); + Stream finiteIntsWhileLessThan10 = StreamUtils.takeWhile(infiniteInts, i -> i < 10); + Stream finiteIntsUntilGreaterThan10 = StreamUtils.takeUntil(infiniteInts, i -> i > 10); + } + + public void skipWhileAndSkipUntilStream() { + Stream ints = Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + Stream skippedWhileConditionMet = StreamUtils.skipWhile(ints, i -> i < 4); + Stream skippedUntilConditionMet = StreamUtils.skipWhile(ints, i -> i > 4); + } + + public void unfoldStream() { + Stream unfolded = StreamUtils.unfold(1, i -> (i < 10) ? Optional.of(i + 1) : Optional.empty()); + } + + public void windowedStream() { + Stream integerStream = Stream.of(1, 2, 3, 4, 5); + + List> windows = StreamUtils + .windowed(integerStream, 2) + .collect(toList()); + List> windowsWithSkipIndex = StreamUtils + .windowed(integerStream, 3, 2) + .collect(toList()); + List> windowsWithSkipIndexAndAllowLowerSize = StreamUtils + .windowed(integerStream, 2, 2, true) + .collect(toList()); + + } + + public void groupRunsStreams() { + Stream integerStream = Stream.of(1, 1, 2, 2, 3, 4, 5); + + List> runs = StreamUtils + .groupRuns(integerStream) + .collect(toList()); + } + + public void aggreagateOnBiElementPredicate() { + Stream stream = Stream.of("a1", "b1", "b2", "c1"); + Stream> aggregated = StreamUtils.aggregate(stream, (e1, e2) -> e1.charAt(0) == e2.charAt(0)); + } + +} diff --git a/libraries/src/main/java/com/baeldung/retrofit/basic/GitHubBasicApi.java b/libraries/src/main/java/com/baeldung/retrofit/basic/GitHubBasicApi.java new file mode 100644 index 0000000000..4e071d3384 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/retrofit/basic/GitHubBasicApi.java @@ -0,0 +1,33 @@ +package com.baeldung.retrofit.basic; + +import java.util.List; + +import com.baeldung.retrofit.models.Contributor; +import com.baeldung.retrofit.models.Repository; + +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Path; + +public interface GitHubBasicApi { + + /** + * List GitHub repositories of user + * @param user GitHub Account + * @return GitHub repositories + */ + @GET("users/{user}/repos") + Call> listRepos(@Path("user") String user); + + /** + * List Contributors of a GitHub Repository + * @param user GitHub Account + * @param repo GitHub Repository + * @return GitHub Repository Contributors + */ + @GET("repos/{user}/{repo}/contributors") + Call> listRepoContributors( + @Path("user") String user, + @Path("repo") String repo); + +} diff --git a/libraries/src/main/java/com/baeldung/retrofit/basic/GitHubBasicApp.java b/libraries/src/main/java/com/baeldung/retrofit/basic/GitHubBasicApp.java new file mode 100644 index 0000000000..6b2cd14252 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/retrofit/basic/GitHubBasicApp.java @@ -0,0 +1,14 @@ +package com.baeldung.retrofit.basic; + +import java.io.IOException; +import java.util.List; + +public class GitHubBasicApp { + + public static void main(String[] args) throws IOException { + String userName = "eugenp"; + List topContributors = new GitHubBasicService() + .getTopContributors(userName); + topContributors.forEach(System.out::println); + } +} diff --git a/libraries/src/main/java/com/baeldung/retrofit/basic/GitHubBasicService.java b/libraries/src/main/java/com/baeldung/retrofit/basic/GitHubBasicService.java new file mode 100644 index 0000000000..20256fb540 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/retrofit/basic/GitHubBasicService.java @@ -0,0 +1,60 @@ +package com.baeldung.retrofit.basic; + +import com.baeldung.retrofit.models.Contributor; +import com.baeldung.retrofit.models.Repository; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +class GitHubBasicService { + + private GitHubBasicApi gitHubApi; + + GitHubBasicService() { + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("https://api.github.com/") + .addConverterFactory(GsonConverterFactory.create()) + .build(); + + gitHubApi = retrofit.create(GitHubBasicApi.class); + } + + List getTopContributors(String userName) throws IOException { + List repos = gitHubApi + .listRepos(userName) + .execute() + .body(); + + repos = repos != null ? repos : Collections.emptyList(); + + return repos.stream() + .flatMap(repo -> getContributors(userName, repo)) + .sorted((a, b) -> b.getContributions() - a.getContributions()) + .map(Contributor::getName) + .distinct() + .sorted() + .collect(Collectors.toList()); + } + + private Stream getContributors(String userName, Repository repo) { + List contributors = null; + try { + contributors = gitHubApi + .listRepoContributors(userName, repo.getName()) + .execute() + .body(); + } catch (IOException e) { + e.printStackTrace(); + } + + contributors = contributors != null ? contributors : Collections.emptyList(); + + return contributors.stream() + .filter(c -> c.getContributions() > 100); + } +} diff --git a/libraries/src/main/java/com/baeldung/retrofit/models/Contributor.java b/libraries/src/main/java/com/baeldung/retrofit/models/Contributor.java new file mode 100644 index 0000000000..2f8697f603 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/retrofit/models/Contributor.java @@ -0,0 +1,30 @@ +package com.baeldung.retrofit.models; + +import com.google.gson.annotations.SerializedName; + +public class Contributor { + + @SerializedName("login") + private String name; + + private Integer contributions; + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Integer getContributions() { + return contributions; + } + public void setContributions(Integer contributions) { + this.contributions = contributions; + } + + @Override + public String toString() { + return "Contributer [name=" + name + ", contributions=" + contributions + "]"; + } + +} diff --git a/libraries/src/main/java/com/baeldung/retrofit/models/Repository.java b/libraries/src/main/java/com/baeldung/retrofit/models/Repository.java new file mode 100644 index 0000000000..f12fcdf8f2 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/retrofit/models/Repository.java @@ -0,0 +1,27 @@ +package com.baeldung.retrofit.models; + +public class Repository { + + private String name; + + private String description; + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + + @Override + public String toString() { + return "Repository [name=" + name + ", description=" + description + "]"; + } + +} diff --git a/libraries/src/main/java/com/baeldung/retrofit/rx/GitHubRxApi.java b/libraries/src/main/java/com/baeldung/retrofit/rx/GitHubRxApi.java new file mode 100644 index 0000000000..4e40aff448 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/retrofit/rx/GitHubRxApi.java @@ -0,0 +1,33 @@ +package com.baeldung.retrofit.rx; + +import java.util.List; + +import com.baeldung.retrofit.models.Contributor; +import com.baeldung.retrofit.models.Repository; + +import retrofit2.http.GET; +import retrofit2.http.Path; +import rx.Observable; + +public interface GitHubRxApi { + + /** + * List GitHub repositories of user + * @param user GitHub Account + * @return GitHub repositories + */ + @GET("users/{user}/repos") + Observable> listRepos(@Path("user") String user); + + /** + * List Contributors of a GitHub Repository + * @param user GitHub Account + * @param repo GitHub Repository + * @return GitHub Repository Contributors + */ + @GET("repos/{user}/{repo}/contributors") + Observable> listRepoContributors( + @Path("user") String user, + @Path("repo") String repo); + +} diff --git a/libraries/src/main/java/com/baeldung/retrofit/rx/GitHubRxApp.java b/libraries/src/main/java/com/baeldung/retrofit/rx/GitHubRxApp.java new file mode 100644 index 0000000000..b136a1e40b --- /dev/null +++ b/libraries/src/main/java/com/baeldung/retrofit/rx/GitHubRxApp.java @@ -0,0 +1,12 @@ +package com.baeldung.retrofit.rx; + +import java.io.IOException; + +public class GitHubRxApp { + + public static void main(String[] args) throws IOException { + String userName = "eugenp"; + new GitHubRxService().getTopContributors(userName) + .subscribe(System.out::println); + } +} diff --git a/libraries/src/main/java/com/baeldung/retrofit/rx/GitHubRxService.java b/libraries/src/main/java/com/baeldung/retrofit/rx/GitHubRxService.java new file mode 100644 index 0000000000..2ad50a9f39 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/retrofit/rx/GitHubRxService.java @@ -0,0 +1,33 @@ +package com.baeldung.retrofit.rx; + +import com.baeldung.retrofit.models.Contributor; +import retrofit2.Retrofit; +import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; +import retrofit2.converter.gson.GsonConverterFactory; +import rx.Observable; + +class GitHubRxService { + + private GitHubRxApi gitHubApi; + + GitHubRxService() { + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("https://api.github.com/") + .addConverterFactory(GsonConverterFactory.create()) + .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) + .build(); + + gitHubApi = retrofit.create(GitHubRxApi.class); + } + + Observable getTopContributors(String userName) { + return gitHubApi.listRepos(userName) + .flatMapIterable(x -> x) + .flatMap(repo -> gitHubApi.listRepoContributors(userName, repo.getName())) + .flatMapIterable(x -> x) + .filter(c -> c.getContributions() > 100) + .sorted((a, b) -> b.getContributions() - a.getContributions()) + .map(Contributor::getName) + .distinct(); + } +} diff --git a/libraries/src/main/java/com/baeldung/retrofitguide/GitHubServiceGenerator.java b/libraries/src/main/java/com/baeldung/retrofitguide/GitHubServiceGenerator.java new file mode 100644 index 0000000000..d32891be9e --- /dev/null +++ b/libraries/src/main/java/com/baeldung/retrofitguide/GitHubServiceGenerator.java @@ -0,0 +1,58 @@ +package com.baeldung.retrofitguide; + +import java.io.IOException; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.logging.HttpLoggingInterceptor; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + +public class GitHubServiceGenerator { + + private static final String BASE_URL = "https://api.github.com/"; + + private static Retrofit.Builder builder + = new Retrofit.Builder() + .baseUrl(BASE_URL) + .addConverterFactory(GsonConverterFactory.create()); + + private static Retrofit retrofit = builder.build(); + + private static OkHttpClient.Builder httpClient + = new OkHttpClient.Builder(); + + private static HttpLoggingInterceptor logging + = new HttpLoggingInterceptor() + .setLevel(HttpLoggingInterceptor.Level.BASIC); + + public static S createService(Class serviceClass) { + if (!httpClient.interceptors().contains(logging)) { + httpClient.addInterceptor(logging); + builder.client(httpClient.build()); + retrofit = builder.build(); + } + return retrofit.create(serviceClass); + } + + public static S createService(Class serviceClass, final String token) { + if (token != null) { + httpClient.interceptors().clear(); + httpClient.addInterceptor(new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + Request original = chain.request(); + Request.Builder builder = original.newBuilder() + .header("Authorization", token); + Request request = builder.build(); + return chain.proceed(request); + } + }); + builder.client(httpClient.build()); + retrofit = builder.build(); + } + return retrofit.create(serviceClass); + } + +} diff --git a/libraries/src/main/java/com/baeldung/retrofitguide/Main.java b/libraries/src/main/java/com/baeldung/retrofitguide/Main.java new file mode 100644 index 0000000000..8a674f634b --- /dev/null +++ b/libraries/src/main/java/com/baeldung/retrofitguide/Main.java @@ -0,0 +1,49 @@ +package com.baeldung.retrofitguide; + +import java.io.IOException; +import okhttp3.OkHttpClient; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + +public class Main { + + public static void main(String[] args) { + //Manual creation + OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("https://api.github.com/") + .addConverterFactory(GsonConverterFactory.create()) + .client(httpClient.build()) + .build(); + UserService service = retrofit.create(UserService.class); + //Using GitHubServiceGenerator + service = GitHubServiceGenerator.createService(UserService.class); + Call callSync = service.getUser("eugenp"); + Call callAsync = service.getUser("eugenp"); + + try { + Response response = callSync.execute(); + User user = response.body(); + System.out.println(user); + } catch (IOException ex) { + } + + // Execute the call asynchronously. Get a positive or negative callback. + callAsync.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + User user = response.body(); + System.out.println(user); + } + + @Override + public void onFailure(Call call, Throwable throwable) { + System.out.println(throwable); + } + }); + + } +} diff --git a/libraries/src/main/java/com/baeldung/retrofitguide/User.java b/libraries/src/main/java/com/baeldung/retrofitguide/User.java new file mode 100644 index 0000000000..1b097aa4f1 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/retrofitguide/User.java @@ -0,0 +1,65 @@ +package com.baeldung.retrofitguide; + +public class User { + + private String login; + private long id; + private String url; + private String company; + private String blog; + private String email; + + public String getLogin() { + return login; + } + + public void setLogin(String login) { + this.login = login; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getCompany() { + return company; + } + + public void setCompany(String company) { + this.company = company; + } + + public String getBlog() { + return blog; + } + + public void setBlog(String blog) { + this.blog = blog; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public String toString() { + return "User{" + "login=" + login + ", id=" + id + ", url=" + url + ", company=" + company + ", blog=" + blog + ", email=" + email + '}'; + } + +} diff --git a/libraries/src/main/java/com/baeldung/retrofitguide/UserService.java b/libraries/src/main/java/com/baeldung/retrofitguide/UserService.java new file mode 100644 index 0000000000..6e18e685ca --- /dev/null +++ b/libraries/src/main/java/com/baeldung/retrofitguide/UserService.java @@ -0,0 +1,17 @@ +package com.baeldung.retrofitguide; + +import java.util.List; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Path; +import retrofit2.http.Query; + +public interface UserService { + + @GET("/users") + public Call> getUsers(@Query("per_page") int per_page, @Query("page") int page); + + @GET("/users/{username}") + public Call getUser(@Path("username") String username); + +} diff --git a/libraries/src/main/java/com/baeldung/yarg/DocumentController.java b/libraries/src/main/java/com/baeldung/yarg/DocumentController.java new file mode 100644 index 0000000000..0e1bbca561 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/yarg/DocumentController.java @@ -0,0 +1,56 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.baeldung.yarg; + +import com.haulmont.yarg.formatters.factory.DefaultFormatterFactory; +import com.haulmont.yarg.loaders.factory.DefaultLoaderFactory; +import com.haulmont.yarg.loaders.impl.JsonDataLoader; +import com.haulmont.yarg.reporting.Reporting; +import com.haulmont.yarg.reporting.RunParams; +import com.haulmont.yarg.structure.Report; +import com.haulmont.yarg.structure.ReportBand; +import com.haulmont.yarg.structure.ReportOutputType; +import com.haulmont.yarg.structure.impl.BandBuilder; +import com.haulmont.yarg.structure.impl.ReportBuilder; +import com.haulmont.yarg.structure.impl.ReportTemplateBuilder; +import java.io.File; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import org.apache.commons.io.FileUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class DocumentController { + + @RequestMapping(path = "/generate/doc", method = RequestMethod.GET) + public void generateDocument(HttpServletResponse response) throws IOException { + ReportBuilder reportBuilder = new ReportBuilder(); + ReportTemplateBuilder reportTemplateBuilder = new ReportTemplateBuilder() + .documentPath("./src/main/resources/Letter.docx") + .documentName("Letter.docx") + .outputType(ReportOutputType.docx) + .readFileFromPath(); + reportBuilder.template(reportTemplateBuilder.build()); + BandBuilder bandBuilder = new BandBuilder(); + String json = FileUtils.readFileToString(new File("./src/main/resources/Data.json")); + ReportBand main = bandBuilder.name("Main") + .query("Main", "parameter=param1 $.main", "json") + .build(); + reportBuilder.band(main); + Report report = reportBuilder.build(); + + Reporting reporting = new Reporting(); + reporting.setFormatterFactory(new DefaultFormatterFactory()); + reporting.setLoaderFactory( + new DefaultLoaderFactory() + .setJsonDataLoader(new JsonDataLoader())); + response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + reporting.runReport(new RunParams(report).param("param1", json), response.getOutputStream()); + } + +} diff --git a/libraries/src/main/resources/Data.json b/libraries/src/main/resources/Data.json new file mode 100644 index 0000000000..d098839d51 --- /dev/null +++ b/libraries/src/main/resources/Data.json @@ -0,0 +1,7 @@ +{ + "main": { + "title" : "INTRODUCTION TO YARG", + "name" : "Baeldung", + "content" : "This is the content of the letter, can be anything we like." + } +} diff --git a/libraries/src/main/resources/Letter.docx b/libraries/src/main/resources/Letter.docx new file mode 100644 index 0000000000..fbd01271d0 Binary files /dev/null and b/libraries/src/main/resources/Letter.docx differ diff --git a/libraries/src/test/java/com/baeldung/commons/collections4/BagTests.java b/libraries/src/test/java/com/baeldung/commons/collections4/BagTests.java index 1270c50008..4ce250d979 100644 --- a/libraries/src/test/java/com/baeldung/commons/collections4/BagTests.java +++ b/libraries/src/test/java/com/baeldung/commons/collections4/BagTests.java @@ -34,9 +34,7 @@ public class BagTests { Assert.assertFalse(baseBag.contains("lemon")); Assert.assertTrue(baseBag.uniqueSet().contains("apple")); - Assert.assertFalse(baseBag.uniqueSet().contains("lemon")); - Assert.assertTrue(baseBag.uniqueSet().contains("lime")); - + List containList = new ArrayList(); containList.add("apple"); containList.add("lemon"); @@ -56,11 +54,12 @@ public class BagTests { baseCollectionBag.remove("lemon"); Assert.assertEquals(8, baseCollectionBag.size()); Assert.assertTrue(baseCollectionBag.contains("lemon")); + + baseCollectionBag.remove("lemon",1); + Assert.assertEquals(7, baseCollectionBag.size()); Assert.assertTrue(baseBag.uniqueSet().contains("apple")); - Assert.assertTrue(baseBag.uniqueSet().contains("lemon")); - Assert.assertTrue(baseBag.uniqueSet().contains("lime")); - + List containList = new ArrayList(); containList.add("apple"); containList.add("lemon"); @@ -81,5 +80,6 @@ public class BagTests { treeBag.remove("apple"); Assert.assertEquals(9, treeBag.size()); Assert.assertEquals("banana", treeBag.first()); + } } diff --git a/libraries/src/test/java/com/baeldung/commons/io/CommonsIOUnitTest.java b/libraries/src/test/java/com/baeldung/commons/io/CommonsIOUnitTest.java new file mode 100644 index 0000000000..3c82c30d9b --- /dev/null +++ b/libraries/src/test/java/com/baeldung/commons/io/CommonsIOUnitTest.java @@ -0,0 +1,151 @@ +package com.baeldung.commons.io; + +import org.apache.commons.io.FileSystemUtils; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOCase; +import org.apache.commons.io.comparator.PathFileComparator; +import org.apache.commons.io.comparator.SizeFileComparator; +import org.apache.commons.io.filefilter.AndFileFilter; +import org.apache.commons.io.filefilter.NameFileFilter; +import org.apache.commons.io.filefilter.SuffixFileFilter; +import org.apache.commons.io.filefilter.WildcardFileFilter; +import org.apache.commons.io.input.TeeInputStream; +import org.apache.commons.io.output.TeeOutputStream; +import org.junit.Assert; +import org.junit.Test; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FilterOutputStream; +import java.io.IOException; +import java.nio.charset.Charset; + +public class CommonsIOUnitTest { + + @Test + public void whenCopyANDReadFileTesttxt_thenMatchExpectedData() + throws IOException { + + String expectedData = "Hello World from fileTest.txt!!!"; + + File file = FileUtils.getFile(getClass().getClassLoader() + .getResource("fileTest.txt") + .getPath()); + File tempDir = FileUtils.getTempDirectory(); + FileUtils.copyFileToDirectory(file, tempDir); + File newTempFile = FileUtils.getFile(tempDir, file.getName()); + String data = FileUtils.readFileToString(newTempFile, + Charset.defaultCharset()); + + Assert.assertEquals(expectedData, data.trim()); + } + + @Test + public void whenUsingFileNameUtils_thenshowdifferentFileOperations() + throws IOException { + + String path = getClass().getClassLoader() + .getResource("fileTest.txt") + .getPath(); + + String fullPath = FilenameUtils.getFullPath(path); + String extension = FilenameUtils.getExtension(path); + String baseName = FilenameUtils.getBaseName(path); + + System.out.println("full path" + fullPath); + System.out.println("Extension" + extension); + System.out.println("Base name" + baseName); + } + + @Test + public void whenUsingFileSystemUtils_thenDriveFreeSpace() + throws IOException { + + long freeSpace = FileSystemUtils.freeSpaceKb("/"); + } + + @SuppressWarnings("resource") + @Test + public void whenUsingTeeInputOutputStream_thenWriteto2OutputStreams() + throws IOException { + + final String str = "Hello World."; + ByteArrayInputStream inputStream = new ByteArrayInputStream(str.getBytes()); + ByteArrayOutputStream outputStream1 = new ByteArrayOutputStream(); + ByteArrayOutputStream outputStream2 = new ByteArrayOutputStream(); + + FilterOutputStream teeOutputStream = new TeeOutputStream(outputStream1,outputStream2); + new TeeInputStream(inputStream, teeOutputStream, true).read(new byte[str.length()]); + + Assert.assertEquals(str, String.valueOf(outputStream1)); + Assert.assertEquals(str, String.valueOf(outputStream2)); + } + + @Test + public void whenGetFilewithNameFileFilter_thenFindfileTesttxt() + throws IOException { + + final String testFile = "fileTest.txt"; + + String path = getClass().getClassLoader() + .getResource(testFile) + .getPath(); + File dir = FileUtils.getFile(FilenameUtils.getFullPath(path)); + + String[] possibleNames = { "NotThisOne", testFile }; + + Assert.assertEquals(testFile, + dir.list(new NameFileFilter(possibleNames, IOCase.INSENSITIVE))[0]); + } + + @Test + public void whenGetFilewith_ANDFileFilter_thenFindsampletxt() + throws IOException { + + String path = getClass().getClassLoader() + .getResource("fileTest.txt") + .getPath(); + File dir = FileUtils.getFile(FilenameUtils.getFullPath(path)); + + Assert.assertEquals("sample.txt", + dir.list(new AndFileFilter( + new WildcardFileFilter("*ple*", IOCase.INSENSITIVE), + new SuffixFileFilter("txt")))[0]); + } + + @Test + public void whenSortDirWithPathFileComparator_thenFirstFileaaatxt() + throws IOException { + + PathFileComparator pathFileComparator = new PathFileComparator( + IOCase.INSENSITIVE); + String path = FilenameUtils.getFullPath(getClass().getClassLoader() + .getResource("fileTest.txt") + .getPath()); + File dir = new File(path); + File[] files = dir.listFiles(); + + pathFileComparator.sort(files); + + Assert.assertEquals("aaa.txt", files[0].getName()); + } + + @Test + public void whenSizeFileComparator_thenLargerFile() + throws IOException { + + SizeFileComparator sizeFileComparator = new SizeFileComparator(); + File largerFile = FileUtils.getFile(getClass().getClassLoader() + .getResource("fileTest.txt") + .getPath()); + File smallerFile = FileUtils.getFile(getClass().getClassLoader() + .getResource("sample.txt") + .getPath()); + + int i = sizeFileComparator.compare(largerFile, smallerFile); + + Assert.assertTrue(i > 0); + } +} \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/commons/lang3/Lang3UtilsTest.java b/libraries/src/test/java/com/baeldung/commons/lang3/Lang3UtilsTest.java new file mode 100644 index 0000000000..af70ccecc7 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/commons/lang3/Lang3UtilsTest.java @@ -0,0 +1,136 @@ +package com.baeldung.commons.lang3; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.File; +import java.lang.reflect.Field; +import java.util.Locale; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import org.apache.commons.lang3.ArchUtils; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.SystemUtils; +import org.apache.commons.lang3.arch.Processor; +import org.apache.commons.lang3.concurrent.ConcurrentException; +import org.apache.commons.lang3.concurrent.ConcurrentRuntimeException; +import org.apache.commons.lang3.concurrent.ConcurrentUtils; +import org.apache.commons.lang3.event.EventUtils; +import org.apache.commons.lang3.reflect.FieldUtils; +import org.apache.commons.lang3.time.FastDateFormat; +import org.junit.Assert; +import org.junit.Test; + +public class Lang3UtilsTest { + + @Test + public void test_to_Boolean_fromString() { + assertFalse(BooleanUtils.toBoolean("off")); + assertTrue(BooleanUtils.toBoolean("true")); + assertTrue(BooleanUtils.toBoolean("tRue")); + assertFalse(BooleanUtils.toBoolean("no")); + assertFalse(BooleanUtils.isTrue(Boolean.FALSE)); + assertFalse(BooleanUtils.isTrue(null)); + } + + @Test + public void testGetUserHome() { + final File dir = SystemUtils.getUserHome(); + Assert.assertNotNull(dir); + Assert.assertTrue(dir.exists()); + } + + @Test + public void testGetJavaHome() { + final File dir = SystemUtils.getJavaHome(); + Assert.assertNotNull(dir); + Assert.assertTrue(dir.exists()); + } + + @Test + public void testProcessorArchType() { + Processor processor = ArchUtils.getProcessor("x86"); + assertTrue(processor.is32Bit()); + assertFalse(processor.is64Bit()); + } + + @Test + public void testProcessorArchType64Bit() { + Processor processor = ArchUtils.getProcessor("x86_64"); + assertFalse(processor.is32Bit()); + assertTrue(processor.is64Bit()); + } + + @Test(expected = IllegalArgumentException.class) + public void testConcurrentRuntimeExceptionCauseError() { + new ConcurrentRuntimeException("An error", new Error()); + } + + @Test + public void testConstantFuture_Integer() throws Exception { + Future test = ConcurrentUtils.constantFuture(5); + assertTrue(test.isDone()); + assertSame(5, test.get()); + assertFalse(test.isCancelled()); + } + + @Test + public void testFieldUtilsGetAllFields() { + final Field[] fieldsNumber = Number.class.getDeclaredFields(); + assertArrayEquals(fieldsNumber, FieldUtils.getAllFields(Number.class)); + } + + @Test + public void test_getInstance_String_Locale() { + final FastDateFormat format1 = FastDateFormat.getInstance("MM/DD/yyyy", Locale.US); + final FastDateFormat format3 = FastDateFormat.getInstance("MM/DD/yyyy", Locale.GERMANY); + + assertNotSame(format1, format3); + } + + @Test + public void testAddEventListenerThrowsException() { + final ExceptionEventSource src = new ExceptionEventSource(); + try { + EventUtils.addEventListener(src, PropertyChangeListener.class, (PropertyChangeEvent e) -> { + /* Change event*/}); + fail("Add method should have thrown an exception, so method should fail."); + } catch (final RuntimeException e) { + + } + } + + @Test + public void ConcurrentExceptionSample() throws ConcurrentException { + final Error err = new AssertionError("Test"); + try { + ConcurrentUtils.handleCause(new ExecutionException(err)); + fail("Error not thrown!"); + } catch (final Error e) { + assertEquals("Wrong error", err, e); + } + } + + public static class ExceptionEventSource { + public void addPropertyChangeListener(final PropertyChangeListener listener) { + throw new RuntimeException(); + } + } + + @Test + public void testLazyInitializer() throws Exception { + SampleLazyInitializer sampleLazyInitializer = new SampleLazyInitializer(); + SampleObject sampleObjectOne = sampleLazyInitializer.get(); + SampleObject sampleObjectTwo = sampleLazyInitializer.get(); + assertEquals(sampleObjectOne, sampleObjectTwo); + } + +} diff --git a/libraries/src/test/java/com/baeldung/date/DateDiffUnitTest.java b/libraries/src/test/java/com/baeldung/date/DateDiffUnitTest.java new file mode 100644 index 0000000000..14d3f925f5 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/date/DateDiffUnitTest.java @@ -0,0 +1,71 @@ +package com.baeldung.date; + +import org.junit.Test; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.Duration; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; + +public class DateDiffUnitTest { + + @Test + public void givenTwoDatesBeforeJava8_whenDifferentiating_thenWeGetSix() throws ParseException { + SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH); + Date firstDate = sdf.parse("06/24/2017"); + Date secondDate = sdf.parse("06/30/2017"); + + long diffInMillies = Math.abs(secondDate.getTime() - firstDate.getTime()); + long diff = TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS); + + assertEquals(diff, 6); + } + + @Test + public void givenTwoDateTimesInJava8_whenDifferentiating_thenWeGetSix() { + LocalDateTime now = LocalDateTime.now(); + LocalDateTime sixMinutesBehind = now.minusMinutes(6); + + Duration duration = Duration.between(now, sixMinutesBehind); + long diff = Math.abs(duration.toMinutes()); + + assertEquals(diff, 6); + } + + @Test + public void givenTwoDatesInJodaTime_whenDifferentiating_thenWeGetSix() { + org.joda.time.LocalDate now = org.joda.time.LocalDate.now(); + org.joda.time.LocalDate sixDaysBehind = now.minusDays(6); + + org.joda.time.Period period = new org.joda.time.Period(now, sixDaysBehind); + long diff = Math.abs(period.getDays()); + + assertEquals(diff, 6); + } + + @Test + public void givenTwoDateTimesInJodaTime_whenDifferentiating_thenWeGetSix() { + org.joda.time.LocalDateTime now = org.joda.time.LocalDateTime.now(); + org.joda.time.LocalDateTime sixMinutesBehind = now.minusMinutes(6); + + org.joda.time.Period period = new org.joda.time.Period(now, sixMinutesBehind); + long diff = Math.abs(period.getDays()); + } + + @Test + public void givenTwoDatesInDate4j_whenDifferentiating_thenWeGetSix() { + hirondelle.date4j.DateTime now = hirondelle.date4j.DateTime.now(TimeZone.getDefault()); + hirondelle.date4j.DateTime sixDaysBehind = now.minusDays(6); + + long diff = Math.abs(now.numDaysFrom(sixDaysBehind)); + + assertEquals(diff, 6); + } +} \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/fj/FunctionalJavaTest.java b/libraries/src/test/java/com/baeldung/fj/FunctionalJavaTest.java new file mode 100644 index 0000000000..04ab6e43be --- /dev/null +++ b/libraries/src/test/java/com/baeldung/fj/FunctionalJavaTest.java @@ -0,0 +1,79 @@ +package com.baeldung.fj; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import fj.F; +import fj.data.Array; +import fj.data.List; +import fj.data.Option; +import fj.function.Characters; +import fj.function.Integers; + +public class FunctionalJavaTest { + + public static final F isEven = i -> i % 2 == 0; + + @Test + public void calculateEvenNumbers_givenIntList_returnTrue() { + List fList = List.list(3, 4, 5, 6); + List evenList = fList.map(isEven); + List evenListTrueResult = List.list(false, true, false, true); + List evenListFalseResult = List.list(true, false, false, true); + assertEquals(evenList.equals(evenListTrueResult), true); + assertEquals(evenList.equals(evenListFalseResult), false); + } + + @Test + public void mapList_givenIntList_returnResult() { + List fList = List.list(3, 4, 5, 6); + fList = fList.map(i -> i + 100); + List resultList = List.list(103, 104, 105, 106); + List falseResultList = List.list(15, 504, 105, 106); + assertEquals(fList.equals(resultList), true); + assertEquals(fList.equals(falseResultList), false); + } + + @Test + public void filterList_givenIntList_returnResult() { + Array array = Array.array(3, 4, 5, 6); + Array filteredArray = array.filter(Integers.even); + Array result = Array.array(4, 6); + Array wrongResult = Array.array(3, 5); + assertEquals(filteredArray.equals(result), true); + assertEquals(filteredArray.equals(wrongResult), false); + } + + @Test + public void checkForLowerCase_givenStringArray_returnResult() { + Array array = Array.array("Welcome", "To", "baeldung"); + Array array2 = Array.array("Welcome", "To", "Baeldung"); + Boolean isExist = array.exists(s -> List.fromString(s).forall(Characters.isLowerCase)); + Boolean isExist2 = array2.exists(s -> List.fromString(s).forall(Characters.isLowerCase)); + assertEquals(isExist, true); + assertEquals(isExist2, false); + } + + @Test + public void checkOptions_givenOptions_returnResult() { + Option n1 = Option.some(1); + Option n2 = Option.some(2); + + F> f1 = i -> i % 2 == 0 ? Option.some(i + 100) : Option.none(); + + Option result1 = n1.bind(f1); + Option result2 = n2.bind(f1); + + assertEquals(result1, Option.none()); + assertEquals(result2, Option.some(102)); + } + + @Test + public void foldLeft_givenArray_returnResult() { + Array intArray = Array.array(17, 44, 67, 2, 22, 80, 1, 27); + int sum = intArray.foldLeft(Integers.add, 0); + assertEquals(sum, 260); + } + +} diff --git a/libraries/src/test/java/com/baeldung/java/io/JavaDirectoryDeleteUnitTest.java b/libraries/src/test/java/com/baeldung/java/io/JavaDirectoryDeleteUnitTest.java new file mode 100644 index 0000000000..1cd390b873 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/java/io/JavaDirectoryDeleteUnitTest.java @@ -0,0 +1,141 @@ +package com.baeldung.java.io; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.springframework.util.FileSystemUtils; + +public class JavaDirectoryDeleteUnitTest { + private static Path TEMP_DIRECTORY; + private static final String DIRECTORY_NAME = "toBeDeleted"; + + private static final List ALL_LINES = Arrays.asList("This is line 1", "This is line 2", "This is line 3", "This is line 4", "This is line 5", "This is line 6"); + + @BeforeClass + public static void initializeTempDirectory() throws IOException { + TEMP_DIRECTORY = Files.createTempDirectory("tmpForJUnit"); + } + + @AfterClass + public static void cleanTempDirectory() throws IOException { + FileUtils.deleteDirectory(TEMP_DIRECTORY.toFile()); + } + + @Before + public void setupDirectory() throws IOException { + Path tempPathForEachTest = Files.createDirectory(TEMP_DIRECTORY.resolve(DIRECTORY_NAME)); + + // Create a directory structure + Files.write(tempPathForEachTest.resolve("file1.txt"), ALL_LINES.subList(0, 2)); + Files.write(tempPathForEachTest.resolve("file2.txt"), ALL_LINES.subList(2, 4)); + + Files.createDirectories(tempPathForEachTest.resolve("Empty")); + + Path aSubDir = Files.createDirectories(tempPathForEachTest.resolve("notEmpty")); + Files.write(aSubDir.resolve("file3.txt"), ALL_LINES.subList(3, 5)); + Files.write(aSubDir.resolve("file4.txt"), ALL_LINES.subList(0, 3)); + + aSubDir = Files.createDirectories(aSubDir.resolve("anotherSubDirectory")); + Files.write(aSubDir.resolve("file5.txt"), ALL_LINES.subList(4, 5)); + Files.write(aSubDir.resolve("file6.txt"), ALL_LINES.subList(0, 2)); + } + + @After + public void checkAndCleanupIfRequired() throws IOException { + Path pathToBeDeleted = TEMP_DIRECTORY.resolve(DIRECTORY_NAME); + if (Files.exists(pathToBeDeleted)) { + FileUtils.deleteDirectory(pathToBeDeleted.toFile()); + } + } + + private boolean deleteDirectory(File directoryToBeDeleted) { + File[] allContents = directoryToBeDeleted.listFiles(); + + if (allContents != null) { + for (File file : allContents) { + deleteDirectory(file); + } + } + + return directoryToBeDeleted.delete(); + } + + @Test + public void givenDirectory_whenDeletedWithRecursion_thenIsGone() throws IOException { + Path pathToBeDeleted = TEMP_DIRECTORY.resolve(DIRECTORY_NAME); + + boolean result = deleteDirectory(pathToBeDeleted.toFile()); + + assertTrue("Could not delete directory", result); + assertFalse("Directory still exists", Files.exists(pathToBeDeleted)); + } + + @Test + public void givenDirectory_whenDeletedWithCommonsIOFileUtils_thenIsGone() throws IOException { + Path pathToBeDeleted = TEMP_DIRECTORY.resolve(DIRECTORY_NAME); + + FileUtils.deleteDirectory(pathToBeDeleted.toFile()); + + assertFalse("Directory still exists", Files.exists(pathToBeDeleted)); + } + + @Test + public void givenDirectory_whenDeletedWithSpringFileSystemUtils_thenIsGone() throws IOException { + Path pathToBeDeleted = TEMP_DIRECTORY.resolve(DIRECTORY_NAME); + + boolean result = FileSystemUtils.deleteRecursively(pathToBeDeleted.toFile()); + + assertTrue("Could not delete directory", result); + assertFalse("Directory still exists", Files.exists(pathToBeDeleted)); + } + + @Test + public void givenDirectory_whenDeletedWithFilesWalk_thenIsGone() throws IOException { + Path pathToBeDeleted = TEMP_DIRECTORY.resolve(DIRECTORY_NAME); + + Files.walk(pathToBeDeleted) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + + assertFalse("Directory still exists", Files.exists(pathToBeDeleted)); + } + + @Test + public void givenDirectory_whenDeletedWithNIO2WalkFileTree_thenIsGone() throws IOException { + Path pathToBeDeleted = TEMP_DIRECTORY.resolve(DIRECTORY_NAME); + + Files.walkFileTree(pathToBeDeleted, new SimpleFileVisitor() { + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + Files.delete(dir); + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + Files.delete(file); + return FileVisitResult.CONTINUE; + } + }); + + assertFalse("Directory still exists", Files.exists(pathToBeDeleted)); + } +} diff --git a/libraries/src/test/java/com/baeldung/jcache/CacheLoaderTest.java b/libraries/src/test/java/com/baeldung/jcache/CacheLoaderTest.java new file mode 100644 index 0000000000..da4f51674f --- /dev/null +++ b/libraries/src/test/java/com/baeldung/jcache/CacheLoaderTest.java @@ -0,0 +1,44 @@ +package com.baeldung.jcache; + +import static org.junit.Assert.assertEquals; + +import javax.cache.Cache; +import javax.cache.CacheManager; +import javax.cache.Caching; +import javax.cache.configuration.FactoryBuilder; +import javax.cache.configuration.MutableConfiguration; +import javax.cache.spi.CachingProvider; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CacheLoaderTest { + + private static final String CACHE_NAME = "SimpleCache"; + + private Cache cache; + + @Before + public void setup() { + CachingProvider cachingProvider = Caching.getCachingProvider(); + CacheManager cacheManager = cachingProvider.getCacheManager(); + MutableConfiguration config = new MutableConfiguration().setReadThrough(true) + .setCacheLoaderFactory(new FactoryBuilder.SingletonFactory<>(new SimpleCacheLoader())); + this.cache = cacheManager.createCache("SimpleCache", config); + } + + @After + public void tearDown() { + Caching.getCachingProvider() + .getCacheManager().destroyCache(CACHE_NAME); + } + + @Test + public void whenReadingFromStorage_thenCorrect() { + for (int i = 1; i < 4; i++) { + String value = cache.get(i); + assertEquals("fromCache" + i, value); + } + } +} \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/jcache/EntryProcessorTest.java b/libraries/src/test/java/com/baeldung/jcache/EntryProcessorTest.java new file mode 100644 index 0000000000..eb40e63ef0 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/jcache/EntryProcessorTest.java @@ -0,0 +1,41 @@ +package com.baeldung.jcache; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import javax.cache.Cache; +import javax.cache.CacheManager; +import javax.cache.Caching; +import javax.cache.configuration.MutableConfiguration; +import javax.cache.spi.CachingProvider; + +import static org.junit.Assert.assertEquals; + +public class EntryProcessorTest { + + private static final String CACHE_NAME = "MyCache"; + + private Cache cache; + + @Before + public void instantiateCache() { + CachingProvider cachingProvider = Caching.getCachingProvider(); + CacheManager cacheManager = cachingProvider.getCacheManager(); + MutableConfiguration config = new MutableConfiguration<>(); + this.cache = cacheManager.createCache(CACHE_NAME, config); + this.cache.put("key", "value"); + } + + @After + public void tearDown() { + Caching.getCachingProvider() + .getCacheManager().destroyCache(CACHE_NAME); + } + + @Test + public void whenModifyValue_thenCorrect() { + this.cache.invoke("key", new SimpleEntryProcessor()); + assertEquals("value - modified", cache.get("key")); + } +} \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/jcache/EventListenerTest.java b/libraries/src/test/java/com/baeldung/jcache/EventListenerTest.java new file mode 100644 index 0000000000..be83e572d8 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/jcache/EventListenerTest.java @@ -0,0 +1,56 @@ +package com.baeldung.jcache; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import javax.cache.Cache; +import javax.cache.CacheManager; +import javax.cache.Caching; +import javax.cache.configuration.FactoryBuilder; +import javax.cache.configuration.MutableCacheEntryListenerConfiguration; +import javax.cache.configuration.MutableConfiguration; +import javax.cache.spi.CachingProvider; + +import static org.junit.Assert.assertEquals; + +public class EventListenerTest { + + private static final String CACHE_NAME = "MyCache"; + + private Cache cache; + private SimpleCacheEntryListener listener; + private MutableCacheEntryListenerConfiguration listenerConfiguration; + + @Before + public void setup() { + CachingProvider cachingProvider = Caching.getCachingProvider(); + CacheManager cacheManager = cachingProvider.getCacheManager(); + MutableConfiguration config = new MutableConfiguration(); + this.cache = cacheManager.createCache("MyCache", config); + this.listener = new SimpleCacheEntryListener(); + } + + @After + public void tearDown() { + Caching.getCachingProvider() + .getCacheManager().destroyCache(CACHE_NAME); + } + + @Test + public void whenRunEvent_thenCorrect() throws InterruptedException { + this.listenerConfiguration = new MutableCacheEntryListenerConfiguration<>(FactoryBuilder + .factoryOf(this.listener), null, false, true); + this.cache.registerCacheEntryListener(this.listenerConfiguration); + + assertEquals(false, this.listener.getCreated()); + + this.cache.put("key", "value"); + assertEquals(true, this.listener.getCreated()); + assertEquals(false, this.listener.getUpdated()); + + this.cache.put("key", "newValue"); + assertEquals(true, this.listener.getUpdated()); + } + +} \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/jcache/JCacheTest.java b/libraries/src/test/java/com/baeldung/jcache/JCacheTest.java new file mode 100644 index 0000000000..c98539a9ec --- /dev/null +++ b/libraries/src/test/java/com/baeldung/jcache/JCacheTest.java @@ -0,0 +1,27 @@ +package com.baeldung.jcache; + +import org.junit.Test; + +import javax.cache.Cache; +import javax.cache.CacheManager; +import javax.cache.Caching; +import javax.cache.configuration.MutableConfiguration; +import javax.cache.spi.CachingProvider; + +import static org.junit.Assert.assertEquals; + +public class JCacheTest { + + @Test + public void instantiateCache() { + CachingProvider cachingProvider = Caching.getCachingProvider(); + CacheManager cacheManager = cachingProvider.getCacheManager(); + MutableConfiguration config = new MutableConfiguration<>(); + Cache cache = cacheManager.createCache("simpleCache", config); + cache.put("key1", "value1"); + cache.put("key2", "value2"); + assertEquals("value1", cache.get("key1")); + assertEquals("value2", cache.get("key2")); + cacheManager.close(); + } +} \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/jdeffered/AppTest.java b/libraries/src/test/java/com/baeldung/jdeffered/AppTest.java new file mode 100644 index 0000000000..97b20cda57 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/jdeffered/AppTest.java @@ -0,0 +1,26 @@ +package com.baeldung.jdeffered; + +import com.baeldung.jdeffered.PipeDemo.Result; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class AppTest { + + @Test + public void givenJob_expectPromise() { + PromiseDemo.startJob("Baeldung Job"); + } + + @Test + public void givenMsg_expectModifiedMsg() { + String msg = FilterDemo.filter("Baeldung"); + assertEquals("Hello Baeldung", msg); + } + + @Test + public void givenNum_validateNum_expectStatus() { + Result result = PipeDemo.validate(80); + assertEquals(result, Result.SUCCESS); + } +} diff --git a/libraries/src/test/java/com/baeldung/mbassador/MBassadorAsyncDispatchTest.java b/libraries/src/test/java/com/baeldung/mbassador/MBassadorAsyncDispatchTest.java new file mode 100644 index 0000000000..0cab612a7b --- /dev/null +++ b/libraries/src/test/java/com/baeldung/mbassador/MBassadorAsyncDispatchTest.java @@ -0,0 +1,37 @@ +package com.baeldung.mbassador; + +import net.engio.mbassy.bus.MBassador; +import net.engio.mbassy.listener.Handler; +import org.junit.Before; +import org.junit.Test; + +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.awaitility.Awaitility.await; +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertNotNull; + +public class MBassadorAsyncDispatchTest { + + private MBassador dispatcher = new MBassador(); + private String testString; + private AtomicBoolean ready = new AtomicBoolean(false); + + @Before + public void prepareTests() { + dispatcher.subscribe(this); + } + + @Test + public void whenAsyncDispatched_thenMessageReceived() { + dispatcher.post("foobar").asynchronously(); + await().untilAtomic(ready, equalTo(true)); + assertNotNull(testString); + } + + @Handler + public void handleStringMessage(String message) { + this.testString = message; + ready.set(true); + } +} diff --git a/libraries/src/test/java/com/baeldung/mbassador/MBassadorAsyncInvocationTest.java b/libraries/src/test/java/com/baeldung/mbassador/MBassadorAsyncInvocationTest.java new file mode 100644 index 0000000000..d0b1cafd71 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/mbassador/MBassadorAsyncInvocationTest.java @@ -0,0 +1,47 @@ +package com.baeldung.mbassador; + +import net.engio.mbassy.bus.MBassador; +import net.engio.mbassy.listener.Handler; +import net.engio.mbassy.listener.Invoke; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.awaitility.Awaitility.await; +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertFalse; + +public class MBassadorAsyncInvocationTest { + + private MBassador dispatcher = new MBassador(); + + private Integer testInteger; + private String invocationThreadName; + private AtomicBoolean ready = new AtomicBoolean(false); + + @Before + public void prepareTests() { + dispatcher.subscribe(this); + } + + @Test + public void whenHandlerAsync_thenHandled() { + + dispatcher.post(42).now(); + + await().untilAtomic(ready, equalTo(true)); + assertNotNull(testInteger); + assertFalse(Thread.currentThread().getName().equals(invocationThreadName)); + } + + @Handler(delivery = Invoke.Asynchronously) + public void handleIntegerMessage(Integer message) { + this.invocationThreadName = Thread.currentThread().getName(); + this.testInteger = message; + ready.set(true); + } +} diff --git a/libraries/src/test/java/com/baeldung/mbassador/MBassadorBasicTest.java b/libraries/src/test/java/com/baeldung/mbassador/MBassadorBasicTest.java new file mode 100644 index 0000000000..04f6272412 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/mbassador/MBassadorBasicTest.java @@ -0,0 +1,69 @@ +package com.baeldung.mbassador; + +import net.engio.mbassy.bus.MBassador; +import net.engio.mbassy.bus.common.DeadMessage; +import net.engio.mbassy.listener.Handler; +import org.junit.Before; +import org.junit.Test; + +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class MBassadorBasicTest { + + private MBassador dispatcher = new MBassador(); + + private String messageString; + private Integer messageInteger; + private Object deadEvent; + + @Before + public void prepareTests() { + dispatcher.subscribe(this); + } + + @Test + public void whenStringDispatched_thenHandleString() { + dispatcher.post("TestString").now(); + assertNotNull(messageString); + assertEquals("TestString", messageString); + } + + @Test + public void whenIntegerDispatched_thenHandleInteger() { + dispatcher.post(42).now(); + assertNull(messageString); + assertNotNull(messageInteger); + assertTrue(42 == messageInteger); + } + + @Test + public void whenLongDispatched_thenDeadEvent() { + dispatcher.post(42L).now(); + assertNull(messageString); + assertNull(messageInteger); + assertNotNull(deadEvent); + assertTrue(deadEvent instanceof Long); + assertTrue(42L == (Long) deadEvent); + } + + @Handler + public void handleString(String message) { + messageString = message; + } + + @Handler + public void handleInteger(Integer message) { + messageInteger = message; + } + + @Handler + public void handleDeadEvent(DeadMessage message) { + + deadEvent = message.getMessage(); + + } + +} diff --git a/libraries/src/test/java/com/baeldung/mbassador/MBassadorConfigurationTest.java b/libraries/src/test/java/com/baeldung/mbassador/MBassadorConfigurationTest.java new file mode 100644 index 0000000000..fe9c130d93 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/mbassador/MBassadorConfigurationTest.java @@ -0,0 +1,91 @@ +package com.baeldung.mbassador; + +import net.engio.mbassy.bus.MBassador; +import net.engio.mbassy.bus.error.IPublicationErrorHandler; +import net.engio.mbassy.bus.error.PublicationError; +import net.engio.mbassy.listener.Handler; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.*; + +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.*; + +public class MBassadorConfigurationTest implements IPublicationErrorHandler { + + private MBassador dispatcher; + private String messageString; + private Throwable errorCause; + + private LinkedList list = new LinkedList<>(); + + @Before + public void prepareTests() { + + dispatcher = new MBassador(this); + dispatcher.subscribe(this); + } + + @Test + public void whenErrorOccurs_thenErrorHandler() { + dispatcher.post("Error").now(); + assertNull(messageString); + assertNotNull(errorCause); + } + + @Test + public void whenNoErrorOccurs_thenStringHandler() { + dispatcher.post("Errol").now(); + assertNull(errorCause); + assertNotNull(messageString); + } + + @Test + public void whenRejectDispatched_thenPriorityHandled() { + dispatcher.post(new RejectMessage()).now(); + + // Items should pop() off in reverse priority order + assertTrue(1 == list.pop()); + assertTrue(3 == list.pop()); + assertTrue(5 == list.pop()); + } + + @Handler + public void handleString(String message) { + + if ("Error".equals(message)) { + throw new Error("BOOM"); + } + + messageString = message; + + } + + @Override + public void handleError(PublicationError error) { + errorCause = error.getCause().getCause(); + } + + @Handler(priority = 5) + public void handleRejectMessage5(RejectMessage rejectMessage) { + list.push(5); + } + + @Handler(priority = 3) + public void handleRejectMessage3(RejectMessage rejectMessage) { + list.push(3); + } + + @Handler(priority = 2, rejectSubtypes = true) + public void handleMessage(Message rejectMessage) { + list.push(3); + } + + @Handler(priority = 0) + public void handleRejectMessage0(RejectMessage rejectMessage) { + list.push(1); + } +} diff --git a/libraries/src/test/java/com/baeldung/mbassador/MBassadorFilterTest.java b/libraries/src/test/java/com/baeldung/mbassador/MBassadorFilterTest.java new file mode 100644 index 0000000000..e90ae15d3d --- /dev/null +++ b/libraries/src/test/java/com/baeldung/mbassador/MBassadorFilterTest.java @@ -0,0 +1,103 @@ +package com.baeldung.mbassador; + +import net.engio.mbassy.bus.MBassador; +import net.engio.mbassy.bus.common.DeadMessage; +import net.engio.mbassy.bus.common.FilteredMessage; +import net.engio.mbassy.listener.Filter; +import net.engio.mbassy.listener.Filters; +import net.engio.mbassy.listener.Handler; +import org.junit.Before; +import org.junit.Test; + +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +public class MBassadorFilterTest { + + private MBassador dispatcher = new MBassador(); + + private Message baseMessage; + private Message subMessage; + private String testString; + private FilteredMessage filteredMessage; + private RejectMessage rejectMessage; + private DeadMessage deadMessage; + + @Before + public void prepareTests() { + dispatcher.subscribe(this); + } + + @Test + public void whenMessageDispatched_thenMessageFiltered() { + dispatcher.post(new Message()).now(); + assertNotNull(baseMessage); + assertNull(subMessage); + } + + @Test + public void whenRejectDispatched_thenRejectFiltered() { + dispatcher.post(new RejectMessage()).now(); + assertNotNull(subMessage); + assertNull(baseMessage); + } + + @Test + public void whenShortStringDispatched_thenStringHandled() { + dispatcher.post("foobar").now(); + assertNotNull(testString); + } + + @Test + public void whenLongStringDispatched_thenStringFiltered() { + dispatcher.post("foobar!").now(); + assertNull(testString); + // filtered only populated when messages does not pass any filters + assertNotNull(filteredMessage); + assertTrue(filteredMessage.getMessage() instanceof String); + assertNull(deadMessage); + } + + @Test + public void whenWrongRejectDispatched_thenRejectFiltered() { + RejectMessage testReject = new RejectMessage(); + testReject.setCode(-1); + dispatcher.post(testReject).now(); + assertNull(rejectMessage); + assertNotNull(subMessage); + assertEquals(-1, ((RejectMessage) subMessage).getCode()); + } + + @Handler(filters = { @Filter(Filters.RejectSubtypes.class) }) + public void handleBaseMessage(Message message) { + this.baseMessage = message; + } + + @Handler(filters = { @Filter(Filters.SubtypesOnly.class) }) + public void handleSubMessage(Message message) { + this.subMessage = message; + } + + @Handler(condition = "msg.length() < 7") + public void handleStringMessage(String message) { + this.testString = message; + } + + @Handler(condition = "msg.getCode() != -1") + public void handleRejectMessage(RejectMessage rejectMessage) { + this.rejectMessage = rejectMessage; + } + + @Handler + public void handleFilterMessage(FilteredMessage message) { + this.filteredMessage = message; + } + + @Handler + public void handleDeadMessage(DeadMessage deadMessage) { + this.deadMessage = deadMessage; + } + +} diff --git a/libraries/src/test/java/com/baeldung/mbassador/MBassadorHierarchyTest.java b/libraries/src/test/java/com/baeldung/mbassador/MBassadorHierarchyTest.java new file mode 100644 index 0000000000..be5c9d4897 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/mbassador/MBassadorHierarchyTest.java @@ -0,0 +1,61 @@ +package com.baeldung.mbassador; + +import net.engio.mbassy.bus.MBassador; +import net.engio.mbassy.listener.Handler; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class MBassadorHierarchyTest { + + private MBassador dispatcher = new MBassador(); + + private Message message; + private AckMessage ackMessage; + private RejectMessage rejectMessage; + + @Before + public void prepareTests() { + dispatcher.subscribe(this); + } + + @Test + public void whenMessageDispatched_thenMessageHandled() { + dispatcher.post(new Message()).now(); + assertNotNull(message); + assertNull(ackMessage); + assertNull(rejectMessage); + } + + @Test + public void whenRejectDispatched_thenMessageAndRejectHandled() { + dispatcher.post(new RejectMessage()).now(); + assertNotNull(message); + assertNotNull(rejectMessage); + assertNull(ackMessage); + } + + @Test + public void whenAckDispatched_thenMessageAndAckHandled() { + dispatcher.post(new AckMessage()).now(); + assertNotNull(message); + assertNotNull(ackMessage); + assertNull(rejectMessage); + } + + @Handler + public void handleMessage(Message message) { + this.message = message; + } + + @Handler + public void handleRejectMessage(RejectMessage message) { + rejectMessage = message; + } + + @Handler + public void handleAckMessage(AckMessage message) { + ackMessage = message; + } +} diff --git a/libraries/src/test/java/com/baeldung/measurement/WaterTankTests.java b/libraries/src/test/java/com/baeldung/measurement/WaterTankTests.java new file mode 100644 index 0000000000..b023ffe8d9 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/measurement/WaterTankTests.java @@ -0,0 +1,86 @@ +package com.baeldung.measurement; + +import javax.measure.Quantity; +import javax.measure.quantity.Area; +import javax.measure.quantity.Length; +import javax.measure.quantity.Pressure; +import javax.measure.quantity.Volume; + +import javax.measure.Unit; +import javax.measure.UnitConverter; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +import com.baeldung.measurement.WaterTank; + +import tec.units.ri.format.SimpleUnitFormat; +import tec.units.ri.quantity.Quantities; +import tec.units.ri.unit.MetricPrefix; +import static tec.units.ri.unit.Units.*; + +public class WaterTankTests { + + @Test + public void givenQuantity_whenGetUnitAndConvertValue_thenSuccess() { + WaterTank waterTank = new WaterTank(); + waterTank.setCapacityMeasure(Quantities.getQuantity(9.2, LITRE)); + assertEquals(LITRE, waterTank.getCapacityMeasure().getUnit()); + + Quantity waterCapacity = waterTank.getCapacityMeasure(); + double volumeInLitre = waterCapacity.getValue().doubleValue(); + assertEquals(9.2, volumeInLitre, 0.0f); + + double volumeInMilliLitre = waterCapacity.to(MetricPrefix.MILLI(LITRE)).getValue().doubleValue(); + assertEquals(9200.0, volumeInMilliLitre, 0.0f); + + // compilation error + // volumeInMilliLitre = waterCapacity.to(MetricPrefix.MILLI(KILOGRAM)); + + Unit Kilometer = MetricPrefix.KILO(METRE); + + // compilation error + // Unit Centimeter = MetricPrefix.CENTI(LITRE); + } + + @Test + public void givenUnit_whenAlternateUnit_ThenGetAlternateUnit() { + + Unit PASCAL = NEWTON.divide(METRE.pow(2)).alternate("Pa").asType(Pressure.class); + assertTrue(SimpleUnitFormat.getInstance().parse("Pa").equals(PASCAL)); + } + + @Test + public void givenUnit_whenProduct_ThenGetProductUnit() { + Unit squareMetre = METRE.multiply(METRE).asType(Area.class); + Quantity line = Quantities.getQuantity(2, METRE); + assertEquals(line.multiply(line).getUnit(), squareMetre); + } + + @Test + public void givenMeters_whenConvertToKilometer_ThenConverted() { + double distanceInMeters = 50.0; + UnitConverter metreToKilometre = METRE.getConverterTo(MetricPrefix.KILO(METRE)); + double distanceInKilometers = metreToKilometre.convert(distanceInMeters); + assertEquals(0.05, distanceInKilometers, 0.00f); + } + + @Test + public void givenSymbol_WhenCompareToSystemUnit_ThenSuccess() { + assertTrue(SimpleUnitFormat.getInstance().parse("kW").equals(MetricPrefix.KILO(WATT))); + assertTrue(SimpleUnitFormat.getInstance().parse("ms").equals(SECOND.divide(1000))); + } + + @Test + public void givenUnits_WhenAdd_ThenSuccess() { + Quantity total = Quantities.getQuantity(2, METRE).add(Quantities.getQuantity(3, METRE)); + assertEquals(total.getValue().intValue(), 5); + + // compilation error + // Quantity total = Quantities.getQuantity(2, METRE).add(Quantities.getQuantity(3, LITRE)); + + Quantity totalKm = Quantities.getQuantity(2, METRE).add(Quantities.getQuantity(3, MetricPrefix.KILO(METRE))); + assertEquals(totalKm.getValue().intValue(), 3002); + } +} diff --git a/libraries/src/test/java/com/baeldung/pairs/ApacheCommonsPairUnitTest.java b/libraries/src/test/java/com/baeldung/pairs/ApacheCommonsPairUnitTest.java new file mode 100644 index 0000000000..0e6242b8a3 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/pairs/ApacheCommonsPairUnitTest.java @@ -0,0 +1,50 @@ +package com.baeldung.pairs; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.MutablePair; +import org.junit.Assert; +import org.junit.Test; + +public class ApacheCommonsPairUnitTest { + + @Test + public void givenMutablePair_whenGetValue_shouldPass() { + int key = 5; + String value = "Five"; + + MutablePair mutablePair = new MutablePair<>(key, value); + Assert.assertTrue(mutablePair.getKey() == key); + Assert.assertEquals(mutablePair.getValue(), value); + } + + @Test + public void givenMutablePair_whenSetValue_shouldPass() { + int key = 6; + String value = "Six"; + String newValue = "New Six"; + + MutablePair mutablePair = new MutablePair<>(key, value); + Assert.assertTrue(mutablePair.getKey() == key); + Assert.assertEquals(mutablePair.getValue(), value); + mutablePair.setValue(newValue); + Assert.assertEquals(mutablePair.getValue(), newValue); + } + + @Test + public void givenImmutablePair_whenGetValue_shouldPass() { + int key = 2; + String value = "Two"; + + ImmutablePair immutablePair = new ImmutablePair<>(key, value); + Assert.assertTrue(immutablePair.getKey() == key); + Assert.assertEquals(immutablePair.getValue(), value); + } + + @Test(expected = UnsupportedOperationException.class) + public void givenImmutablePair_whenSetValue_shouldFail() { + ImmutablePair immutablePair = new ImmutablePair<>(1, "One"); + immutablePair.setValue("Another One"); + } + + +} diff --git a/libraries/src/test/java/com/baeldung/pairs/CoreJavaPairUnitTest.java b/libraries/src/test/java/com/baeldung/pairs/CoreJavaPairUnitTest.java new file mode 100644 index 0000000000..ac258b9c77 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/pairs/CoreJavaPairUnitTest.java @@ -0,0 +1,17 @@ +package com.baeldung.pairs; + +import javafx.util.Pair; +import org.junit.Assert; +import org.junit.Test; + +public class CoreJavaPairUnitTest { + @Test + public void givenPair_whenGetValue_shouldSucceed() { + String key = "Good Day"; + boolean value = true; + Pair pair = new Pair<>(key, value); + + Assert.assertEquals(key, pair.getKey()); + Assert.assertEquals(value, pair.getValue()); + } +} \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/pairs/CoreJavaSimpleEntryUnitTest.java b/libraries/src/test/java/com/baeldung/pairs/CoreJavaSimpleEntryUnitTest.java new file mode 100644 index 0000000000..ca425339fa --- /dev/null +++ b/libraries/src/test/java/com/baeldung/pairs/CoreJavaSimpleEntryUnitTest.java @@ -0,0 +1,39 @@ +package com.baeldung.pairs; + +import static org.junit.Assert.*; + +import java.util.AbstractMap; + +import org.junit.Test; + +public class CoreJavaSimpleEntryUnitTest { + + @Test + public void givenSimpleEntry_whenGetValue_thenOk() { + AbstractMap.SimpleEntry entry = new AbstractMap.SimpleEntry(1, "one"); + Integer key = entry.getKey(); + String value = entry.getValue(); + + assertEquals(key.intValue(), 1); + assertEquals(value, "one"); + } + + @Test(expected = UnsupportedOperationException.class) + public void givenSimpleImmutableEntry_whenSetValue_thenException() { + AbstractMap.SimpleImmutableEntry entry = new AbstractMap.SimpleImmutableEntry(1, "one"); + + entry.setValue("two"); + + } + + @Test + public void givenSimpleImmutableEntry_whenGetValue_thenOk() { + AbstractMap.SimpleImmutableEntry entry = new AbstractMap.SimpleImmutableEntry(1, "one"); + Integer key = entry.getKey(); + String value = entry.getValue(); + + assertEquals(key.intValue(), 1); + assertEquals(value, "one"); + } + +} diff --git a/libraries/src/test/java/com/baeldung/pairs/VavrPairsUnitTest.java b/libraries/src/test/java/com/baeldung/pairs/VavrPairsUnitTest.java new file mode 100644 index 0000000000..9c318c7744 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/pairs/VavrPairsUnitTest.java @@ -0,0 +1,29 @@ +package com.baeldung.pairs; + +import io.vavr.Tuple2; +import org.junit.Assert; +import org.junit.Test; + +public class VavrPairsUnitTest { + @Test + public void givenTuple_whenSetValue_shouldSucceed() { + String key = "Eleven"; + double value = 11.0; + double newValue = 11.1; + + Tuple2 pair = new Tuple2<>(key, value); + + pair = pair.update2(newValue); + Assert.assertTrue(newValue == pair._2()); + } + + @Test + public void givenPair_whenGetValue_shouldSucceed() { + String key = "Twelve"; + double value = 12.0; + + Tuple2 pair = new Tuple2<>(key, value); + + Assert.assertTrue(value == pair._2()); + } +} \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/protonpack/CollectorUtilsTests.java b/libraries/src/test/java/com/baeldung/protonpack/CollectorUtilsTests.java new file mode 100644 index 0000000000..cf6a1e5ec5 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/protonpack/CollectorUtilsTests.java @@ -0,0 +1,66 @@ +package com.baeldung.protonpack; + +import com.codepoetics.protonpack.collectors.CollectorUtils; +import com.codepoetics.protonpack.collectors.NonUniqueValueException; +import org.junit.Test; + +import java.util.Optional; +import java.util.stream.Stream; + +import static com.codepoetics.protonpack.collectors.CollectorUtils.maxBy; +import static com.codepoetics.protonpack.collectors.CollectorUtils.minBy; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +public class CollectorUtilsTests { + + @Test + public void givenIntegerStream_whenCollectOnMaxByProjection_shouldReturnOptionalMaxValue() { + Stream integerStream = Stream.of("a", "bb", "ccc", "1"); + + Optional max = integerStream.collect(maxBy(String::length)); + + assertThat(max.get(), is("ccc")); + } + + @Test + public void givenIntegerStream_whenCollectOnMinByProjection_shouldReturnOptionalMinValue() { + Stream integerStream = Stream.of("abc", "bb", "ccc", "1"); + + Optional max = integerStream.collect(minBy(String::length)); + + assertThat(max.get(), is("1")); + } + + @Test + public void givenEmptyStream_withCollectorUnique_shouldReturnEmpty() { + assertThat(Stream + .empty() + .collect(CollectorUtils.unique()), equalTo(Optional.empty())); + } + + @Test + public void givenIntegerStream_withCollectorUnique_shouldReturnUniqueValue() { + assertThat(Stream + .of(1, 2, 3) + .filter(i -> i > 2) + .collect(CollectorUtils.unique()), equalTo(Optional.of(3))); + } + + @Test + public void givenIntegerStream_withUniqueNullable_shouldReturnUniqueValue() { + assertThat(Stream + .of(1, 2, 3) + .filter(i -> i > 2) + .collect(CollectorUtils.uniqueNullable()), equalTo(3)); + } + + @Test(expected = NonUniqueValueException.class) + public void givenIntegerStream_withCollectorUnique_shouldThrowNonUniqueValueException() { + Stream + .of(1, 2, 3) + .filter(i -> i > 1) + .collect(CollectorUtils.unique()); + } +} diff --git a/libraries/src/test/java/com/baeldung/protonpack/StreamUtilsTests.java b/libraries/src/test/java/com/baeldung/protonpack/StreamUtilsTests.java new file mode 100644 index 0000000000..37ca71287f --- /dev/null +++ b/libraries/src/test/java/com/baeldung/protonpack/StreamUtilsTests.java @@ -0,0 +1,202 @@ +package com.baeldung.protonpack; + +import com.codepoetics.protonpack.Indexed; +import com.codepoetics.protonpack.StreamUtils; +import com.codepoetics.protonpack.selectors.Selectors; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.LongStream; +import java.util.stream.Stream; + +import static java.util.Arrays.asList; +import static java.util.stream.Collectors.maxBy; +import static java.util.stream.Collectors.toList; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; + +public class StreamUtilsTests { + + @Test + public void givenStream_whenZipWithIndex_shouldReturnZippedStreamWithIndex() { + Stream source = Stream.of("Foo", "Bar", "Baz"); + + List> zipped = StreamUtils + .zipWithIndex(source) + .collect(Collectors.toList()); + + assertThat(zipped, contains(Indexed.index(0, "Foo"), Indexed.index(1, "Bar"), Indexed.index(2, "Baz"))); + } + + @Test + public void givenTwoStreams_whenZip_shouldReturnZippedStream() { + Stream streamA = Stream.of("A", "B", "C"); + Stream streamB = Stream.of("Apple", "Banana", "Carrot"); + + List zipped = StreamUtils + .zip(streamA, streamB, (a, b) -> a + " is for " + b) + .collect(Collectors.toList()); + + assertThat(zipped, contains("A is for Apple", "B is for Banana", "C is for Carrot")); + } + + @Test + public void givenThreeStreams_whenZip_shouldReturnZippedStream() { + Stream streamA = Stream.of("A", "B", "C"); + Stream streamB = Stream.of("aggravating", "banausic", "complaisant"); + Stream streamC = Stream.of("Apple", "Banana", "Carrot"); + + List zipped = StreamUtils + .zip(streamA, streamB, streamC, (a, b, c) -> a + " is for " + b + " " + c) + .collect(Collectors.toList()); + + assertThat(zipped, contains("A is for aggravating Apple", "B is for banausic Banana", "C is for complaisant Carrot")); + } + + @Test + //givenThreeStreams_whenMerge_shouldReturnMergedStream + public void givenThreeStreams_whenMerge_shouldReturnMergedStream() { + Stream streamA = Stream.of("A", "B", "C"); + Stream streamB = Stream.of("apple", "banana", "carrot", "date"); + Stream streamC = Stream.of("fritter", "split", "cake", "roll", "pastry"); + + Stream> merged = StreamUtils.mergeToList(streamA, streamB, streamC); + + assertThat(merged.collect(toList()), contains(asList("A", "apple", "fritter"), asList("B", "banana", "split"), asList("C", "carrot", "cake"), asList("date", "roll"), asList("pastry"))); + } + + @Test + //givenThreeStreams_whenInterleave_shouldReturnRoundRobinInterleavingStream + public void givenThreeStreams_whenInterleave_shouldReturnRoundRobinInterleavingStream() { + Stream streamA = Stream.of("Peter", "Paul", "Mary"); + Stream streamB = Stream.of("A", "B", "C", "D", "E"); + Stream streamC = Stream.of("foo", "bar", "baz", "xyzzy"); + + Stream interleaved = StreamUtils.interleave(Selectors.roundRobin(), streamA, streamB, streamC); + + assertThat(interleaved.collect(Collectors.toList()), contains("Peter", "A", "foo", "Paul", "B", "bar", "Mary", "C", "baz", "D", "xyzzy", "E")); + } + + @Test + //givenInfiniteStream_whenTakeWhile10_shouldReturnStreamOfSize10 + public void givenInfiniteStream_whenTakeWhile10_shouldReturnStream() { + Stream infiniteInts = Stream.iterate(0, i -> i + 1); + Stream finiteInts = StreamUtils.takeWhile(infiniteInts, i -> i < 10); + + assertThat(finiteInts.collect(Collectors.toList()), hasSize(10)); + } + + @Test + public void givenInfiniteStream_whenTakeUntil10_shouldReturnStreamUpto10() { + Stream infiniteInts = Stream.iterate(0, i -> i + 1); + Stream finiteInts = StreamUtils.takeUntil(infiniteInts, i -> i > 10); + + assertThat(finiteInts.collect(Collectors.toList()), hasSize(11)); + } + + @Test + public void givenIntegerStreamOfTen_whenSkipWhileLessThanFour_shouldReturnStreamFromFourToTen() { + Stream ints = Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + Stream skipped = StreamUtils.skipWhile(ints, i -> i < 4); + List collected = skipped.collect(Collectors.toList()); + + assertThat(collected, contains(4, 5, 6, 7, 8, 9, 10)); + } + + @Test + public void givenIntegerStreamOfTen_whenSkipUntilFour_shouldReturnStreamFromFiveToTen() { + Stream ints = Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + Stream skipped = StreamUtils.skipUntil(ints, i -> i > 4); + List collected = skipped.collect(Collectors.toList()); + + assertThat(collected, contains(5, 6, 7, 8, 9, 10)); + } + + @Test + public void givenSeedValue_withUnfold_shouldReturnStreamAccordingToGeneratorMethod() { + Stream unfolded = StreamUtils.unfold(1, i -> (i < 10) ? Optional.of(i + 1) : Optional.empty()); + + assertThat(unfolded.collect(Collectors.toList()), contains(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); + } + + @Test + public void giveIntegerStream_whenGroupRuns_shouldReturnListGroupItems() { + Stream integerStream = Stream.of(1, 1, 2, 2, 3, 4, 5); + List> runs = StreamUtils + .groupRuns(integerStream) + .collect(toList()); + + assertThat(runs, contains(asList(1, 1), asList(2, 2), asList(3), asList(4), asList(5))); + } + + @Test + public void givenAStream_whenAggregate_shouldReturnAggregatedStreamOnTheBasisOfBiFunction() { + Stream stream = Stream.of("a1", "b1", "b2", "c1"); + Stream> aggregated = StreamUtils.aggregate(stream, (e1, e2) -> e1.charAt(0) == e2.charAt(0)); + assertThat(aggregated.collect(toList()), contains(asList("a1"), asList("b1", "b2"), asList("c1"))); + } + + @Test + public void givenIntegerStream_whenWindowed_shouldReturnListOfListOfItemsOfWindowSize() { + Stream integerStream = Stream.of(1, 2, 3, 4, 5); + + List> windows = StreamUtils + .windowed(integerStream, 2) + .collect(toList()); + + assertThat(windows, contains(asList(1, 2), asList(2, 3), asList(3, 4), asList(4, 5))); + } + + @Test + //givenIntegerStream_whenWindowedWithWindowSizeAndSkip_shouldReturnListOfListOfWindowSizeAddingASkip + public void givenIntegerStream_whenWindowedWithWindowSizeAndSkip_shouldReturnListOfListOfWindowSizeAddingASkip() { + Stream integerStream = Stream.of(1, 2, 3, 4, 5); + + List> windows = StreamUtils + .windowed(integerStream, 3, 2) + .collect(toList()); + + assertThat(windows, contains(asList(1, 2, 3), asList(3, 4, 5))); + } + + @Test + public void givenEmptyStream_whenWindowed_shouldReturnIterableWithSizeZero() { + ArrayList ints = new ArrayList<>(); + + ints + .stream() + .collect(maxBy((a, b) -> a + .toString() + .compareTo(b.toString()))); + + List> windows = StreamUtils + .windowed(ints.stream(), 2) + .collect(toList()); + + assertThat(windows, iterableWithSize(0)); + } + + @Test + public void givenIntegerStream_whenWindowedWithWindowSizeAndSkipAndAllowLesserSize_shouldReturnListOfListOfInteger() { + Stream integerStream = Stream.of(1, 2, 3, 4, 5); + + List> windows = StreamUtils + .windowed(integerStream, 2, 2, true) + .collect(toList()); + + assertThat(windows, contains(asList(1, 2), asList(3, 4), asList(5))); + } + + @Test + public void givenLimit_withIndices_shouldReturnLongStreamUptoLimit() { + LongStream indices = StreamUtils + .indices() + .limit(500); + + assertThat(indices.count(), equalTo(500)); + } + +} diff --git a/libraries/src/test/java/com/baeldung/retrofit/basic/GitHubBasicApiLiveTest.java b/libraries/src/test/java/com/baeldung/retrofit/basic/GitHubBasicApiLiveTest.java new file mode 100644 index 0000000000..7170d35aa5 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/retrofit/basic/GitHubBasicApiLiveTest.java @@ -0,0 +1,65 @@ +package com.baeldung.retrofit.basic; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import com.baeldung.retrofit.basic.GitHubBasicApi; +import com.baeldung.retrofit.models.Contributor; +import com.baeldung.retrofit.models.Repository; + +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + +public class GitHubBasicApiLiveTest { + + GitHubBasicApi gitHub; + + @Before + public void init() { + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("https://api.github.com/") + .addConverterFactory(GsonConverterFactory.create()) + .build(); + + gitHub = retrofit.create(GitHubBasicApi.class); + } + + @Test + public void whenListRepos_thenExpectReposThatContainTutorials() { + try { + List repos = gitHub + .listRepos("eugenp") + .execute() + .body(); + + assertThat(repos) + .isNotEmpty() + .extracting(Repository::getName).contains("tutorials"); + } catch (IOException e) { + fail("Can not communicate with GitHub API"); + } + } + + @Test + public void whenListRepoContributers_thenExpectContributorsThatContainEugenp() { + try { + List contributors = gitHub + .listRepoContributors("eugenp", "tutorials") + .execute() + .body(); + + assertThat(contributors) + .isNotEmpty() + .extracting(Contributor::getName).contains("eugenp"); + } catch (IOException e) { + fail("Can not communicate with GitHub API"); + } + } + +} diff --git a/libraries/src/test/java/com/baeldung/retrofit/rx/GitHubRxApiTest.java b/libraries/src/test/java/com/baeldung/retrofit/rx/GitHubRxApiTest.java new file mode 100644 index 0000000000..c2fbd9bf60 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/retrofit/rx/GitHubRxApiTest.java @@ -0,0 +1,53 @@ +package com.baeldung.retrofit.rx; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Before; +import org.junit.Test; + +import com.baeldung.retrofit.models.Contributor; +import com.baeldung.retrofit.models.Repository; +import com.baeldung.retrofit.rx.GitHubRxApi; + +import retrofit2.Retrofit; +import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; +import retrofit2.converter.gson.GsonConverterFactory; + +public class GitHubRxApiTest { + + GitHubRxApi gitHub; + + @Before + public void init() { + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("https://api.github.com/") + .addConverterFactory(GsonConverterFactory.create()) + .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) + .build(); + + gitHub = retrofit.create(GitHubRxApi.class); + } + + @Test + public void whenListRepos_thenExpectReposThatContainTutorials() { + gitHub + .listRepos("eugenp") + .subscribe( repos -> { + assertThat(repos) + .isNotEmpty() + .extracting(Repository::getName).contains("tutorials"); + }); + } + + @Test + public void whenListRepoContributers_thenExpectContributorsThatContainEugenp() { + gitHub + .listRepoContributors("eugenp", "tutorials") + .subscribe(contributors -> { + assertThat(contributors) + .isNotEmpty() + .extracting(Contributor::getName).contains("eugenp"); + }); + } + +} diff --git a/libraries/src/test/resources/ABC.txt b/libraries/src/test/resources/ABC.txt new file mode 100644 index 0000000000..f78e42598c --- /dev/null +++ b/libraries/src/test/resources/ABC.txt @@ -0,0 +1 @@ +Hello World from ABC.txt!!! \ No newline at end of file diff --git a/libraries/src/test/resources/aaa.txt b/libraries/src/test/resources/aaa.txt new file mode 100644 index 0000000000..e5875f97d6 --- /dev/null +++ b/libraries/src/test/resources/aaa.txt @@ -0,0 +1 @@ +Hello World from aaa.txt!!! \ No newline at end of file diff --git a/libraries/src/test/resources/fileTest.txt b/libraries/src/test/resources/fileTest.txt new file mode 100644 index 0000000000..ce4bea208b --- /dev/null +++ b/libraries/src/test/resources/fileTest.txt @@ -0,0 +1 @@ +Hello World from fileTest.txt!!! \ No newline at end of file diff --git a/libraries/src/test/resources/sample.txt b/libraries/src/test/resources/sample.txt new file mode 100644 index 0000000000..20f137b416 --- /dev/null +++ b/libraries/src/test/resources/sample.txt @@ -0,0 +1,2 @@ +line 1 +a second line \ No newline at end of file diff --git a/linkrest/WebContent/META-INF/MANIFEST.MF b/linkrest/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..254272e1c0 --- /dev/null +++ b/linkrest/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/linkrest/WebContent/WEB-INF/web.xml b/linkrest/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000000..046c82b08a --- /dev/null +++ b/linkrest/WebContent/WEB-INF/web.xml @@ -0,0 +1,20 @@ + + + linkrest + + linkrest + org.glassfish.jersey.servlet.ServletContainer + + javax.ws.rs.Application + com.baeldung.LinkRestApplication + + 1 + + + linkrest + /* + + \ No newline at end of file diff --git a/linkrest/pom.xml b/linkrest/pom.xml new file mode 100644 index 0000000000..aa2f0f8bda --- /dev/null +++ b/linkrest/pom.xml @@ -0,0 +1,81 @@ + + 4.0.0 + com.baeldung + linkrest + 0.0.1-SNAPSHOT + war + + + + com.nhl.link.rest + link-rest + ${linkrest.version} + + + org.glassfish.jersey.containers + jersey-container-servlet + ${jersey.version} + + + org.glassfish.jersey.media + jersey-media-moxy + ${jersey.version} + + + com.h2database + h2 + ${h2.version} + + + + + + + maven-compiler-plugin + 3.5 + + 1.8 + 1.8 + + + + maven-war-plugin + 2.6 + + WebContent + false + + + + org.apache.cayenne.plugins + cayenne-maven-plugin + ${cayenne.version} + + + ${project.basedir}/src/main/resources/linkrest.map.xml + + + + + + cgen + + + + + + org.apache.cayenne.plugins + cayenne-modeler-maven-plugin + ${cayenne.version} + + + + + + 2.9 + 4.0.B1 + 1.4.196 + 2.25.1 + + \ No newline at end of file diff --git a/linkrest/src/main/java/com/baeldung/LinkRestApplication.java b/linkrest/src/main/java/com/baeldung/LinkRestApplication.java new file mode 100644 index 0000000000..7a2f7c8903 --- /dev/null +++ b/linkrest/src/main/java/com/baeldung/LinkRestApplication.java @@ -0,0 +1,24 @@ +package com.baeldung; + + +import javax.ws.rs.ApplicationPath; + +import org.apache.cayenne.configuration.server.ServerRuntime; +import org.glassfish.jersey.server.ResourceConfig; + +import com.nhl.link.rest.runtime.LinkRestBuilder; +import com.nhl.link.rest.runtime.LinkRestRuntime; + +@ApplicationPath("/linkrest") +public class LinkRestApplication extends ResourceConfig { + + public LinkRestApplication() { + ServerRuntime cayenneRuntime = ServerRuntime.builder() + .addConfig("cayenne-linkrest-project.xml") + .build(); + LinkRestRuntime lrRuntime = LinkRestBuilder.build(cayenneRuntime); + super.register(lrRuntime); + packages("com.baeldung.linkrest.apis"); + } + +} diff --git a/linkrest/src/main/java/com/baeldung/cayenne/Department.java b/linkrest/src/main/java/com/baeldung/cayenne/Department.java new file mode 100644 index 0000000000..ed7a2bd795 --- /dev/null +++ b/linkrest/src/main/java/com/baeldung/cayenne/Department.java @@ -0,0 +1,9 @@ +package com.baeldung.cayenne; + +import com.baeldung.cayenne.auto._Department; + +public class Department extends _Department { + + private static final long serialVersionUID = 1L; + +} diff --git a/linkrest/src/main/java/com/baeldung/cayenne/Employee.java b/linkrest/src/main/java/com/baeldung/cayenne/Employee.java new file mode 100644 index 0000000000..632ea4fbf9 --- /dev/null +++ b/linkrest/src/main/java/com/baeldung/cayenne/Employee.java @@ -0,0 +1,9 @@ +package com.baeldung.cayenne; + +import com.baeldung.cayenne.auto._Employee; + +public class Employee extends _Employee { + + private static final long serialVersionUID = 1L; + +} diff --git a/linkrest/src/main/java/com/baeldung/cayenne/auto/_Department.java b/linkrest/src/main/java/com/baeldung/cayenne/auto/_Department.java new file mode 100644 index 0000000000..4111a8c8b2 --- /dev/null +++ b/linkrest/src/main/java/com/baeldung/cayenne/auto/_Department.java @@ -0,0 +1,44 @@ +package com.baeldung.cayenne.auto; + +import java.util.List; + +import org.apache.cayenne.CayenneDataObject; +import org.apache.cayenne.exp.Property; + +import com.baeldung.cayenne.Employee; + +/** + * Class _Department was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Department extends CayenneDataObject { + + private static final long serialVersionUID = 1L; + + public static final String DEP_ID_PK_COLUMN = "dep_id"; + + public static final Property NAME = Property.create("name", String.class); + public static final Property> EMPLOYEES = Property.create("employees", List.class); + + public void setName(String name) { + writeProperty("name", name); + } + public String getName() { + return (String)readProperty("name"); + } + + public void addToEmployees(Employee obj) { + addToManyTarget("employees", obj, true); + } + public void removeFromEmployees(Employee obj) { + removeToManyTarget("employees", obj, true); + } + @SuppressWarnings("unchecked") + public List getEmployees() { + return (List)readProperty("employees"); + } + + +} diff --git a/linkrest/src/main/java/com/baeldung/cayenne/auto/_Employee.java b/linkrest/src/main/java/com/baeldung/cayenne/auto/_Employee.java new file mode 100644 index 0000000000..50e1880a56 --- /dev/null +++ b/linkrest/src/main/java/com/baeldung/cayenne/auto/_Employee.java @@ -0,0 +1,39 @@ +package com.baeldung.cayenne.auto; + +import org.apache.cayenne.CayenneDataObject; +import org.apache.cayenne.exp.Property; + +import com.baeldung.cayenne.Department; + +/** + * Class _Employee was generated by Cayenne. + * It is probably a good idea to avoid changing this class manually, + * since it may be overwritten next time code is regenerated. + * If you need to make any customizations, please use subclass. + */ +public abstract class _Employee extends CayenneDataObject { + + private static final long serialVersionUID = 1L; + + public static final String EMP_ID_PK_COLUMN = "emp_id"; + + public static final Property NAME = Property.create("name", String.class); + public static final Property DEPARTMENT = Property.create("department", Department.class); + + public void setName(String name) { + writeProperty("name", name); + } + public String getName() { + return (String)readProperty("name"); + } + + public void setDepartment(Department department) { + setToOneTarget("department", department, true); + } + + public Department getDepartment() { + return (Department)readProperty("department"); + } + + +} diff --git a/linkrest/src/main/java/com/baeldung/linkrest/apis/DepartmentResource.java b/linkrest/src/main/java/com/baeldung/linkrest/apis/DepartmentResource.java new file mode 100644 index 0000000000..f4090b580e --- /dev/null +++ b/linkrest/src/main/java/com/baeldung/linkrest/apis/DepartmentResource.java @@ -0,0 +1,58 @@ +package com.baeldung.linkrest.apis; + +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Configuration; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.UriInfo; + +import com.baeldung.cayenne.Department; +import com.nhl.link.rest.DataResponse; +import com.nhl.link.rest.LinkRest; +import com.nhl.link.rest.SimpleResponse; + +@Path("department") +@Produces(MediaType.APPLICATION_JSON) +public class DepartmentResource { + + @Context + private Configuration config; + + @GET + public DataResponse getAll(@Context UriInfo uriInfo) { + return LinkRest.select(Department.class, config).uri(uriInfo).get(); + } + + @GET + @Path("{id}") + public DataResponse getOne(@PathParam("id") int id, @Context UriInfo uriInfo) { + return LinkRest.select(Department.class, config).byId(id).uri(uriInfo).getOne(); + } + + @POST + public SimpleResponse create(String data) { + return LinkRest.create(Department.class, config).sync(data); + } + + @PUT + public SimpleResponse createOrUpdate(String data) { + return LinkRest.createOrUpdate(Department.class, config).sync(data); + } + + @Path("{id}/employees") + public EmployeeSubResource getEmployees(@PathParam("id") int id, @Context UriInfo uriInfo) { + return new EmployeeSubResource(id, config); + } + + @DELETE + @Path("{id}") + public SimpleResponse delete(@PathParam("id") int id) { + return LinkRest.delete(Department.class, config).id(id).delete(); + } +} diff --git a/linkrest/src/main/java/com/baeldung/linkrest/apis/EmployeeSubResource.java b/linkrest/src/main/java/com/baeldung/linkrest/apis/EmployeeSubResource.java new file mode 100644 index 0000000000..ba9c3759bb --- /dev/null +++ b/linkrest/src/main/java/com/baeldung/linkrest/apis/EmployeeSubResource.java @@ -0,0 +1,65 @@ +package com.baeldung.linkrest.apis; + +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Configuration; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.UriInfo; + +import com.baeldung.cayenne.Department; +import com.baeldung.cayenne.Employee; +import com.nhl.link.rest.DataResponse; +import com.nhl.link.rest.LinkRest; +import com.nhl.link.rest.SimpleResponse; + +@Produces(MediaType.APPLICATION_JSON) +public class EmployeeSubResource { + + private Configuration config; + + private int departmentId; + + public EmployeeSubResource(int departmentId, Configuration config) { + this.departmentId = departmentId; + this.config = config; + } + + public EmployeeSubResource() { + } + + @GET + public DataResponse getAll(@Context UriInfo uriInfo) { + return LinkRest.select(Employee.class, config).toManyParent(Department.class, departmentId, Department.EMPLOYEES).uri(uriInfo).get(); + } + + @GET + @Path("{id}") + public DataResponse getOne(@PathParam("id") int id, @Context UriInfo uriInfo) { + return LinkRest.select(Employee.class, config).toManyParent(Department.class, departmentId, Department.EMPLOYEES).byId(id).uri(uriInfo).getOne(); + } + + @POST + public SimpleResponse create(String data) { + + return LinkRest.create(Employee.class, config).toManyParent(Department.class, departmentId, Department.EMPLOYEES).sync(data); + } + + @PUT + public SimpleResponse createOrUpdate(String data) { + return LinkRest.create(Employee.class, config).toManyParent(Department.class, departmentId, Department.EMPLOYEES).sync(data); + } + + @DELETE + @Path("{id}") + public SimpleResponse delete(@PathParam("id") int id) { + return LinkRest.delete(Employee.class, config).toManyParent(Department.class, departmentId, Department.EMPLOYEES).id(id).delete(); + + } + +} diff --git a/linkrest/src/main/resources/cayenne-linkrest-project.xml b/linkrest/src/main/resources/cayenne-linkrest-project.xml new file mode 100644 index 0000000000..8a4ba39c4d --- /dev/null +++ b/linkrest/src/main/resources/cayenne-linkrest-project.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + diff --git a/linkrest/src/main/resources/linkrest.map.xml b/linkrest/src/main/resources/linkrest.map.xml new file mode 100644 index 0000000000..105d7d9d14 --- /dev/null +++ b/linkrest/src/main/resources/linkrest.map.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/log4j2/README.md b/log4j2/README.md index 3afd842c82..57ca4df21b 100644 --- a/log4j2/README.md +++ b/log4j2/README.md @@ -1,3 +1,4 @@ ### Relevant articles - [Intro to Log4j2 – Appenders, Layouts and Filters](http://www.baeldung.com/log4j2-appenders-layouts-filters) +- [Log4j 2 and Lambda Expressions](http://www.baeldung.com/log4j-2-lazy-logging) diff --git a/lombok/pom.xml b/lombok/pom.xml index 472516de4d..bea05b38f3 100644 --- a/lombok/pom.xml +++ b/lombok/pom.xml @@ -6,8 +6,6 @@ 4.0.0 lombok - - com.baeldung lombok 0.1-SNAPSHOT @@ -81,7 +79,7 @@ UTF-8 - 1.16.12 + 1.16.18 1.0.0.Final diff --git a/mapstruct/pom.xml b/mapstruct/pom.xml index 17cf882d2b..ba67ccc2df 100644 --- a/mapstruct/pom.xml +++ b/mapstruct/pom.xml @@ -5,7 +5,6 @@ 4.0.0 mapstruct mapstruct - com.baeldung 1.0 jar diff --git a/mocks/mock-comparisons/pom.xml b/mocks/mock-comparisons/pom.xml index e350457f54..11bc59d710 100644 --- a/mocks/mock-comparisons/pom.xml +++ b/mocks/mock-comparisons/pom.xml @@ -13,9 +13,9 @@ mock-comparisons - 2.8.9 + 2.9.0 3.4 - 1.29 + 1.34 UTF-8 diff --git a/mustache/pom.xml b/mustache/pom.xml index d5d80b58e9..8aab038313 100644 --- a/mustache/pom.xml +++ b/mustache/pom.xml @@ -8,9 +8,11 @@ mustache - com.baeldung - parent-modules - 1.0.0-SNAPSHOT + org.springframework.boot + spring-boot-starter-parent + 1.5.4.RELEASE + + @@ -32,6 +34,28 @@ log4j ${log4j.version} + + + org.springframework.boot + spring-boot-starter-mustache + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.webjars + bootstrap + 3.3.7 + + + org.fluttercode.datafactory + datafactory + 0.8 + + junit junit @@ -41,6 +65,102 @@ + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + 3 + true + + **/*IntegrationTest.java + **/*LongRunningUnitTest.java + **/*ManualTest.java + **/JdbcTest.java + **/*LiveTest.java + + true + + + + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + **/AutoconfigurationTest.java + + + **/*IntegrationTest.java + + + + + + + json + + + + + + + + autoconfiguration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + **/*IntegrationTest.java + + + **/AutoconfigurationTest.java + + + + + + + json + + + + + + + + 0.9.2 3.7.0 @@ -52,6 +172,8 @@ 3.6.0 2.19.1 + + 1.8 \ No newline at end of file diff --git a/mustache/src/main/java/com/baeldung/springmustache/SpringMustacheApplication.java b/mustache/src/main/java/com/baeldung/springmustache/SpringMustacheApplication.java new file mode 100644 index 0000000000..8cdf89d08a --- /dev/null +++ b/mustache/src/main/java/com/baeldung/springmustache/SpringMustacheApplication.java @@ -0,0 +1,32 @@ +package com.baeldung.springmustache; + +import com.samskivert.mustache.Mustache; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.mustache.MustacheEnvironmentCollector; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.core.env.Environment; + +@SpringBootApplication +@ComponentScan(basePackages = {"com.baeldung"}) +public class SpringMustacheApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringMustacheApplication.class, args); + } + + @Bean + public Mustache.Compiler mustacheCompiler(Mustache.TemplateLoader templateLoader, Environment environment) { + + MustacheEnvironmentCollector collector = new MustacheEnvironmentCollector(); + collector.setEnvironment(environment); + + return Mustache.compiler() + .defaultValue("Some Default Value") + .withLoader(templateLoader) + .withCollector(collector); + + } +} + diff --git a/mustache/src/main/java/com/baeldung/springmustache/controller/ArticleController.java b/mustache/src/main/java/com/baeldung/springmustache/controller/ArticleController.java new file mode 100644 index 0000000000..880fb337fd --- /dev/null +++ b/mustache/src/main/java/com/baeldung/springmustache/controller/ArticleController.java @@ -0,0 +1,42 @@ +package com.baeldung.springmustache.controller; + +import com.baeldung.springmustache.model.Article; +import org.fluttercode.datafactory.impl.DataFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.servlet.ModelAndView; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +@Controller +public class ArticleController { + + @GetMapping("/article") + public ModelAndView displayArticle(Map model) { + + List
articles = IntStream.range(0, 10) + .mapToObj(i -> generateArticle("Article Title " + i)) + .collect(Collectors.toList()); + + model.put("articles", articles); + + return new ModelAndView("index", model); + } + + private Article generateArticle(String title) { + Article article = new Article(); + DataFactory factory = new DataFactory(); + article.setTitle(title); + article.setBody( + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur faucibus tempor diam. In molestie arcu eget ante facilisis sodales. Maecenas porta tellus sapien, eget rutrum nisi blandit in. Mauris tempor auctor ante, ut blandit velit venenatis id. Ut varius, augue aliquet feugiat congue, arcu ipsum finibus purus, dapibus semper velit sapien venenatis magna. Nunc quam ex, aliquet at rutrum sed, vestibulum quis libero. In laoreet libero cursus maximus vulputate. Nullam in fermentum sem. Duis aliquam ullamcorper dui, et dictum justo placerat id. Aliquam pretium orci quis sapien convallis, non blandit est tempus."); + article.setPublishDate(factory.getBirthDate().toString()); + article.setAuthor(factory.getName()); + return article; + } +} + + diff --git a/mustache/src/main/java/com/baeldung/springmustache/model/Article.java b/mustache/src/main/java/com/baeldung/springmustache/model/Article.java new file mode 100644 index 0000000000..78b08f877f --- /dev/null +++ b/mustache/src/main/java/com/baeldung/springmustache/model/Article.java @@ -0,0 +1,41 @@ +package com.baeldung.springmustache.model; + +public class Article { + private String title; + private String body; + private String author; + private String publishDate; + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getPublishDate() { + return publishDate; + } + + public void setPublishDate(String publishDate) { + this.publishDate = publishDate; + } + +} diff --git a/mustache/src/main/resources/application.properties b/mustache/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/mustache/src/main/resources/templates/error/error.html b/mustache/src/main/resources/templates/error/error.html new file mode 100644 index 0000000000..fa29db41c4 --- /dev/null +++ b/mustache/src/main/resources/templates/error/error.html @@ -0,0 +1,9 @@ + + + + + + Something went wrong: {{status}} {{error}} + + + \ No newline at end of file diff --git a/mustache/src/main/resources/templates/index.html b/mustache/src/main/resources/templates/index.html new file mode 100644 index 0000000000..bda60f9d8f --- /dev/null +++ b/mustache/src/main/resources/templates/index.html @@ -0,0 +1,9 @@ +{{>layout/header}} + +
{{>layout/article}}
+ + + + +{{>layout/footer}} diff --git a/mustache/src/main/resources/templates/layout/article.html b/mustache/src/main/resources/templates/layout/article.html new file mode 100644 index 0000000000..9d573580d3 --- /dev/null +++ b/mustache/src/main/resources/templates/layout/article.html @@ -0,0 +1,8 @@ +
+ {{#articles}} +

{{title}}

+

{{publishDate}}

+

{{author}}

+

{{body}}

+ {{/articles}} +
\ No newline at end of file diff --git a/mustache/src/main/resources/templates/layout/footer.html b/mustache/src/main/resources/templates/layout/footer.html new file mode 100644 index 0000000000..04f34cac54 --- /dev/null +++ b/mustache/src/main/resources/templates/layout/footer.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/mustache/src/main/resources/templates/layout/header.html b/mustache/src/main/resources/templates/layout/header.html new file mode 100644 index 0000000000..d203ef800b --- /dev/null +++ b/mustache/src/main/resources/templates/layout/header.html @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/mustache/src/test/java/com/baeldung/mustache/TodoMustacheServiceTest.java b/mustache/src/test/java/com/baeldung/mustache/TodoMustacheServiceTest.java index 17a59aa6a1..0df2f7f8a4 100644 --- a/mustache/src/test/java/com/baeldung/mustache/TodoMustacheServiceTest.java +++ b/mustache/src/test/java/com/baeldung/mustache/TodoMustacheServiceTest.java @@ -1,100 +1,98 @@ package com.baeldung.mustache; -import static org.assertj.core.api.Assertions.assertThat; +import com.baeldung.mustache.model.Todo; +import com.github.mustachejava.Mustache; +import org.junit.Test; import java.io.IOException; import java.io.StringWriter; import java.time.Instant; -import java.time.LocalDateTime; -import java.time.temporal.TemporalUnit; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.Function; -import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; -import com.baeldung.mustache.model.Todo; -import com.github.mustachejava.Mustache; public class TodoMustacheServiceTest { - private String executeTemplate(Mustache m, Map context) throws IOException{ + private String executeTemplate(Mustache m, Map context) throws IOException { StringWriter writer = new StringWriter(); m.execute(writer, context).flush(); return writer.toString(); } - - private String executeTemplate(Mustache m, Todo todo) throws IOException{ + + private String executeTemplate(Mustache m, Todo todo) throws IOException { StringWriter writer = new StringWriter(); m.execute(writer, todo).flush(); return writer.toString(); } - + @Test - public void givenTodoObject_whenGetHtml_thenSuccess() throws IOException{ + public void givenTodoObject_whenGetHtml_thenSuccess() throws IOException { Todo todo = new Todo("Todo 1", "Todo description"); Mustache m = MustacheUtil.getMustacheFactory().compile("todo.mustache"); Map context = new HashMap<>(); context.put("todo", todo); - + String expected = "

Todo 1

"; assertThat(executeTemplate(m, todo)).contains(expected); } - + @Test - public void givenNullTodoObject_whenGetHtml_thenEmptyHtml() throws IOException{ + public void givenNullTodoObject_whenGetHtml_thenEmptyHtml() throws IOException { Mustache m = MustacheUtil.getMustacheFactory().compile("todo-section.mustache"); Map context = new HashMap<>(); assertThat(executeTemplate(m, context)).isEmpty(); } - + @Test - public void givenTodoList_whenGetHtml_thenSuccess() throws IOException{ + public void givenTodoList_whenGetHtml_thenSuccess() throws IOException { Mustache m = MustacheUtil.getMustacheFactory().compile("todos.mustache"); - + List todos = Arrays.asList( - new Todo("Todo 1", "Todo description"), - new Todo("Todo 2", "Todo description another"), - new Todo("Todo 3", "Todo description another") - ); + new Todo("Todo 1", "Todo description"), + new Todo("Todo 2", "Todo description another"), + new Todo("Todo 3", "Todo description another") + ); Map context = new HashMap<>(); context.put("todos", todos); - + assertThat(executeTemplate(m, context)) .contains("

Todo 1

") .contains("

Todo 2

") .contains("

Todo 3

"); } - + @Test - public void givenEmptyList_whenGetHtml_thenEmptyHtml() throws IOException{ + public void givenEmptyList_whenGetHtml_thenEmptyHtml() throws IOException { Mustache m = MustacheUtil.getMustacheFactory().compile("todos.mustache"); - + Map context = new HashMap<>(); - assertThat(executeTemplate(m, context)).isEmpty();; + assertThat(executeTemplate(m, context)).isEmpty(); + ; } - + @Test - public void givenEmptyList_whenGetHtmlUsingInvertedSection_thenHtml() throws IOException{ + public void givenEmptyList_whenGetHtmlUsingInvertedSection_thenHtml() throws IOException { Mustache m = MustacheUtil.getMustacheFactory().compile("todos-inverted-section.mustache"); - + Map context = new HashMap<>(); assertThat(executeTemplate(m, context).trim()).isEqualTo("

No todos!

"); } - + @Test - public void givenTodoList_whenGetHtmlUsingLamdba_thenHtml() throws IOException{ + public void givenTodoList_whenGetHtmlUsingLamdba_thenHtml() throws IOException { Mustache m = MustacheUtil.getMustacheFactory().compile("todos-lambda.mustache"); List todos = Arrays.asList( - new Todo("Todo 1", "Todo description"), - new Todo("Todo 2", "Todo description another"), - new Todo("Todo 3", "Todo description another") - ); + new Todo("Todo 1", "Todo description"), + new Todo("Todo 2", "Todo description another"), + new Todo("Todo 3", "Todo description another") + ); todos.get(2).setDone(true); todos.get(2).setCompletedOn(Date.from(Instant.now().plusSeconds(300))); - + Map context = new HashMap<>(); context.put("todos", todos); assertThat(executeTemplate(m, context).trim()).contains("Done 5 minutes ago"); diff --git a/mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationIntegrationTest.java b/mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationIntegrationTest.java new file mode 100644 index 0000000000..1eecf58986 --- /dev/null +++ b/mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationIntegrationTest.java @@ -0,0 +1,30 @@ +package com.baeldung.springmustache; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +public class SpringMustacheApplicationIntegrationTest { + + @Autowired + private TestRestTemplate restTemplate; + + @Test + public void givenIndexPageWhenContainsArticleThenTrue() { + + ResponseEntity entity = this.restTemplate.getForEntity("/article", String.class); + + Assert.assertTrue(entity.getStatusCode().equals(HttpStatus.OK)); + Assert.assertTrue(entity.getBody().contains("Article Title 0")); + } + +} diff --git a/pom.xml b/pom.xml index f2dd0ae48c..dd0871ae79 100644 --- a/pom.xml +++ b/pom.xml @@ -28,6 +28,7 @@ + apache-cayenne aws akka-streams algorithms @@ -43,11 +44,15 @@ cdi core-java - couchbase-sdk + core-java-8 + core-java-concurrency + couchbase deltaspike dozer + ethereumj + feign @@ -55,7 +60,7 @@ - + geotools groovy-spock gson guava @@ -93,7 +98,8 @@ jws libraries - libraries-data + libraries-data + linkrest log-mdc log4j log4j2 @@ -123,6 +129,7 @@ rest-testing resteasy rxjava + spring-swagger-codegen selenium-junit-testng solr @@ -239,6 +246,7 @@ spring-boot-property-exp mockserver undertow + vertx-and-rxjava diff --git a/ratpack/README.md b/ratpack/README.md index 8215f74148..02b91da0bd 100644 --- a/ratpack/README.md +++ b/ratpack/README.md @@ -3,3 +3,5 @@ - [Introduction to Ratpack](http://www.baeldung.com/ratpack) - [Ratpack Google Guice Integration](http://www.baeldung.com/ratpack-google-guice) - [Ratpack Integration with Spring Boot](http://www.baeldung.com/ratpack-spring-boot) +- [Ratpack with Hystrix](http://www.baeldung.com/ratpack-hystrix) + diff --git a/rxjava/README.md b/rxjava/README.md index 7670dd4ed3..c7fd0c595d 100644 --- a/rxjava/README.md +++ b/rxjava/README.md @@ -2,3 +2,4 @@ - [Dealing with Backpressure with RxJava](http://www.baeldung.com/rxjava-backpressure) - [How to Test RxJava?](http://www.baeldung.com/rxjava-testing) +- [Implementing Custom Operators in RxJava](http://www.baeldung.com/rxjava-custom-operators) diff --git a/rxjava/pom.xml b/rxjava/pom.xml index 578eda3fcf..96d49e0d3c 100644 --- a/rxjava/pom.xml +++ b/rxjava/pom.xml @@ -19,10 +19,47 @@ rxjava ${rx.java.version} + + + io.reactivex.rxjava2 + rxjava + 2.1.3 + + + + com.jayway.awaitility + awaitility + 1.7.0 + + + com.github.davidmoten + rxjava-jdbc + ${rx.java.jdbc.version} + + + com.h2database + h2 + ${h2.version} + runtime + + + org.assertj + assertj-core + ${assertj.version} + + + com.google.guava + guava + 22.0 + test + + 3.8.0 1.2.5 + 0.7.11 + 1.4.196 diff --git a/rxjava/src/main/java/com/baelding/rxjava/ConnectableObservableImpl.java b/rxjava/src/main/java/com/baelding/rxjava/ConnectableObservableImpl.java new file mode 100644 index 0000000000..005487dae8 --- /dev/null +++ b/rxjava/src/main/java/com/baelding/rxjava/ConnectableObservableImpl.java @@ -0,0 +1,22 @@ +package com.baelding.rxjava; + +import rx.Observable; +import rx.observables.ConnectableObservable; + +import java.util.concurrent.TimeUnit; + +public class ConnectableObservableImpl { + + public static void main(String[] args) throws InterruptedException { + + ConnectableObservable connectable + = Observable.interval(200, TimeUnit.MILLISECONDS).publish(); + connectable.subscribe(System.out::println); + + System.out.println("Connect"); + connectable.connect(); + + Thread.sleep(500); + System.out.println("Sleep"); + } +} diff --git a/rxjava/src/main/java/com/baelding/rxjava/ObservableImpl.java b/rxjava/src/main/java/com/baelding/rxjava/ObservableImpl.java new file mode 100644 index 0000000000..9ab0d0e1e6 --- /dev/null +++ b/rxjava/src/main/java/com/baelding/rxjava/ObservableImpl.java @@ -0,0 +1,81 @@ +package com.baelding.rxjava; + +import rx.Observable; +import rx.observables.BlockingObservable; + +import java.util.Arrays; +import java.util.List; + +public class ObservableImpl { + + static Integer[] numbers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + static String[] letters = {"a", "b", "c", "d", "e", "f", "g", "h", "i"}; + static String[] titles = {"title"}; + public static List titleList = Arrays.asList(titles); + + public static Observable getTitle() { + return Observable.from(titleList); + } + + public static void main(String[] args) { + + System.out.println("-------Just-----------"); + Observable observable = Observable.just("Hello"); + observable.subscribe( + System.out::println, //onNext + Throwable::printStackTrace, //onError + () -> System.out.println("onCompleted") //onCompleted + ); + + BlockingObservable blockingObservable = observable.toBlocking(); + + System.out.println(); + System.out.println("-------Map-----------"); + Observable.from(letters) + .map(String::toUpperCase) + .subscribe(System.out::print); + + System.out.println(); + System.out.println("-------FlatMap-----------"); + Observable.just("book1", "book2") + .flatMap(s -> getTitle()) + .subscribe(System.out::print); + + System.out.println(); + System.out.println("--------Scan----------"); + Observable.from(letters) + .scan(new StringBuilder(), StringBuilder::append) + .subscribe(System.out::println); + + System.out.println(); + System.out.println("------GroubBy------------"); + Observable.from(numbers) + .groupBy(i -> 0 == (i % 2) ? "EVEN" : "ODD") + .subscribe((group) -> group.subscribe((number) -> { + System.out.println(group.getKey() + " : " + number); + })); + + System.out.println(); + System.out.println("-------Filter-----------"); + Observable.from(numbers) + .filter(i -> (i % 2 == 1)) + .subscribe(System.out::println); + + System.out.println("------DefaultIfEmpty------------"); + Observable.empty() + .defaultIfEmpty("Observable is empty") + .subscribe(System.out::println); + + System.out.println("------DefaultIfEmpty-2-----------"); + Observable.from(letters) + .defaultIfEmpty("Observable is empty") + .first() + .subscribe(System.out::println); + + System.out.println("-------TakeWhile-----------"); + Observable.from(numbers) + .takeWhile(i -> i < 5) + .subscribe(System.out::println); + } +} \ No newline at end of file diff --git a/rxjava/src/main/java/com/baelding/rxjava/ResourceManagement.java b/rxjava/src/main/java/com/baelding/rxjava/ResourceManagement.java new file mode 100644 index 0000000000..44bbd7edda --- /dev/null +++ b/rxjava/src/main/java/com/baelding/rxjava/ResourceManagement.java @@ -0,0 +1,30 @@ +package com.baelding.rxjava; + +import rx.Observable; + +public class ResourceManagement { + + public static void main(String[] args) { + + Observable values = Observable.using( + () -> { + String resource = "MyResource"; + System.out.println("Leased: " + resource); + return resource; + }, + r -> Observable.create(o -> { + for (Character c : r.toCharArray()) { + o.onNext(c); + } + o.onCompleted(); + }), + r -> System.out.println("Disposed: " + r) + ); + + values.subscribe( + System.out::println, + System.out::println + ); + } +} + diff --git a/rxjava/src/main/java/com/baelding/rxjava/SingleImpl.java b/rxjava/src/main/java/com/baelding/rxjava/SingleImpl.java new file mode 100644 index 0000000000..f625ab6b44 --- /dev/null +++ b/rxjava/src/main/java/com/baelding/rxjava/SingleImpl.java @@ -0,0 +1,18 @@ +package com.baelding.rxjava; + +import rx.Observable; +import rx.Single; + +public class SingleImpl { + + public static void main(String[] args) { + + Single single = Observable.just("Hello") + .toSingle() + .doOnSuccess(System.out::print) + .doOnError(e -> { + throw new RuntimeException(e.getMessage()); + }); + single.subscribe(); + } +} diff --git a/rxjava/src/main/java/com/baelding/rxjava/SubjectImpl.java b/rxjava/src/main/java/com/baelding/rxjava/SubjectImpl.java new file mode 100644 index 0000000000..aac9b4454a --- /dev/null +++ b/rxjava/src/main/java/com/baelding/rxjava/SubjectImpl.java @@ -0,0 +1,73 @@ +package com.baelding.rxjava; + +import rx.Observer; +import rx.subjects.PublishSubject; + +public class SubjectImpl { + + public static Integer subscriber1 = 0; + public static Integer subscriber2 = 0; + + public static Integer subjectMethod() { + PublishSubject subject = PublishSubject.create(); + + subject.subscribe(getFirstObserver()); + + subject.onNext(1); + subject.onNext(2); + subject.onNext(3); + + subject.subscribe(getSecondObserver()); + + subject.onNext(4); + subject.onCompleted(); + return subscriber1 + subscriber2; + } + + + public static Observer getFirstObserver() { + return new Observer() { + + @Override + public void onNext(Integer value) { + subscriber1 += value; + System.out.println("Subscriber1: " + value); + } + + @Override + public void onError(Throwable e) { + System.out.println("error"); + } + + @Override + public void onCompleted() { + System.out.println("Subscriber1 completed"); + } + }; + } + + public static Observer getSecondObserver() { + return new Observer() { + + @Override + public void onNext(Integer value) { + subscriber2 += value; + System.out.println("Subscriber2: " + value); + } + + @Override + public void onError(Throwable e) { + System.out.println("error"); + } + + @Override + public void onCompleted() { + System.out.println("Subscriber2 completed"); + } + }; + } + + public static void main(String[] args) throws InterruptedException { + System.out.println(subjectMethod()); + } +} diff --git a/rxjava/src/main/java/com/baelding/rxjava/operator/ToCleanString.java b/rxjava/src/main/java/com/baelding/rxjava/operator/ToCleanString.java index f6cf9fba68..32db92c8fe 100644 --- a/rxjava/src/main/java/com/baelding/rxjava/operator/ToCleanString.java +++ b/rxjava/src/main/java/com/baelding/rxjava/operator/ToCleanString.java @@ -39,5 +39,4 @@ public class ToCleanString implements Operator { } }; } - } \ No newline at end of file diff --git a/rxjava/src/main/java/com/baeldung/rxjava/jdbc/Connector.java b/rxjava/src/main/java/com/baeldung/rxjava/jdbc/Connector.java new file mode 100644 index 0000000000..b7416e471a --- /dev/null +++ b/rxjava/src/main/java/com/baeldung/rxjava/jdbc/Connector.java @@ -0,0 +1,13 @@ +package com.baeldung.rxjava.jdbc; + +import com.github.davidmoten.rx.jdbc.ConnectionProvider; +import com.github.davidmoten.rx.jdbc.ConnectionProviderFromUrl; + +class Connector { + + static final String DB_CONNECTION = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1"; + static final String DB_USER = ""; + static final String DB_PASSWORD = ""; + + static final ConnectionProvider connectionProvider = new ConnectionProviderFromUrl(DB_CONNECTION, DB_USER, DB_PASSWORD); +} diff --git a/rxjava/src/main/java/com/baeldung/rxjava/jdbc/Employee.java b/rxjava/src/main/java/com/baeldung/rxjava/jdbc/Employee.java new file mode 100644 index 0000000000..790dddeb74 --- /dev/null +++ b/rxjava/src/main/java/com/baeldung/rxjava/jdbc/Employee.java @@ -0,0 +1,13 @@ +package com.baeldung.rxjava.jdbc; + +import com.github.davidmoten.rx.jdbc.annotations.Column; + +public interface Employee { + + @Column("id") + int id(); + + @Column("name") + String name(); + +} diff --git a/rxjava/src/main/java/com/baeldung/rxjava/jdbc/Manager.java b/rxjava/src/main/java/com/baeldung/rxjava/jdbc/Manager.java new file mode 100644 index 0000000000..56faa4cae7 --- /dev/null +++ b/rxjava/src/main/java/com/baeldung/rxjava/jdbc/Manager.java @@ -0,0 +1,28 @@ +package com.baeldung.rxjava.jdbc; + +public class Manager { + + private int id; + private String name; + + public Manager(int id, String name) { + this.id = id; + this.name = name; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/rxjava/src/main/java/com/baeldung/rxjava/jdbc/Utils.java b/rxjava/src/main/java/com/baeldung/rxjava/jdbc/Utils.java new file mode 100644 index 0000000000..401962d1a9 --- /dev/null +++ b/rxjava/src/main/java/com/baeldung/rxjava/jdbc/Utils.java @@ -0,0 +1,16 @@ +package com.baeldung.rxjava.jdbc; + +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; + +import org.apache.commons.io.IOUtils; + +class Utils { + + static String getStringFromInputStream(InputStream input) throws IOException { + StringWriter writer = new StringWriter(); + IOUtils.copy(input, writer, "UTF-8"); + return writer.toString(); + } +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/ConnectableObservableTest.java b/rxjava/src/test/java/com/baeldung/rxjava/ConnectableObservableTest.java new file mode 100644 index 0000000000..031ff0c5bb --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/ConnectableObservableTest.java @@ -0,0 +1,27 @@ +package com.baeldung.rxjava; + +import org.junit.Test; +import rx.Observable; +import rx.observables.ConnectableObservable; + +import java.util.concurrent.TimeUnit; + +import static com.jayway.awaitility.Awaitility.await; +import static junit.framework.Assert.assertFalse; +import static junit.framework.Assert.assertTrue; + +public class ConnectableObservableTest { + + @Test + public void givenConnectableObservable_whenConnect_thenGetMessage() throws InterruptedException { + String[] result = {""}; + ConnectableObservable connectable + = Observable.interval(500, TimeUnit.MILLISECONDS).publish(); + connectable.subscribe(i -> result[0] += i); + assertFalse(result[0].equals("01")); + + connectable.connect(); + await() + .until(() -> assertTrue(result[0].equals("01"))); + } +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/ObservableTest.java b/rxjava/src/test/java/com/baeldung/rxjava/ObservableTest.java new file mode 100644 index 0000000000..08fccfb238 --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/ObservableTest.java @@ -0,0 +1,145 @@ +package com.baeldung.rxjava; + +import org.junit.Test; +import rx.Observable; + +import static com.baelding.rxjava.ObservableImpl.getTitle; +import static junit.framework.Assert.assertTrue; + +public class ObservableTest { + + String result = ""; + + @Test + public void givenString_whenJustAndSubscribe_thenEmitsSingleItem() { + Observable observable = Observable.just("Hello"); + observable.subscribe(s -> result = s); + assertTrue(result.equals("Hello")); + } + + @Test + public void givenArray_whenFromAndSubscribe_thenEmitsItems() { + String[] letters = {"a", "b", "c", "d", "e", "f", "g"}; + Observable observable = Observable.from(letters); + observable.subscribe( + i -> result += i, + Throwable::printStackTrace, + () -> result += "_Complete" + ); + assertTrue(result.equals("abcdefg_Complete")); + } + + @Test + public void givenArray_whenConvertsObservabletoBlockingObservable_thenReturnFirstElement() { + String[] letters = {"a", "b", "c", "d", "e", "f", "g"}; + Observable observable = Observable.from(letters); + String blockingObservable = observable.toBlocking().first(); + + observable.subscribe( + i -> result += i, + Throwable::printStackTrace, + () -> result += "_Completed" + ); + assertTrue(String.valueOf(result.charAt(0)).equals(blockingObservable)); + } + + @Test + public void givenArray_whenMapAndSubscribe_thenReturnCapitalLetters() { + String[] letters = {"a", "b", "c", "d", "e", "f", "g"}; + + Observable.from(letters) + .map(String::toUpperCase) + .subscribe(letter -> result += letter); + + assertTrue(result.equals("ABCDEFG")); + } + + @Test + public void givenArray_whenFlatMapAndSubscribe_thenReturnUpperAndLowerCaseLetters() { + + Observable.just("book1", "book2") + .flatMap(s -> getTitle()) + .subscribe(l -> result += l); + + assertTrue(result.equals("titletitle")); + } + + @Test + public void givenArray_whenScanAndSubscribe_thenReturnTheSumOfAllLetters() { + String[] letters = {"a", "b", "c"}; + + Observable.from(letters) + .scan(new StringBuilder(), StringBuilder::append) + .subscribe(total -> result += total.toString()); + + assertTrue(result.equals("aababc")); + } + + @Test + public void givenArrayOfNumbers_whenGroupBy_thenCreateTwoGroupsBasedOnParity() { + Integer[] numbers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + String[] EVEN = {""}; + String[] ODD = {""}; + + Observable.from(numbers) + .groupBy(i -> 0 == (i % 2) ? "EVEN" : "ODD") + .subscribe(group -> + group.subscribe((number) -> { + if (group.getKey().toString().equals("EVEN")) { + EVEN[0] += number; + } else { + ODD[0] += number; + } + }) + ); + + assertTrue(EVEN[0].equals("0246810")); + assertTrue(ODD[0].equals("13579")); + } + + @Test + public void givenArrayOfNumbers_whenFilter_thenGetAllOddNumbers() { + Integer[] numbers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + + Observable.from(numbers) + .filter(i -> (i % 2 == 1)) + .subscribe(i -> result += i); + + assertTrue(result.equals("13579")); + } + + @Test + public void givenEmptyObservable_whenDefaultIfEmpty_thenGetDefaultMessage() { + + Observable.empty() + .defaultIfEmpty("Observable is empty") + .subscribe(s -> result += s); + + assertTrue(result.equals("Observable is empty")); + } + + @Test + public void givenObservableFromArray_whenDefaultIfEmptyAndFirst_thenGetFirstLetterFromArray() { + String[] letters = {"a", "b", "c", "d", "e", "f", "g"}; + + Observable.from(letters) + .defaultIfEmpty("Observable is empty") + .first() + .subscribe(s -> result += s); + + assertTrue(result.equals("a")); + } + + @Test + public void givenObservableFromArray_whenTakeWhile_thenGetSumOfNumbersFromCondition() { + Integer[] numbers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + final Integer[] sum = {0}; + + Observable.from(numbers) + .takeWhile(i -> i < 5) + .subscribe(s -> sum[0] += s); + + assertTrue(sum[0] == 10); + } + +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/ResourceManagementTest.java b/rxjava/src/test/java/com/baeldung/rxjava/ResourceManagementTest.java new file mode 100644 index 0000000000..9c52af61d0 --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/ResourceManagementTest.java @@ -0,0 +1,34 @@ +package com.baeldung.rxjava; + +import org.junit.Test; +import rx.Observable; + +import static junit.framework.Assert.assertTrue; + +public class ResourceManagementTest { + + @Test + public void givenResource_whenUsingOberservable_thenCreatePrintDisposeResource() throws InterruptedException { + + String[] result = {""}; + Observable values = Observable.using( + () -> { + return "MyResource"; + }, + r -> { + return Observable.create(o -> { + for (Character c : r.toCharArray()) + o.onNext(c); + o.onCompleted(); + }); + }, + r -> System.out.println("Disposed: " + r) + ); + + values.subscribe( + v -> result[0] += v, + e -> result[0] += e + ); + assertTrue(result[0].equals("MyResource")); + } +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/SchedulersTest.java b/rxjava/src/test/java/com/baeldung/rxjava/SchedulersTest.java new file mode 100644 index 0000000000..1d36501fed --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/SchedulersTest.java @@ -0,0 +1,238 @@ +package com.baeldung.rxjava; + + +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import rx.Observable; +import rx.Scheduler; +import rx.observers.TestSubscriber; +import rx.schedulers.Schedulers; +import rx.schedulers.TestScheduler; + +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; + +import static java.util.concurrent.Executors.newFixedThreadPool; +import static org.hamcrest.Matchers.hasItems; +import static org.junit.Assert.assertThat; + +public class SchedulersTest { + String result = ""; + String result1 = ""; + String result2 = ""; + + @Test + public void givenScheduledWorker_whenScheduleAnAction_thenResultAction() throws InterruptedException { + System.out.println("scheduling"); + Scheduler scheduler = Schedulers.immediate(); + Scheduler.Worker worker = scheduler.createWorker(); + worker.schedule(() -> result += "action"); + Assert.assertTrue(result.equals("action")); + } + + @Test + public void givenScheduledWorker_whenUnsubscribeOnWorker_thenResultFirstAction() throws InterruptedException { + System.out.println("canceling"); + Scheduler scheduler = Schedulers.newThread(); + Scheduler.Worker worker = scheduler.createWorker(); + worker.schedule(() -> { + result += "First_Action"; + worker.unsubscribe(); + }); + worker.schedule(() -> result += "Second_Action"); + Thread.sleep(500); + Assert.assertTrue(result.equals("First_Action")); + } + + @Ignore //it's not safe, not every time is running correctly + @Test + public void givenWorker_whenScheduledOnNewThread_thenResultIsBoundToNewThread() throws InterruptedException { + System.out.println("newThread_1"); + Scheduler scheduler = Schedulers.newThread(); + Scheduler.Worker worker = scheduler.createWorker(); + worker.schedule(() -> { + result += Thread.currentThread().getName() + "_Start"; + worker.schedule(() -> result += "_worker_"); + result += "_End"; + }); + Thread.sleep(2000); + Assert.assertTrue(result.equals("RxNewThreadScheduler-1_Start_End_worker_")); + } + + @Test + public void givenObservable_whenObserveOnNewThread_thenRunOnDifferentThreadEachTime() throws InterruptedException { + System.out.println("newThread_2"); + Observable.just("Hello") + .observeOn(Schedulers.newThread()) + .doOnNext(s -> + result2 += Thread.currentThread().getName() + ) + .observeOn(Schedulers.newThread()) + .subscribe(s -> + result1 += Thread.currentThread().getName() + ); + Thread.sleep(500); + Assert.assertTrue(result1.equals("RxNewThreadScheduler-1")); + Assert.assertTrue(result2.equals("RxNewThreadScheduler-2")); + } + + @Test + public void givenWorker_whenScheduledOnImmediate_thenResultIsBoundToThread() throws InterruptedException { + System.out.println("immediate_1"); + Scheduler scheduler = Schedulers.immediate(); + Scheduler.Worker worker = scheduler.createWorker(); + worker.schedule(() -> { + result += Thread.currentThread().getName() + "_Start"; + worker.schedule(() -> result += "_worker_"); + result += "_End"; + }); + Thread.sleep(500); + Assert.assertTrue(result.equals("main_Start_worker__End")); + } + + @Test + public void givenObservable_whenImmediateScheduled_thenExecuteOnMainThread() throws InterruptedException { + System.out.println("immediate_2"); + Observable.just("Hello") + .subscribeOn(Schedulers.immediate()) + .subscribe(s -> + result += Thread.currentThread().getName() + ); + Thread.sleep(500); + Assert.assertTrue(result.equals("main")); + } + + + @Test + public void givenObservable_whenTrampolineScheduled_thenExecuteOnMainThread() throws InterruptedException { + System.out.println("trampoline_1"); + Observable.just(2, 4, 6, 8) + .subscribeOn(Schedulers.trampoline()) + .subscribe(i -> result += "" + i); + Observable.just(1, 3, 5, 7, 9) + .subscribeOn(Schedulers.trampoline()) + .subscribe(i -> result += "" + i); + Thread.sleep(500); + Assert.assertTrue(result.equals("246813579")); + } + + @Test + public void givenWorker_whenScheduledOnTrampoline_thenComposeResultAsBlocking() throws InterruptedException { + System.out.println("trampoline_2"); + Scheduler scheduler = Schedulers.trampoline(); + Scheduler.Worker worker = scheduler.createWorker(); + worker.schedule(() -> { + result += Thread.currentThread().getName() + "Start"; + worker.schedule(() -> { + result += "_middleStart"; + worker.schedule(() -> + result += "_worker_" + ); + result += "_middleEnd"; + }); + result += "_mainEnd"; + }); + Thread.sleep(500); + Assert.assertTrue(result + .equals("mainStart_mainEnd_middleStart_middleEnd_worker_")); + } + + private ThreadFactory threadFactory(String pattern) { + return new ThreadFactoryBuilder() + .setNameFormat(pattern) + .build(); + } + + @Test + public void givenExecutors_whenSchedulerFromCreatedExecutors_thenReturnElementsOnEacheThread() throws InterruptedException { + System.out.println("from"); + ExecutorService poolA = newFixedThreadPool(10, threadFactory("Sched-A-%d")); + Scheduler schedulerA = Schedulers.from(poolA); + ExecutorService poolB = newFixedThreadPool(10, threadFactory("Sched-B-%d")); + Scheduler schedulerB = Schedulers.from(poolB); + + Observable observable = Observable.create(subscriber -> { + subscriber.onNext("Alfa"); + subscriber.onNext("Beta"); + subscriber.onCompleted(); + });; + + observable + .subscribeOn(schedulerA) + .subscribeOn(schedulerB) + .subscribe( + x -> result += Thread.currentThread().getName() + x + "_", + Throwable::printStackTrace, + () -> result += "_Completed" + ); + Thread.sleep(2000); + Assert.assertTrue(result.equals("Sched-A-0Alfa_Sched-A-0Beta__Completed")); + } + + @Test + public void givenObservable_whenIoScheduling_thenReturnThreadName() throws InterruptedException { + System.out.println("io"); + Observable.just("io") + .subscribeOn(Schedulers.io()) + .subscribe(i -> result += Thread.currentThread().getName()); + Thread.sleep(500); + Assert.assertTrue(result.equals("RxIoScheduler-2")); + } + + @Test + public void givenObservable_whenComputationScheduling_thenReturnThreadName() throws InterruptedException { + System.out.println("computation"); + Observable.just("computation") + .subscribeOn(Schedulers.computation()) + .subscribe(i -> result += Thread.currentThread().getName()); + Thread.sleep(500); + Assert.assertTrue(result.equals("RxComputationScheduler-1")); + } + + @Test + public void givenLetters_whenTestScheduling_thenReturnValuesControllingAdvanceTime() throws InterruptedException { + List letters = Arrays.asList("A", "B", "C"); + TestScheduler scheduler = Schedulers.test(); + TestSubscriber subscriber = new TestSubscriber<>(); + + Observable tick = Observable.interval(1, TimeUnit.SECONDS, scheduler); + + Observable.from(letters) + .zipWith(tick, (string, index) -> index + "-" + string) + .subscribeOn(scheduler) + .subscribe(subscriber); + + subscriber.assertNoValues(); + subscriber.assertNotCompleted(); + + scheduler.advanceTimeBy(1, TimeUnit.SECONDS); + subscriber.assertNoErrors(); + subscriber.assertValueCount(1); + subscriber.assertValues("0-A"); + + scheduler.advanceTimeTo(3, TimeUnit.SECONDS); + subscriber.assertCompleted(); + subscriber.assertNoErrors(); + subscriber.assertValueCount(3); + assertThat(subscriber.getOnNextEvents(), hasItems("0-A", "1-B", "2-C")); + } + + @Test + public void givenLetters_whenDelay_thenReturne() throws InterruptedException { + ExecutorService poolA = newFixedThreadPool(10, threadFactory("Sched1-")); + Scheduler schedulerA = Schedulers.from(poolA); + Observable.just('A', 'B') + .delay(1, TimeUnit.SECONDS, schedulerA) + .subscribe(i -> result+= Thread.currentThread().getName() + i + " "); + + Thread.sleep(2000); + Assert.assertTrue(result.equals("Sched1-A Sched1-B ")); + } + +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/SingleTest.java b/rxjava/src/test/java/com/baeldung/rxjava/SingleTest.java new file mode 100644 index 0000000000..6d428d856b --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/SingleTest.java @@ -0,0 +1,24 @@ +package com.baeldung.rxjava; + +import org.junit.Test; +import rx.Observable; +import rx.Single; + +import static junit.framework.Assert.assertTrue; + +public class SingleTest { + + @Test + public void givenSingleObservable_whenSuccess_thenGetMessage() throws InterruptedException { + String[] result = {""}; + Single single = Observable.just("Hello") + .toSingle() + .doOnSuccess(i -> result[0] += i) + .doOnError(error -> { + throw new RuntimeException(error.getMessage()); + }); + single.subscribe(); + assertTrue(result[0].equals("Hello")); + } + +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/SubjectTest.java b/rxjava/src/test/java/com/baeldung/rxjava/SubjectTest.java new file mode 100644 index 0000000000..429a7fe231 --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/SubjectTest.java @@ -0,0 +1,26 @@ +package com.baeldung.rxjava; + +import com.baelding.rxjava.SubjectImpl; +import org.junit.Test; +import rx.subjects.PublishSubject; + +import static junit.framework.Assert.assertTrue; + +public class SubjectTest { + + @Test + public void givenSubjectAndTwoSubscribers_whenSubscribeOnSubject_thenSubscriberBeginsToAdd(){ + PublishSubject subject = PublishSubject.create(); + + subject.subscribe(SubjectImpl.getFirstObserver()); + subject.onNext(1); + subject.onNext(2); + subject.onNext(3); + + subject.subscribe(SubjectImpl.getSecondObserver()); + subject.onNext(4); + subject.onCompleted(); + + assertTrue(SubjectImpl.subscriber1 + SubjectImpl.subscriber2 == 14); + } +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/UtilityOperatorsTest.java b/rxjava/src/test/java/com/baeldung/rxjava/UtilityOperatorsTest.java new file mode 100644 index 0000000000..8ce370e356 --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/UtilityOperatorsTest.java @@ -0,0 +1,273 @@ +package com.baeldung.rxjava; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import rx.Observable; +import rx.Observer; +import rx.exceptions.OnErrorNotImplementedException; +import rx.schedulers.Schedulers; + +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertTrue; + +public class UtilityOperatorsTest { + + int emittedTotal = 0; + int receivedTotal = 0; + String result = ""; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Test + public void givenObservable_whenObserveOnAfterOnNext_thenEmitsEventsOnComputeScheduler() throws InterruptedException { + + Observable.range(1, 5) + .map(i -> i * 100) + .doOnNext(i -> { + emittedTotal += i; + System.out.println("Emitting " + i + + " on thread " + Thread.currentThread().getName()); + }) + .observeOn(Schedulers.computation()) + .map(i -> i * 10) + .subscribe(i -> { + receivedTotal += i; + System.out.println("Received " + i + " on thread " + + Thread.currentThread().getName()); + }); + + Thread.sleep(2000); + assertTrue(emittedTotal == 1500); + assertTrue(receivedTotal == 15000); + } + + + @Test + public void givenObservable_whenObserveOnBeforeOnNext_thenEmitsEventsOnComputeScheduler() throws InterruptedException { + + Observable.range(1, 5) + .map(i -> i * 100) + .observeOn(Schedulers.computation()) + .doOnNext(i -> { + emittedTotal += i; + System.out.println("Emitting " + i + + " on thread " + Thread.currentThread().getName()); + }) + .map(i -> i * 10) + .subscribe(i -> { + receivedTotal += i; + System.out.println("Received " + i + " on thread " + + Thread.currentThread().getName()); + }); + + Thread.sleep(2000); + assertTrue(emittedTotal == 1500); + assertTrue(receivedTotal == 15000); + } + + + @Test + public void givenObservable_whenSubscribeOn_thenEmitsEventsOnComputeScheduler() throws InterruptedException { + + Observable.range(1, 5) + .map(i -> i * 100) + .doOnNext(i -> { + emittedTotal += i; + System.out.println("Emitting " + i + + " on thread " + Thread.currentThread().getName()); + }) + .subscribeOn(Schedulers.computation()) + .map(i -> i * 10) + .subscribe(i -> { + receivedTotal += i; + System.out.println("Received " + i + " on thread " + + Thread.currentThread().getName()); + }); + + Thread.sleep(2000); + assertTrue(emittedTotal == 1500); + assertTrue(receivedTotal == 15000); + } + + + @Test + public void givenObservableWithOneEvent_whenSingle_thenEmitEvent() { + + Observable.range(1, 1) + .single() + .subscribe(i -> receivedTotal += i); + assertTrue(receivedTotal == 1); + } + + @Test + public void givenObservableWithNoEvents_whenSingle_thenThrowException() { + + Observable.range(1, 3) + .single() + .onErrorReturn(e -> receivedTotal += 10) + .subscribe(); + assertTrue(receivedTotal == 10); + } + + @Test + public void givenObservableWihNoEvents_whenSingleOrDefault_thenDefaultMessage() { + + Observable.empty() + .singleOrDefault("Default") + .subscribe(i -> result += i); + assertTrue(result.equals("Default")); + } + + @Test + public void givenObservableWithManyEvents_whenSingleOrDefault_thenThrowException() { + + Observable.range(1, 3) + .singleOrDefault(5) + .onErrorReturn(e -> receivedTotal += 10) + .subscribe(); + assertTrue(receivedTotal == 10); + } + + @Test + public void givenObservable_whenDoOnNextAndDoOnCompleted_thenSumAllEventsAndShowMessage() { + + Observable.range(1, 10) + .doOnNext(r -> receivedTotal += r) + .doOnCompleted(() -> result = "Completed") + .subscribe(); + assertTrue(receivedTotal == 55); + assertTrue(result.equals("Completed")); + } + + @Test + public void givenObservable_whenDoOnEachAndDoOnSubscribe_thenSumAllValuesAndShowMessage() { + + Observable.range(1, 10) + .doOnEach(new Observer() { + @Override + public void onCompleted() { + System.out.println("Complete"); + } + + @Override + public void onError(Throwable e) { + e.printStackTrace(); + } + + @Override + public void onNext(Integer value) { + receivedTotal += value; + } + }) + .doOnSubscribe(() -> result = "Subscribed") + .subscribe(); + assertTrue(receivedTotal == 55); + assertTrue(result.equals("Subscribed")); + } + + @Test + public void givenObservable_whenDoOnErrorDoOnTerminateAndDoAfterTerminate_thenShowErrorTerminateAndAfterTerminateMessages() { + + thrown.expect(OnErrorNotImplementedException.class); + Observable.empty() + .single() + .doOnError(throwable -> { + throw new RuntimeException("error"); + }) + .doOnTerminate(() -> result += "doOnTerminate") + .doAfterTerminate(() -> result += "_doAfterTerminate") + .subscribe(); + assertTrue(result.equals("doOnTerminate_doAfterTerminate")); + } + + @Test + public void givenObservable_whenTimestamp_thenEventsShouldAppearTimestamped() { + + Observable.range(1, 10) + .timestamp() + .map(o -> result = o.getClass().toString()) + .last() + .subscribe(); + assertTrue(result.equals("class rx.schedulers.Timestamped")); + } + + @Test + public void givenObservables_whenDelay_thenEventsStartAppearAfterATime() throws InterruptedException { + + Observable source + = Observable.interval(1, TimeUnit.SECONDS) + .take(5) + .timestamp(); + + Observable delay + = source.delaySubscription(2, TimeUnit.SECONDS); + + source.subscribe( + value -> System.out.println("source :" + value), + t -> System.out.println("source error"), + () -> System.out.println("source completed")); + + delay.subscribe( + value -> System.out.println("delay : " + value), + t -> System.out.println("delay error"), + () -> System.out.println("delay completed")); + Thread.sleep(8000); + } + + @Test + public void givenObservable_whenRepeat_thenSumNumbersThreeTimes() { + + Observable.range(1, 3) + .repeat(3) + .subscribe(i -> receivedTotal += i); + assertTrue(receivedTotal == 18); + } + + @Test + public void givenObservable_whenUsing_thenReturnCreatedResource() { + + Observable values = Observable.using( + () -> "resource", + r -> { + return Observable.create(o -> { + for (Character c : r.toCharArray()) { + o.onNext(c); + } + o.onCompleted(); + }); + }, + r -> System.out.println("Disposed: " + r) + ); + values.subscribe( + v -> result += v, + e -> result += e + ); + assertTrue(result.equals("resource")); + } + + + @Test + public void givenObservableCached_whenSubscribesWith2Actions_thenEmitsCachedValues() { + + Observable source = + Observable.create(subscriber -> { + System.out.println("Create"); + subscriber.onNext(receivedTotal += 5); + subscriber.onCompleted(); + } + ).cache(); + source.subscribe(i -> { + System.out.println("element 1"); + receivedTotal += 1; + }); + source.subscribe(i -> { + System.out.println("element 2"); + receivedTotal += 2; + }); + assertTrue(receivedTotal == 8); + } + +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/jdbc/AutomapClassTest.java b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/AutomapClassTest.java new file mode 100644 index 0000000000..f44d4ac6b8 --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/AutomapClassTest.java @@ -0,0 +1,63 @@ +package com.baeldung.rxjava.jdbc; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.github.davidmoten.rx.jdbc.ConnectionProvider; +import com.github.davidmoten.rx.jdbc.Database; + +import rx.Observable; + +public class AutomapClassTest { + + ConnectionProvider connectionProvider = Connector.connectionProvider; + Database db = Database.from(connectionProvider); + + Observable create = null; + Observable insert1, insert2 = null; + + @Before + public void setup() { + create = db.update("CREATE TABLE IF NOT EXISTS MANAGER(id int primary key, name varchar(255))") + .count(); + insert1 = db.update("INSERT INTO MANAGER(id, name) VALUES(1, 'Alan')") + .dependsOn(create) + .count(); + insert2 = db.update("INSERT INTO MANAGER(id, name) VALUES(2, 'Sarah')") + .dependsOn(create) + .count(); + } + + @Test + public void whenSelectManagersAndAutomap_thenCorrect() { + List managers = db.select("select id, name from MANAGER") + .dependsOn(create) + .dependsOn(insert1) + .dependsOn(insert2) + .autoMap(Manager.class) + .toList() + .toBlocking() + .single(); + + assertThat(managers.get(0) + .getId()).isEqualTo(1); + assertThat(managers.get(0) + .getName()).isEqualTo("Alan"); + assertThat(managers.get(1) + .getId()).isEqualTo(2); + assertThat(managers.get(1) + .getName()).isEqualTo("Sarah"); + } + + @After + public void close() { + db.update("DROP TABLE MANAGER") + .dependsOn(create); + connectionProvider.close(); + } +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/jdbc/AutomapInterfaceTest.java b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/AutomapInterfaceTest.java new file mode 100644 index 0000000000..79bae281eb --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/AutomapInterfaceTest.java @@ -0,0 +1,64 @@ +package com.baeldung.rxjava.jdbc; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.github.davidmoten.rx.jdbc.ConnectionProvider; +import com.github.davidmoten.rx.jdbc.Database; + +import rx.Observable; + +public class AutomapInterfaceTest { + + ConnectionProvider connectionProvider = Connector.connectionProvider; + Database db = Database.from(connectionProvider); + + Observable create = null; + Observable insert1, insert2 = null; + + @Before + public void setup() { + create = db.update("CREATE TABLE IF NOT EXISTS EMPLOYEE(id int primary key, name varchar(255))") + .count(); + insert1 = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(1, 'Alan')") + .dependsOn(create) + .count(); + insert2 = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(2, 'Sarah')") + .dependsOn(create) + .count(); + } + + @Test + public void whenSelectFromTableAndAutomap_thenCorrect() { + List employees = db.select("select id, name from EMPLOYEE") + .dependsOn(create) + .dependsOn(insert1) + .dependsOn(insert2) + .autoMap(Employee.class) + .toList() + .toBlocking() + .single(); + + assertThat(employees.get(0) + .id()).isEqualTo(1); + assertThat(employees.get(0) + .name()).isEqualTo("Alan"); + assertThat(employees.get(1) + .id()).isEqualTo(2); + assertThat(employees.get(1) + .name()).isEqualTo("Sarah"); + } + + @After + public void close() { + db.update("DROP TABLE EMPLOYEE") + .dependsOn(create); + connectionProvider.close(); + } + +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/jdbc/BasicQueryTypesTest.java b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/BasicQueryTypesTest.java new file mode 100644 index 0000000000..7677b2375d --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/BasicQueryTypesTest.java @@ -0,0 +1,64 @@ +package com.baeldung.rxjava.jdbc; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.List; + +import org.junit.After; +import org.junit.Test; + +import com.github.davidmoten.rx.jdbc.ConnectionProvider; +import com.github.davidmoten.rx.jdbc.Database; + +import rx.Observable; + +public class BasicQueryTypesTest { + + ConnectionProvider connectionProvider = Connector.connectionProvider; + Database db = Database.from(connectionProvider); + + Observable create, insert1, insert2, insert3, update, delete = null; + + @Test + public void whenCreateTableAndInsertRecords_thenCorrect() { + create = db.update("CREATE TABLE IF NOT EXISTS EMPLOYEE(id int primary key, name varchar(255))") + .count(); + insert1 = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(1, 'John')") + .dependsOn(create) + .count(); + update = db.update("UPDATE EMPLOYEE SET name = 'Alan' WHERE id = 1") + .dependsOn(create) + .count(); + insert2 = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(2, 'Sarah')") + .dependsOn(create) + .count(); + insert3 = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(3, 'Mike')") + .dependsOn(create) + .count(); + delete = db.update("DELETE FROM EMPLOYEE WHERE id = 2") + .dependsOn(create) + .count(); + List names = db.select("select name from EMPLOYEE where id < ?") + .parameter(3) + .dependsOn(create) + .dependsOn(insert1) + .dependsOn(insert2) + .dependsOn(insert3) + .dependsOn(update) + .dependsOn(delete) + .getAs(String.class) + .toList() + .toBlocking() + .single(); + + assertEquals(Arrays.asList("Alan"), names); + } + + @After + public void close() { + db.update("DROP TABLE EMPLOYEE") + .dependsOn(create); + connectionProvider.close(); + } +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/jdbc/InsertBlobTest.java b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/InsertBlobTest.java new file mode 100644 index 0000000000..fb3018ede4 --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/InsertBlobTest.java @@ -0,0 +1,65 @@ +package com.baeldung.rxjava.jdbc; + +import static org.junit.Assert.assertEquals; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.github.davidmoten.rx.jdbc.ConnectionProvider; +import com.github.davidmoten.rx.jdbc.Database; + +import rx.Observable; + +public class InsertBlobTest { + + ConnectionProvider connectionProvider = Connector.connectionProvider; + Database db = Database.from(connectionProvider); + + String expectedDocument = null; + String actualDocument = null; + + Observable create, insert = null; + + @Before + public void setup() throws IOException { + create = db.update("CREATE TABLE IF NOT EXISTS SERVERLOG (id int primary key, document BLOB)") + .count(); + + InputStream actualInputStream = new FileInputStream("src/test/resources/actual_clob"); + this.actualDocument = Utils.getStringFromInputStream(actualInputStream); + byte[] bytes = this.actualDocument.getBytes(StandardCharsets.UTF_8); + + InputStream expectedInputStream = new FileInputStream("src/test/resources/expected_clob"); + this.expectedDocument = Utils.getStringFromInputStream(expectedInputStream); + this.insert = db.update("insert into SERVERLOG(id,document) values(?,?)") + .parameter(1) + .parameter(Database.toSentinelIfNull(bytes)) + .dependsOn(create) + .count(); + } + + @Test + public void whenInsertBLOB_thenCorrect() throws IOException { + db.select("select document from SERVERLOG where id = 1") + .dependsOn(create) + .dependsOn(insert) + .getAs(String.class) + .toList() + .toBlocking() + .single(); + assertEquals(expectedDocument, actualDocument); + } + + @After + public void close() { + db.update("DROP TABLE SERVERLOG") + .dependsOn(create); + connectionProvider.close(); + } +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/jdbc/InsertClobTest.java b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/InsertClobTest.java new file mode 100644 index 0000000000..d29c2e3de2 --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/InsertClobTest.java @@ -0,0 +1,63 @@ +package com.baeldung.rxjava.jdbc; + +import static org.junit.Assert.assertEquals; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.github.davidmoten.rx.jdbc.ConnectionProvider; +import com.github.davidmoten.rx.jdbc.Database; + +import rx.Observable; + +public class InsertClobTest { + + ConnectionProvider connectionProvider = Connector.connectionProvider; + Database db = Database.from(connectionProvider); + + String expectedDocument = null; + String actualDocument = null; + + Observable create, insert = null; + + @Before + public void setup() throws IOException { + create = db.update("CREATE TABLE IF NOT EXISTS SERVERLOG (id int primary key, document CLOB)") + .count(); + + InputStream actualInputStream = new FileInputStream("src/test/resources/actual_clob"); + this.actualDocument = Utils.getStringFromInputStream(actualInputStream); + + InputStream expectedInputStream = new FileInputStream("src/test/resources/expected_clob"); + this.expectedDocument = Utils.getStringFromInputStream(expectedInputStream); + this.insert = db.update("insert into SERVERLOG(id,document) values(?,?)") + .parameter(1) + .parameter(Database.toSentinelIfNull(actualDocument)) + .dependsOn(create) + .count(); + } + + @Test + public void whenSelectCLOB_thenCorrect() throws IOException { + db.select("select document from SERVERLOG where id = 1") + .dependsOn(create) + .dependsOn(insert) + .getAs(String.class) + .toList() + .toBlocking() + .single(); + assertEquals(expectedDocument, actualDocument); + } + + @After + public void close() { + db.update("DROP TABLE SERVERLOG") + .dependsOn(create); + connectionProvider.close(); + } +} \ No newline at end of file diff --git a/rxjava/src/test/java/com/baeldung/rxjava/jdbc/ReturnKeysTest.java b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/ReturnKeysTest.java new file mode 100644 index 0000000000..87604b6c5f --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/ReturnKeysTest.java @@ -0,0 +1,48 @@ +package com.baeldung.rxjava.jdbc; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.github.davidmoten.rx.jdbc.ConnectionProvider; +import com.github.davidmoten.rx.jdbc.Database; + +import rx.Observable; + +public class ReturnKeysTest { + + Observable begin, commit = null; + Observable createStatement, insertStatement, updateStatement = null; + + ConnectionProvider connectionProvider = Connector.connectionProvider; + Database db = Database.from(connectionProvider); + + @Before + public void setup() { + begin = db.beginTransaction(); + createStatement = db.update("CREATE TABLE IF NOT EXISTS EMPLOYEE(id int auto_increment primary key, name varchar(255))") + .dependsOn(begin) + .count(); + } + + @Test + public void whenInsertAndReturnGeneratedKey_thenCorrect() { + Integer key = db.update("INSERT INTO EMPLOYEE(name) VALUES('John')") + .dependsOn(createStatement) + .returnGeneratedKeys() + .getAs(Integer.class) + .count() + .toBlocking() + .single(); + assertThat(key).isEqualTo(1); + } + + @After + public void close() { + db.update("DROP TABLE EMPLOYEE") + .dependsOn(createStatement); + connectionProvider.close(); + } +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/jdbc/TransactionTest.java b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/TransactionTest.java new file mode 100644 index 0000000000..9603a11c46 --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/jdbc/TransactionTest.java @@ -0,0 +1,50 @@ +package com.baeldung.rxjava.jdbc; + +import static org.junit.Assert.assertEquals; + +import org.junit.After; +import org.junit.Test; + +import com.github.davidmoten.rx.jdbc.ConnectionProvider; +import com.github.davidmoten.rx.jdbc.Database; + +import rx.Observable; + +public class TransactionTest { + + Observable begin, commit = null; + Observable createStatement, insertStatement, updateStatement = null; + + ConnectionProvider connectionProvider = Connector.connectionProvider; + Database db = Database.from(connectionProvider); + + @Test + public void whenCommitTransaction_thenRecordUpdated() { + Observable begin = db.beginTransaction(); + Observable createStatement = db + .update("CREATE TABLE IF NOT EXISTS EMPLOYEE(id int primary key, name varchar(255))") + .dependsOn(begin) + .count(); + Observable insertStatement = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(1, 'John')") + .dependsOn(createStatement) + .count(); + Observable updateStatement = db.update("UPDATE EMPLOYEE SET name = 'Tom' WHERE id = 1") + .dependsOn(insertStatement) + .count(); + Observable commit = db.commit(updateStatement); + String name = db.select("select name from EMPLOYEE WHERE id = 1") + .dependsOn(commit) + .getAs(String.class) + .toBlocking() + .single(); + + assertEquals("Tom", name); + } + + @After + public void close() { + db.update("DROP TABLE EMPLOYEE") + .dependsOn(createStatement); + connectionProvider.close(); + } +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/onerror/ExceptionHandlingTest.java b/rxjava/src/test/java/com/baeldung/rxjava/onerror/ExceptionHandlingTest.java new file mode 100644 index 0000000000..297cfa980b --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/onerror/ExceptionHandlingTest.java @@ -0,0 +1,141 @@ +package com.baeldung.rxjava.onerror; + +import io.reactivex.Observable; +import io.reactivex.exceptions.CompositeException; +import io.reactivex.observers.TestObserver; +import org.junit.Test; + +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.junit.Assert.assertTrue; + +/** + * @author aiet + */ +public class ExceptionHandlingTest { + + private Error UNKNOWN_ERROR = new Error("unknown error"); + private Exception UNKNOWN_EXCEPTION = new Exception("unknown exception"); + + @Test + public void givenSubscriberAndError_whenHandleOnErrorReturn_thenResumed() { + TestObserver testObserver = new TestObserver(); + + Observable + .error(UNKNOWN_ERROR) + .onErrorReturn(Throwable::getMessage) + .subscribe(testObserver); + + testObserver.assertNoErrors(); + testObserver.assertComplete(); + testObserver.assertValueCount(1); + testObserver.assertValue("unknown error"); + } + + @Test + public void givenSubscriberAndError_whenHandleOnErrorResume_thenResumed() { + TestObserver testObserver = new TestObserver(); + + Observable + .error(UNKNOWN_ERROR) + .onErrorResumeNext(Observable.just("one", "two")) + .subscribe(testObserver); + + testObserver.assertNoErrors(); + testObserver.assertComplete(); + testObserver.assertValueCount(2); + testObserver.assertValues("one", "two"); + } + + @Test + public void givenSubscriberAndError_whenHandleOnErrorResumeItem_thenResumed() { + TestObserver testObserver = new TestObserver(); + + Observable + .error(UNKNOWN_ERROR) + .onErrorReturnItem("singleValue") + .subscribe(testObserver); + + testObserver.assertNoErrors(); + testObserver.assertComplete(); + testObserver.assertValueCount(1); + testObserver.assertValue("singleValue"); + } + + @Test + public void givenSubscriberAndError_whenHandleOnErrorResumeFunc_thenResumed() { + TestObserver testObserver = new TestObserver(); + + Observable + .error(UNKNOWN_ERROR) + .onErrorResumeNext(throwable -> { + return Observable.just(throwable.getMessage(), "nextValue"); + }) + .subscribe(testObserver); + + testObserver.assertNoErrors(); + testObserver.assertComplete(); + testObserver.assertValueCount(2); + testObserver.assertValues("unknown error", "nextValue"); + } + + @Test + public void givenSubscriberAndError_whenChangeStateOnError_thenErrorThrown() { + TestObserver testObserver = new TestObserver(); + final AtomicBoolean state = new AtomicBoolean(false); + + Observable + .error(UNKNOWN_ERROR) + .doOnError(throwable -> state.set(true)) + .subscribe(testObserver); + + testObserver.assertError(UNKNOWN_ERROR); + testObserver.assertNotComplete(); + testObserver.assertNoValues(); + assertTrue("state should be changed", state.get()); + } + + @Test + public void givenSubscriberAndError_whenExceptionOccurOnError_thenCompositeExceptionThrown() { + TestObserver testObserver = new TestObserver(); + + Observable + .error(UNKNOWN_ERROR) + .doOnError(throwable -> { + throw new RuntimeException("unexcepted"); + }) + .subscribe(testObserver); + + testObserver.assertError(CompositeException.class); + testObserver.assertNotComplete(); + testObserver.assertNoValues(); + } + + @Test + public void givenSubscriberAndException_whenHandleOnException_thenResumed() { + TestObserver testObserver = new TestObserver(); + + Observable + .error(UNKNOWN_EXCEPTION) + .onExceptionResumeNext(Observable.just("exceptionResumed")) + .subscribe(testObserver); + + testObserver.assertNoErrors(); + testObserver.assertComplete(); + testObserver.assertValueCount(1); + testObserver.assertValue("exceptionResumed"); + } + + @Test + public void givenSubscriberAndError_whenHandleOnException_thenNotResumed() { + TestObserver testObserver = new TestObserver(); + Observable + .error(UNKNOWN_ERROR) + .onExceptionResumeNext(Observable.just("exceptionResumed")) + .subscribe(testObserver); + + testObserver.assertError(UNKNOWN_ERROR); + testObserver.assertNotComplete(); + } + +} diff --git a/rxjava/src/test/java/com/baeldung/rxjava/onerror/OnErrorRetryTest.java b/rxjava/src/test/java/com/baeldung/rxjava/onerror/OnErrorRetryTest.java new file mode 100644 index 0000000000..0f9c39ad1b --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/onerror/OnErrorRetryTest.java @@ -0,0 +1,149 @@ +package com.baeldung.rxjava.onerror; + +import io.reactivex.Observable; +import io.reactivex.observers.TestObserver; +import org.junit.Test; + +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import static org.junit.Assert.assertTrue; + +/** + * @author aiet + */ +public class OnErrorRetryTest { + + private Error UNKNOWN_ERROR = new Error("unknown error"); + + @Test + public void givenSubscriberAndError_whenRetryOnError_thenRetryConfirmed() { + TestObserver testObserver = new TestObserver(); + AtomicInteger atomicCounter = new AtomicInteger(0); + + Observable + .error(() -> { + atomicCounter.incrementAndGet(); + return UNKNOWN_ERROR; + }) + .retry(1) + .subscribe(testObserver); + + testObserver.assertError(UNKNOWN_ERROR); + testObserver.assertNotComplete(); + testObserver.assertNoValues(); + assertTrue("should call twice", atomicCounter.get() == 2); + } + + @Test + public void givenSubscriberAndError_whenRetryConditionallyOnError_thenRetryConfirmed() { + TestObserver testObserver = new TestObserver(); + + AtomicInteger atomicCounter = new AtomicInteger(0); + + Observable + .error(() -> { + atomicCounter.incrementAndGet(); + return UNKNOWN_ERROR; + }) + .retry((integer, throwable) -> integer < 4) + .subscribe(testObserver); + + testObserver.assertError(UNKNOWN_ERROR); + testObserver.assertNotComplete(); + testObserver.assertNoValues(); + assertTrue("should call 4 times", atomicCounter.get() == 4); + } + + @Test + public void givenSubscriberAndError_whenRetryUntilOnError_thenRetryConfirmed() { + TestObserver testObserver = new TestObserver(); + AtomicInteger atomicCounter = new AtomicInteger(0); + + Observable + .error(UNKNOWN_ERROR) + .retryUntil(() -> atomicCounter.incrementAndGet() > 3) + .subscribe(testObserver); + + testObserver.assertError(UNKNOWN_ERROR); + testObserver.assertNotComplete(); + testObserver.assertNoValues(); + assertTrue("should call 4 times", atomicCounter.get() == 4); + } + + @Test + public void givenSubscriberAndError_whenRetryWhenOnError_thenRetryConfirmed() { + TestObserver testObserver = new TestObserver(); + Exception noretryException = new Exception("don't retry"); + + Observable + .error(UNKNOWN_ERROR) + .retryWhen(throwableObservable -> Observable.error(noretryException)) + .subscribe(testObserver); + + testObserver.assertError(noretryException); + testObserver.assertNotComplete(); + testObserver.assertNoValues(); + } + + @Test + public void givenSubscriberAndError_whenRetryWhenOnError_thenCompleted() { + TestObserver testObserver = new TestObserver(); + AtomicInteger atomicCounter = new AtomicInteger(0); + + Observable + .error(() -> { + atomicCounter.incrementAndGet(); + return UNKNOWN_ERROR; + }) + .retryWhen(throwableObservable -> Observable.empty()) + .subscribe(testObserver); + + testObserver.assertNoErrors(); + testObserver.assertComplete(); + testObserver.assertNoValues(); + assertTrue("should not retry", atomicCounter.get() == 0); + } + + @Test + public void givenSubscriberAndError_whenRetryWhenOnError_thenResubscribed() { + TestObserver testObserver = new TestObserver(); + AtomicInteger atomicCounter = new AtomicInteger(0); + + Observable + .error(() -> { + atomicCounter.incrementAndGet(); + return UNKNOWN_ERROR; + }) + .retryWhen(throwableObservable -> Observable.just("anything")) + .subscribe(testObserver); + + testObserver.assertNoErrors(); + testObserver.assertComplete(); + testObserver.assertNoValues(); + assertTrue("should retry once", atomicCounter.get() == 1); + } + + @Test + public void givenSubscriberAndError_whenRetryWhenForMultipleTimesOnError_thenResumed() { + TestObserver testObserver = new TestObserver(); + long before = System.currentTimeMillis(); + + Observable + .error(UNKNOWN_ERROR) + .retryWhen(throwableObservable -> throwableObservable + .zipWith(Observable.range(1, 3), (throwable, integer) -> integer) + .flatMap(integer -> { + System.out.println("retried " + integer + " times"); + return Observable.timer(integer, TimeUnit.SECONDS); + })) + .blockingSubscribe(testObserver); + + testObserver.assertNoErrors(); + testObserver.assertComplete(); + testObserver.assertNoValues(); + long secondsElapsed = (System.currentTimeMillis() - before) / 1000; + assertTrue("6 seconds should elapse", secondsElapsed == 6); + } + +} diff --git a/rxjava/src/test/resources/actual_clob b/rxjava/src/test/resources/actual_clob new file mode 100644 index 0000000000..d7bc560556 --- /dev/null +++ b/rxjava/src/test/resources/actual_clob @@ -0,0 +1,1546 @@ +64.242.88.10 - - [07/Mar/2004:16:05:49 -0800] "GET /ops/SP/play//edit/Main/Double_bounce_sender?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:16:06:51 -0800] "GET /ops/SP/play//rdiff/TWiki/NewUserTemplate?rev1=1.3&rev2=1.2 HTTP/1.1" 200 4523 +64.242.88.10 - - [07/Mar/2004:16:10:02 -0800] "GET /mailman/listinfo/hsdivision HTTP/1.1" 200 6291 +64.242.88.10 - - [07/Mar/2004:16:11:58 -0800] "GET /ops/SP/play//view/TWiki/WikiSyntax HTTP/1.1" 200 7352 +64.242.88.10 - - [07/Mar/2004:16:20:55 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +64.242.88.10 - - [07/Mar/2004:16:23:12 -0800] "GET /ops/SP/play//oops/TWiki/AppendixFileSystem?template=oopsmore¶m1=1.12¶m2=1.12 HTTP/1.1" 200 11382 +64.242.88.10 - - [07/Mar/2004:16:24:16 -0800] "GET /ops/SP/play//view/Main/PeterThoeny HTTP/1.1" 200 4924 +64.242.88.10 - - [07/Mar/2004:16:29:16 -0800] "GET /ops/SP/play//edit/Main/Header_checks?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:16:30:29 -0800] "GET /ops/SP/play//attach/Main/OfficeLocations HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:16:31:48 -0800] "GET /ops/SP/play//view/TWiki/WebTopicEditTemplate HTTP/1.1" 200 3732 +64.242.88.10 - - [07/Mar/2004:16:32:50 -0800] "GET /ops/SP/play//view/Main/WebChanges HTTP/1.1" 200 40520 +64.242.88.10 - - [07/Mar/2004:16:33:53 -0800] "GET /ops/SP/play//edit/Main/Smtpd_etrn_restrictions?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:16:35:19 -0800] "GET /mailman/listinfo/business HTTP/1.1" 200 6379 +64.242.88.10 - - [07/Mar/2004:16:36:22 -0800] "GET /ops/SP/play//rdiff/Main/WebIndex?rev1=1.2&rev2=1.1 HTTP/1.1" 200 46373 +64.242.88.10 - - [07/Mar/2004:16:37:27 -0800] "GET /ops/SP/play//view/TWiki/DontNotify HTTP/1.1" 200 4140 +64.242.88.10 - - [07/Mar/2004:16:39:24 -0800] "GET /ops/SP/play//view/Main/TokyoOffice HTTP/1.1" 200 3853 +64.242.88.10 - - [07/Mar/2004:16:43:54 -0800] "GET /ops/SP/play//view/Main/MikeMannix HTTP/1.1" 200 3686 +64.242.88.10 - - [07/Mar/2004:16:45:56 -0800] "GET /ops/SP/play//attach/Main/PostfixCommands HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:16:47:12 -0800] "GET /robots.txt HTTP/1.1" 200 68 +64.242.88.10 - - [07/Mar/2004:16:47:46 -0800] "GET /ops/SP/play//rdiff/Know/ReadmeFirst?rev1=1.5&rev2=1.4 HTTP/1.1" 200 5724 +64.242.88.10 - - [07/Mar/2004:16:49:04 -0800] "GET /ops/SP/play//view/Main/TWikiGroups?rev=1.2 HTTP/1.1" 200 5162 +64.242.88.10 - - [07/Mar/2004:16:50:54 -0800] "GET /ops/SP/play//rdiff/Main/ConfigurationVariables HTTP/1.1" 200 59679 +64.242.88.10 - - [07/Mar/2004:16:52:35 -0800] "GET /ops/SP/play//edit/Main/Flush_service_name?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:16:53:46 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiRegistration HTTP/1.1" 200 34395 +64.242.88.10 - - [07/Mar/2004:16:54:55 -0800] "GET /ops/SP/play//rdiff/Main/NicholasLee HTTP/1.1" 200 7235 +64.242.88.10 - - [07/Mar/2004:16:56:39 -0800] "GET /ops/SP/play//view/Sandbox/WebHome?rev=1.6 HTTP/1.1" 200 8545 +64.242.88.10 - - [07/Mar/2004:16:58:54 -0800] "GET /mailman/listinfo/administration HTTP/1.1" 200 6459 +lordgun.org - - [07/Mar/2004:17:01:53 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +64.242.88.10 - - [07/Mar/2004:17:09:01 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Joris%20*Benschop[^A-Za-z] HTTP/1.1" 200 4284 +64.242.88.10 - - [07/Mar/2004:17:10:20 -0800] "GET /ops/SP/play//oops/TWiki/TextFormattingRules?template=oopsmore¶m1=1.37¶m2=1.37 HTTP/1.1" 200 11400 +64.242.88.10 - - [07/Mar/2004:17:13:50 -0800] "GET /ops/SP/play//edit/TWiki/DefaultPlugin?t=1078688936 HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:17:16:00 -0800] "GET /ops/SP/play//search/Main/?scope=topic®ex=on&search=^g HTTP/1.1" 200 3675 +64.242.88.10 - - [07/Mar/2004:17:17:27 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=^d HTTP/1.1" 200 5773 +lj1036.passgo.com - - [07/Mar/2004:17:18:36 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1090.passgo.com - - [07/Mar/2004:17:18:41 -0800] "GET /ops/SP/play//view/Main/LondonOffice HTTP/1.0" 200 3860 +64.242.88.10 - - [07/Mar/2004:17:21:44 -0800] "GET /ops/SP/play//attach/TWiki/TablePlugin HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:17:22:49 -0800] "GET /ops/SP/play//view/TWiki/ManagingWebs?rev=1.22 HTTP/1.1" 200 9310 +64.242.88.10 - - [07/Mar/2004:17:23:54 -0800] "GET /ops/SP/play//statistics/Main HTTP/1.1" 200 808 +64.242.88.10 - - [07/Mar/2004:17:26:30 -0800] "GET /ops/SP/play//view/TWiki/WikiCulture HTTP/1.1" 200 5935 +64.242.88.10 - - [07/Mar/2004:17:27:37 -0800] "GET /ops/SP/play//edit/Main/WebSearch?t=1078669682 HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:17:28:45 -0800] "GET /ops/SP/play//oops/TWiki/ResetPassword?template=oopsmore¶m1=1.4¶m2=1.4 HTTP/1.1" 200 11281 +64.242.88.10 - - [07/Mar/2004:17:29:59 -0800] "GET /ops/SP/play//view/TWiki/ManagingWebs?skin=print HTTP/1.1" 200 8806 +64.242.88.10 - - [07/Mar/2004:17:31:39 -0800] "GET /ops/SP/play//edit/Main/UvscanAndPostFix?topicparent=Main.WebHome HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:17:35:35 -0800] "GET /ops/SP/play//view/TWiki/KlausWriessnegger HTTP/1.1" 200 3848 +64.242.88.10 - - [07/Mar/2004:17:39:39 -0800] "GET /ops/SP/play//view/Main/SpamAssassin HTTP/1.1" 200 4081 +64.242.88.10 - - [07/Mar/2004:17:42:15 -0800] "GET /ops/SP/play//oops/TWiki/RichardDonkin?template=oopsmore¶m1=1.2¶m2=1.2 HTTP/1.1" 200 11281 +64.242.88.10 - - [07/Mar/2004:17:46:17 -0800] "GET /ops/SP/play//rdiff/TWiki/AlWilliams?rev1=1.3&rev2=1.2 HTTP/1.1" 200 4485 +64.242.88.10 - - [07/Mar/2004:17:47:43 -0800] "GET /ops/SP/play//rdiff/TWiki/AlWilliams?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5234 +64.242.88.10 - - [07/Mar/2004:17:50:44 -0800] "GET /ops/SP/play//view/TWiki/SvenDowideit HTTP/1.1" 200 3616 +64.242.88.10 - - [07/Mar/2004:17:53:45 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Office%20*Locations[^A-Za-z] HTTP/1.1" 200 7771 +64.242.88.10 - - [07/Mar/2004:17:56:54 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.31 HTTP/1.1" 200 23338 +64.242.88.10 - - [07/Mar/2004:17:58:00 -0800] "GET /ops/SP/play//edit/Main/KevinWGagel?t=1078670331 HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:18:00:09 -0800] "GET /ops/SP/play//edit/Main/Virtual_mailbox_lock?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:18:02:10 -0800] "GET /ops/SP/play//view/Main/WebPreferences HTTP/1.1" 200 8820 +64.242.88.10 - - [07/Mar/2004:18:04:05 -0800] "GET /ops/SP/play//view/TWiki/WikiWord?rev=1.3 HTTP/1.1" 200 6816 +lj1125.passgo.com - - [07/Mar/2004:18:06:14 -0800] "GET /ops/SP/play//oops/Sandbox/WebChanges HTTP/1.0" 200 209 +64.242.88.10 - - [07/Mar/2004:18:09:00 -0800] "GET /ops/SP/play//rdiff/Main/TWikiGuest HTTP/1.1" 200 11314 +64.242.88.10 - - [07/Mar/2004:18:10:09 -0800] "GET /ops/SP/play//edit/TWiki/TWikiVariables?t=1078684115 HTTP/1.1" 401 12846 +d207-6-9-183.bchsia.telus.net - - [07/Mar/2004:18:10:18 -0800] "GET /pipermail/cncce/2004-January/000001.jsp HTTP/1.1" 200 3095 +d207-6-9-183.bchsia.telus.net - - [07/Mar/2004:18:10:20 -0800] "GET /pipermail/cncce/2004-January/000002.jsp HTTP/1.1" 200 3810 +64.242.88.10 - - [07/Mar/2004:18:17:26 -0800] "GET /ops/SP/play//rdiff/TWiki/WikiWord?rev1=1.4&rev2=1.3 HTTP/1.1" 200 6948 +64.242.88.10 - - [07/Mar/2004:18:19:01 -0800] "GET /ops/SP/play//edit/Main/TWikiPreferences?topicparent=Main.WebHome HTTP/1.1" 401 12846 +d207-6-9-183.bchsia.telus.net - - [07/Mar/2004:18:19:16 -0800] "GET /pipermail/cncce/2004-January.txt HTTP/1.1" 200 3376 +64.242.88.10 - - [07/Mar/2004:18:22:52 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Web%20*Statistics[^A-Za-z] HTTP/1.1" 200 3584 +64.242.88.10 - - [07/Mar/2004:18:26:32 -0800] "GET /ops/SP/play//rdiff/TWiki/PeterFokkinga?rev1=1.4&rev2=1.3 HTTP/1.1" 200 4548 +64.242.88.10 - - [07/Mar/2004:18:32:39 -0800] "GET /mailman/listinfo/dentalstudies HTTP/1.1" 200 6345 +64.242.88.10 - - [07/Mar/2004:18:34:42 -0800] "GET /ops/SP/play//view/Main/TWikiGuest HTTP/1.1" 200 4449 +64.242.88.10 - - [07/Mar/2004:18:42:29 -0800] "GET /ops/SP/play//attach/Main/TWikiGroups HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:18:46:00 -0800] "GET /ops/SP/play//rdiff/TWiki/TextFormattingRules?rev1=1.36&rev2=1.35 HTTP/1.1" 200 25416 +64.242.88.10 - - [07/Mar/2004:18:47:06 -0800] "GET /ops/SP/play//rdiff/Main/TWikiGroups?rev1=1.3&rev2=1.2 HTTP/1.1" 200 4308 +64.242.88.10 - - [07/Mar/2004:18:48:15 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=.* HTTP/1.1" 200 3544 +64.242.88.10 - - [07/Mar/2004:18:52:30 -0800] "GET /ops/SP/play//edit/Main/Trigger_timeout?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:18:53:55 -0800] "GET /ops/SP/play//oops/TWiki/TWikiSite?template=oopsmore¶m1=1.21¶m2=1.21 HTTP/1.1" 200 11284 +64.242.88.10 - - [07/Mar/2004:18:57:07 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.35 HTTP/1.1" 200 27248 +64.242.88.10 - - [07/Mar/2004:18:58:52 -0800] "GET /ops/SP/play//edit/Main/Mydestination?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:18:59:52 -0800] "GET /mailman/listinfo/fcd HTTP/1.1" 200 5967 +64.242.88.10 - - [07/Mar/2004:19:01:48 -0800] "GET /ops/SP/play//rdiff/Main/WebHome?rev1=1.28&rev2=1.27 HTTP/1.1" 200 3596 +64.242.88.10 - - [07/Mar/2004:19:03:58 -0800] "GET /ops/SP/play//edit/Main/Message_size_limit?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:19:08:55 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiHistory HTTP/1.1" 200 138789 +64.242.88.10 - - [07/Mar/2004:19:10:13 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=^y HTTP/1.1" 200 3628 +64.242.88.10 - - [07/Mar/2004:19:15:38 -0800] "GET /ops/SP/play//edit/Main/Smtpd_history_flush_threshold?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:19:16:44 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=1.59 HTTP/1.1" 200 52854 +64.242.88.10 - - [07/Mar/2004:19:18:05 -0800] "GET /ops/SP/play//edit/Main/Sender_canonical_maps?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:19:19:19 -0800] "GET /mailman/listinfo/mlc HTTP/1.1" 200 6142 +64.242.88.10 - - [07/Mar/2004:19:21:01 -0800] "GET /ops/SP/play//rdiff/Main/WebChanges HTTP/1.1" 200 114241 +64.242.88.10 - - [07/Mar/2004:19:22:11 -0800] "GET /ops/SP/play//edit/Sandbox/TestTopic5?topicparent=Sandbox.WebHome HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:19:24:57 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.22 HTTP/1.1" 200 21162 +64.242.88.10 - - [07/Mar/2004:19:26:22 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=^j HTTP/1.1" 200 4524 +64.242.88.10 - - [07/Mar/2004:19:29:46 -0800] "GET /ops/SP/play//oops/TWiki/TWikiVariables?template=oopsmore¶m1=1.62¶m2=1.62 HTTP/1.1" 200 11444 +64.242.88.10 - - [07/Mar/2004:19:31:25 -0800] "GET /ops/SP/play//edit/Main/Lmtp_connect_timeout?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:19:32:45 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=^q HTTP/1.1" 200 2937 +64.242.88.10 - - [07/Mar/2004:19:36:14 -0800] "GET /ops/SP/play//view/TWiki/ManagingWebs?rev=1.21 HTTP/1.1" 200 9310 +64.242.88.10 - - [07/Mar/2004:19:39:40 -0800] "GET /ops/SP/play//edit/Main/Qmqpd_authorized_clients?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:19:41:33 -0800] "GET /ops/SP/play//edit/Main/Header_address_token_limit?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:19:42:45 -0800] "GET /ops/SP/play//edit/Main/Syslog_name?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +80-219-148-207.dclient.hispeed.ch - - [07/Mar/2004:19:47:36 -0800] "OPTIONS * HTTP/1.0" 200 - +64.242.88.10 - - [07/Mar/2004:19:49:28 -0800] "GET /ops/SP/play//oops/TWiki/TWikiHistory?template=oopsmore¶m1=1.61¶m2=1.61 HTTP/1.1" 200 11345 +64.242.88.10 - - [07/Mar/2004:19:52:28 -0800] "GET /ops/SP/play//view/TWiki/HaroldGottschalk HTTP/1.1" 200 3838 +64.242.88.10 - - [07/Mar/2004:19:54:33 -0800] "GET /ops/SP/play//view/TWiki/DefaultPlugin?rev=1.4 HTTP/1.1" 200 7298 +64.242.88.10 - - [07/Mar/2004:19:55:40 -0800] "GET /ops/SP/play//oops/TWiki/WelcomeGuest?template=oopsmore¶m1=1.20¶m2=1.20 HTTP/1.1" 200 11266 +64.242.88.10 - - [07/Mar/2004:19:56:41 -0800] "GET /ops/SP/play//rdiff/Main/WebIndex HTTP/1.1" 200 46373 +64.242.88.10 - - [07/Mar/2004:19:58:24 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiRegistration?rev1=1.10&rev2=1.9 HTTP/1.1" 200 3826 +64.242.88.10 - - [07/Mar/2004:20:00:06 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.21 HTTP/1.1" 200 20972 +64.242.88.10 - - [07/Mar/2004:20:02:13 -0800] "GET /ops/SP/play//attach/TWiki/DefaultPlugin HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:20:03:29 -0800] "GET /ops/SP/play//search/Main/?scope=topic®ex=on&search=^p HTTP/1.1" 200 7245 +206-15-133-181.dialup.ziplink.net - - [07/Mar/2004:20:04:03 -0800] "HEAD /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 0 +64.242.88.10 - - [07/Mar/2004:20:04:35 -0800] "GET /ops/SP/play//edit/Main/Smtp_pix_workaround_delay_time?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:20:07:12 -0800] "GET /ops/SP/play//edit/Main/Berkeley_db_create_buffer_size?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +mmscrm07-2.uah.goweb.net - - [07/Mar/2004:20:10:50 -0800] "GET /robots.txt HTTP/1.0" 200 68 +64.242.88.10 - - [07/Mar/2004:20:11:33 -0800] "GET /ops/SP/play//attach/TWiki/TWikiSite HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:20:12:55 -0800] "GET /ops/SP/play//edit/TWiki/TWikiSite?t=1078681794 HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:20:23:35 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Web%20*Statistics[^A-Za-z] HTTP/1.1" 200 10118 +64.242.88.10 - - [07/Mar/2004:20:25:31 -0800] "GET /ops/SP/play//edit/Main/Defer_transports?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:20:31:40 -0800] "GET /ops/SP/play//rdiff/TWiki/SearchDoesNotWork HTTP/1.1" 200 6738 +64.242.88.10 - - [07/Mar/2004:20:35:28 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=TWiki%20*Admin%20*Group[^A-Za-z] HTTP/1.1" 200 7311 +64.242.88.10 - - [07/Mar/2004:20:38:14 -0800] "GET /ops/SP/play//rdiff/TWiki/ChangePassword HTTP/1.1" 200 16670 +64.242.88.10 - - [07/Mar/2004:20:40:41 -0800] "GET /ops/SP/play//rdiff/TWiki/SvenDowideit HTTP/1.1" 200 5277 +64.242.88.10 - - [07/Mar/2004:20:42:09 -0800] "GET /ops/SP/play//rdiff/TWiki/KevinKinnell?rev1=1.5&rev2=1.4 HTTP/1.1" 200 4982 +64.242.88.10 - - [07/Mar/2004:20:44:48 -0800] "GET /ops/SP/play//edit/Main/Undisclosed_recipients_header?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:20:55:43 -0800] "GET /mailman/listinfo/hs_support HTTP/1.1" 200 6294 +64.242.88.10 - - [07/Mar/2004:20:56:56 -0800] "GET /ops/SP/play//view/TWiki/WebTopicList HTTP/1.1" 200 14070 +64.242.88.10 - - [07/Mar/2004:20:58:27 -0800] "GET /ops/SP/play//attach/TWiki/WebPreferences HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:21:03:48 -0800] "GET /ops/SP/play//view/TWiki/TWikiFAQ HTTP/1.1" 200 12050 +64.242.88.10 - - [07/Mar/2004:21:06:05 -0800] "GET /ops/SP/play//oops/TWiki/DefaultPlugin?template=oopsmore¶m1=1.5¶m2=1.5 HTTP/1.1" 200 11281 +64.242.88.10 - - [07/Mar/2004:21:07:24 -0800] "GET /ops/SP/play//rdiff/TWiki/AppendixFileSystem?rev1=1.11&rev2=1.10 HTTP/1.1" 200 40578 +64.242.88.10 - - [07/Mar/2004:21:14:32 -0800] "GET /ops/SP/play//rdiff/TWiki/FileAttribute HTTP/1.1" 200 5846 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:17 -0800] "GET /twiki/view/Main/WebHome HTTP/1.1" 404 300 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:18 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:21 -0800] "GET /twiki/ HTTP/1.1" 200 782 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:23 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:23 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:33 -0800] "GET /ops/SP/play//view/Main/TWikiUsers HTTP/1.1" 200 6697 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:40 -0800] "GET /ops/SP/play//view/Main/KevinWGagel HTTP/1.1" 200 4901 +64.242.88.10 - - [07/Mar/2004:21:20:14 -0800] "GET /ops/SP/play//edit/TWiki/RichardDonkin?t=1078691832 HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:21:21:40 -0800] "GET /ops/SP/play//oops/Main/DCC?template=oopsmore¶m1=1.1¶m2=1.1 HTTP/1.1" 200 6399 +64.242.88.10 - - [07/Mar/2004:21:23:38 -0800] "GET /ops/SP/play//view/TWiki/TWikiUpgradeTo01May2000 HTTP/1.1" 200 7463 +64.242.88.10 - - [07/Mar/2004:21:31:12 -0800] "GET /ops/SP/play//edit/Main/Mail_release_date?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:21:33:51 -0800] "GET /ops/SP/play//view/TWiki/TWikiPlugins?rev=1.19 HTTP/1.1" 200 26541 +bh02i525f01.au.ibm.com - - [07/Mar/2004:21:34:00 -0800] "GET /AmavisNew.jsp HTTP/1.0" 200 2300 +64.242.88.10 - - [07/Mar/2004:21:39:55 -0800] "GET /ops/SP/play//attach/Main/ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:21:41:04 -0800] "GET /mailman/listinfo/techcomm HTTP/1.1" 200 6155 +64.242.88.10 - - [07/Mar/2004:21:42:47 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=1.8 HTTP/1.1" 200 15618 +64.242.88.10 - - [07/Mar/2004:21:44:10 -0800] "GET /ops/SP/play//edit/Sandbox/TestTopic7?topicparent=Sandbox.WebHome HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:21:50:22 -0800] "GET /ops/SP/play//rdiff/TWiki/WebSearch HTTP/1.1" 200 55862 +64.242.88.10 - - [07/Mar/2004:21:52:05 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiTopics HTTP/1.1" 200 101445 +64.242.88.10 - - [07/Mar/2004:22:03:19 -0800] "GET /ops/SP/play//rdiff/Main/VishaalGolam HTTP/1.1" 200 5055 +64.242.88.10 - - [07/Mar/2004:22:04:44 -0800] "GET /ops/SP/play//view/Main/TWikiUsers?rev=1.21 HTTP/1.1" 200 6522 +64.242.88.10 - - [07/Mar/2004:22:06:16 -0800] "GET /ops/SP/play//edit/Main/Delay_notice_recipient?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:22:07:33 -0800] "GET /ops/SP/play//view/TWiki/WikiNotation HTTP/1.1" 200 3617 +64.242.88.10 - - [07/Mar/2004:22:08:43 -0800] "GET /ops/SP/play//edit/Main/Forward_expansion_filter?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:22:09:44 -0800] "GET /ops/SP/play//edit/Main/TestArea?topicparent=Main.WebHome HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:22:10:55 -0800] "GET /ops/SP/play//view/Main/TokyoOffice?rev=1.2 HTTP/1.1" 200 4366 +64.242.88.10 - - [07/Mar/2004:22:12:28 -0800] "GET /ops/SP/play//attach/TWiki/WebSearch HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:22:15:57 -0800] "GET /mailman/listinfo/hs_rcafaculty HTTP/1.1" 200 6345 +64.242.88.10 - - [07/Mar/2004:22:17:40 -0800] "GET /ops/SP/play//view/TWiki/TWikiSkins?skin=print HTTP/1.1" 200 9563 +64.242.88.10 - - [07/Mar/2004:22:27:18 -0800] "GET /ops/SP/play//edit/Main/OfficeLocations?t=1078691049 HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:22:29:10 -0800] "GET /ops/SP/play//view/Main/ThanadonSomdee HTTP/1.1" 200 4611 +h24-71-249-14.ca.clawio.org - - [07/Mar/2004:22:29:12 -0800] "GET /mailman/options/cnc_notice/arobin%40shaw.c HTTP/1.1" 200 3382 +h24-71-249-14.ca.clawio.org - - [07/Mar/2004:22:29:13 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +h24-71-249-14.ca.clawio.org - - [07/Mar/2004:22:29:13 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +h24-71-249-14.ca.clawio.org - - [07/Mar/2004:22:29:13 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +h24-71-249-14.ca.clawio.org - - [07/Mar/2004:22:29:41 -0800] "POST /mailman/options/cnc_notice HTTP/1.1" 200 3533 +h24-71-249-14.ca.clawio.org - - [07/Mar/2004:22:30:08 -0800] "POST /mailman/options/cnc_notice HTTP/1.1" 200 13973 +64.242.88.10 - - [07/Mar/2004:22:31:25 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.16 HTTP/1.1" 200 17361 +64.242.88.10 - - [07/Mar/2004:22:35:53 -0800] "GET /ops/SP/play//edit/Main/Default_delivery_slot_discount?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:22:36:58 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiHistory?rev1=1.10&rev2=1.9 HTTP/1.1" 200 5336 +64.242.88.10 - - [07/Mar/2004:22:39:00 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Al%20*Williams[^A-Za-z] HTTP/1.1" 200 4364 +64.242.88.10 - - [07/Mar/2004:22:45:46 -0800] "GET /ops/SP/play//edit/Main/Smtpd_banner?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:22:47:19 -0800] "GET /ops/SP/play//view/Main/WebHome?rev=r1.9 HTTP/1.1" 200 9133 +64.242.88.10 - - [07/Mar/2004:22:48:55 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiSkins?rev1=1.10&rev2=1.9 HTTP/1.1" 200 5989 +64.242.88.10 - - [07/Mar/2004:22:51:55 -0800] "GET /ops/SP/play//attach/TWiki/AndreaSterbini HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:22:53:36 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiPlugins?rev1=1.20&rev2=1.19 HTTP/1.1" 200 5140 +64.242.88.10 - - [07/Mar/2004:22:54:43 -0800] "GET /ops/SP/play//view/Know/ReadmeFirst?rev=1.4 HTTP/1.1" 200 6736 +64.242.88.10 - - [07/Mar/2004:22:58:24 -0800] "GET /ops/SP/play//view/Main/TokyoOffice?rev=r1.3 HTTP/1.1" 200 3853 +64.242.88.10 - - [07/Mar/2004:23:09:07 -0800] "GET /ops/SP/play//view/TWiki/AlWilliams?rev=1.1 HTTP/1.1" 200 3697 +calcite.rhyolite.com - - [07/Mar/2004:23:10:27 -0800] "GET /clients.jsp HTTP/1.1" 200 18753 +64.242.88.10 - - [07/Mar/2004:23:10:44 -0800] "GET /ops/SP/play//view/TWiki/JohnTalintyre HTTP/1.1" 200 3766 +64.242.88.10 - - [07/Mar/2004:23:13:51 -0800] "GET /ops/SP/play//view/TWiki/TWikiDocGraphics HTTP/1.1" 200 14492 +64.242.88.10 - - [07/Mar/2004:23:15:51 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.24 HTTP/1.1" 200 20981 +64.242.88.10 - - [07/Mar/2004:23:16:57 -0800] "GET /ops/SP/play//rdiff/Main/SanJoseOffice HTTP/1.1" 200 9524 +64.242.88.10 - - [07/Mar/2004:23:19:01 -0800] "GET /ops/SP/play//rdiff/Main/WebNotify HTTP/1.1" 200 16853 +64.242.88.10 - - [07/Mar/2004:23:20:26 -0800] "GET /ops/SP/play//view/TWiki/TWikiSiteTools HTTP/1.1" 200 14435 +64.242.88.10 - - [07/Mar/2004:23:23:00 -0800] "GET /ops/SP/play//rdiff/TWiki/RichardDonkin?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5891 +64.242.88.10 - - [07/Mar/2004:23:27:26 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Web%20*Preferences[^A-Za-z] HTTP/1.1" 200 20030 +64.242.88.10 - - [07/Mar/2004:23:30:23 -0800] "GET /ops/SP/play//rdiff/TWiki/WebHome HTTP/1.1" 200 108162 +64.242.88.10 - - [07/Mar/2004:23:34:31 -0800] "GET /ops/SP/play//edit/Main/Lmtp_quit_timeout?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:23:36:48 -0800] "GET /ops/SP/play//view/TWiki/WebSiteTools HTTP/1.1" 200 5208 +lj1036.passgo.com - - [07/Mar/2004:23:36:59 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1088.passgo.com - - [07/Mar/2004:23:36:59 -0800] "GET /ops/SP/play//oops/TWiki/JohnAltstadt HTTP/1.0" 200 209 +64.242.88.10 - - [07/Mar/2004:23:37:48 -0800] "GET /ops/SP/play//oops/Main/FileAttachment?template=oopsmore¶m1=1.3¶m2=1.3 HTTP/1.1" 200 6612 +64.242.88.10 - - [07/Mar/2004:23:42:44 -0800] "GET /ops/SP/play//edit/Main/Cleanup_service_name?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:23:47:58 -0800] "GET /ops/SP/play//view/TWiki/WikiReferences?skin=print HTTP/1.1" 200 5596 +64.242.88.10 - - [07/Mar/2004:23:50:03 -0800] "GET /ops/SP/play//view/Main/TokyoOffice?rev=1.3 HTTP/1.1" 200 3853 +64.242.88.10 - - [07/Mar/2004:23:51:38 -0800] "GET /ops/SP/play//view/Main/PostSuper?rev=r1.1 HTTP/1.1" 200 3629 +64.242.88.10 - - [07/Mar/2004:23:56:30 -0800] "GET /ops/SP/play//rdiff/Main/PostQueue HTTP/1.1" 200 4662 +64.242.88.10 - - [07/Mar/2004:23:58:53 -0800] "GET /ops/SP/play//edit/TWiki/TablePlugin?t=1078681446 HTTP/1.1" 401 12851 +dsl-80-43-113-44.access.uk.tiscali.com - - [08/Mar/2004:00:05:30 -0800] "GET / HTTP/1.1" 200 3169 +dsl-80-43-113-44.access.uk.tiscali.com - - [08/Mar/2004:00:05:35 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +dsl-80-43-113-44.access.uk.tiscali.com - - [08/Mar/2004:00:06:32 -0800] "GET /DCC.jsp HTTP/1.1" 200 2878 +64.242.88.10 - - [08/Mar/2004:00:08:58 -0800] "GET /ops/SP/play//oops/Sandbox/WebHome?template=oopsmore¶m1=1.7¶m2=1.7 HTTP/1.1" 200 4226 +64.242.88.10 - - [08/Mar/2004:00:11:22 -0800] "GET /ops/SP/play//edit/Main/WelcomeGuest?topicparent=Main.WebHome HTTP/1.1" 401 12846 +lj1125.passgo.com - - [08/Mar/2004:00:17:00 -0800] "GET /ops/SP/play//oops/Main/TWiki HTTP/1.0" 200 209 +64.242.88.10 - - [08/Mar/2004:00:17:22 -0800] "GET /ops/SP/play//view/TWiki/RichardDonkin?skin=print HTTP/1.1" 200 1729 +64.242.88.10 - - [08/Mar/2004:00:19:51 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=r1.4 HTTP/1.1" 200 7049 +64.242.88.10 - - [08/Mar/2004:00:21:54 -0800] "GET /ops/SP/play//view/TWiki/TWikiRegistration?rev=r1.7 HTTP/1.1" 200 12737 +64.242.88.10 - - [08/Mar/2004:00:25:11 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.26 HTTP/1.1" 200 22710 +64.242.88.10 - - [08/Mar/2004:00:27:53 -0800] "GET /ops/SP/play//view/TWiki/GoBox HTTP/1.1" 200 3762 +64.242.88.10 - - [08/Mar/2004:00:29:13 -0800] "GET /ops/SP/play//view/Main/FileAttachment?rev=1.1 HTTP/1.1" 200 17757 +64.242.88.10 - - [08/Mar/2004:00:32:45 -0800] "GET /ops/SP/play//attach/TWiki/KevinKinnell HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:00:36:21 -0800] "GET /ops/SP/play//rdiff/TWiki/WikiWikiClones HTTP/1.1" 200 9259 +64.242.88.10 - - [08/Mar/2004:00:37:23 -0800] "GET /ops/SP/play//oops/Main/NicholasLee?template=oopsmore¶m1=1.2¶m2=1.2 HTTP/1.1" 200 6558 +64.242.88.10 - - [08/Mar/2004:00:40:10 -0800] "GET /ops/SP/play//edit/Main/TWikiForms?topicparent=Main.TWikiVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:00:43:43 -0800] "GET /ops/SP/play//rdiff/TWiki/DefaultPlugin HTTP/1.1" 200 20376 +64.242.88.10 - - [08/Mar/2004:00:50:59 -0800] "GET /mailman/admin/educationadmin HTTP/1.1" 200 2150 +64.242.88.10 - - [08/Mar/2004:00:52:12 -0800] "GET /mailman/private/hsdivision/ HTTP/1.1" 200 1549 +64.242.88.10 - - [08/Mar/2004:00:54:26 -0800] "GET /mailman/listinfo/artsscience HTTP/1.1" 200 6248 +64.242.88.10 - - [08/Mar/2004:00:55:38 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=^i HTTP/1.1" 200 7226 +64.242.88.10 - - [08/Mar/2004:01:00:08 -0800] "GET /ops/SP/play//rdiff/TWiki/AdrianLynch HTTP/1.1" 200 4011 +64.242.88.10 - - [08/Mar/2004:01:01:15 -0800] "GET /ops/SP/play//view/Main/WelcomeGuest HTTP/1.1" 200 4723 +64.242.88.10 - - [08/Mar/2004:01:02:16 -0800] "GET /ops/SP/play//view/Main/MikeMannix?rev=1.3 HTTP/1.1" 200 4721 +64.242.88.10 - - [08/Mar/2004:01:04:05 -0800] "GET /ops/SP/play//edit/TWiki/WikiStyleWord?topicparent=TWiki.TextFormattingFAQ HTTP/1.1" 401 12846 +lj1089.passgo.com - - [08/Mar/2004:01:04:54 -0800] "GET /ops/SP/play//oops/TWiki/InterWikis HTTP/1.0" 200 209 +64.242.88.10 - - [08/Mar/2004:01:10:43 -0800] "GET /ops/SP/play//view/TWiki/FormattedSearch?rev=1.8 HTTP/1.1" 200 20434 +64.242.88.10 - - [08/Mar/2004:01:12:20 -0800] "GET /ops/SP/play//view/TWiki/TWikiEnhancementRequests?rev=1.3 HTTP/1.1" 200 4379 +64.242.88.10 - - [08/Mar/2004:01:16:37 -0800] "GET /ops/SP/play//view/Main/FileAttachment?rev=1.2 HTTP/1.1" 200 17919 +64.242.88.10 - - [08/Mar/2004:01:19:18 -0800] "GET /ops/SP/play//edit/TWiki/AppendixFileSystem?t=1078674582 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:01:24:13 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.33 HTTP/1.1" 200 26294 +64.242.88.10 - - [08/Mar/2004:01:25:15 -0800] "GET /ops/SP/play//search/Main/?scope=topic®ex=on&search=^t HTTP/1.1" 200 8306 +64.242.88.10 - - [08/Mar/2004:01:29:17 -0800] "GET /ops/SP/play//oops/TWiki/TWikiPlugins?template=oopsmore¶m1=1.21¶m2=1.21 HTTP/1.1" 200 11341 +64.242.88.10 - - [08/Mar/2004:01:30:39 -0800] "GET /mailman/private/sswk/ HTTP/1.1" 200 1531 +64.242.88.10 - - [08/Mar/2004:01:33:14 -0800] "GET /mailman/private/business/ HTTP/1.1" 200 1543 +64.242.88.10 - - [08/Mar/2004:01:35:13 -0800] "GET /ops/SP/play//edit/TWiki/InterWikis?t=1078696998 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:01:41:14 -0800] "GET /ops/SP/play//view/TWiki/WelcomeGuest?rev=r1.18 HTTP/1.1" 200 14001 +64.242.88.10 - - [08/Mar/2004:01:46:05 -0800] "GET /ops/SP/play//search/TWiki/?search=\\.*&scope=topic&order=modified&reverse=on®ex=on&nosearch=on&limit=200 HTTP/1.1" 200 101279 +64.242.88.10 - - [08/Mar/2004:01:47:06 -0800] "GET /ops/SP/play//edit/TWiki/TWikiPages?topicparent=TWiki.WelcomeGuest HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:01:48:06 -0800] "GET /ops/SP/play//view/Main/WebHome?rev=r1.16 HTTP/1.1" 200 9342 +64.242.88.10 - - [08/Mar/2004:01:50:37 -0800] "GET /ops/SP/play//rdiff/TWiki/RyanFreebern?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5243 +64.242.88.10 - - [08/Mar/2004:01:59:13 -0800] "GET /ops/SP/play//edit/Main/Smtp_line_length_limit?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:02:00:30 -0800] "GET /ops/SP/play//view/Main/WebStatistics?skin=print HTTP/1.1" 200 6194 +64.242.88.10 - - [08/Mar/2004:02:01:34 -0800] "GET /mailman/listinfo/webber HTTP/1.1" 200 6051 +64.242.88.10 - - [08/Mar/2004:02:03:12 -0800] "GET /mailman/admin/mlc HTTP/1.1" 200 2060 +64.242.88.10 - - [08/Mar/2004:02:05:15 -0800] "GET /mailman/listinfo/jjec HTTP/1.1" 200 6297 +64.242.88.10 - - [08/Mar/2004:02:06:17 -0800] "GET /mailman/listinfo/deans HTTP/1.1" 200 6102 +64.242.88.10 - - [08/Mar/2004:02:07:21 -0800] "GET /mailman/listinfo/gisgrad HTTP/1.1" 200 6024 +64.242.88.10 - - [08/Mar/2004:02:09:08 -0800] "GET /ops/SP/play//view/Main/WebNotify HTTP/1.1" 200 4468 +64.242.88.10 - - [08/Mar/2004:02:12:24 -0800] "GET /ops/SP/play//edit/Main/Setgid_group?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:02:16:24 -0800] "GET /ops/SP/play//view/Main/WebChanges?skin=print HTTP/1.1" 200 38580 +lj1016.passgo.com - - [08/Mar/2004:02:17:10 -0800] "GET /ops/SP/play//oops/TWiki/FileAttachment HTTP/1.0" 200 209 +lj1036.passgo.com - - [08/Mar/2004:02:22:19 -0800] "GET /ops/SP/play//view/Main/TWi HTTP/1.0" 200 4866 +64.242.88.10 - - [08/Mar/2004:02:23:45 -0800] "GET /ops/SP/play//rdiff/TWiki/IncludeTopicsAndWebPages HTTP/1.1" 200 20972 +64.242.88.10 - - [08/Mar/2004:02:26:44 -0800] "GET /ops/SP/play//oops/Main/WebChanges?template=oopsmore¶m1=1.2¶m2=1.2 HTTP/1.1" 200 6540 +64.242.88.10 - - [08/Mar/2004:02:27:51 -0800] "GET /ops/SP/play//rdiff/TWiki/InstantEnhancements HTTP/1.1" 200 25123 +64.242.88.10 - - [08/Mar/2004:02:33:28 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiPreferences?rev1=1.47&rev2=1.46 HTTP/1.1" 200 4313 +64.242.88.10 - - [08/Mar/2004:02:34:40 -0800] "GET /ops/SP/play//view/Main/WebHome?rev=r1.24 HTTP/1.1" 200 9769 +64.242.88.10 - - [08/Mar/2004:02:42:36 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +64.242.88.10 - - [08/Mar/2004:02:45:03 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&bookview=on&search=.* HTTP/1.1" 200 102399 +64.242.88.10 - - [08/Mar/2004:02:46:12 -0800] "GET /ops/SP/play//edit/Main/Local_recipient_maps?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [08/Mar/2004:02:47:58 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +lj1025.passgo.com - - [08/Mar/2004:02:48:05 -0800] "GET /ops/SP/play//oops/Main/KevinWGage HTTP/1.0" 200 209 +prxint-sxb3.e-i.net - - [08/Mar/2004:02:50:53 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +prxint-sxb3.e-i.net - - [08/Mar/2004:02:50:54 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +64.242.88.10 - - [08/Mar/2004:02:52:39 -0800] "GET /ops/SP/play//view/Main/PostfixCmd HTTP/1.1" 200 4173 +prxint-sxb2.e-i.net - - [08/Mar/2004:02:54:29 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.0" 200 4022 +64.242.88.10 - - [08/Mar/2004:02:54:54 -0800] "GET /ops/SP/play//edit/TWiki/NewTopic?topicparent=TWiki.WikiSyntax HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:02:59:03 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiSite HTTP/1.1" 200 71941 +64.242.88.10 - - [08/Mar/2004:03:01:12 -0800] "GET /ops/SP/play//rdiff/TWiki/SimultaneousEdits HTTP/1.1" 200 6180 +64.242.88.10 - - [08/Mar/2004:03:06:31 -0800] "GET /ops/SP/play//view/Main/NicholasLee?rev=1.2 HTTP/1.1" 200 3570 +64.242.88.10 - - [08/Mar/2004:03:07:59 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=1.9 HTTP/1.1" 200 15756 +64.242.88.10 - - [08/Mar/2004:03:09:20 -0800] "GET /mailman/listinfo/ncbnpfaculty HTTP/1.1" 200 6331 +64.242.88.10 - - [08/Mar/2004:03:11:28 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Inter%20*Wikis[^A-Za-z] HTTP/1.1" 200 5113 +64.242.88.10 - - [08/Mar/2004:03:16:22 -0800] "GET /ops/SP/play//oops/TWiki/TextFormattingFAQ?template=oopsmore¶m1=1.14¶m2=1.14 HTTP/1.1" 200 11364 +64.242.88.10 - - [08/Mar/2004:03:17:50 -0800] "GET /ops/SP/play//rdiff/Main/WebTopicList HTTP/1.1" 200 8004 +64.242.88.10 - - [08/Mar/2004:03:21:16 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +64.242.88.10 - - [08/Mar/2004:03:26:06 -0800] "GET /mailman/private/mlc/ HTTP/1.1" 200 1528 +64.242.88.10 - - [08/Mar/2004:03:28:02 -0800] "GET /ops/SP/play//view/TWiki/WikiName HTTP/1.1" 200 4811 +64.242.88.10 - - [08/Mar/2004:03:33:52 -0800] "GET /ops/SP/play//rdiff/Main/WebRss HTTP/1.1" 200 20726 +64.242.88.10 - - [08/Mar/2004:03:35:42 -0800] "GET /ops/SP/play//rdiff/TWiki/SvenDowideit?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5277 +rouble.cc.strath.ac.uk - - [08/Mar/2004:03:40:51 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +213.181.81.4 - - [08/Mar/2004:03:42:20 -0800] "GET /LateEmail.jsp HTTP/1.0" 200 7649 +64.242.88.10 - - [08/Mar/2004:03:46:27 -0800] "GET /ops/SP/play//edit/Main/Deliver_lock_attempts?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:03:48:18 -0800] "GET /ops/SP/play//edit/Main/Daemon_directory?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:03:49:24 -0800] "GET /ops/SP/play//rdiff/TWiki/KlausWriessnegger?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5421 +64.242.88.10 - - [08/Mar/2004:03:51:05 -0800] "GET /ops/SP/play//view/Main/TWikiGuest?rev=1.4 HTTP/1.1" 200 4719 +64.242.88.10 - - [08/Mar/2004:03:52:17 -0800] "GET /ops/SP/play//edit/Main/Relayhost?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +lj1036.passgo.com - - [08/Mar/2004:03:53:59 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1159.passgo.com - - [08/Mar/2004:03:54:03 -0800] "GET /ops/SP/play//oops/Main/TWi HTTP/1.0" 200 209 +64.242.88.10 - - [08/Mar/2004:03:55:09 -0800] "GET /ops/SP/play//edit/Main/BookView?topicparent=Main.TWikiVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:04:16:08 -0800] "GET /ops/SP/play//rdiff/TWiki/DeleteOrRenameATopic HTTP/1.1" 200 10254 +64.242.88.10 - - [08/Mar/2004:04:18:28 -0800] "GET /ops/SP/play//view/TWiki/DavidWarman HTTP/1.1" 200 3739 +64.242.88.10 - - [08/Mar/2004:04:20:48 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.28 HTTP/1.1" 200 22777 +64.242.88.10 - - [08/Mar/2004:04:21:53 -0800] "GET /ops/SP/play//rdiff/Main/PeterThoeny HTTP/1.1" 200 18927 +64.242.88.10 - - [08/Mar/2004:04:22:55 -0800] "GET /ops/SP/play//edit/TWiki/SvenDowideit?t=1078710644 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:04:24:47 -0800] "GET /ops/SP/play//edit/Main/RBLsHowTo?t=1078668449 HTTP/1.1" 401 12846 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:25:38 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.0" 200 5672 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:25:44 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:26:02 -0800] "GET /ops/SP/play//view/Main/SideBar HTTP/1.0" 200 3960 +64.242.88.10 - - [08/Mar/2004:04:26:02 -0800] "GET /ops/SP/play//rdiff/TWiki/DefaultPlugin?rev1=1.5&rev2=1.4 HTTP/1.1" 200 4911 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:26:11 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.0" 200 4515 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:28:34 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.0" 200 4213 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:28:38 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.0" 200 4004 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:28:41 -0800] "GET /ops/SP/play//view/Main/PostfixCmd HTTP/1.0" 200 4154 +64.242.88.10 - - [08/Mar/2004:04:28:42 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiHistory?rev1=1.61&rev2=1.60 HTTP/1.1" 200 4898 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:28:52 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.0" 200 3617 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:29:00 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.0" 200 4646 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:29:11 -0800] "GET /ops/SP/play//view/Main/ConfigurationVariables HTTP/1.0" 200 58169 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:29:21 -0800] "GET /ops/SP/play//edit/Main/Propagate_unmatched_extensions?topicparent=Main.ConfigurationVariables HTTP/1.0" 401 12816 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:29:30 -0800] "GET /go/bin/test/TWikiDocGraphics/help.gif HTTP/1.0" 200 130 +64.242.88.10 - - [08/Mar/2004:04:33:25 -0800] "GET /mailman/admin/hs_support HTTP/1.1" 200 2120 +64.242.88.10 - - [08/Mar/2004:04:40:32 -0800] "GET /ops/SP/play//edit/Main/Always_bcc?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:04:43:52 -0800] "GET /ops/SP/play//view/TWiki/WelcomeGuest?rev=r1.5 HTTP/1.1" 200 9492 +64.242.88.10 - - [08/Mar/2004:04:52:13 -0800] "GET /ops/SP/play//rdiff/Main/TWikiGuest?rev1=1.5&rev2=1.4 HTTP/1.1" 200 6233 +64.242.88.10 - - [08/Mar/2004:04:55:40 -0800] "GET /ops/SP/play//edit/Main/Delay_warning_time?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:04:59:13 -0800] "GET /ops/SP/play//edit/TWiki/KlausWriessnegger?t=1078709735 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:05:00:42 -0800] "GET /ops/SP/play//rdiff/TWiki/StanleyKnutson HTTP/1.1" 200 5327 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:00:44 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:00:45 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:00:46 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:00:52 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:01:02 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:01:14 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +64.242.88.10 - - [08/Mar/2004:05:01:58 -0800] "GET /ops/SP/play//view/TWiki/WhatIsWikiWiki HTTP/1.1" 200 4234 +200.160.249.68.bmf.com.br - - [08/Mar/2004:05:02:06 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +200.160.249.68.bmf.com.br - - [08/Mar/2004:05:02:07 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +64.242.88.10 - - [08/Mar/2004:05:03:13 -0800] "GET /ops/SP/play//view/Main/WebIndex?rev=1.1 HTTP/1.1" 200 44960 +64.242.88.10 - - [08/Mar/2004:05:13:35 -0800] "GET /mailman/private/hs_support/ HTTP/1.1" 200 1549 +68-174-110-154.nyc.rr.com - - [08/Mar/2004:05:16:15 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +68-174-110-154.nyc.rr.com - - [08/Mar/2004:05:16:20 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +64.242.88.10 - - [08/Mar/2004:05:22:57 -0800] "GET /ops/SP/play//attach/Sandbox/WebHome HTTP/1.1" 401 12846 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:23:37 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +66-194-6-70.gen.twtelecom.net - - [08/Mar/2004:05:24:18 -0800] "GET / HTTP/1.1" 200 3169 +64.242.88.10 - - [08/Mar/2004:05:24:29 -0800] "GET /ops/SP/play//edit/TWiki/UnchangeableTopicBug?topicparent=TWiki.TWikiHistory HTTP/1.1" 401 12846 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:24:50 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:25:46 -0800] "GET /ops/SP/play//view/Main/Postfix HTTP/1.1" 200 3699 +64.242.88.10 - - [08/Mar/2004:05:26:02 -0800] "GET /ops/SP/play//view/Main/TWikiGuest?skin=print HTTP/1.1" 200 2372 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:26:06 -0800] "GET /ops/SP/play//edit/Main/UvscanAndPostFix?topicparent=Main.WebHome HTTP/1.1" 401 12851 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:26:08 -0800] "GET /go/bin/test/TWikiDocGraphics/help.gif HTTP/1.1" 200 130 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:26:16 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +64.242.88.10 - - [08/Mar/2004:05:30:07 -0800] "GET /ops/SP/play//view/TWiki/SvenDowideit?rev=1.1 HTTP/1.1" 200 3564 +64.242.88.10 - - [08/Mar/2004:05:31:47 -0800] "GET /ops/SP/play//edit/Main/Maps_rbl_reject_code?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +lj1027.passgo.com - - [08/Mar/2004:05:32:01 -0800] "GET /ops/SP/play//view/TWiki/2fa HTTP/1.0" 200 4615 +64.242.88.10 - - [08/Mar/2004:05:34:33 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Web%20*Changes[^A-Za-z] HTTP/1.1" 200 4829 +64.242.88.10 - - [08/Mar/2004:05:36:56 -0800] "GET /ops/SP/play//edit/Main/WebStatistics?t=1078690975 HTTP/1.1" 401 12851 +68-174-110-154.nyc.rr.com - - [08/Mar/2004:05:38:57 -0800] "GET /razor.jsp HTTP/1.1" 304 - +64.242.88.10 - - [08/Mar/2004:05:42:06 -0800] "GET /ops/SP/play//view/Main/RelayGateway?rev=1.3 HTTP/1.1" 200 4232 +64.242.88.10 - - [08/Mar/2004:05:47:38 -0800] "GET /robots.txt HTTP/1.1" 200 68 +64.242.88.10 - - [08/Mar/2004:05:48:48 -0800] "GET /ops/SP/play//rdiff/TWiki/KevinKinnell?rev1=1.4&rev2=1.3 HTTP/1.1" 200 4369 +64.242.88.10 - - [08/Mar/2004:05:51:45 -0800] "GET /ops/SP/play//view/TWiki/WelcomeGuest?rev=r1.11 HTTP/1.1" 200 13102 +64.242.88.10 - - [08/Mar/2004:05:56:08 -0800] "GET /ops/SP/play//view/TWiki/TWikiRegistration?rev=r1.4 HTTP/1.1" 200 12113 +64.242.88.10 - - [08/Mar/2004:05:57:15 -0800] "GET /ops/SP/play//edit/TWiki/TWikiCodevTWikiEnhancementRequests?topicparent=TWiki.TWikiHistory HTTP/1.1" 401 12851 +64.242.88.10 - - [08/Mar/2004:05:58:39 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Peter%20*Fokkinga[^A-Za-z] HTTP/1.1" 200 4388 +64.242.88.10 - - [08/Mar/2004:06:01:51 -0800] "GET /ops/SP/play//attach/Main/WebPreferences HTTP/1.1" 401 12851 +64.242.88.10 - - [08/Mar/2004:06:09:37 -0800] "GET /mailman/admin/hs_rcafaculty HTTP/1.1" 200 2144 +64.242.88.10 - - [08/Mar/2004:06:17:13 -0800] "GET /ops/SP/play//rdiff/TWiki/WebChanges HTTP/1.1" 200 114167 +64.242.88.10 - - [08/Mar/2004:06:20:36 -0800] "GET /ops/SP/play//view/Main/JorisBenschop?skin=print HTTP/1.1" 200 2717 +64.242.88.10 - - [08/Mar/2004:06:23:52 -0800] "GET /ops/SP/play//edit/TWiki/TestArea?topicparent=TWiki.WelcomeGuest HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:06:32:14 -0800] "GET /ops/SP/play//view/TWiki/WelcomeGuest?rev=r1.6 HTTP/1.1" 200 12620 +64.242.88.10 - - [08/Mar/2004:06:37:19 -0800] "GET /ops/SP/play//rdiff/TWiki/HaroldGottschalk?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5389 +64.242.88.10 - - [08/Mar/2004:06:41:22 -0800] "GET /pipermail/techcomm/ HTTP/1.1" 200 1176 +64.242.88.10 - - [08/Mar/2004:06:42:29 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.19 HTTP/1.1" 200 20488 +64.242.88.10 - - [08/Mar/2004:06:43:32 -0800] "GET /ops/SP/play//edit/Sandbox/TestTopic2?topicparent=Sandbox.WebHome HTTP/1.1" 401 12846 +128.227.88.79 - - [08/Mar/2004:06:47:41 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +128.227.88.79 - - [08/Mar/2004:06:47:41 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +64.242.88.10 - - [08/Mar/2004:06:49:27 -0800] "GET /ops/SP/play//attach/TWiki/InterWikis HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:06:54:30 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiSkins?rev1=1.11&rev2=1.10 HTTP/1.1" 200 5711 +64.242.88.10 - - [08/Mar/2004:06:57:09 -0800] "GET /ops/SP/play//rdiff/TWiki/WebNotify HTTP/1.1" 200 11780 +128.227.88.79 - - [08/Mar/2004:06:57:46 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +128.227.88.79 - - [08/Mar/2004:06:57:46 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +64.242.88.10 - - [08/Mar/2004:07:00:15 -0800] "GET /ops/SP/play//view/TWiki/DontNotify?rev=1.1 HTTP/1.1" 200 3965 +64.242.88.10 - - [08/Mar/2004:07:07:13 -0800] "GET /ops/SP/play//edit/Main/Masquerade_classes?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +128.227.88.79 - - [08/Mar/2004:07:09:12 -0800] "GET /ops/SP/play//view/Main/SpamAssassin HTTP/1.1" 200 4081 +64.242.88.10 - - [08/Mar/2004:07:09:21 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=r1.10 HTTP/1.1" 200 8312 +64.242.88.10 - - [08/Mar/2004:07:10:26 -0800] "GET /ops/SP/play//view/TWiki/HaroldGottschalk?rev=1.2 HTTP/1.1" 200 3774 +64.242.88.10 - - [08/Mar/2004:07:11:37 -0800] "GET /ops/SP/play//edit/TWiki/TWikiCodevTWikiPlannedFeatures?topicparent=TWiki.TWikiHistory HTTP/1.1" 401 12851 +64.242.88.10 - - [08/Mar/2004:07:12:39 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=r1.44 HTTP/1.1" 200 41434 +64.242.88.10 - - [08/Mar/2004:07:22:13 -0800] "GET /ops/SP/play//view/TWiki/PeterFokkinga?rev=1.2 HTTP/1.1" 200 3748 +64.242.88.10 - - [08/Mar/2004:07:23:38 -0800] "GET /ops/SP/play//edit/TWiki/TWikiPlugins?t=1078696313 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:07:24:43 -0800] "GET /mailman/listinfo/webct HTTP/1.1" 200 6377 +64.242.88.10 - - [08/Mar/2004:07:25:56 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +64.242.88.10 - - [08/Mar/2004:07:27:01 -0800] "GET /mailman/listinfo/faculty HTTP/1.1" 200 6054 +61.9.4.61 - - [08/Mar/2004:07:27:36 -0800] "GET /_vti_bin/owssvr.dll?UL=1&ACT=4&BUILD=2614&STRMVER=4&CAPREQ=0 HTTP/1.0" 404 284 +61.9.4.61 - - [08/Mar/2004:07:27:36 -0800] "GET /SpamAssassin.jsp HTTP/1.0" 200 7368 +61.9.4.61 - - [08/Mar/2004:07:27:37 -0800] "GET /MSOffice/cltreq.asp?UL=1&ACT=4&BUILD=2614&STRMVER=4&CAPREQ=0 HTTP/1.0" 404 284 +64.242.88.10 - - [08/Mar/2004:07:28:29 -0800] "GET /mailman/admin/sswk HTTP/1.1" 200 2072 +64.242.88.10 - - [08/Mar/2004:07:29:56 -0800] "GET /mailman/listinfo/purchasing HTTP/1.1" 200 6050 +64.242.88.10 - - [08/Mar/2004:07:35:50 -0800] "GET /ops/SP/play//edit/Main/Invalid_hostname_reject_code?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:07:39:31 -0800] "GET /ops/SP/play//rdiff/Main/WebPreferences?rev1=1.14&rev2=1.13 HTTP/1.1" 200 7207 +64.242.88.10 - - [08/Mar/2004:07:40:54 -0800] "GET /ops/SP/play//rename/TWiki/TWikiHistory HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:07:43:21 -0800] "GET /ops/SP/play//view/TWiki/SearchDoesNotWork?rev=r1.2 HTTP/1.1" 200 4072 +64.242.88.10 - - [08/Mar/2004:07:44:53 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=r1.50 HTTP/1.1" 200 42285 +64.242.88.10 - - [08/Mar/2004:07:49:56 -0800] "GET /ops/SP/play//edit/TWiki/RyanFreebern?t=1078701457 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:07:51:39 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=r1.2 HTTP/1.1" 200 6061 +64.242.88.10 - - [08/Mar/2004:07:53:19 -0800] "GET /ops/SP/play//rdiff/TWiki/WebTopicEditTemplate HTTP/1.1" 200 7895 +mcl02.tnr.on.ca - - [08/Mar/2004:07:53:37 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +mcl02.tnr.on.ca - - [08/Mar/2004:07:53:38 -0800] "GET /images/image005.jpg HTTP/1.1" 200 21125 +mcl02.tnr.on.ca - - [08/Mar/2004:07:53:38 -0800] "GET /images/image004.jpg HTTP/1.1" 200 10936 +mcl02.tnr.on.ca - - [08/Mar/2004:07:53:38 -0800] "GET /images/msgops.JPG HTTP/1.1" 200 7939 +64.242.88.10 - - [08/Mar/2004:07:54:30 -0800] "GET /ops/SP/play//edit/Main/Unknown_local_recipient_reject_code?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:07:56:34 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Web%20*Index[^A-Za-z] HTTP/1.1" 200 4163 +64.242.88.10 - - [08/Mar/2004:08:04:46 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +p5083cd5d.dip0.t-ipconnect.de - - [08/Mar/2004:08:09:32 -0800] "GET /SpamAssassin.jsp HTTP/1.0" 200 7368 +64.242.88.10 - - [08/Mar/2004:08:12:50 -0800] "GET /ops/SP/play//view/TWiki/ChangePassword?rev=r1.6 HTTP/1.1" 200 5181 +64.242.88.10 - - [08/Mar/2004:08:14:15 -0800] "GET /ops/SP/play//edit/TWiki/HaroldGottschalk?t=1078717948 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:08:15:21 -0800] "GET /ops/SP/play//edit/Main/Expand_owner_alias?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:08:17:09 -0800] "GET /ops/SP/play//view/Main/WebIndex?rev=r1.2 HTTP/1.1" 200 45059 +64.242.88.10 - - [08/Mar/2004:08:18:52 -0800] "GET /rfc.jsp HTTP/1.1" 200 3103 +pool-68-160-195-60.ny325.east.verizon.net - - [08/Mar/2004:08:21:00 -0800] "GET / HTTP/1.1" 200 3169 +pool-68-160-195-60.ny325.east.verizon.net - - [08/Mar/2004:08:21:00 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +64.242.88.10 - - [08/Mar/2004:08:21:47 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=RBLs%20*How%20*To[^A-Za-z] HTTP/1.1" 200 3575 +64.242.88.10 - - [08/Mar/2004:08:25:37 -0800] "GET /ops/SP/play//rdiff/TWiki/WebTopicEditTemplate?rev1=1.5&rev2=1.4 HTTP/1.1" 200 4212 +212.92.37.62 - - [08/Mar/2004:08:26:41 -0800] "GET / HTTP/1.1" 200 3169 +212.92.37.62 - - [08/Mar/2004:08:27:04 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +212.92.37.62 - - [08/Mar/2004:08:27:08 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +64.242.88.10 - - [08/Mar/2004:08:27:14 -0800] "GET /ops/SP/play//rdiff/Main/SpamAssassin HTTP/1.1" 200 4445 +212.92.37.62 - - [08/Mar/2004:08:27:23 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +212.92.37.62 - - [08/Mar/2004:08:27:28 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +64.242.88.10 - - [08/Mar/2004:08:28:23 -0800] "GET /ops/SP/play//rdiff/Main/TokyoOffice?rev1=1.2&rev2=1.1 HTTP/1.1" 200 7316 +64.242.88.10 - - [08/Mar/2004:08:29:36 -0800] "GET /ops/SP/play//view/TWiki/TWikiCategoryTable HTTP/1.1" 200 3729 +219.95.17.51 - - [08/Mar/2004:08:29:57 -0800] "GET / HTTP/1.1" 200 3169 +212.92.37.62 - - [08/Mar/2004:08:30:25 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +212.92.37.62 - - [08/Mar/2004:08:31:37 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +10.0.0.176 - - [08/Mar/2004:08:32:24 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [08/Mar/2004:08:32:27 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +10.0.0.176 - - [08/Mar/2004:08:32:27 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +212.92.37.62 - - [08/Mar/2004:08:32:34 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +212.92.37.62 - - [08/Mar/2004:08:33:27 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +212.92.37.62 - - [08/Mar/2004:08:33:30 -0800] "GET /ops/SP/play//view/Main/PostfixCmd HTTP/1.1" 200 4173 +212.92.37.62 - - [08/Mar/2004:08:33:39 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.1" 200 3629 +64.242.88.10 - - [08/Mar/2004:08:33:51 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=r1.14 HTTP/1.1" 200 8820 +212.92.37.62 - - [08/Mar/2004:08:33:52 -0800] "GET /ops/SP/play//view/Main/SideBar HTTP/1.1" 200 3972 +212.92.37.62 - - [08/Mar/2004:08:33:57 -0800] "GET /ops/SP/play//view/Main/DCCGraphs HTTP/1.1" 200 5402 +212.92.37.62 - - [08/Mar/2004:08:34:09 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +64.242.88.10 - - [08/Mar/2004:08:34:53 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiHistory?rev1=1.8&rev2=1.7 HTTP/1.1" 200 4972 +64.242.88.10 - - [08/Mar/2004:08:36:05 -0800] "GET /ops/SP/play//view/TWiki/ChangePassword?rev=r1.3 HTTP/1.1" 200 5229 +92-moc-6.acn.waw.pl - - [08/Mar/2004:08:37:14 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +92-moc-6.acn.waw.pl - - [08/Mar/2004:08:37:14 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +92-moc-6.acn.waw.pl - - [08/Mar/2004:08:37:17 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +64.242.88.10 - - [08/Mar/2004:08:37:23 -0800] "GET /ops/SP/play//attach/TWiki/HaroldGottschalk HTTP/1.1" 401 12846 +66.213.206.2 - - [08/Mar/2004:08:37:53 -0800] "GET / HTTP/1.1" 200 3169 +64.242.88.10 - - [08/Mar/2004:08:40:15 -0800] "GET /LateEmail.jsp HTTP/1.1" 200 7649 +64.242.88.10 - - [08/Mar/2004:08:52:13 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.15 HTTP/1.1" 200 16746 +64.242.88.10 - - [08/Mar/2004:08:53:17 -0800] "GET /ops/SP/play//view/TWiki/TWikiTutorial HTTP/1.1" 200 14485 +64.242.88.10 - - [08/Mar/2004:08:55:12 -0800] "GET /mailman/private/dentalstudies/ HTTP/1.1" 200 1558 +spot.nnacorp.com - - [08/Mar/2004:09:02:14 -0800] "GET / HTTP/1.1" 200 3169 +spot.nnacorp.com - - [08/Mar/2004:09:02:21 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +spot.nnacorp.com - - [08/Mar/2004:09:02:21 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +10.0.0.176 - - [08/Mar/2004:09:02:29 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [08/Mar/2004:09:02:31 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 7326 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 7927 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7182 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8866 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9307 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6805 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6596 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5499 +spot.nnacorp.com - - [08/Mar/2004:09:02:54 -0800] "GET /ops/SP/play//view/Main/TWikiUsers HTTP/1.1" 200 6697 +spot.nnacorp.com - - [08/Mar/2004:09:02:54 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +64.242.88.10 - - [08/Mar/2004:09:03:18 -0800] "GET /ststats/index.jsp HTTP/1.1" 200 2955 +64.242.88.10 - - [08/Mar/2004:09:05:54 -0800] "GET /ops/SP/play//edit/Sandbox/TestTopic6?topicparent=Sandbox.WebHome HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:09:09:55 -0800] "GET /ops/SP/play//view/TWiki/TablePlugin?skin=print HTTP/1.1" 200 1572 +64.242.88.10 - - [08/Mar/2004:09:12:54 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Spam%20*Assassin[^A-Za-z] HTTP/1.1" 200 8782 +lhr003a.dhl.com - - [08/Mar/2004:09:16:26 -0800] "GET / HTTP/1.0" 200 3169 +lhr003a.dhl.com - - [08/Mar/2004:09:17:16 -0800] "GET /ststats/index.jsp HTTP/1.0" 200 2955 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.0" 200 3040 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.0" 200 2341 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.0" 200 2271 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.0" 200 3302 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.0" 200 1663 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.0" 200 2521 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.0" 200 1918 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.0" 200 1580 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.0" 200 2202 +lhr003a.dhl.com - - [08/Mar/2004:09:17:18 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.0" 200 1822 +lhr003a.dhl.com - - [08/Mar/2004:09:17:18 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.0" 200 1526 +10.0.0.176 - - [08/Mar/2004:09:18:53 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [08/Mar/2004:09:18:56 -0800] "GET /ststats/index.jsp HTTP/1.1" 304 - +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3040 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2271 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2341 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3302 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1580 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 1918 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1663 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2202 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2521 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1822 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1526 +64.242.88.10 - - [08/Mar/2004:09:23:03 -0800] "GET /ops/SP/play//view/TWiki/SearchDoesNotWork?rev=r1.1 HTTP/1.1" 200 3981 +64.242.88.10 - - [08/Mar/2004:09:25:42 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=TWiki%20*FAQ[^A-Za-z] HTTP/1.1" 200 12083 +lj1036.passgo.com - - [08/Mar/2004:09:29:35 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1027.passgo.com - - [08/Mar/2004:09:29:36 -0800] "GET /ops/SP/play//oops/Know/WinDoze95Crash HTTP/1.0" 200 209 +pool-68-160-195-60.ny325.east.verizon.net - - [08/Mar/2004:09:30:10 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +pool-68-160-195-60.ny325.east.verizon.net - - [08/Mar/2004:09:30:11 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +pool-68-160-195-60.ny325.east.verizon.net - - [08/Mar/2004:09:30:11 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +64.242.88.10 - - [08/Mar/2004:09:30:40 -0800] "GET /ops/SP/play//view/TWiki/WebSearch?rev=r1.10 HTTP/1.1" 200 9419 +64.242.88.10 - - [08/Mar/2004:09:32:32 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiDownload HTTP/1.1" 200 5933 +64.242.88.10 - - [08/Mar/2004:09:33:46 -0800] "GET /ops/SP/play//view/Main/SideBar?rev=1.1 HTTP/1.1" 200 3564 +lj1156.passgo.com - - [08/Mar/2004:09:33:53 -0800] "GET /ops/SP/play//oops/TWiki/TWikiAccessControl HTTP/1.0" 200 209 +64.242.88.10 - - [08/Mar/2004:09:34:58 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiFAQ HTTP/1.1" 200 43115 +64.242.88.10 - - [08/Mar/2004:09:36:35 -0800] "GET /ops/SP/play//edit/TWiki/WebNotification?topicparent=TWiki.TWikiUpgradeTo01May2000 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:09:38:11 -0800] "GET /ops/SP/play//view/Main/TWikiGuest?rev=r1.3 HTTP/1.1" 200 4604 +lj1156.passgo.com - - [08/Mar/2004:09:40:30 -0800] "GET /ops/SP/play//view/TWiki/d43 HTTP/1.0" 200 4619 +64.242.88.10 - - [08/Mar/2004:09:41:15 -0800] "GET /ops/SP/play//edit/Main/Export_environment?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:09:42:27 -0800] "GET /ops/SP/play//rdiff/Know/ReadmeFirst?rev1=1.6&rev2=1.5 HTTP/1.1" 200 4187 +64.242.88.10 - - [08/Mar/2004:09:45:15 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Change%20*Password[^A-Za-z] HTTP/1.1" 200 7226 +64.242.88.10 - - [08/Mar/2004:10:01:06 -0800] "GET /ops/SP/play//view/TWiki/TWikiTopics?rev=r1.4 HTTP/1.1" 200 5171 +64.242.88.10 - - [08/Mar/2004:10:05:40 -0800] "GET /ops/SP/play//view/TWiki/WebSearch?rev=r1.9 HTTP/1.1" 200 9469 +lj1164.passgo.com - - [08/Mar/2004:10:06:28 -0800] "GET /ops/SP/play//view/Main/DCCGraphs HTTP/1.0" 200 5383 +64.242.88.10 - - [08/Mar/2004:10:08:02 -0800] "GET /ops/SP/play//rename/TWiki/DefaultPlugin HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:10:09:52 -0800] "GET /ops/SP/play//view/Main/TWikiGuest?rev=r1.1 HTTP/1.1" 200 3763 +64.242.88.10 - - [08/Mar/2004:10:14:46 -0800] "GET /ops/SP/play//edit/TWiki/TWikiRegistration?t=1078670224 HTTP/1.1" 401 12851 +64.242.88.10 - - [08/Mar/2004:10:16:52 -0800] "GET /ops/SP/play//view/Main/TWikiAdminGroup?rev=1.6 HTTP/1.1" 200 4462 +64.242.88.10 - - [08/Mar/2004:10:18:21 -0800] "GET /ops/SP/play//rdiff/TWiki/WikiSyntax HTTP/1.1" 200 59454 +64.242.88.10 - - [08/Mar/2004:10:21:21 -0800] "GET /ops/SP/play//oops/TWiki/WikiCulture?template=oopsmore¶m1=1.8¶m2=1.8 HTTP/1.1" 200 11245 +64.242.88.10 - - [08/Mar/2004:10:30:56 -0800] "GET /ops/SP/play//view/TWiki/WikiTopic HTTP/1.1" 200 4646 +64.242.88.10 - - [08/Mar/2004:10:32:18 -0800] "GET /ops/SP/play//rdiff/TWiki/WebPreferences HTTP/1.1" 200 36410 +64.242.88.10 - - [08/Mar/2004:10:34:55 -0800] "GET /ops/SP/play//view/TWiki/WebSearch?skin=print HTTP/1.1" 200 7196 +64.242.88.10 - - [08/Mar/2004:10:40:09 -0800] "GET /ops/SP/play//view/TWiki/TWikiTopics?rev=r1.7 HTTP/1.1" 200 8540 +64.242.88.10 - - [08/Mar/2004:10:45:25 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Thanadon%20*Somdee[^A-Za-z] HTTP/1.1" 200 4287 +64.242.88.10 - - [08/Mar/2004:10:46:34 -0800] "GET /ops/SP/play//view/TWiki/TWikiUpgradeTo01May2000?rev=1.3 HTTP/1.1" 200 7441 +10.0.0.176 - - [08/Mar/2004:10:48:02 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [08/Mar/2004:10:48:05 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 7213 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 7970 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7254 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8821 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6866 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9312 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6596 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5499 +64.242.88.10 - - [08/Mar/2004:10:48:19 -0800] "GET /ops/SP/play//edit/Main/Max_use?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/index.jsp HTTP/1.1" 304 - +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3080 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2224 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3299 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2481 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1667 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2346 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 1872 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1585 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2202 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1833 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1521 +64.242.88.10 - - [08/Mar/2004:10:50:05 -0800] "GET /ops/SP/play//rdiff/TWiki/WebRss HTTP/1.1" 200 21483 +64.242.88.10 - - [08/Mar/2004:11:03:34 -0800] "GET /ops/SP/play//rdiff/TWiki/WikiCulture?rev1=1.8&rev2=1.7 HTTP/1.1" 200 5326 +128.227.88.79 - - [08/Mar/2004:11:06:20 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +128.227.88.79 - - [08/Mar/2004:11:06:20 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +128.227.88.79 - - [08/Mar/2004:11:06:28 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +64.242.88.10 - - [08/Mar/2004:11:09:24 -0800] "GET /ops/SP/play//edit/Main/Lmtp_mail_timeout?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +128.227.88.79 - - [08/Mar/2004:11:10:09 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +128.227.88.79 - - [08/Mar/2004:11:10:24 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +128.227.88.79 - - [08/Mar/2004:11:11:04 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +128.227.88.79 - - [08/Mar/2004:11:11:10 -0800] "GET /ops/SP/play//view/Main/TWikiGroups HTTP/1.1" 200 4816 +128.227.88.79 - - [08/Mar/2004:11:11:15 -0800] "GET /ops/SP/play//view/Main/TWikiAdminGroup HTTP/1.1" 200 4175 +128.227.88.79 - - [08/Mar/2004:11:11:26 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +64.242.88.10 - - [08/Mar/2004:11:11:51 -0800] "GET /ops/SP/play//edit/Main/TWikiGuest?t=1078713282 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:11:15:51 -0800] "GET /ops/SP/play//rdiff/TWiki/AdminSkillsAssumptions HTTP/1.1" 200 10368 +64.242.88.10 - - [08/Mar/2004:11:17:49 -0800] "GET /ops/SP/play//view/Sandbox/WebHome?rev=r1.3 HTTP/1.1" 200 8708 +64.242.88.10 - - [08/Mar/2004:11:19:43 -0800] "GET /ops/SP/play//edit/TWiki/WikiNotation?t=1078726052 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:11:24:12 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Wiki%20*Notation[^A-Za-z] HTTP/1.1" 200 6558 +64.242.88.10 - - [08/Mar/2004:11:25:16 -0800] "GET /ops/SP/play//oops/TWiki/WikiNotation?template=oopsmore¶m1=1.3¶m2=1.3 HTTP/1.1" 200 11263 +10.0.0.176 - - [08/Mar/2004:11:40:41 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 7226 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 8055 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8787 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7088 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6866 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6596 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9312 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5499 +64.242.88.10 - - [08/Mar/2004:11:41:14 -0800] "GET /mailman/admin/artsscience HTTP/1.1" 200 2125 +64.242.88.10 - - [08/Mar/2004:11:43:17 -0800] "GET /ops/SP/play//search/Main/?scope=topic®ex=on&search=^d HTTP/1.1" 200 5036 +64.242.88.10 - - [08/Mar/2004:11:45:08 -0800] "GET /ops/SP/play//edit/TWiki/TWikiCodevFeatureToDo?topicparent=TWiki.TWikiHistory HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:11:47:52 -0800] "GET /ops/SP/play//rename/TWiki/ResetPassword HTTP/1.1" 401 12851 +64.242.88.10 - - [08/Mar/2004:11:49:23 -0800] "GET /ops/SP/play//edit/Main/Fast_flush_domains?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:11:51:20 -0800] "GET /ops/SP/play//edit/Main/SpamAssassin?t=1078709979 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:11:56:19 -0800] "GET /ops/SP/play//view/TWiki/TWikiTopics?rev=r1.10 HTTP/1.1" 200 14650 +64.242.88.10 - - [08/Mar/2004:11:57:28 -0800] "GET /ops/SP/play//view/TWiki/FileAttribute?rev=r1.2 HTTP/1.1" 200 3949 +64.242.88.10 - - [08/Mar/2004:12:00:26 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiEnhancementRequests HTTP/1.1" 200 10417 +64.242.88.10 - - [08/Mar/2004:12:06:03 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Kevin%20*Kinnell[^A-Za-z] HTTP/1.1" 200 4536 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 7192 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 8081 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 9065 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7206 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9312 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6866 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6596 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5499 +64.242.88.10 - - [08/Mar/2004:12:07:13 -0800] "GET /ops/SP/play//view/TWiki/FileAttribute?rev=1.2 HTTP/1.1" 200 3949 +64.242.88.10 - - [08/Mar/2004:12:08:32 -0800] "GET /ops/SP/play//view/TWiki/WikiNotation?skin=print HTTP/1.1" 200 1435 +64.242.88.10 - - [08/Mar/2004:12:10:39 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiPlannedFeatures HTTP/1.1" 200 10577 +64.242.88.10 - - [08/Mar/2004:12:12:50 -0800] "GET /mailman/admin/deans HTTP/1.1" 200 2080 +64.242.88.10 - - [08/Mar/2004:12:15:36 -0800] "GET /pipermail/webber/ HTTP/1.1" 200 1161 +64.242.88.10 - - [08/Mar/2004:12:20:18 -0800] "GET /ops/SP/play//view/Main/PostSuper?rev=1.1 HTTP/1.1" 200 3629 +64.242.88.10 - - [08/Mar/2004:12:25:47 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=1.13 HTTP/1.1" 200 8770 +64.242.88.10 - - [08/Mar/2004:12:28:09 -0800] "GET /ops/SP/play//edit/Main/Mailq_path?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:12:31:32 -0800] "GET /ops/SP/play//view/TWiki/WebHome?rev=r1.49 HTTP/1.1" 200 12993 +64.242.88.10 - - [08/Mar/2004:12:33:09 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=r1.49 HTTP/1.1" 200 42243 +64.242.88.10 - - [08/Mar/2004:12:39:34 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiDocGraphics?rev1=1.11&rev2=1.10 HTTP/1.1" 200 6551 +64.242.88.10 - - [08/Mar/2004:12:40:36 -0800] "GET /ops/SP/play//view/TWiki/WebHome?rev=r1.47 HTTP/1.1" 200 12819 +64.242.88.10 - - [08/Mar/2004:12:42:04 -0800] "GET /ops/SP/play//view/Sandbox/WebStatistics HTTP/1.1" 200 6063 +64.242.88.10 - - [08/Mar/2004:12:43:08 -0800] "GET /pipermail/gisgrad/ HTTP/1.1" 200 1118 +64.242.88.10 - - [08/Mar/2004:12:45:13 -0800] "GET /mailman/admin/webber HTTP/1.1" 200 2089 +64.242.88.10 - - [08/Mar/2004:12:47:42 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=1.14 HTTP/1.1" 200 8820 +64.242.88.10 - - [08/Mar/2004:12:55:18 -0800] "GET /ops/SP/play//view/TWiki/KevinKinnell?rev=1.4 HTTP/1.1" 200 3730 +64.242.88.10 - - [08/Mar/2004:12:58:39 -0800] "GET /ops/SP/play//search/Main/?search=\\.*&scope=topic&order=modified&reverse=on®ex=on&nosearch=on&limit=800 HTTP/1.1" 200 43915 +market-mail.panduit.com - - [08/Mar/2004:12:58:50 -0800] "GET / HTTP/1.0" 200 3169 +market-mail.panduit.com - - [08/Mar/2004:12:58:50 -0800] "GET /favicon.ico HTTP/1.0" 200 1078 +market-mail.panduit.com - - [08/Mar/2004:12:59:18 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +market-mail.panduit.com - - [08/Mar/2004:12:59:34 -0800] "GET /ststats/index.jsp HTTP/1.0" 200 2955 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.0" 200 3095 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.0" 200 2272 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.0" 200 3279 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.0" 200 2349 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.0" 200 1659 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.0" 200 2542 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.0" 200 1927 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.0" 200 1580 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.0" 200 2201 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.0" 200 1829 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.0" 200 1524 +market-mail.panduit.com - - [08/Mar/2004:12:59:55 -0800] "GET /DCC.jsp HTTP/1.0" 200 2878 +market-mail.panduit.com - - [08/Mar/2004:13:00:12 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +market-mail.panduit.com - - [08/Mar/2004:13:00:12 -0800] "GET /favicon.ico HTTP/1.0" 200 1078 +market-mail.panduit.com - - [08/Mar/2004:13:00:13 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +market-mail.panduit.com - - [08/Mar/2004:13:00:20 -0800] "GET /ops/SP/play//view/Main/DCC HTTP/1.0" 200 4377 +market-mail.panduit.com - - [08/Mar/2004:13:00:27 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.0" 200 5234 +64.242.88.10 - - [08/Mar/2004:13:00:40 -0800] "GET /ops/SP/play//oops/TWiki/HaroldGottschalk?template=oopsmore¶m1=1.3¶m2=1.3 HTTP/1.1" 200 11335 +market-mail.panduit.com - - [08/Mar/2004:13:01:27 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.0" 200 4004 +market-mail.panduit.com - - [08/Mar/2004:13:01:29 -0800] "GET /ops/SP/play//view/Main/PostfixCmd HTTP/1.0" 200 4154 +market-mail.panduit.com - - [08/Mar/2004:13:01:35 -0800] "GET /ops/SP/play//edit/Main/PostConf?topicparent=Main.PostfixCommands HTTP/1.0" 401 12816 +market-mail.panduit.com - - [08/Mar/2004:13:01:38 -0800] "GET /go/bin/test/TWikiDocGraphics/help.gif HTTP/1.0" 200 130 +64.242.88.10 - - [08/Mar/2004:13:01:42 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=John%20*Talintyre[^A-Za-z] HTTP/1.1" 200 8066 +market-mail.panduit.com - - [08/Mar/2004:13:01:42 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.0" 200 3617 +market-mail.panduit.com - - [08/Mar/2004:13:01:55 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.0" 200 4213 +market-mail.panduit.com - - [08/Mar/2004:13:02:03 -0800] "GET /ops/SP/play//view/Main/VerifingGatway HTTP/1.0" 200 4731 +market-mail.panduit.com - - [08/Mar/2004:13:02:16 -0800] "GET /ops/SP/play//view/Main/Relay_Domains HTTP/1.0" 200 4564 +64.242.88.10 - - [08/Mar/2004:13:04:14 -0800] "GET /ops/SP/play//attach/Main/TWikiGuest HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:07:16 -0800] "GET /ops/SP/play//view/Main/NicholasLee?rev=1.1 HTTP/1.1" 200 4456 +64.242.88.10 - - [08/Mar/2004:13:08:17 -0800] "GET /ops/SP/play//attach/TWiki/TWikiDocGraphics?filename=pencil.gif&revInfo=1 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:12:54 -0800] "GET /ops/SP/play//rdiff/TWiki/WebSiteTools?rev1=1.2&rev2=1.1 HTTP/1.1" 200 6640 +64.242.88.10 - - [08/Mar/2004:13:15:03 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=r1.55 HTTP/1.1" 200 44652 +64.242.88.10 - - [08/Mar/2004:13:16:11 -0800] "GET /ops/SP/play//attach/Main/SpamAssassinAndPostFix HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:17:23 -0800] "GET /mailman/private/artsscience/ HTTP/1.1" 200 1552 +64.242.88.10 - - [08/Mar/2004:13:18:57 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=^l HTTP/1.1" 200 2937 +64.242.88.10 - - [08/Mar/2004:13:24:49 -0800] "GET /ops/SP/play//rdiff/Main/RelayGateway?rev1=1.3&rev2=1.2 HTTP/1.1" 200 5181 +64.242.88.10 - - [08/Mar/2004:13:29:37 -0800] "GET /ops/SP/play//rdiff/Main/RelayGateway?rev1=1.2&rev2=1.1 HTTP/1.1" 200 6029 +64.242.88.10 - - [08/Mar/2004:13:31:16 -0800] "GET /ops/SP/play//rdiff/TWiki/WikiReferences?rev1=1.2&rev2=1.1 HTTP/1.1" 200 10024 +64.242.88.10 - - [08/Mar/2004:13:32:35 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=r1.9 HTTP/1.1" 200 7511 +64.242.88.10 - - [08/Mar/2004:13:35:02 -0800] "GET /ops/SP/play//edit/TWiki/WebSiteTools?t=1078731408 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:36:06 -0800] "GET /ops/SP/play//attach/TWiki/TWikiDocGraphics?filename=viewtopic.gif&revInfo=1 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:38:39 -0800] "GET /ops/SP/play//view/TWiki/SvenDowideit?rev=r1.1 HTTP/1.1" 200 3564 +64.242.88.10 - - [08/Mar/2004:13:45:46 -0800] "GET /ops/SP/play//edit/Main/Ignore_mx_lookup_error?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:48:06 -0800] "GET /ops/SP/play//oops/Main/DCCAndPostFix?template=oopsmore¶m1=1.2¶m2=1.2 HTTP/1.1" 200 6602 +64.242.88.10 - - [08/Mar/2004:13:49:47 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=r1.54 HTTP/1.1" 200 44644 +64.242.88.10 - - [08/Mar/2004:13:55:51 -0800] "GET /ops/SP/play//edit/Main/Allow_min_user?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:56:52 -0800] "GET /ops/SP/play//edit/TWiki/KevinKinnell?t=1078692967 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:57:52 -0800] "GET /pipermail/fcd/ HTTP/1.1" 200 468 +64.242.88.10 - - [08/Mar/2004:13:58:55 -0800] "GET /mailman/listinfo/mgt-157 HTTP/1.1" 200 6189 +64.242.88.10 - - [08/Mar/2004:14:00:08 -0800] "GET /mailman/admin/fcd HTTP/1.1" 200 2060 +64.242.88.10 - - [08/Mar/2004:14:01:36 -0800] "GET /mailman/listinfo/cnc_forestry HTTP/1.1" 200 6159 +64.242.88.10 - - [08/Mar/2004:14:07:26 -0800] "GET /ops/SP/play//edit/Main/Strict_8bitmime?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:14:11:28 -0800] "GET /ops/SP/play//view/TWiki/WelcomeGuest?rev=r1.19 HTTP/1.1" 200 13997 +64.242.88.10 - - [08/Mar/2004:14:12:49 -0800] "GET /ops/SP/play//view/TWiki/TWikiFAQ?rev=1.11 HTTP/1.1" 200 11950 +64.242.88.10 - - [08/Mar/2004:14:13:51 -0800] "GET /mailman/admin/gisgrad HTTP/1.1" 200 2093 +64.242.88.10 - - [08/Mar/2004:14:15:01 -0800] "GET /mailman/admin/jjec HTTP/1.1" 200 2088 +fw.aub.dk - - [08/Mar/2004:14:16:38 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +fw.aub.dk - - [08/Mar/2004:14:16:39 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +64.242.88.10 - - [08/Mar/2004:14:23:54 -0800] "GET /ops/SP/play//oops/TWiki/RyanFreebern?template=oopsmore¶m1=1.2¶m2=1.2 HTTP/1.1" 200 11263 +64.242.88.10 - - [08/Mar/2004:14:25:33 -0800] "GET /ops/SP/play//rdiff/TWiki/WebChangesAlert HTTP/1.1" 200 27035 +64.242.88.10 - - [08/Mar/2004:14:26:45 -0800] "GET /ops/SP/play//rdiff/Sandbox/WebTopicList HTTP/1.1" 200 4319 +64.242.88.10 - - [08/Mar/2004:14:27:46 -0800] "GET /ops/SP/play//edit/Main/Virtual_gid_maps?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:14:28:46 -0800] "GET /ops/SP/play//view/TWiki/NewUserTemplate?skin=print HTTP/1.1" 200 2449 +64.242.88.10 - - [08/Mar/2004:14:33:56 -0800] "GET /mailman/admin HTTP/1.1" 200 6872 +64.242.88.10 - - [08/Mar/2004:14:40:18 -0800] "GET /mailman/admin/ncbnpfaculty HTTP/1.1" 200 2136 +64.242.88.10 - - [08/Mar/2004:14:41:22 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Web%20*Topic%20*List[^A-Za-z] HTTP/1.1" 200 10700 +64.242.88.10 - - [08/Mar/2004:14:42:44 -0800] "GET /ops/SP/play//view/TWiki/WebSearch?rev=1.11 HTTP/1.1" 200 9419 +64.242.88.10 - - [08/Mar/2004:14:43:45 -0800] "GET /ops/SP/play//view/TWiki/MartinCleaver HTTP/1.1" 200 3634 +64.242.88.10 - - [08/Mar/2004:14:52:51 -0800] "GET /ops/SP/play//view/TWiki/WebIndex HTTP/1.1" 200 102154 +64.242.88.10 - - [08/Mar/2004:14:54:56 -0800] "GET /ops/SP/play//edit/Main/TokyoOffice?t=1078706364 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:14:57:19 -0800] "GET /ops/SP/play//rdiff/Main/SpamAssassinAndPostFix?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5794 +64.242.88.10 - - [08/Mar/2004:14:58:58 -0800] "GET /ops/SP/play//rdiff/TWiki/WhatIsWikiWiki HTTP/1.1" 200 9412 +64.242.88.10 - - [08/Mar/2004:15:00:07 -0800] "GET /ops/SP/play//rdiff/Main/WebChanges?rev1=1.2&rev2=1.1 HTTP/1.1" 200 114220 +64.242.88.10 - - [08/Mar/2004:15:01:12 -0800] "GET /ops/SP/play//rdiff/TWiki/EditDoesNotIncreaseTheRevision HTTP/1.1" 200 6310 +64.242.88.10 - - [08/Mar/2004:15:02:29 -0800] "GET /ops/SP/play//rdiff/TWiki/WebTopicList HTTP/1.1" 200 14591 +64.242.88.10 - - [08/Mar/2004:15:03:49 -0800] "GET /antivirus.jsp HTTP/1.1" 200 3548 +64.242.88.10 - - [08/Mar/2004:15:07:41 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Harold%20*Gottschalk[^A-Za-z] HTTP/1.1" 200 4412 +ip-200-56-225-61-mty.marcatel.net.mx - - [08/Mar/2004:15:15:17 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +64.242.88.10 - - [08/Mar/2004:15:16:14 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.37 HTTP/1.1" 200 28922 +64.242.88.10 - - [08/Mar/2004:15:17:18 -0800] "GET /ops/SP/play//search/Main/?scope=topic®ex=on&search=^f HTTP/1.1" 200 3438 +64.242.88.10 - - [08/Mar/2004:15:19:35 -0800] "GET /RBL.jsp HTTP/1.1" 200 4114 +c-24-11-14-147.client.comcast.net - - [08/Mar/2004:16:54:47 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +c-24-11-14-147.client.comcast.net - - [08/Mar/2004:16:54:47 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +lj1036.passgo.com - - [08/Mar/2004:17:39:00 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1168.passgo.com - - [08/Mar/2004:17:39:01 -0800] "GET /ops/SP/play//oops/TWiki/TWikiVariables HTTP/1.0" 200 209 +calcite.rhyolite.com - - [08/Mar/2004:18:14:44 -0800] "GET /clients.jsp HTTP/1.1" 200 18767 +acbf6930.ipt.aol.com - - [08/Mar/2004:18:20:44 -0800] "GET /RBL.jsp HTTP/1.1" 200 4114 +acbf6930.ipt.aol.com - - [08/Mar/2004:18:20:44 -0800] "GET /LateEmail.jsp HTTP/1.1" 200 7649 +lj1018.passgo.com - - [08/Mar/2004:18:23:43 -0800] "GET /ops/SP/play//oops/Know/PublicSupported HTTP/1.0" 200 209 +barrie-ppp108371.sympatico.ca - - [08/Mar/2004:18:39:33 -0800] "GET /mailman/listinfo/webber HTTP/1.1" 200 6051 +barrie-ppp108371.sympatico.ca - - [08/Mar/2004:18:39:35 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +barrie-ppp108371.sympatico.ca - - [08/Mar/2004:18:39:35 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +barrie-ppp108371.sympatico.ca - - [08/Mar/2004:18:39:36 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +px7wh.vc.shawcable.net - - [08/Mar/2004:18:41:16 -0800] "GET /LateEmail.jsp HTTP/1.1" 200 7649 +user-0c8hdkf.cable.mindspring.com - - [08/Mar/2004:19:08:27 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +user-0c8hdkf.cable.mindspring.com - - [08/Mar/2004:19:08:28 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +user-0c8hdkf.cable.mindspring.com - - [08/Mar/2004:19:08:39 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.1" 200 4232 +user-0c8hdkf.cable.mindspring.com - - [08/Mar/2004:19:08:52 -0800] "GET /ops/SP/play//view/Main/VerifingGatway HTTP/1.1" 200 4750 +user-0c8hdkf.cable.mindspring.com - - [08/Mar/2004:19:10:06 -0800] "GET /ops/SP/play//view/Main/Relay_Domains HTTP/1.1" 200 4583 +lj1053.passgo.com - - [08/Mar/2004:19:24:42 -0800] "GET /ops/SP/play//oops/Main/SpamAssassinTaggingOnly HTTP/1.0" 200 209 +64.246.94.152 - - [08/Mar/2004:20:09:57 -0800] "HEAD /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 0 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:18 -0800] "GET / HTTP/1.0" 200 3169 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:18 -0800] "GET /favicon.ico HTTP/1.0" 200 1078 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:25 -0800] "GET /ststats/index.jsp HTTP/1.0" 200 2955 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:26 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.0" 200 3049 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:26 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.0" 200 2160 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:26 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.0" 200 2386 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:26 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.0" 200 3271 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:26 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.0" 200 1687 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:26 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.0" 200 2482 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:27 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.0" 200 1914 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:27 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.0" 200 1536 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:27 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.0" 200 2250 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:27 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.0" 200 1883 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:27 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.0" 200 1493 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:48 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:49 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:49 -0800] "GET /favicon.ico HTTP/1.0" 200 1078 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:53 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.0" 200 5234 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:50:59 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.0" 200 4022 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:51:01 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.0" 200 5672 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:51:51 -0800] "GET /ops/SP/play//view/Main/SpamAssassin HTTP/1.0" 200 4062 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:52:01 -0800] "GET /ops/SP/play//view/Main/SpamAssassin HTTP/1.0" 200 4062 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:04 -0800] "GET / HTTP/1.0" 200 3169 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:28 -0800] "GET /ststats/index.jsp HTTP/1.0" 200 2955 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.0" 200 3238 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.0" 200 3032 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.0" 200 2160 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.0" 200 2369 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.0" 200 1671 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.0" 200 2485 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.0" 200 1533 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.0" 200 1906 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.0" 200 2251 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.0" 200 1875 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.0" 200 1483 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:44 -0800] "GET /SpamAssassin.jsp HTTP/1.0" 200 7368 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:52 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +proxy0.haifa.ac.il - - [08/Mar/2004:22:04:09 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +proxy0.haifa.ac.il - - [08/Mar/2004:22:04:10 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +proxy0.haifa.ac.il - - [08/Mar/2004:22:04:24 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.0" 200 4515 +proxy0.haifa.ac.il - - [08/Mar/2004:22:04:35 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.0" 200 4004 +alille-251-1-2-197.w82-124.abo.wanadoo.fr - - [08/Mar/2004:22:30:01 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +a213-84-36-192.adsl.xs4all.nl - - [08/Mar/2004:23:42:55 -0800] "GET / HTTP/1.1" 200 3169 +195.246.13.119 - - [09/Mar/2004:01:48:27 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +195.246.13.119 - - [09/Mar/2004:01:48:28 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +195.246.13.119 - - [09/Mar/2004:01:48:28 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +195.246.13.119 - - [09/Mar/2004:01:49:53 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +195.246.13.119 - - [09/Mar/2004:01:49:57 -0800] "GET /ops/SP/play//view/Main/KevinWGagel HTTP/1.1" 200 4901 +195.246.13.119 - - [09/Mar/2004:01:50:35 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +195.246.13.119 - - [09/Mar/2004:01:50:54 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +195.246.13.119 - - [09/Mar/2004:01:51:17 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +195.246.13.119 - - [09/Mar/2004:01:51:41 -0800] "GET /ops/SP/play//edit/Main/RazorAndPostFix?topicparent=Main.WebHome HTTP/1.1" 401 12851 +195.246.13.119 - - [09/Mar/2004:01:51:45 -0800] "GET /go/bin/test/TWikiDocGraphics/help.gif HTTP/1.1" 200 130 +195.246.13.119 - - [09/Mar/2004:01:51:54 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.1" 200 4232 +195.246.13.119 - - [09/Mar/2004:01:52:12 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.1" 200 4534 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:10 -0800] "GET /ststats/index.jsp HTTP/1.1" 200 2955 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:17 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3068 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:17 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2187 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:17 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3277 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:17 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2379 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1687 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2592 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 1983 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1545 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2222 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1866 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1494 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +lj1052.passgo.com - - [09/Mar/2004:02:39:17 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1162.passgo.com - - [09/Mar/2004:02:39:18 -0800] "GET /ops/SP/play//view/Main/SanJoseOffice HTTP/1.0" 200 3884 +lj1162.passgo.com - - [09/Mar/2004:03:10:39 -0800] "GET /ops/SP/play//view/Main/SanJoseOffice HTTP/1.0" 200 3884 +mail.geovariances.fr - - [09/Mar/2004:05:01:53 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +mail.geovariances.fr - - [09/Mar/2004:05:01:53 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +mail.geovariances.fr - - [09/Mar/2004:05:02:11 -0800] "GET /ops/SP/play//view/Main/SpamAssassin HTTP/1.1" 200 4081 +mail.geovariances.fr - - [09/Mar/2004:05:02:11 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:02:14 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +mail.geovariances.fr - - [09/Mar/2004:05:02:14 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:02:19 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +mail.geovariances.fr - - [09/Mar/2004:05:02:19 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:02:27 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +mail.geovariances.fr - - [09/Mar/2004:05:02:28 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:04:09 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +mail.geovariances.fr - - [09/Mar/2004:05:04:09 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:09:30 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +mail.geovariances.fr - - [09/Mar/2004:05:09:31 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:12:45 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:12:45 -0800] "GET /ops/SP/play//view/Main/ConfigurationVariables HTTP/1.1" 200 58292 +mail.geovariances.fr - - [09/Mar/2004:05:13:40 -0800] "GET /ops/SP/play//view/TWiki/WebHome HTTP/1.1" 200 15182 +mail.geovariances.fr - - [09/Mar/2004:05:13:40 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:13:40 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot131x64.gif HTTP/1.1" 200 7218 +mail.geovariances.fr - - [09/Mar/2004:05:13:40 -0800] "GET /go/bin/test/TWikiDocGraphics/tip.gif HTTP/1.1" 200 123 +mail.geovariances.fr - - [09/Mar/2004:05:13:40 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot88x31.gif HTTP/1.1" 200 3501 +mail.geovariances.fr - - [09/Mar/2004:05:14:13 -0800] "GET /ops/SP/play//view/Sandbox/WebHome HTTP/1.1" 200 8632 +mail.geovariances.fr - - [09/Mar/2004:05:14:14 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +66-194-6-70.gen.twtelecom.net - - [09/Mar/2004:05:20:20 -0800] "GET / HTTP/1.1" 200 3169 +195.230.181.122 - - [09/Mar/2004:06:29:03 -0800] "GET /AmavisNew.jsp HTTP/1.0" 200 2300 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:33:21 -0800] "GET / HTTP/1.1" 200 3169 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:51 -0800] "GET /ststats/index.jsp HTTP/1.1" 200 2955 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:53 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3027 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:53 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2148 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:54 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3200 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:54 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2341 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:55 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1686 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:55 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2534 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:56 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 1948 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:56 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1549 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:57 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2214 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:57 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1873 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:58 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1500 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:04 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6708 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 8232 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:09 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8857 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:10 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7175 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:13 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9391 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:13 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6922 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:17 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6618 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:17 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5615 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:42 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:36:28 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:36:29 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:36:51 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:37:00 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:37:40 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:27:10 -0800] "GET / HTTP/1.1" 200 3169 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:27:10 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:27:44 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:27:44 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:27:44 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:27:59 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:28:05 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:28:12 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +207.195.59.160 - - [09/Mar/2004:08:08:35 -0800] "GET / HTTP/1.1" 200 3169 +207.195.59.160 - - [09/Mar/2004:08:08:37 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +207.195.59.160 - - [09/Mar/2004:08:08:38 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +207.195.59.160 - - [09/Mar/2004:08:08:54 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +207.195.59.160 - - [09/Mar/2004:08:08:54 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +207.195.59.160 - - [09/Mar/2004:08:08:57 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +207.195.59.160 - - [09/Mar/2004:08:09:39 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.1" 200 4665 +207.195.59.160 - - [09/Mar/2004:08:09:39 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +207.195.59.160 - - [09/Mar/2004:08:09:58 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +207.195.59.160 - - [09/Mar/2004:08:09:58 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +207.195.59.160 - - [09/Mar/2004:08:10:04 -0800] "GET /ops/SP/play//edit/Main/PostConf?topicparent=Main.PostfixCommands HTTP/1.1" 401 12851 +207.195.59.160 - - [09/Mar/2004:08:10:06 -0800] "GET /go/bin/test/TWikiDocGraphics/help.gif HTTP/1.1" 200 130 +207.195.59.160 - - [09/Mar/2004:08:10:12 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.1" 200 4232 +207.195.59.160 - - [09/Mar/2004:08:10:12 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +207.195.59.160 - - [09/Mar/2004:08:10:20 -0800] "GET /ops/SP/play//view/Main/Relay_Domains HTTP/1.1" 200 4583 +fw1.millardref.com - - [09/Mar/2004:08:17:27 -0800] "GET / HTTP/1.1" 200 3169 +207.195.59.160 - - [09/Mar/2004:08:17:34 -0800] "GET /ops/SP/play//view/Main/VerifingGatway HTTP/1.1" 200 4750 +fw1.millardref.com - - [09/Mar/2004:08:17:50 -0800] "GET /RBL.jsp HTTP/1.1" 200 4114 +207.195.59.160 - - [09/Mar/2004:08:18:17 -0800] "GET /ops/SP/play//view/Main/SideBar HTTP/1.1" 200 3972 +207.195.59.160 - - [09/Mar/2004:08:18:17 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +fw1.millardref.com - - [09/Mar/2004:08:18:19 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +fw1.millardref.com - - [09/Mar/2004:08:18:25 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +fw1.millardref.com - - [09/Mar/2004:08:18:26 -0800] "GET /images/image004.jpg HTTP/1.1" 200 10936 +fw1.millardref.com - - [09/Mar/2004:08:18:27 -0800] "GET /images/image005.jpg HTTP/1.1" 200 21125 +fw1.millardref.com - - [09/Mar/2004:08:18:27 -0800] "GET /images/msgops.JPG HTTP/1.1" 200 7939 +207.195.59.160 - - [09/Mar/2004:08:18:50 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +207.195.59.160 - - [09/Mar/2004:08:19:04 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +lj1007.passgo.com - - [09/Mar/2004:09:55:44 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1125.passgo.com - - [09/Mar/2004:09:55:53 -0800] "GET /ops/SP/play//oops/TWiki/WebChangesAlert HTTP/1.0" 200 209 +80.58.35.111.proxycache.rima-tde.net - - [09/Mar/2004:10:08:07 -0800] "GET /RBL.jsp HTTP/1.0" 200 4114 +10.0.0.176 - - [09/Mar/2004:10:29:38 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [09/Mar/2004:10:29:40 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8830 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 7255 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6703 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7127 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9241 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6856 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6618 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5615 +200.222.33.33 - - [09/Mar/2004:11:21:36 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +1-320.tnr.on.ca - - [09/Mar/2004:11:43:54 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +1-320.tnr.on.ca - - [09/Mar/2004:11:43:56 -0800] "GET /images/image005.jpg HTTP/1.1" 200 21125 +1-320.tnr.on.ca - - [09/Mar/2004:11:43:56 -0800] "GET /images/msgops.JPG HTTP/1.1" 200 7939 +1-320.tnr.on.ca - - [09/Mar/2004:11:43:56 -0800] "GET /images/image004.jpg HTTP/1.1" 200 10936 +l07v-1-17.d1.club-internet.fr - - [09/Mar/2004:11:57:20 -0800] "GET / HTTP/1.1" 200 3169 +wwwcache.lanl.gov - - [09/Mar/2004:12:16:06 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +trrc02m01-40.bctel.ca - - [09/Mar/2004:12:21:08 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +trrc02m01-40.bctel.ca - - [09/Mar/2004:12:21:09 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +trrc02m01-40.bctel.ca - - [09/Mar/2004:12:21:09 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +trrc02m01-40.bctel.ca - - [09/Mar/2004:12:21:10 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +fw.kcm.org - - [09/Mar/2004:12:21:49 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +fw.kcm.org - - [09/Mar/2004:12:21:49 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +lj1048.passgo.com - - [09/Mar/2004:12:52:21 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1031.passgo.com - - [09/Mar/2004:12:52:58 -0800] "GET /ops/SP/play//oops/TWiki/InterwikiPlugin HTTP/1.0" 200 209 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:14:53 -0800] "GET / HTTP/1.1" 200 3169 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:15:15 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:15:15 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:15:23 -0800] "GET /ops/SP/play//view/Main/SpamAssassin HTTP/1.1" 200 4081 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:15:33 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:15:49 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:16:00 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +h194n2fls308o1033.telia.com - - [09/Mar/2004:13:49:05 -0800] "-" 408 - +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:14:43:02 -0800] "GET /mailman HTTP/1.1" 302 301 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:14:43:03 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:14:43:04 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:14:43:05 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:14:43:05 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:14:43:12 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:15 -0800] "GET / HTTP/1.1" 200 3169 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:23 -0800] "GET /mailman HTTP/1.1" 302 301 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:23 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:24 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:24 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:24 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:28 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:56:15 -0800] "GET / HTTP/1.1" 304 - +home.yeungs.net - - [09/Mar/2004:15:03:55 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +203.147.138.233 - - [09/Mar/2004:15:25:03 -0800] "GET /ststats/index.jsp HTTP/1.1" 200 2955 +203.147.138.233 - - [09/Mar/2004:15:25:05 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +203.147.138.233 - - [09/Mar/2004:15:25:14 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3041 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1695 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2577 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3203 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 1970 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2181 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1550 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2314 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1850 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2213 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1509 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:37:35 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:37:36 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:37:36 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:37:36 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:15:44:52 -0800] "GET / HTTP/1.1" 200 3169 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:15:44:52 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:15:44:57 -0800] "GET /rejected.jsp HTTP/1.1" 200 3998 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:51:10 -0800] "GET /mailman/admin/ppwc HTTP/1.1" 200 2082 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:51:24 -0800] "POST /mailman/admin/ppwc HTTP/1.1" 200 2182 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:52:09 -0800] "POST /mailman/admin/ppwc HTTP/1.1" 200 2182 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:52:15 -0800] "POST /mailman/admin/ppwc HTTP/1.1" 200 19597 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:53:40 -0800] "GET /mailman/admin/ppwc/logout HTTP/1.1" 200 2103 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:53:49 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:53:56 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +lj1123.passgo.com - - [09/Mar/2004:16:23:55 -0800] "GET /ops/SP/play//oops/TWiki/RegularExp HTTP/1.0" 200 209 +206-15-133-153.dialup.ziplink.net - - [09/Mar/2004:16:27:48 -0800] "HEAD /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 0 +lj1048.passgo.com - - [09/Mar/2004:17:10:26 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1061.passgo.com - - [09/Mar/2004:17:10:28 -0800] "GET /ops/SP/play//oops/TWiki/TablePlugin HTTP/1.0" 200 209 +korell2.cc.gatech.edu - - [09/Mar/2004:17:33:58 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +65-37-13-251.nrp2.roc.ny.frontiernet.net - - [09/Mar/2004:17:42:41 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +65-37-13-251.nrp2.roc.ny.frontiernet.net - - [09/Mar/2004:17:42:42 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +65-37-13-251.nrp2.roc.ny.frontiernet.net - - [09/Mar/2004:17:42:42 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +65-37-13-251.nrp2.roc.ny.frontiernet.net - - [09/Mar/2004:17:43:54 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.1" 200 4665 +65-37-13-251.nrp2.roc.ny.frontiernet.net - - [09/Mar/2004:17:45:02 -0800] "GET /ops/SP/play//view/Sandbox/WebHome HTTP/1.1" 200 8632 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:00:43 -0800] "GET /mailman/admin HTTP/1.1" 200 6872 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:00:44 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:00:44 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:00:44 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:01:11 -0800] "GET /mailman/admin/webct HTTP/1.1" 200 2080 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:01:24 -0800] "GET /mailman HTTP/1.1" 302 301 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:01:25 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:01:28 -0800] "GET /mailman/listinfo/administration HTTP/1.1" 200 6459 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:01:45 -0800] "GET /mailman/listinfo/cnc_notice HTTP/1.1" 200 6337 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:02:07 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +grandpa.mmlc.northwestern.edu - - [09/Mar/2004:18:06:27 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +grandpa.mmlc.northwestern.edu - - [09/Mar/2004:18:06:27 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:23:32 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:23:32 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:25:15 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:25:18 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +calcite.rhyolite.com - - [09/Mar/2004:20:34:55 -0800] "GET /clients.jsp HTTP/1.1" 200 18892 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:45:43 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:45:48 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:45:51 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +2-238.tnr.on.ca - - [09/Mar/2004:21:33:22 -0800] "GET / HTTP/1.1" 200 3169 +lj1048.passgo.com - - [09/Mar/2004:21:51:09 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1153.passgo.com - - [09/Mar/2004:21:51:16 -0800] "GET /ops/SP/play//oops/Main/ThanadonSomdee HTTP/1.0" 200 209 +mmscrm07-2.uah.goweb.net - - [09/Mar/2004:22:23:39 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1036.passgo.com - - [09/Mar/2004:22:31:21 -0800] "GET /ops/SP/play//oops/Know/TopicClassification HTTP/1.0" 200 209 +adsl-157-26-153.msy.bellsouth.net - - [09/Mar/2004:22:40:32 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +adsl-157-26-153.msy.bellsouth.net - - [09/Mar/2004:22:40:33 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +lj1164.passgo.com - - [09/Mar/2004:22:44:31 -0800] "GET /ops/SP/play//oops/TWiki/TextFormattingRules HTTP/1.0" 200 209 +66-194-6-79.gen.twtelecom.net - - [09/Mar/2004:23:36:11 -0800] "GET / HTTP/1.1" 200 3169 +lj1231.passgo.com - - [10/Mar/2004:00:21:51 -0800] "GET /ops/SP/play//oops/Main/TWikiUsers HTTP/1.0" 200 209 +212.21.228.26 - - [10/Mar/2004:00:24:58 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +yongsan-cache.korea.army.mil - - [10/Mar/2004:00:29:44 -0800] "GET /mailman/listinfo/cncce HTTP/1.1" 200 6208 +yongsan-cache.korea.army.mil - - [10/Mar/2004:00:29:44 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +yongsan-cache.korea.army.mil - - [10/Mar/2004:00:29:44 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +yongsan-cache.korea.army.mil - - [10/Mar/2004:00:29:45 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +pd9e761cf.dip.t-dialin.net - - [10/Mar/2004:02:07:27 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +lj1048.passgo.com - - [10/Mar/2004:02:31:33 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1160.passgo.com - - [10/Mar/2004:02:31:44 -0800] "GET /razor.jsp HTTP/1.0" 304 - +nb-bolz.cremona.polimi.it - - [10/Mar/2004:02:52:49 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +pc-030-040.eco.rug.nl - - [10/Mar/2004:02:55:00 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:11:40 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:11:50 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:11:53 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:12:07 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:12:20 -0800] "GET /ops/SP/play//view/Main/ConfigurationVariables HTTP/1.1" 200 58292 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:12:33 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.1" 200 4665 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:12:45 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:12:48 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.1" 200 3629 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:12:56 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.1" 200 4534 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:14:40 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:14:54 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:15:28 -0800] "GET /ops/SP/play//view/Main/SideBar HTTP/1.1" 200 3972 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:15:33 -0800] "GET /ops/SP/play//view/Main/DCCGraphs HTTP/1.1" 200 5402 +80.58.14.235.proxycache.rima-tde.net - - [10/Mar/2004:03:52:49 -0800] "GET /mailman/listinfo/fnac HTTP/1.0" 200 5969 +80.58.14.235.proxycache.rima-tde.net - - [10/Mar/2004:03:52:51 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +80.58.14.235.proxycache.rima-tde.net - - [10/Mar/2004:03:52:51 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +80.58.14.235.proxycache.rima-tde.net - - [10/Mar/2004:03:52:52 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +66-194-6-70.gen.twtelecom.net - - [10/Mar/2004:05:21:38 -0800] "GET / HTTP/1.1" 200 3169 +pd9e50809.dip.t-dialin.net - - [10/Mar/2004:07:36:56 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +10.0.0.176 - - [10/Mar/2004:08:36:28 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:08:36:30 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 7783 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8845 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6274 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7071 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9328 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6976 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6619 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5517 +10.0.0.176 - - [10/Mar/2004:08:36:57 -0800] "GET /ststats/index.jsp HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3020 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2287 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2332 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1673 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2583 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 1976 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3364 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2220 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1627 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1837 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1528 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:51:31 -0800] "GET / HTTP/1.1" 304 - +ts05-ip44.hevanet.com - - [10/Mar/2004:08:52:13 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:52:16 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ts05-ip44.hevanet.com - - [10/Mar/2004:08:52:25 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:52:52 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:53:12 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:53:19 -0800] "GET /ops/SP/play//view/Main/PostfixCmd HTTP/1.1" 200 4173 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:53:33 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.1" 200 3629 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:54:15 -0800] "GET /ops/SP/play//view/Main/ConfigurationVariables HTTP/1.1" 200 58292 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:54:37 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.1" 200 4665 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:55:03 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.1" 200 4232 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:55:17 -0800] "GET /ops/SP/play//view/Main/VerifingGatway HTTP/1.1" 200 4750 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:55:40 -0800] "GET /ops/SP/play//view/Main/KevinWGagel HTTP/1.1" 200 4901 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:55:49 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.1" 200 4534 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:56:10 -0800] "GET /ops/SP/play//view/Main/SideBar HTTP/1.1" 200 3972 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:56:13 -0800] "GET /ops/SP/play//view/Main/DCCGraphs HTTP/1.1" 200 5402 +lj1048.passgo.com - - [10/Mar/2004:09:05:59 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1145.passgo.com - - [10/Mar/2004:09:05:59 -0800] "GET /ops/SP/play//oops/TWiki/MoveTopic HTTP/1.0" 200 209 +cacher2-ext.wise.edt.ericsson.se - - [10/Mar/2004:09:41:56 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +adsl-64-173-42-65.dsl.snfc21.pacbell.net - - [10/Mar/2004:10:37:53 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +ic8234.upco.es - - [10/Mar/2004:10:38:04 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +ic8234.upco.es - - [10/Mar/2004:10:38:05 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +ic8234.upco.es - - [10/Mar/2004:10:38:23 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +ic8234.upco.es - - [10/Mar/2004:10:38:27 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.1" 200 3629 +ns.mou.cz - - [10/Mar/2004:10:59:06 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:12:51 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +lj1117.passgo.com - - [10/Mar/2004:11:13:21 -0800] "GET /ops/SP/play//view/Know/WebStatistics HTTP/1.0" 200 6394 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:18:59 -0800] "GET /mailman/admin/ppwc HTTP/1.1" 200 2082 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:19:00 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:19:00 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:19:00 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:19:32 -0800] "POST /mailman/admin/ppwc HTTP/1.1" 200 19597 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:41:25 -0800] "GET /mailman/admin/ppwc HTTP/1.1" 200 2082 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:41:25 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:41:25 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:41:25 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:41:52 -0800] "POST /mailman/admin/ppwc HTTP/1.1" 200 19597 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:43:26 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:44:13 -0800] "GET /mailman/admin/ppwc/members HTTP/1.1" 200 15271 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:44:27 -0800] "GET /mailman/admin/ppwc/members?letter=n HTTP/1.1" 200 15131 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:44:44 -0800] "GET /mailman/admin/ppwc/members?letter=p HTTP/1.1" 200 24507 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:45:22 -0800] "GET /mailman/admin/ppwc/passwords HTTP/1.1" 200 6217 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:45:51 -0800] "GET /mailman/admin/ppwc/gateway HTTP/1.1" 200 0 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:45:51 -0800] "GET /mailman/admin/ppwc/gateway HTTP/1.1" 200 8692 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:46:42 -0800] "GET /mailman/admin/ppwc/general HTTP/1.1" 200 19597 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:47:37 -0800] "GET /mailman/admin/ppwc/?VARHELP=general/owner HTTP/1.1" 200 3505 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:49:57 -0800] "GET /mailman/admin/ppwc HTTP/1.1" 200 2082 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:49:57 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:49:57 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:49:57 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:50:28 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:50:35 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:52:14 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:52:42 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +10.0.0.176 - - [10/Mar/2004:12:02:38 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:43 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +10.0.0.176 - - [10/Mar/2004:12:02:43 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:45 -0800] "GET /mailman HTTP/1.1" 302 301 +10.0.0.176 - - [10/Mar/2004:12:02:46 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +10.0.0.176 - - [10/Mar/2004:12:02:46 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:46 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:46 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:50 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +10.0.0.176 - - [10/Mar/2004:12:02:50 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:50 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:50 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:52 -0800] "GET /mailman/admin/ppwc HTTP/1.1" 200 2082 +10.0.0.176 - - [10/Mar/2004:12:02:52 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:52 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:52 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:59 -0800] "POST /mailman/admin/ppwc HTTP/1.1" 200 19597 +10.0.0.176 - - [10/Mar/2004:12:03:00 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:00 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:00 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:03 -0800] "GET /mailman/admin/ppwc/members HTTP/1.1" 200 15271 +10.0.0.176 - - [10/Mar/2004:12:03:04 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:04 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:04 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:08 -0800] "GET /mailman/admin/ppwc/members?letter=p HTTP/1.1" 200 24507 +10.0.0.176 - - [10/Mar/2004:12:03:08 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:08 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:08 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:45 -0800] "GET /mailman/options/ppwc/ppwctwentynine--at--shaw.com HTTP/1.1" 200 14296 +10.0.0.176 - - [10/Mar/2004:12:03:45 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:45 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:45 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:06 -0800] "POST /mailman/options/ppwc/ppwctwentynine@shaw.com HTTP/1.1" 200 14579 +10.0.0.176 - - [10/Mar/2004:12:05:06 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:06 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:06 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:22 -0800] "GET /mailman/admin/ppwc HTTP/1.1" 200 19597 +10.0.0.176 - - [10/Mar/2004:12:05:22 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:22 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:22 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:38 -0800] "GET /mailman/admin/ppwc/members HTTP/1.1" 200 15271 +10.0.0.176 - - [10/Mar/2004:12:05:38 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:38 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:38 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:40 -0800] "GET /mailman/admin/ppwc/members?letter=p HTTP/1.1" 200 24525 +10.0.0.176 - - [10/Mar/2004:12:05:40 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:40 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:40 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:54 -0800] "POST /mailman/admin/ppwc/members?letter=p HTTP/1.1" 200 23169 +10.0.0.176 - - [10/Mar/2004:12:05:54 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:54 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:54 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:58 -0800] "GET /mailman/admin/ppwc/general HTTP/1.1" 200 19597 +10.0.0.176 - - [10/Mar/2004:12:05:58 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:58 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:58 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:06:07 -0800] "GET /mailman/admin/ppwc/members HTTP/1.1" 200 15271 +10.0.0.176 - - [10/Mar/2004:12:06:07 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:06:07 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:06:07 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:06:09 -0800] "GET /mailman/admin/ppwc/members/add HTTP/1.1" 200 6681 +10.0.0.176 - - [10/Mar/2004:12:06:09 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:06:09 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:06:09 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:07 -0800] "POST /mailman/admin/ppwc/members/add HTTP/1.1" 200 6762 +10.0.0.176 - - [10/Mar/2004:12:07:07 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:07 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:08 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:12 -0800] "GET /mailman/admin/ppwc/members/list HTTP/1.1" 200 15271 +10.0.0.176 - - [10/Mar/2004:12:07:12 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:12 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:13 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:14 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:14 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:14 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:14 -0800] "GET /mailman/admin/ppwc/members?letter=p HTTP/1.1" 200 24585 +10.0.0.176 - - [10/Mar/2004:12:07:25 -0800] "POST /mailman/admin/ppwc/members?letter=p HTTP/1.1" 200 24577 +10.0.0.176 - - [10/Mar/2004:12:07:25 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:25 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:25 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:16:59 -0800] "GET /mailman/admin/ppwc/logout HTTP/1.1" 200 2103 +10.0.0.176 - - [10/Mar/2004:12:16:59 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:16:59 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:16:59 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +142.27.64.35 - - [10/Mar/2004:12:19:02 -0800] "GET / HTTP/1.1" 304 - +142.27.64.35 - - [10/Mar/2004:12:19:05 -0800] "GET /mailman HTTP/1.1" 302 301 +142.27.64.35 - - [10/Mar/2004:12:19:05 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +142.27.64.35 - - [10/Mar/2004:12:19:06 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +142.27.64.35 - - [10/Mar/2004:12:19:06 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +142.27.64.35 - - [10/Mar/2004:12:19:06 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +142.27.64.35 - - [10/Mar/2004:12:19:08 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +lj1216.passgo.com - - [10/Mar/2004:12:22:32 -0800] "GET /ops/SP/play//oops/TWiki/WikiTopic HTTP/1.0" 200 209 +10.0.0.176 - - [10/Mar/2004:12:25:25 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:25:28 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 8663 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6392 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7133 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 9449 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6895 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9403 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6619 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5517 +c-411472d5.04-138-73746f22.cust.bredbandsbolaget.se - - [10/Mar/2004:13:13:23 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +3_343_lt_someone - - [10/Mar/2004:13:15:44 -0800] "GET / HTTP/1.1" 200 3169 +3_343_lt_someone - - [10/Mar/2004:13:15:53 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7142 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 5882 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6485 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8673 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6895 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9403 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6619 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5517 +watchguard.cgmatane.qc.ca - - [10/Mar/2004:13:41:37 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +watchguard.cgmatane.qc.ca - - [10/Mar/2004:13:42:23 -0800] "GET /RBL.jsp HTTP/1.1" 200 4114 +ppp2.p33.is.com.ua - - [10/Mar/2004:14:20:51 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +ppp2.p33.is.com.ua - - [10/Mar/2004:14:21:36 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +ppp2.p33.is.com.ua - - [10/Mar/2004:14:22:13 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +10.0.0.176 - - [10/Mar/2004:15:06:20 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:15:06:24 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [10/Mar/2004:15:06:24 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 5871 +10.0.0.176 - - [10/Mar/2004:15:06:24 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6484 +10.0.0.176 - - [10/Mar/2004:15:06:24 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7014 +10.0.0.176 - - [10/Mar/2004:15:06:24 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8821 +10.0.0.176 - - [10/Mar/2004:15:06:25 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9306 +10.0.0.176 - - [10/Mar/2004:15:06:25 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6937 +10.0.0.176 - - [10/Mar/2004:15:06:25 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5517 +10.0.0.176 - - [10/Mar/2004:15:06:25 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6619 +lj1024.passgo.com - - [10/Mar/2004:15:10:10 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1028.passgo.com - - [10/Mar/2004:15:10:13 -0800] "GET /ops/SP/play//oops/Main/T HTTP/1.0" 200 209 +lj1145.passgo.com - - [10/Mar/2004:15:49:55 -0800] "GET /ops/SP/play//oops/TWiki/NicholasLee HTTP/1.0" 200 209 +h24-68-45-227.gv.shawcable.net - - [10/Mar/2004:16:29:30 -0800] "GET /pipermail/cnc_notice/2004-February.txt HTTP/1.1" 200 6712 +64.246.94.141 - - [10/Mar/2004:16:31:19 -0800] "HEAD /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 0 +pntn02m05-129.bctel.ca - - [10/Mar/2004:16:33:04 -0800] "GET /pipermail/cncce/2004-January/000001.jsp HTTP/1.1" 200 3095 +calcite.rhyolite.com - - [10/Mar/2004:16:47:44 -0800] "GET /clients.jsp HTTP/1.1" 200 18971 +h24-68-45-227.gv.shawcable.net - - [10/Mar/2004:16:52:44 -0800] "GET /pipermail/cnc_notice/2003-December.txt HTTP/1.1" 200 6570 +h24-68-45-227.gv.shawcable.net - - [10/Mar/2004:16:54:36 -0800] "GET /pipermail/cnc_notice/2003-December/000002.jsp HTTP/1.1" 200 7074 +lj1117.passgo.com - - [10/Mar/2004:18:13:54 -0800] "GET /ops/SP/play//view/Main/VishaalGolam HTTP/1.0" 200 4577 +lj1073.passgo.com - - [10/Mar/2004:18:17:24 -0800] "GET /ops/SP/play//oops/TWiki/Wik HTTP/1.0" 200 209 +lj1024.passgo.com - - [10/Mar/2004:19:55:54 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1000.passgo.com - - [10/Mar/2004:19:55:56 -0800] "GET /ops/SP/play//view/Know/WebHome HTTP/1.0" 200 7529 +dialup-5-81.tulane.edu - - [10/Mar/2004:20:22:41 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +dialup-5-81.tulane.edu - - [10/Mar/2004:20:22:42 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +dialup-5-81.tulane.edu - - [10/Mar/2004:20:23:11 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +dialup-5-81.tulane.edu - - [10/Mar/2004:20:23:41 -0800] "GET /ops/SP/play//view/Main/TWikiGroups HTTP/1.1" 200 4816 +dialup-5-81.tulane.edu - - [10/Mar/2004:20:23:52 -0800] "GET /ops/SP/play//view/Main/TWikiAdminGroup HTTP/1.1" 200 4175 +lj1145.passgo.com - - [10/Mar/2004:21:56:34 -0800] "GET /ops/SP/play//oops/Main/WebStatistics HTTP/1.0" 200 209 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:58:46 -0800] "GET / HTTP/1.1" 200 3169 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:58:46 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:16 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:17 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 5664 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:17 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6403 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8837 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 6980 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9241 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6970 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6619 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5517 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:03 -0800] "GET /ststats/index.jsp HTTP/1.1" 200 2955 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:04 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3093 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2255 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3419 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2381 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1658 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2657 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 2008 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1598 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2223 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1924 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1550 +lj1220.passgo.com - - [10/Mar/2004:22:16:58 -0800] "GET /ops/SP/play//oops/TWiki/SvenDowideit HTTP/1.0" 200 209 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:28 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:30 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 5805 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:30 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6445 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:30 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8809 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 6882 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9241 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6970 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6619 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5517 +lj1024.passgo.com - - [11/Mar/2004:00:07:57 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1117.passgo.com - - [11/Mar/2004:00:07:58 -0800] "GET /ops/SP/play//oops/Know/WebStatistics HTTP/1.0" 200 209 +lj1120.passgo.com - - [11/Mar/2004:00:42:01 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.0" 200 5234 +ns3.vonroll.ch - - [11/Mar/2004:00:43:57 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +ns3.vonroll.ch - - [11/Mar/2004:00:43:59 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +ns3.vonroll.ch - - [11/Mar/2004:00:44:08 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.0" 200 4646 +lj1145.passgo.com - - [11/Mar/2004:01:39:53 -0800] "GET /ops/SP/play//view/Main/SimonMudd HTTP/1.0" 200 4612 +1513.cps.virtua.com.br - - [11/Mar/2004:02:27:39 -0800] "GET /pipermail/cipg/2003-november.txt HTTP/1.1" 404 309 +194.151.73.43 - - [11/Mar/2004:03:35:49 -0800] "GET /ie.htm HTTP/1.0" 200 3518 +194.151.73.43 - - [11/Mar/2004:03:35:57 -0800] "GET /images/image004.jpg HTTP/1.0" 200 10936 +194.151.73.43 - - [11/Mar/2004:03:35:57 -0800] "GET /images/image005.jpg HTTP/1.0" 200 21125 +194.151.73.43 - - [11/Mar/2004:03:35:58 -0800] "GET /images/msgops.JPG HTTP/1.0" 200 7939 +spica.ukc.ac.uk - - [11/Mar/2004:03:50:09 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +spica.ukc.ac.uk - - [11/Mar/2004:03:50:09 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +ogw.netinfo.nl - - [11/Mar/2004:06:11:19 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +ogw.netinfo.nl - - [11/Mar/2004:06:11:21 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +ogw.netinfo.nl - - [11/Mar/2004:06:11:38 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +ogw.netinfo.nl - - [11/Mar/2004:06:11:39 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ogw.netinfo.nl - - [11/Mar/2004:06:11:46 -0800] "GET /ops/SP/play//view/Main/PostfixCmd HTTP/1.1" 200 4173 +ogw.netinfo.nl - - [11/Mar/2004:06:11:47 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ogw.netinfo.nl - - [11/Mar/2004:06:12:41 -0800] "GET /ops/SP/play//view/Main/PostQueue HTTP/1.1" 200 4280 +ogw.netinfo.nl - - [11/Mar/2004:06:12:43 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ogw.netinfo.nl - - [11/Mar/2004:06:13:07 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.1" 200 3629 +ogw.netinfo.nl - - [11/Mar/2004:06:13:08 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ogw.netinfo.nl - - [11/Mar/2004:06:14:03 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.1" 200 4665 +ogw.netinfo.nl - - [11/Mar/2004:06:14:04 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ogw.netinfo.nl - - [11/Mar/2004:06:16:40 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.1" 200 4232 +ogw.netinfo.nl - - [11/Mar/2004:06:17:06 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.1" 200 4534 +ogw.netinfo.nl - - [11/Mar/2004:06:17:11 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +lj1024.passgo.com - - [11/Mar/2004:06:27:31 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1153.passgo.com - - [11/Mar/2004:06:27:36 -0800] "GET /ops/SP/play//oops/Sandbox/WebStatistics HTTP/1.0" 200 209 +208-186-146-13.nrp3.brv.mn.frontiernet.net - - [11/Mar/2004:06:48:05 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +208-186-146-13.nrp3.brv.mn.frontiernet.net - - [11/Mar/2004:06:48:05 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +ladybug.cns.vt.edu - - [11/Mar/2004:07:15:10 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +ladybug.cns.vt.edu - - [11/Mar/2004:07:15:11 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +ladybug.cns.vt.edu - - [11/Mar/2004:07:19:57 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +ladybug.cns.vt.edu - - [11/Mar/2004:07:20:05 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +ladybug.cns.vt.edu - - [11/Mar/2004:07:20:09 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +osdlab.eic.nctu.edu.tw - - [11/Mar/2004:07:39:30 -0800] "GET /M83A HTTP/1.0" 404 269 +208.247.148.12 - - [11/Mar/2004:08:14:18 -0800] "GET /mailman/listinfo/ppwc HTTP/1.0" 200 6252 +208.247.148.12 - - [11/Mar/2004:08:14:18 -0800] "GET /icons/mailman.jpg HTTP/1.0" 200 2022 +208.247.148.12 - - [11/Mar/2004:08:14:18 -0800] "GET /icons/PythonPowered.png HTTP/1.0" 200 945 +208.247.148.12 - - [11/Mar/2004:08:14:18 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.0" 200 3049 +ogw.netinfo.nl - - [11/Mar/2004:08:45:41 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +ogw.netinfo.nl - - [11/Mar/2004:08:45:42 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ogw.netinfo.nl - - [11/Mar/2004:08:45:49 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +ogw.netinfo.nl - - [11/Mar/2004:08:45:54 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +0x503e4fce.virnxx2.adsl-dhcp.tele.dk - - [11/Mar/2004:10:55:40 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +0x503e4fce.virnxx2.adsl-dhcp.tele.dk - - [11/Mar/2004:10:58:16 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +0x503e4fce.virnxx2.adsl-dhcp.tele.dk - - [11/Mar/2004:10:58:27 -0800] "GET /razor.jsp HTTP/1.1" 304 - +64-93-34-186.client.dsl.net - - [11/Mar/2004:11:12:40 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +d207-6-50-215.bchsia.telus.net - - [11/Mar/2004:11:33:35 -0800] "GET /pipermail/cncce/2004-January/000001.jsp HTTP/1.1" 200 3095 +10.0.0.176 - - [11/Mar/2004:11:49:51 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [11/Mar/2004:11:49:53 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 5622 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6357 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8728 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 6791 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9561 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 7087 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6427 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5598 +1-729.tnr.on.ca - - [11/Mar/2004:11:54:59 -0800] "GET / HTTP/1.1" 200 3169 +1-729.tnr.on.ca - - [11/Mar/2004:11:55:22 -0800] "GET /mailman HTTP/1.1" 302 301 +1-729.tnr.on.ca - - [11/Mar/2004:11:55:22 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +1-729.tnr.on.ca - - [11/Mar/2004:11:55:22 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +1-729.tnr.on.ca - - [11/Mar/2004:11:55:23 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +1-729.tnr.on.ca - - [11/Mar/2004:11:55:23 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +1-729.tnr.on.ca - - [11/Mar/2004:11:55:26 -0800] "GET /mailman/listinfo/administration HTTP/1.1" 200 6459 +h24-71-236-129.ca.clawio.org - - [11/Mar/2004:12:28:50 -0800] "GET /mailman/admindb/ppwc HTTP/1.1" 200 2072 +h24-71-236-129.ca.clawio.org - - [11/Mar/2004:12:28:50 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [11/Mar/2004:12:28:51 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [11/Mar/2004:12:28:51 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [11/Mar/2004:12:29:03 -0800] "POST /mailman/admindb/ppwc HTTP/1.1" 200 3407 +h24-71-236-129.ca.clawio.org - - [11/Mar/2004:12:29:27 -0800] "POST /mailman/admindb/ppwc HTTP/1.1" 200 1134 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:56:35 -0800] "GET /robots.txt HTTP/1.0" 200 68 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:56:58 -0800] "GET /ops/SP/play//view/TWiki/WebStatistics HTTP/1.0" 200 8193 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:57:18 -0800] "GET /ops/SP/play//view/Main/TWikiGuest HTTP/1.0" 200 4430 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:57:24 -0800] "GET /ops/SP/play//view/Main/WebHome?rev=1.25 HTTP/1.0" 200 9812 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:57:45 -0800] "GET /ops/SP/play//view/Main/WebNotify?rev=r1.6 HTTP/1.0" 200 4300 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:58:03 -0800] "GET /ops/SP/play//rdiff/TWiki/ManagingTopics?rev1=1.16&rev2=1.15 HTTP/1.0" 200 7912 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:58:37 -0800] "GET /ops/SP/play//view/Main/WebHome?rev=r1.8 HTTP/1.0" 200 8986 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:58:50 -0800] "GET /ops/SP/play//edit/Main/Max_idle?topicparent=Main.ConfigurationVariables HTTP/1.0" 401 12816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:59:07 -0800] "GET /ops/SP/play//view/Main/WebChanges HTTP/1.0" 200 40430 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:59:33 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Appendix%20*File%20*System%5B%5EA-Za-z%5D HTTP/1.0" 200 5794 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:59:52 -0800] "GET /ops/SP/play//oops/TWiki/AppendixFileSystem?template=oopsmore¶m1=1.12¶m2=1.12 HTTP/1.0" 200 11355 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:00:12 -0800] "GET /ops/SP/play//view/TWiki/WebTopicViewTemplate HTTP/1.0" 200 5420 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:00:47 -0800] "GET /ops/SP/play//rdiff/Main/WebHome HTTP/1.0" 200 69197 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:00:57 -0800] "GET /ops/SP/play//view/TWiki/WebPreferences?rev=r1.9 HTTP/1.0" 200 7875 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:01:21 -0800] "GET /ops/SP/play//rdiff/Main/ConfigurationVariables?rev1=1.2&rev2=1.1 HTTP/1.0" 200 59549 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:01:37 -0800] "GET /ops/SP/play//view/Main/AndreaSterbini HTTP/1.0" 200 3891 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:01:58 -0800] "GET /ops/SP/play//rdiff/Main/AndreaSterbini HTTP/1.0" 200 5567 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:02:22 -0800] "GET /ops/SP/play//rdiff/TWiki/WebNotify HTTP/1.0" 200 11733 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:02:42 -0800] "GET /ops/SP/play//rdiff/Main/WebHome?rev1=1.28&rev2=1.27 HTTP/1.0" 200 3577 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:03:06 -0800] "GET /ops/SP/play//view/Main/WebHome?skin=print HTTP/1.0" 200 8347 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:03:23 -0800] "GET /ops/SP/play//search/Main/SearchResult?search=%5C.*&scope=topic&order=modified&reverse=on®ex=on&nosearch=on HTTP/1.0" 200 43816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:03:48 -0800] "GET /ops/SP/play//view/TWiki/FormattedSearch HTTP/1.0" 200 20420 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:04:09 -0800] "GET /ops/SP/play//oops/Main/WebHome?template=oopsmore¶m1=1.28¶m2=1.8 HTTP/1.0" 200 7410 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:04:30 -0800] "GET /ops/SP/play//edit/TWiki/TextFormattingFAQ?t=1075982736 HTTP/1.0" 401 12816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:04:52 -0800] "GET /ops/SP/play//edit/Main/Allow_untrusted_routing?topicparent=Main.ConfigurationVariables HTTP/1.0" 401 12816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:05:13 -0800] "GET /ops/SP/play//edit/Main/Smtp_data_init_timeout?topicparent=Main.ConfigurationVariables HTTP/1.0" 401 12816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:05:33 -0800] "GET /ops/SP/play//view/TWiki/AppendixFileSystem?rev=1.10 HTTP/1.0" 200 34910 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:05:54 -0800] "GET /ops/SP/play//view/Main/AndreaSterbini?rev=r1.1 HTTP/1.0" 200 3732 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:06:17 -0800] "GET /ops/SP/play//view/Know/WebNotify HTTP/1.0" 200 4472 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:06:39 -0800] "GET /ops/SP/play//rdiff/Main/PeterThoeny HTTP/1.0" 200 18859 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:07:02 -0800] "GET /ops/SP/play//view/Main/WebHome?skin=print&rev=1.25 HTTP/1.0" 200 7762 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:07:20 -0800] "GET /ops/SP/play//edit/Main/Relayhost?topicparent=Main.ConfigurationVariables HTTP/1.0" 401 12816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:07:40 -0800] "GET /ops/SP/play//edit/Main/Unknown_virtual_mailbox_reject_code?topicparent=Main.ConfigurationVariables HTTP/1.0" 401 12816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:08:03 -0800] "GET /ops/SP/play//view/TWiki/WebPreferences HTTP/1.0" 200 9109 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:08:44 -0800] "GET /ops/SP/play//view/Main/DCC HTTP/1.0" 200 4377 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:09:04 -0800] "GET /ops/SP/play//view/Know/WebHome HTTP/1.0" 200 7529 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:09:21 -0800] "GET /ops/SP/play//view/Main/WebNotify HTTP/1.0" 200 4449 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:09:24 -0800] "GET /ops/SP/play//oops/Main/WebHome?template=oopsmore¶m1=1.28¶m2=1.28 HTTP/1.0" 200 7411 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:09:52 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.0" 200 4004 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:10:11 -0800] "GET /ops/SP/play//view/TWiki/WebHome HTTP/1.0" 200 15147 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:10:27 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.0" 200 4646 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:10:52 -0800] "GET /ops/SP/play//view/Main/WebTopicList HTTP/1.0" 200 7461 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:11:09 -0800] "GET /ops/SP/play//view/Main/WebHome?rev=1.27 HTTP/1.0" 200 10313 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:11:41 -0800] "GET /ops/SP/play//view/Main/ConfigurationVariables HTTP/1.0" 200 58169 +4.37.97.186 - - [11/Mar/2004:13:12:54 -0800] "GET /pipermail/webber/2004-January/000000.jsp HTTP/1.1" 200 2446 +12.22.207.235 - - [11/Mar/2004:13:18:15 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +archserve.id.ucsb.edu - - [11/Mar/2004:13:22:32 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +archserve.id.ucsb.edu - - [11/Mar/2004:13:22:32 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +2-110.tnr.on.ca - - [11/Mar/2004:13:24:03 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +2-110.tnr.on.ca - - [11/Mar/2004:13:24:04 -0800] "GET /images/image005.jpg HTTP/1.1" 200 21125 +2-110.tnr.on.ca - - [11/Mar/2004:13:24:04 -0800] "GET /images/image004.jpg HTTP/1.1" 200 10936 +2-110.tnr.on.ca - - [11/Mar/2004:13:24:04 -0800] "GET /images/msgops.JPG HTTP/1.1" 200 7939 +2-110.tnr.on.ca - - [11/Mar/2004:13:26:38 -0800] "GET /images/image005.jpg HTTP/1.1" 304 - +2-110.tnr.on.ca - - [11/Mar/2004:13:26:38 -0800] "GET /images/image004.jpg HTTP/1.1" 304 - +2-110.tnr.on.ca - - [11/Mar/2004:13:26:38 -0800] "GET /images/msgops.JPG HTTP/1.1" 304 - +lj1024.passgo.com - - [11/Mar/2004:13:27:05 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1212.passgo.com - - [11/Mar/2004:13:27:05 -0800] "GET / HTTP/1.0" 200 3169 +2-110.tnr.on.ca - - [11/Mar/2004:14:14:44 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +2-110.tnr.on.ca - - [11/Mar/2004:14:14:47 -0800] "GET /images/image005.jpg HTTP/1.1" 200 21125 +2-110.tnr.on.ca - - [11/Mar/2004:14:14:47 -0800] "GET /images/msgops.JPG HTTP/1.1" 200 7939 +2-110.tnr.on.ca - - [11/Mar/2004:14:14:50 -0800] "GET /images/image004.jpg HTTP/1.1" 200 10936 +favr.go.de - - [11/Mar/2004:14:22:08 -0800] "GET /robots.txt HTTP/1.0" 200 68 +favr.go.de - - [11/Mar/2004:14:22:09 -0800] "GET /ops/SP/play//view/Main/WebSearch HTTP/1.0" 200 9263 +favr.go.de - - [11/Mar/2004:14:26:26 -0800] "GET /ops/SP/play//view/Sandbox/WebHome HTTP/1.0" 200 8605 +favr.go.de - - [11/Mar/2004:14:28:53 -0800] "GET /ops/SP/play//view/Sandbox/WebChanges HTTP/1.0" 200 9622 +favr.go.de - - [11/Mar/2004:14:29:44 -0800] "GET /ops/SP/play//view/Sandbox/WebPreferences HTTP/1.0" 200 8380 +favr.go.de - - [11/Mar/2004:14:29:52 -0800] "GET /ops/SP/play//view/Main/WebStatistics HTTP/1.0" 200 8331 +favr.go.de - - [11/Mar/2004:14:30:51 -0800] "GET /ops/SP/play//view/Main/WebTopicList HTTP/1.0" 200 7461 +favr.go.de - - [11/Mar/2004:14:31:43 -0800] "GET /ops/SP/play//view/Main/WebPreferences HTTP/1.0" 200 8793 +lj1008.passgo.com - - [11/Mar/2004:14:31:48 -0800] "GET /ops/SP/play//oops/TWiki/WikiWikiClones HTTP/1.0" 200 209 +favr.go.de - - [11/Mar/2004:14:33:01 -0800] "GET /ops/SP/play//view/Main/WebNotify HTTP/1.0" 200 4449 +64-249-27-114.client.dsl.net - - [11/Mar/2004:14:53:12 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +pd9eb1396.dip.t-dialin.net - - [11/Mar/2004:15:17:08 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +10.0.0.176 - - [11/Mar/2004:15:51:49 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [11/Mar/2004:15:52:07 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +10.0.0.176 - - [11/Mar/2004:15:52:07 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +10.0.0.176 - - [11/Mar/2004:15:52:12 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +10.0.0.176 - - [11/Mar/2004:15:52:12 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +10.0.0.176 - - [11/Mar/2004:15:52:18 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 6329 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8771 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6340 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 6846 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9523 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6996 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6427 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5598 +10.0.0.176 - - [11/Mar/2004:15:52:37 -0800] "GET /ststats/index.jsp HTTP/1.1" 304 - +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3241 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3327 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2434 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1676 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 2029 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1604 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2640 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2251 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1899 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1556 +10.0.0.176 - - [11/Mar/2004:15:52:39 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2243 +lj1105.passgo.com - - [11/Mar/2004:16:02:37 -0800] "GET /ops/SP/play//oops/TWiki/1000 HTTP/1.0" 200 209 +wc01.piwa.pow.fr - - [11/Mar/2004:16:12:59 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +wc01.piwa.pow.fr - - [11/Mar/2004:16:13:02 -0800] "GET /images/image005.jpg HTTP/1.1" 200 21125 +wc01.piwa.pow.fr - - [11/Mar/2004:16:13:02 -0800] "GET /images/msgops.JPG HTTP/1.1" 200 7939 +wc03.mtnk.rnc.net.cable.rogers.com - - [11/Mar/2004:16:13:03 -0800] "GET /images/image004.jpg HTTP/1.1" 200 10936 +206-15-133-154.dialup.ziplink.net - - [11/Mar/2004:16:33:23 -0800] "HEAD /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 0 +lj1024.passgo.com - - [11/Mar/2004:18:11:39 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1008.passgo.com - - [11/Mar/2004:18:11:40 -0800] "GET /ops/SP/play//oops/Main/Smtpd_recipient_limit HTTP/1.0" 200 209 +ipcorp-c8b07af1.terraempresas.com.br - - [11/Mar/2004:18:31:35 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +66-194-6-79.gen.twtelecom.net - - [11/Mar/2004:18:57:52 -0800] "GET / HTTP/1.1" 200 3169 +lj1223.passgo.com - - [11/Mar/2004:20:12:24 -0800] "GET /ops/SP/play//view/Main/MikeMannix HTTP/1.0" 200 3674 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:32 -0800] "GET /ststats/ HTTP/1.1" 200 2955 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:37 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3091 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:37 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2230 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:37 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2388 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:37 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3440 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1659 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2662 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 2064 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1624 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2243 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1879 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1575 +lj1073.passgo.com - - [11/Mar/2004:20:59:05 -0800] "GET /ops/SP/play//oops/TWiki/TWikiPlannedFeatures HTTP/1.0" 200 209 +mmscrm07-2.uah.goweb.net - - [11/Mar/2004:23:56:31 -0800] "GET /robots.txt HTTP/1.0" 200 68 +66-194-6-71.gen.twtelecom.net - - [12/Mar/2004:01:30:44 -0800] "GET / HTTP/1.1" 200 3169 +lj1024.passgo.com - - [12/Mar/2004:02:27:29 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1123.passgo.com - - [12/Mar/2004:02:27:32 -0800] "GET /ops/SP/play//view/Sandbox/WebIndex HTTP/1.0" 200 8667 +195.11.231.210 - - [12/Mar/2004:03:32:56 -0800] "GET /mailman/listinfo/webber HTTP/1.0" 200 6032 +80.58.33.42.proxycache.rima-tde.net - - [12/Mar/2004:04:57:20 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +80.58.33.42.proxycache.rima-tde.net - - [12/Mar/2004:04:57:21 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +80.58.33.42.proxycache.rima-tde.net - - [12/Mar/2004:04:57:56 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.1" 200 4534 +200.100.10.5 - - [12/Mar/2004:04:59:21 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +200.100.10.5 - - [12/Mar/2004:04:59:21 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +lj1115.passgo.com - - [12/Mar/2004:05:03:19 -0800] "GET /ops/SP/play//view/Main/TWikiAdminGroup HTTP/1.0" 200 4156 +lj1008.passgo.com - - [12/Mar/2004:05:19:31 -0800] "GET /ops/SP/play//oops/TWiki/Mana HTTP/1.0" 200 209 +71.134.70.5 - - [12/Mar/2004:05:25:20 -0800] "GET /mailman/listinfo/cncce HTTP/1.1" 200 6208 +71.134.70.5 - - [12/Mar/2004:05:25:24 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +71.134.70.5 - - [12/Mar/2004:05:25:24 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +71.134.70.5 - - [12/Mar/2004:05:25:25 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +200.100.10.5 - - [12/Mar/2004:05:44:35 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +200.100.10.5 - - [12/Mar/2004:05:44:35 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +200.100.10.5 - - [12/Mar/2004:05:44:50 -0800] "GET /ops/SP/play//view/Main/DCC HTTP/1.1" 200 4396 +200.100.10.5 - - [12/Mar/2004:05:44:51 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +200.100.10.5 - - [12/Mar/2004:05:51:36 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +vlp181.vlp.fi - - [12/Mar/2004:08:33:32 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +lj1024.passgo.com - - [12/Mar/2004:09:12:01 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1223.passgo.com - - [12/Mar/2004:09:12:02 -0800] "GET /ops/SP/play//oops/Main/Mi HTTP/1.0" 200 209 +10.0.0.176 - - [12/Mar/2004:11:01:26 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [12/Mar/2004:11:01:28 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 6405 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6413 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 6952 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8715 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 7001 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9514 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6644 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5554 +fassys.org - - [12/Mar/2004:11:16:36 -0800] "GET /ststats/ HTTP/1.0" 200 2955 +fassys.org - - [12/Mar/2004:11:16:55 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.0" 200 2925 +fassys.org - - [12/Mar/2004:11:16:55 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.0" 200 2347 +fassys.org - - [12/Mar/2004:11:16:55 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.0" 200 3431 +fassys.org - - [12/Mar/2004:11:16:55 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.0" 200 2380 +fassys.org - - [12/Mar/2004:11:16:55 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.0" 200 1658 +fassys.org - - [12/Mar/2004:11:16:55 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.0" 200 2685 +fassys.org - - [12/Mar/2004:11:16:56 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.0" 200 2082 +fassys.org - - [12/Mar/2004:11:16:56 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.0" 200 1637 +fassys.org - - [12/Mar/2004:11:16:56 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.0" 200 2211 +fassys.org - - [12/Mar/2004:11:16:56 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.0" 200 1853 +fassys.org - - [12/Mar/2004:11:16:56 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.0" 200 1572 +67.131.107.5 - - [12/Mar/2004:11:39:14 -0800] "GET / HTTP/1.1" 200 3169 +67.131.107.5 - - [12/Mar/2004:11:39:25 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +67.131.107.5 - - [12/Mar/2004:11:39:31 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +10.0.0.176 - - [12/Mar/2004:12:23:11 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [12/Mar/2004:12:23:17 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6324 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8964 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 6225 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 7001 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9514 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 6949 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6644 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5554 +10.0.0.176 - - [12/Mar/2004:12:23:40 -0800] "GET /ststats/index.jsp HTTP/1.1" 304 - +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 2964 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2341 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2346 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3438 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1670 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2651 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 2023 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1636 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2262 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1906 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1582 +216.139.185.45 - - [12/Mar/2004:13:04:01 -0800] "GET /mailman/listinfo/webber HTTP/1.1" 200 6051 +pd95f99f2.dip.t-dialin.net - - [12/Mar/2004:13:18:57 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +d97082.upc-d.chello.nl - - [12/Mar/2004:13:25:45 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 diff --git a/rxjava/src/test/resources/expected_clob b/rxjava/src/test/resources/expected_clob new file mode 100644 index 0000000000..d7bc560556 --- /dev/null +++ b/rxjava/src/test/resources/expected_clob @@ -0,0 +1,1546 @@ +64.242.88.10 - - [07/Mar/2004:16:05:49 -0800] "GET /ops/SP/play//edit/Main/Double_bounce_sender?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:16:06:51 -0800] "GET /ops/SP/play//rdiff/TWiki/NewUserTemplate?rev1=1.3&rev2=1.2 HTTP/1.1" 200 4523 +64.242.88.10 - - [07/Mar/2004:16:10:02 -0800] "GET /mailman/listinfo/hsdivision HTTP/1.1" 200 6291 +64.242.88.10 - - [07/Mar/2004:16:11:58 -0800] "GET /ops/SP/play//view/TWiki/WikiSyntax HTTP/1.1" 200 7352 +64.242.88.10 - - [07/Mar/2004:16:20:55 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +64.242.88.10 - - [07/Mar/2004:16:23:12 -0800] "GET /ops/SP/play//oops/TWiki/AppendixFileSystem?template=oopsmore¶m1=1.12¶m2=1.12 HTTP/1.1" 200 11382 +64.242.88.10 - - [07/Mar/2004:16:24:16 -0800] "GET /ops/SP/play//view/Main/PeterThoeny HTTP/1.1" 200 4924 +64.242.88.10 - - [07/Mar/2004:16:29:16 -0800] "GET /ops/SP/play//edit/Main/Header_checks?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:16:30:29 -0800] "GET /ops/SP/play//attach/Main/OfficeLocations HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:16:31:48 -0800] "GET /ops/SP/play//view/TWiki/WebTopicEditTemplate HTTP/1.1" 200 3732 +64.242.88.10 - - [07/Mar/2004:16:32:50 -0800] "GET /ops/SP/play//view/Main/WebChanges HTTP/1.1" 200 40520 +64.242.88.10 - - [07/Mar/2004:16:33:53 -0800] "GET /ops/SP/play//edit/Main/Smtpd_etrn_restrictions?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:16:35:19 -0800] "GET /mailman/listinfo/business HTTP/1.1" 200 6379 +64.242.88.10 - - [07/Mar/2004:16:36:22 -0800] "GET /ops/SP/play//rdiff/Main/WebIndex?rev1=1.2&rev2=1.1 HTTP/1.1" 200 46373 +64.242.88.10 - - [07/Mar/2004:16:37:27 -0800] "GET /ops/SP/play//view/TWiki/DontNotify HTTP/1.1" 200 4140 +64.242.88.10 - - [07/Mar/2004:16:39:24 -0800] "GET /ops/SP/play//view/Main/TokyoOffice HTTP/1.1" 200 3853 +64.242.88.10 - - [07/Mar/2004:16:43:54 -0800] "GET /ops/SP/play//view/Main/MikeMannix HTTP/1.1" 200 3686 +64.242.88.10 - - [07/Mar/2004:16:45:56 -0800] "GET /ops/SP/play//attach/Main/PostfixCommands HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:16:47:12 -0800] "GET /robots.txt HTTP/1.1" 200 68 +64.242.88.10 - - [07/Mar/2004:16:47:46 -0800] "GET /ops/SP/play//rdiff/Know/ReadmeFirst?rev1=1.5&rev2=1.4 HTTP/1.1" 200 5724 +64.242.88.10 - - [07/Mar/2004:16:49:04 -0800] "GET /ops/SP/play//view/Main/TWikiGroups?rev=1.2 HTTP/1.1" 200 5162 +64.242.88.10 - - [07/Mar/2004:16:50:54 -0800] "GET /ops/SP/play//rdiff/Main/ConfigurationVariables HTTP/1.1" 200 59679 +64.242.88.10 - - [07/Mar/2004:16:52:35 -0800] "GET /ops/SP/play//edit/Main/Flush_service_name?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:16:53:46 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiRegistration HTTP/1.1" 200 34395 +64.242.88.10 - - [07/Mar/2004:16:54:55 -0800] "GET /ops/SP/play//rdiff/Main/NicholasLee HTTP/1.1" 200 7235 +64.242.88.10 - - [07/Mar/2004:16:56:39 -0800] "GET /ops/SP/play//view/Sandbox/WebHome?rev=1.6 HTTP/1.1" 200 8545 +64.242.88.10 - - [07/Mar/2004:16:58:54 -0800] "GET /mailman/listinfo/administration HTTP/1.1" 200 6459 +lordgun.org - - [07/Mar/2004:17:01:53 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +64.242.88.10 - - [07/Mar/2004:17:09:01 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Joris%20*Benschop[^A-Za-z] HTTP/1.1" 200 4284 +64.242.88.10 - - [07/Mar/2004:17:10:20 -0800] "GET /ops/SP/play//oops/TWiki/TextFormattingRules?template=oopsmore¶m1=1.37¶m2=1.37 HTTP/1.1" 200 11400 +64.242.88.10 - - [07/Mar/2004:17:13:50 -0800] "GET /ops/SP/play//edit/TWiki/DefaultPlugin?t=1078688936 HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:17:16:00 -0800] "GET /ops/SP/play//search/Main/?scope=topic®ex=on&search=^g HTTP/1.1" 200 3675 +64.242.88.10 - - [07/Mar/2004:17:17:27 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=^d HTTP/1.1" 200 5773 +lj1036.passgo.com - - [07/Mar/2004:17:18:36 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1090.passgo.com - - [07/Mar/2004:17:18:41 -0800] "GET /ops/SP/play//view/Main/LondonOffice HTTP/1.0" 200 3860 +64.242.88.10 - - [07/Mar/2004:17:21:44 -0800] "GET /ops/SP/play//attach/TWiki/TablePlugin HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:17:22:49 -0800] "GET /ops/SP/play//view/TWiki/ManagingWebs?rev=1.22 HTTP/1.1" 200 9310 +64.242.88.10 - - [07/Mar/2004:17:23:54 -0800] "GET /ops/SP/play//statistics/Main HTTP/1.1" 200 808 +64.242.88.10 - - [07/Mar/2004:17:26:30 -0800] "GET /ops/SP/play//view/TWiki/WikiCulture HTTP/1.1" 200 5935 +64.242.88.10 - - [07/Mar/2004:17:27:37 -0800] "GET /ops/SP/play//edit/Main/WebSearch?t=1078669682 HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:17:28:45 -0800] "GET /ops/SP/play//oops/TWiki/ResetPassword?template=oopsmore¶m1=1.4¶m2=1.4 HTTP/1.1" 200 11281 +64.242.88.10 - - [07/Mar/2004:17:29:59 -0800] "GET /ops/SP/play//view/TWiki/ManagingWebs?skin=print HTTP/1.1" 200 8806 +64.242.88.10 - - [07/Mar/2004:17:31:39 -0800] "GET /ops/SP/play//edit/Main/UvscanAndPostFix?topicparent=Main.WebHome HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:17:35:35 -0800] "GET /ops/SP/play//view/TWiki/KlausWriessnegger HTTP/1.1" 200 3848 +64.242.88.10 - - [07/Mar/2004:17:39:39 -0800] "GET /ops/SP/play//view/Main/SpamAssassin HTTP/1.1" 200 4081 +64.242.88.10 - - [07/Mar/2004:17:42:15 -0800] "GET /ops/SP/play//oops/TWiki/RichardDonkin?template=oopsmore¶m1=1.2¶m2=1.2 HTTP/1.1" 200 11281 +64.242.88.10 - - [07/Mar/2004:17:46:17 -0800] "GET /ops/SP/play//rdiff/TWiki/AlWilliams?rev1=1.3&rev2=1.2 HTTP/1.1" 200 4485 +64.242.88.10 - - [07/Mar/2004:17:47:43 -0800] "GET /ops/SP/play//rdiff/TWiki/AlWilliams?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5234 +64.242.88.10 - - [07/Mar/2004:17:50:44 -0800] "GET /ops/SP/play//view/TWiki/SvenDowideit HTTP/1.1" 200 3616 +64.242.88.10 - - [07/Mar/2004:17:53:45 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Office%20*Locations[^A-Za-z] HTTP/1.1" 200 7771 +64.242.88.10 - - [07/Mar/2004:17:56:54 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.31 HTTP/1.1" 200 23338 +64.242.88.10 - - [07/Mar/2004:17:58:00 -0800] "GET /ops/SP/play//edit/Main/KevinWGagel?t=1078670331 HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:18:00:09 -0800] "GET /ops/SP/play//edit/Main/Virtual_mailbox_lock?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:18:02:10 -0800] "GET /ops/SP/play//view/Main/WebPreferences HTTP/1.1" 200 8820 +64.242.88.10 - - [07/Mar/2004:18:04:05 -0800] "GET /ops/SP/play//view/TWiki/WikiWord?rev=1.3 HTTP/1.1" 200 6816 +lj1125.passgo.com - - [07/Mar/2004:18:06:14 -0800] "GET /ops/SP/play//oops/Sandbox/WebChanges HTTP/1.0" 200 209 +64.242.88.10 - - [07/Mar/2004:18:09:00 -0800] "GET /ops/SP/play//rdiff/Main/TWikiGuest HTTP/1.1" 200 11314 +64.242.88.10 - - [07/Mar/2004:18:10:09 -0800] "GET /ops/SP/play//edit/TWiki/TWikiVariables?t=1078684115 HTTP/1.1" 401 12846 +d207-6-9-183.bchsia.telus.net - - [07/Mar/2004:18:10:18 -0800] "GET /pipermail/cncce/2004-January/000001.jsp HTTP/1.1" 200 3095 +d207-6-9-183.bchsia.telus.net - - [07/Mar/2004:18:10:20 -0800] "GET /pipermail/cncce/2004-January/000002.jsp HTTP/1.1" 200 3810 +64.242.88.10 - - [07/Mar/2004:18:17:26 -0800] "GET /ops/SP/play//rdiff/TWiki/WikiWord?rev1=1.4&rev2=1.3 HTTP/1.1" 200 6948 +64.242.88.10 - - [07/Mar/2004:18:19:01 -0800] "GET /ops/SP/play//edit/Main/TWikiPreferences?topicparent=Main.WebHome HTTP/1.1" 401 12846 +d207-6-9-183.bchsia.telus.net - - [07/Mar/2004:18:19:16 -0800] "GET /pipermail/cncce/2004-January.txt HTTP/1.1" 200 3376 +64.242.88.10 - - [07/Mar/2004:18:22:52 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Web%20*Statistics[^A-Za-z] HTTP/1.1" 200 3584 +64.242.88.10 - - [07/Mar/2004:18:26:32 -0800] "GET /ops/SP/play//rdiff/TWiki/PeterFokkinga?rev1=1.4&rev2=1.3 HTTP/1.1" 200 4548 +64.242.88.10 - - [07/Mar/2004:18:32:39 -0800] "GET /mailman/listinfo/dentalstudies HTTP/1.1" 200 6345 +64.242.88.10 - - [07/Mar/2004:18:34:42 -0800] "GET /ops/SP/play//view/Main/TWikiGuest HTTP/1.1" 200 4449 +64.242.88.10 - - [07/Mar/2004:18:42:29 -0800] "GET /ops/SP/play//attach/Main/TWikiGroups HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:18:46:00 -0800] "GET /ops/SP/play//rdiff/TWiki/TextFormattingRules?rev1=1.36&rev2=1.35 HTTP/1.1" 200 25416 +64.242.88.10 - - [07/Mar/2004:18:47:06 -0800] "GET /ops/SP/play//rdiff/Main/TWikiGroups?rev1=1.3&rev2=1.2 HTTP/1.1" 200 4308 +64.242.88.10 - - [07/Mar/2004:18:48:15 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=.* HTTP/1.1" 200 3544 +64.242.88.10 - - [07/Mar/2004:18:52:30 -0800] "GET /ops/SP/play//edit/Main/Trigger_timeout?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:18:53:55 -0800] "GET /ops/SP/play//oops/TWiki/TWikiSite?template=oopsmore¶m1=1.21¶m2=1.21 HTTP/1.1" 200 11284 +64.242.88.10 - - [07/Mar/2004:18:57:07 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.35 HTTP/1.1" 200 27248 +64.242.88.10 - - [07/Mar/2004:18:58:52 -0800] "GET /ops/SP/play//edit/Main/Mydestination?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:18:59:52 -0800] "GET /mailman/listinfo/fcd HTTP/1.1" 200 5967 +64.242.88.10 - - [07/Mar/2004:19:01:48 -0800] "GET /ops/SP/play//rdiff/Main/WebHome?rev1=1.28&rev2=1.27 HTTP/1.1" 200 3596 +64.242.88.10 - - [07/Mar/2004:19:03:58 -0800] "GET /ops/SP/play//edit/Main/Message_size_limit?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:19:08:55 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiHistory HTTP/1.1" 200 138789 +64.242.88.10 - - [07/Mar/2004:19:10:13 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=^y HTTP/1.1" 200 3628 +64.242.88.10 - - [07/Mar/2004:19:15:38 -0800] "GET /ops/SP/play//edit/Main/Smtpd_history_flush_threshold?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:19:16:44 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=1.59 HTTP/1.1" 200 52854 +64.242.88.10 - - [07/Mar/2004:19:18:05 -0800] "GET /ops/SP/play//edit/Main/Sender_canonical_maps?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:19:19:19 -0800] "GET /mailman/listinfo/mlc HTTP/1.1" 200 6142 +64.242.88.10 - - [07/Mar/2004:19:21:01 -0800] "GET /ops/SP/play//rdiff/Main/WebChanges HTTP/1.1" 200 114241 +64.242.88.10 - - [07/Mar/2004:19:22:11 -0800] "GET /ops/SP/play//edit/Sandbox/TestTopic5?topicparent=Sandbox.WebHome HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:19:24:57 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.22 HTTP/1.1" 200 21162 +64.242.88.10 - - [07/Mar/2004:19:26:22 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=^j HTTP/1.1" 200 4524 +64.242.88.10 - - [07/Mar/2004:19:29:46 -0800] "GET /ops/SP/play//oops/TWiki/TWikiVariables?template=oopsmore¶m1=1.62¶m2=1.62 HTTP/1.1" 200 11444 +64.242.88.10 - - [07/Mar/2004:19:31:25 -0800] "GET /ops/SP/play//edit/Main/Lmtp_connect_timeout?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:19:32:45 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=^q HTTP/1.1" 200 2937 +64.242.88.10 - - [07/Mar/2004:19:36:14 -0800] "GET /ops/SP/play//view/TWiki/ManagingWebs?rev=1.21 HTTP/1.1" 200 9310 +64.242.88.10 - - [07/Mar/2004:19:39:40 -0800] "GET /ops/SP/play//edit/Main/Qmqpd_authorized_clients?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:19:41:33 -0800] "GET /ops/SP/play//edit/Main/Header_address_token_limit?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:19:42:45 -0800] "GET /ops/SP/play//edit/Main/Syslog_name?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +80-219-148-207.dclient.hispeed.ch - - [07/Mar/2004:19:47:36 -0800] "OPTIONS * HTTP/1.0" 200 - +64.242.88.10 - - [07/Mar/2004:19:49:28 -0800] "GET /ops/SP/play//oops/TWiki/TWikiHistory?template=oopsmore¶m1=1.61¶m2=1.61 HTTP/1.1" 200 11345 +64.242.88.10 - - [07/Mar/2004:19:52:28 -0800] "GET /ops/SP/play//view/TWiki/HaroldGottschalk HTTP/1.1" 200 3838 +64.242.88.10 - - [07/Mar/2004:19:54:33 -0800] "GET /ops/SP/play//view/TWiki/DefaultPlugin?rev=1.4 HTTP/1.1" 200 7298 +64.242.88.10 - - [07/Mar/2004:19:55:40 -0800] "GET /ops/SP/play//oops/TWiki/WelcomeGuest?template=oopsmore¶m1=1.20¶m2=1.20 HTTP/1.1" 200 11266 +64.242.88.10 - - [07/Mar/2004:19:56:41 -0800] "GET /ops/SP/play//rdiff/Main/WebIndex HTTP/1.1" 200 46373 +64.242.88.10 - - [07/Mar/2004:19:58:24 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiRegistration?rev1=1.10&rev2=1.9 HTTP/1.1" 200 3826 +64.242.88.10 - - [07/Mar/2004:20:00:06 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.21 HTTP/1.1" 200 20972 +64.242.88.10 - - [07/Mar/2004:20:02:13 -0800] "GET /ops/SP/play//attach/TWiki/DefaultPlugin HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:20:03:29 -0800] "GET /ops/SP/play//search/Main/?scope=topic®ex=on&search=^p HTTP/1.1" 200 7245 +206-15-133-181.dialup.ziplink.net - - [07/Mar/2004:20:04:03 -0800] "HEAD /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 0 +64.242.88.10 - - [07/Mar/2004:20:04:35 -0800] "GET /ops/SP/play//edit/Main/Smtp_pix_workaround_delay_time?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:20:07:12 -0800] "GET /ops/SP/play//edit/Main/Berkeley_db_create_buffer_size?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +mmscrm07-2.uah.goweb.net - - [07/Mar/2004:20:10:50 -0800] "GET /robots.txt HTTP/1.0" 200 68 +64.242.88.10 - - [07/Mar/2004:20:11:33 -0800] "GET /ops/SP/play//attach/TWiki/TWikiSite HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:20:12:55 -0800] "GET /ops/SP/play//edit/TWiki/TWikiSite?t=1078681794 HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:20:23:35 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Web%20*Statistics[^A-Za-z] HTTP/1.1" 200 10118 +64.242.88.10 - - [07/Mar/2004:20:25:31 -0800] "GET /ops/SP/play//edit/Main/Defer_transports?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:20:31:40 -0800] "GET /ops/SP/play//rdiff/TWiki/SearchDoesNotWork HTTP/1.1" 200 6738 +64.242.88.10 - - [07/Mar/2004:20:35:28 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=TWiki%20*Admin%20*Group[^A-Za-z] HTTP/1.1" 200 7311 +64.242.88.10 - - [07/Mar/2004:20:38:14 -0800] "GET /ops/SP/play//rdiff/TWiki/ChangePassword HTTP/1.1" 200 16670 +64.242.88.10 - - [07/Mar/2004:20:40:41 -0800] "GET /ops/SP/play//rdiff/TWiki/SvenDowideit HTTP/1.1" 200 5277 +64.242.88.10 - - [07/Mar/2004:20:42:09 -0800] "GET /ops/SP/play//rdiff/TWiki/KevinKinnell?rev1=1.5&rev2=1.4 HTTP/1.1" 200 4982 +64.242.88.10 - - [07/Mar/2004:20:44:48 -0800] "GET /ops/SP/play//edit/Main/Undisclosed_recipients_header?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:20:55:43 -0800] "GET /mailman/listinfo/hs_support HTTP/1.1" 200 6294 +64.242.88.10 - - [07/Mar/2004:20:56:56 -0800] "GET /ops/SP/play//view/TWiki/WebTopicList HTTP/1.1" 200 14070 +64.242.88.10 - - [07/Mar/2004:20:58:27 -0800] "GET /ops/SP/play//attach/TWiki/WebPreferences HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:21:03:48 -0800] "GET /ops/SP/play//view/TWiki/TWikiFAQ HTTP/1.1" 200 12050 +64.242.88.10 - - [07/Mar/2004:21:06:05 -0800] "GET /ops/SP/play//oops/TWiki/DefaultPlugin?template=oopsmore¶m1=1.5¶m2=1.5 HTTP/1.1" 200 11281 +64.242.88.10 - - [07/Mar/2004:21:07:24 -0800] "GET /ops/SP/play//rdiff/TWiki/AppendixFileSystem?rev1=1.11&rev2=1.10 HTTP/1.1" 200 40578 +64.242.88.10 - - [07/Mar/2004:21:14:32 -0800] "GET /ops/SP/play//rdiff/TWiki/FileAttribute HTTP/1.1" 200 5846 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:17 -0800] "GET /twiki/view/Main/WebHome HTTP/1.1" 404 300 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:18 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:21 -0800] "GET /twiki/ HTTP/1.1" 200 782 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:23 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:23 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:33 -0800] "GET /ops/SP/play//view/Main/TWikiUsers HTTP/1.1" 200 6697 +h24-70-56-49.ca.clawio.org - - [07/Mar/2004:21:16:40 -0800] "GET /ops/SP/play//view/Main/KevinWGagel HTTP/1.1" 200 4901 +64.242.88.10 - - [07/Mar/2004:21:20:14 -0800] "GET /ops/SP/play//edit/TWiki/RichardDonkin?t=1078691832 HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:21:21:40 -0800] "GET /ops/SP/play//oops/Main/DCC?template=oopsmore¶m1=1.1¶m2=1.1 HTTP/1.1" 200 6399 +64.242.88.10 - - [07/Mar/2004:21:23:38 -0800] "GET /ops/SP/play//view/TWiki/TWikiUpgradeTo01May2000 HTTP/1.1" 200 7463 +64.242.88.10 - - [07/Mar/2004:21:31:12 -0800] "GET /ops/SP/play//edit/Main/Mail_release_date?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:21:33:51 -0800] "GET /ops/SP/play//view/TWiki/TWikiPlugins?rev=1.19 HTTP/1.1" 200 26541 +bh02i525f01.au.ibm.com - - [07/Mar/2004:21:34:00 -0800] "GET /AmavisNew.jsp HTTP/1.0" 200 2300 +64.242.88.10 - - [07/Mar/2004:21:39:55 -0800] "GET /ops/SP/play//attach/Main/ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:21:41:04 -0800] "GET /mailman/listinfo/techcomm HTTP/1.1" 200 6155 +64.242.88.10 - - [07/Mar/2004:21:42:47 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=1.8 HTTP/1.1" 200 15618 +64.242.88.10 - - [07/Mar/2004:21:44:10 -0800] "GET /ops/SP/play//edit/Sandbox/TestTopic7?topicparent=Sandbox.WebHome HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:21:50:22 -0800] "GET /ops/SP/play//rdiff/TWiki/WebSearch HTTP/1.1" 200 55862 +64.242.88.10 - - [07/Mar/2004:21:52:05 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiTopics HTTP/1.1" 200 101445 +64.242.88.10 - - [07/Mar/2004:22:03:19 -0800] "GET /ops/SP/play//rdiff/Main/VishaalGolam HTTP/1.1" 200 5055 +64.242.88.10 - - [07/Mar/2004:22:04:44 -0800] "GET /ops/SP/play//view/Main/TWikiUsers?rev=1.21 HTTP/1.1" 200 6522 +64.242.88.10 - - [07/Mar/2004:22:06:16 -0800] "GET /ops/SP/play//edit/Main/Delay_notice_recipient?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:22:07:33 -0800] "GET /ops/SP/play//view/TWiki/WikiNotation HTTP/1.1" 200 3617 +64.242.88.10 - - [07/Mar/2004:22:08:43 -0800] "GET /ops/SP/play//edit/Main/Forward_expansion_filter?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:22:09:44 -0800] "GET /ops/SP/play//edit/Main/TestArea?topicparent=Main.WebHome HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:22:10:55 -0800] "GET /ops/SP/play//view/Main/TokyoOffice?rev=1.2 HTTP/1.1" 200 4366 +64.242.88.10 - - [07/Mar/2004:22:12:28 -0800] "GET /ops/SP/play//attach/TWiki/WebSearch HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:22:15:57 -0800] "GET /mailman/listinfo/hs_rcafaculty HTTP/1.1" 200 6345 +64.242.88.10 - - [07/Mar/2004:22:17:40 -0800] "GET /ops/SP/play//view/TWiki/TWikiSkins?skin=print HTTP/1.1" 200 9563 +64.242.88.10 - - [07/Mar/2004:22:27:18 -0800] "GET /ops/SP/play//edit/Main/OfficeLocations?t=1078691049 HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:22:29:10 -0800] "GET /ops/SP/play//view/Main/ThanadonSomdee HTTP/1.1" 200 4611 +h24-71-249-14.ca.clawio.org - - [07/Mar/2004:22:29:12 -0800] "GET /mailman/options/cnc_notice/arobin%40shaw.c HTTP/1.1" 200 3382 +h24-71-249-14.ca.clawio.org - - [07/Mar/2004:22:29:13 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +h24-71-249-14.ca.clawio.org - - [07/Mar/2004:22:29:13 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +h24-71-249-14.ca.clawio.org - - [07/Mar/2004:22:29:13 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +h24-71-249-14.ca.clawio.org - - [07/Mar/2004:22:29:41 -0800] "POST /mailman/options/cnc_notice HTTP/1.1" 200 3533 +h24-71-249-14.ca.clawio.org - - [07/Mar/2004:22:30:08 -0800] "POST /mailman/options/cnc_notice HTTP/1.1" 200 13973 +64.242.88.10 - - [07/Mar/2004:22:31:25 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.16 HTTP/1.1" 200 17361 +64.242.88.10 - - [07/Mar/2004:22:35:53 -0800] "GET /ops/SP/play//edit/Main/Default_delivery_slot_discount?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:22:36:58 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiHistory?rev1=1.10&rev2=1.9 HTTP/1.1" 200 5336 +64.242.88.10 - - [07/Mar/2004:22:39:00 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Al%20*Williams[^A-Za-z] HTTP/1.1" 200 4364 +64.242.88.10 - - [07/Mar/2004:22:45:46 -0800] "GET /ops/SP/play//edit/Main/Smtpd_banner?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:22:47:19 -0800] "GET /ops/SP/play//view/Main/WebHome?rev=r1.9 HTTP/1.1" 200 9133 +64.242.88.10 - - [07/Mar/2004:22:48:55 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiSkins?rev1=1.10&rev2=1.9 HTTP/1.1" 200 5989 +64.242.88.10 - - [07/Mar/2004:22:51:55 -0800] "GET /ops/SP/play//attach/TWiki/AndreaSterbini HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:22:53:36 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiPlugins?rev1=1.20&rev2=1.19 HTTP/1.1" 200 5140 +64.242.88.10 - - [07/Mar/2004:22:54:43 -0800] "GET /ops/SP/play//view/Know/ReadmeFirst?rev=1.4 HTTP/1.1" 200 6736 +64.242.88.10 - - [07/Mar/2004:22:58:24 -0800] "GET /ops/SP/play//view/Main/TokyoOffice?rev=r1.3 HTTP/1.1" 200 3853 +64.242.88.10 - - [07/Mar/2004:23:09:07 -0800] "GET /ops/SP/play//view/TWiki/AlWilliams?rev=1.1 HTTP/1.1" 200 3697 +calcite.rhyolite.com - - [07/Mar/2004:23:10:27 -0800] "GET /clients.jsp HTTP/1.1" 200 18753 +64.242.88.10 - - [07/Mar/2004:23:10:44 -0800] "GET /ops/SP/play//view/TWiki/JohnTalintyre HTTP/1.1" 200 3766 +64.242.88.10 - - [07/Mar/2004:23:13:51 -0800] "GET /ops/SP/play//view/TWiki/TWikiDocGraphics HTTP/1.1" 200 14492 +64.242.88.10 - - [07/Mar/2004:23:15:51 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.24 HTTP/1.1" 200 20981 +64.242.88.10 - - [07/Mar/2004:23:16:57 -0800] "GET /ops/SP/play//rdiff/Main/SanJoseOffice HTTP/1.1" 200 9524 +64.242.88.10 - - [07/Mar/2004:23:19:01 -0800] "GET /ops/SP/play//rdiff/Main/WebNotify HTTP/1.1" 200 16853 +64.242.88.10 - - [07/Mar/2004:23:20:26 -0800] "GET /ops/SP/play//view/TWiki/TWikiSiteTools HTTP/1.1" 200 14435 +64.242.88.10 - - [07/Mar/2004:23:23:00 -0800] "GET /ops/SP/play//rdiff/TWiki/RichardDonkin?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5891 +64.242.88.10 - - [07/Mar/2004:23:27:26 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Web%20*Preferences[^A-Za-z] HTTP/1.1" 200 20030 +64.242.88.10 - - [07/Mar/2004:23:30:23 -0800] "GET /ops/SP/play//rdiff/TWiki/WebHome HTTP/1.1" 200 108162 +64.242.88.10 - - [07/Mar/2004:23:34:31 -0800] "GET /ops/SP/play//edit/Main/Lmtp_quit_timeout?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [07/Mar/2004:23:36:48 -0800] "GET /ops/SP/play//view/TWiki/WebSiteTools HTTP/1.1" 200 5208 +lj1036.passgo.com - - [07/Mar/2004:23:36:59 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1088.passgo.com - - [07/Mar/2004:23:36:59 -0800] "GET /ops/SP/play//oops/TWiki/JohnAltstadt HTTP/1.0" 200 209 +64.242.88.10 - - [07/Mar/2004:23:37:48 -0800] "GET /ops/SP/play//oops/Main/FileAttachment?template=oopsmore¶m1=1.3¶m2=1.3 HTTP/1.1" 200 6612 +64.242.88.10 - - [07/Mar/2004:23:42:44 -0800] "GET /ops/SP/play//edit/Main/Cleanup_service_name?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [07/Mar/2004:23:47:58 -0800] "GET /ops/SP/play//view/TWiki/WikiReferences?skin=print HTTP/1.1" 200 5596 +64.242.88.10 - - [07/Mar/2004:23:50:03 -0800] "GET /ops/SP/play//view/Main/TokyoOffice?rev=1.3 HTTP/1.1" 200 3853 +64.242.88.10 - - [07/Mar/2004:23:51:38 -0800] "GET /ops/SP/play//view/Main/PostSuper?rev=r1.1 HTTP/1.1" 200 3629 +64.242.88.10 - - [07/Mar/2004:23:56:30 -0800] "GET /ops/SP/play//rdiff/Main/PostQueue HTTP/1.1" 200 4662 +64.242.88.10 - - [07/Mar/2004:23:58:53 -0800] "GET /ops/SP/play//edit/TWiki/TablePlugin?t=1078681446 HTTP/1.1" 401 12851 +dsl-80-43-113-44.access.uk.tiscali.com - - [08/Mar/2004:00:05:30 -0800] "GET / HTTP/1.1" 200 3169 +dsl-80-43-113-44.access.uk.tiscali.com - - [08/Mar/2004:00:05:35 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +dsl-80-43-113-44.access.uk.tiscali.com - - [08/Mar/2004:00:06:32 -0800] "GET /DCC.jsp HTTP/1.1" 200 2878 +64.242.88.10 - - [08/Mar/2004:00:08:58 -0800] "GET /ops/SP/play//oops/Sandbox/WebHome?template=oopsmore¶m1=1.7¶m2=1.7 HTTP/1.1" 200 4226 +64.242.88.10 - - [08/Mar/2004:00:11:22 -0800] "GET /ops/SP/play//edit/Main/WelcomeGuest?topicparent=Main.WebHome HTTP/1.1" 401 12846 +lj1125.passgo.com - - [08/Mar/2004:00:17:00 -0800] "GET /ops/SP/play//oops/Main/TWiki HTTP/1.0" 200 209 +64.242.88.10 - - [08/Mar/2004:00:17:22 -0800] "GET /ops/SP/play//view/TWiki/RichardDonkin?skin=print HTTP/1.1" 200 1729 +64.242.88.10 - - [08/Mar/2004:00:19:51 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=r1.4 HTTP/1.1" 200 7049 +64.242.88.10 - - [08/Mar/2004:00:21:54 -0800] "GET /ops/SP/play//view/TWiki/TWikiRegistration?rev=r1.7 HTTP/1.1" 200 12737 +64.242.88.10 - - [08/Mar/2004:00:25:11 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.26 HTTP/1.1" 200 22710 +64.242.88.10 - - [08/Mar/2004:00:27:53 -0800] "GET /ops/SP/play//view/TWiki/GoBox HTTP/1.1" 200 3762 +64.242.88.10 - - [08/Mar/2004:00:29:13 -0800] "GET /ops/SP/play//view/Main/FileAttachment?rev=1.1 HTTP/1.1" 200 17757 +64.242.88.10 - - [08/Mar/2004:00:32:45 -0800] "GET /ops/SP/play//attach/TWiki/KevinKinnell HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:00:36:21 -0800] "GET /ops/SP/play//rdiff/TWiki/WikiWikiClones HTTP/1.1" 200 9259 +64.242.88.10 - - [08/Mar/2004:00:37:23 -0800] "GET /ops/SP/play//oops/Main/NicholasLee?template=oopsmore¶m1=1.2¶m2=1.2 HTTP/1.1" 200 6558 +64.242.88.10 - - [08/Mar/2004:00:40:10 -0800] "GET /ops/SP/play//edit/Main/TWikiForms?topicparent=Main.TWikiVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:00:43:43 -0800] "GET /ops/SP/play//rdiff/TWiki/DefaultPlugin HTTP/1.1" 200 20376 +64.242.88.10 - - [08/Mar/2004:00:50:59 -0800] "GET /mailman/admin/educationadmin HTTP/1.1" 200 2150 +64.242.88.10 - - [08/Mar/2004:00:52:12 -0800] "GET /mailman/private/hsdivision/ HTTP/1.1" 200 1549 +64.242.88.10 - - [08/Mar/2004:00:54:26 -0800] "GET /mailman/listinfo/artsscience HTTP/1.1" 200 6248 +64.242.88.10 - - [08/Mar/2004:00:55:38 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=^i HTTP/1.1" 200 7226 +64.242.88.10 - - [08/Mar/2004:01:00:08 -0800] "GET /ops/SP/play//rdiff/TWiki/AdrianLynch HTTP/1.1" 200 4011 +64.242.88.10 - - [08/Mar/2004:01:01:15 -0800] "GET /ops/SP/play//view/Main/WelcomeGuest HTTP/1.1" 200 4723 +64.242.88.10 - - [08/Mar/2004:01:02:16 -0800] "GET /ops/SP/play//view/Main/MikeMannix?rev=1.3 HTTP/1.1" 200 4721 +64.242.88.10 - - [08/Mar/2004:01:04:05 -0800] "GET /ops/SP/play//edit/TWiki/WikiStyleWord?topicparent=TWiki.TextFormattingFAQ HTTP/1.1" 401 12846 +lj1089.passgo.com - - [08/Mar/2004:01:04:54 -0800] "GET /ops/SP/play//oops/TWiki/InterWikis HTTP/1.0" 200 209 +64.242.88.10 - - [08/Mar/2004:01:10:43 -0800] "GET /ops/SP/play//view/TWiki/FormattedSearch?rev=1.8 HTTP/1.1" 200 20434 +64.242.88.10 - - [08/Mar/2004:01:12:20 -0800] "GET /ops/SP/play//view/TWiki/TWikiEnhancementRequests?rev=1.3 HTTP/1.1" 200 4379 +64.242.88.10 - - [08/Mar/2004:01:16:37 -0800] "GET /ops/SP/play//view/Main/FileAttachment?rev=1.2 HTTP/1.1" 200 17919 +64.242.88.10 - - [08/Mar/2004:01:19:18 -0800] "GET /ops/SP/play//edit/TWiki/AppendixFileSystem?t=1078674582 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:01:24:13 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.33 HTTP/1.1" 200 26294 +64.242.88.10 - - [08/Mar/2004:01:25:15 -0800] "GET /ops/SP/play//search/Main/?scope=topic®ex=on&search=^t HTTP/1.1" 200 8306 +64.242.88.10 - - [08/Mar/2004:01:29:17 -0800] "GET /ops/SP/play//oops/TWiki/TWikiPlugins?template=oopsmore¶m1=1.21¶m2=1.21 HTTP/1.1" 200 11341 +64.242.88.10 - - [08/Mar/2004:01:30:39 -0800] "GET /mailman/private/sswk/ HTTP/1.1" 200 1531 +64.242.88.10 - - [08/Mar/2004:01:33:14 -0800] "GET /mailman/private/business/ HTTP/1.1" 200 1543 +64.242.88.10 - - [08/Mar/2004:01:35:13 -0800] "GET /ops/SP/play//edit/TWiki/InterWikis?t=1078696998 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:01:41:14 -0800] "GET /ops/SP/play//view/TWiki/WelcomeGuest?rev=r1.18 HTTP/1.1" 200 14001 +64.242.88.10 - - [08/Mar/2004:01:46:05 -0800] "GET /ops/SP/play//search/TWiki/?search=\\.*&scope=topic&order=modified&reverse=on®ex=on&nosearch=on&limit=200 HTTP/1.1" 200 101279 +64.242.88.10 - - [08/Mar/2004:01:47:06 -0800] "GET /ops/SP/play//edit/TWiki/TWikiPages?topicparent=TWiki.WelcomeGuest HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:01:48:06 -0800] "GET /ops/SP/play//view/Main/WebHome?rev=r1.16 HTTP/1.1" 200 9342 +64.242.88.10 - - [08/Mar/2004:01:50:37 -0800] "GET /ops/SP/play//rdiff/TWiki/RyanFreebern?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5243 +64.242.88.10 - - [08/Mar/2004:01:59:13 -0800] "GET /ops/SP/play//edit/Main/Smtp_line_length_limit?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:02:00:30 -0800] "GET /ops/SP/play//view/Main/WebStatistics?skin=print HTTP/1.1" 200 6194 +64.242.88.10 - - [08/Mar/2004:02:01:34 -0800] "GET /mailman/listinfo/webber HTTP/1.1" 200 6051 +64.242.88.10 - - [08/Mar/2004:02:03:12 -0800] "GET /mailman/admin/mlc HTTP/1.1" 200 2060 +64.242.88.10 - - [08/Mar/2004:02:05:15 -0800] "GET /mailman/listinfo/jjec HTTP/1.1" 200 6297 +64.242.88.10 - - [08/Mar/2004:02:06:17 -0800] "GET /mailman/listinfo/deans HTTP/1.1" 200 6102 +64.242.88.10 - - [08/Mar/2004:02:07:21 -0800] "GET /mailman/listinfo/gisgrad HTTP/1.1" 200 6024 +64.242.88.10 - - [08/Mar/2004:02:09:08 -0800] "GET /ops/SP/play//view/Main/WebNotify HTTP/1.1" 200 4468 +64.242.88.10 - - [08/Mar/2004:02:12:24 -0800] "GET /ops/SP/play//edit/Main/Setgid_group?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:02:16:24 -0800] "GET /ops/SP/play//view/Main/WebChanges?skin=print HTTP/1.1" 200 38580 +lj1016.passgo.com - - [08/Mar/2004:02:17:10 -0800] "GET /ops/SP/play//oops/TWiki/FileAttachment HTTP/1.0" 200 209 +lj1036.passgo.com - - [08/Mar/2004:02:22:19 -0800] "GET /ops/SP/play//view/Main/TWi HTTP/1.0" 200 4866 +64.242.88.10 - - [08/Mar/2004:02:23:45 -0800] "GET /ops/SP/play//rdiff/TWiki/IncludeTopicsAndWebPages HTTP/1.1" 200 20972 +64.242.88.10 - - [08/Mar/2004:02:26:44 -0800] "GET /ops/SP/play//oops/Main/WebChanges?template=oopsmore¶m1=1.2¶m2=1.2 HTTP/1.1" 200 6540 +64.242.88.10 - - [08/Mar/2004:02:27:51 -0800] "GET /ops/SP/play//rdiff/TWiki/InstantEnhancements HTTP/1.1" 200 25123 +64.242.88.10 - - [08/Mar/2004:02:33:28 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiPreferences?rev1=1.47&rev2=1.46 HTTP/1.1" 200 4313 +64.242.88.10 - - [08/Mar/2004:02:34:40 -0800] "GET /ops/SP/play//view/Main/WebHome?rev=r1.24 HTTP/1.1" 200 9769 +64.242.88.10 - - [08/Mar/2004:02:42:36 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +64.242.88.10 - - [08/Mar/2004:02:45:03 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&bookview=on&search=.* HTTP/1.1" 200 102399 +64.242.88.10 - - [08/Mar/2004:02:46:12 -0800] "GET /ops/SP/play//edit/Main/Local_recipient_maps?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12851 +64.242.88.10 - - [08/Mar/2004:02:47:58 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +lj1025.passgo.com - - [08/Mar/2004:02:48:05 -0800] "GET /ops/SP/play//oops/Main/KevinWGage HTTP/1.0" 200 209 +prxint-sxb3.e-i.net - - [08/Mar/2004:02:50:53 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +prxint-sxb3.e-i.net - - [08/Mar/2004:02:50:54 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +64.242.88.10 - - [08/Mar/2004:02:52:39 -0800] "GET /ops/SP/play//view/Main/PostfixCmd HTTP/1.1" 200 4173 +prxint-sxb2.e-i.net - - [08/Mar/2004:02:54:29 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.0" 200 4022 +64.242.88.10 - - [08/Mar/2004:02:54:54 -0800] "GET /ops/SP/play//edit/TWiki/NewTopic?topicparent=TWiki.WikiSyntax HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:02:59:03 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiSite HTTP/1.1" 200 71941 +64.242.88.10 - - [08/Mar/2004:03:01:12 -0800] "GET /ops/SP/play//rdiff/TWiki/SimultaneousEdits HTTP/1.1" 200 6180 +64.242.88.10 - - [08/Mar/2004:03:06:31 -0800] "GET /ops/SP/play//view/Main/NicholasLee?rev=1.2 HTTP/1.1" 200 3570 +64.242.88.10 - - [08/Mar/2004:03:07:59 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=1.9 HTTP/1.1" 200 15756 +64.242.88.10 - - [08/Mar/2004:03:09:20 -0800] "GET /mailman/listinfo/ncbnpfaculty HTTP/1.1" 200 6331 +64.242.88.10 - - [08/Mar/2004:03:11:28 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Inter%20*Wikis[^A-Za-z] HTTP/1.1" 200 5113 +64.242.88.10 - - [08/Mar/2004:03:16:22 -0800] "GET /ops/SP/play//oops/TWiki/TextFormattingFAQ?template=oopsmore¶m1=1.14¶m2=1.14 HTTP/1.1" 200 11364 +64.242.88.10 - - [08/Mar/2004:03:17:50 -0800] "GET /ops/SP/play//rdiff/Main/WebTopicList HTTP/1.1" 200 8004 +64.242.88.10 - - [08/Mar/2004:03:21:16 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +64.242.88.10 - - [08/Mar/2004:03:26:06 -0800] "GET /mailman/private/mlc/ HTTP/1.1" 200 1528 +64.242.88.10 - - [08/Mar/2004:03:28:02 -0800] "GET /ops/SP/play//view/TWiki/WikiName HTTP/1.1" 200 4811 +64.242.88.10 - - [08/Mar/2004:03:33:52 -0800] "GET /ops/SP/play//rdiff/Main/WebRss HTTP/1.1" 200 20726 +64.242.88.10 - - [08/Mar/2004:03:35:42 -0800] "GET /ops/SP/play//rdiff/TWiki/SvenDowideit?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5277 +rouble.cc.strath.ac.uk - - [08/Mar/2004:03:40:51 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +213.181.81.4 - - [08/Mar/2004:03:42:20 -0800] "GET /LateEmail.jsp HTTP/1.0" 200 7649 +64.242.88.10 - - [08/Mar/2004:03:46:27 -0800] "GET /ops/SP/play//edit/Main/Deliver_lock_attempts?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:03:48:18 -0800] "GET /ops/SP/play//edit/Main/Daemon_directory?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:03:49:24 -0800] "GET /ops/SP/play//rdiff/TWiki/KlausWriessnegger?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5421 +64.242.88.10 - - [08/Mar/2004:03:51:05 -0800] "GET /ops/SP/play//view/Main/TWikiGuest?rev=1.4 HTTP/1.1" 200 4719 +64.242.88.10 - - [08/Mar/2004:03:52:17 -0800] "GET /ops/SP/play//edit/Main/Relayhost?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +lj1036.passgo.com - - [08/Mar/2004:03:53:59 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1159.passgo.com - - [08/Mar/2004:03:54:03 -0800] "GET /ops/SP/play//oops/Main/TWi HTTP/1.0" 200 209 +64.242.88.10 - - [08/Mar/2004:03:55:09 -0800] "GET /ops/SP/play//edit/Main/BookView?topicparent=Main.TWikiVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:04:16:08 -0800] "GET /ops/SP/play//rdiff/TWiki/DeleteOrRenameATopic HTTP/1.1" 200 10254 +64.242.88.10 - - [08/Mar/2004:04:18:28 -0800] "GET /ops/SP/play//view/TWiki/DavidWarman HTTP/1.1" 200 3739 +64.242.88.10 - - [08/Mar/2004:04:20:48 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.28 HTTP/1.1" 200 22777 +64.242.88.10 - - [08/Mar/2004:04:21:53 -0800] "GET /ops/SP/play//rdiff/Main/PeterThoeny HTTP/1.1" 200 18927 +64.242.88.10 - - [08/Mar/2004:04:22:55 -0800] "GET /ops/SP/play//edit/TWiki/SvenDowideit?t=1078710644 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:04:24:47 -0800] "GET /ops/SP/play//edit/Main/RBLsHowTo?t=1078668449 HTTP/1.1" 401 12846 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:25:38 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.0" 200 5672 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:25:44 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:26:02 -0800] "GET /ops/SP/play//view/Main/SideBar HTTP/1.0" 200 3960 +64.242.88.10 - - [08/Mar/2004:04:26:02 -0800] "GET /ops/SP/play//rdiff/TWiki/DefaultPlugin?rev1=1.5&rev2=1.4 HTTP/1.1" 200 4911 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:26:11 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.0" 200 4515 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:28:34 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.0" 200 4213 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:28:38 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.0" 200 4004 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:28:41 -0800] "GET /ops/SP/play//view/Main/PostfixCmd HTTP/1.0" 200 4154 +64.242.88.10 - - [08/Mar/2004:04:28:42 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiHistory?rev1=1.61&rev2=1.60 HTTP/1.1" 200 4898 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:28:52 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.0" 200 3617 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:29:00 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.0" 200 4646 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:29:11 -0800] "GET /ops/SP/play//view/Main/ConfigurationVariables HTTP/1.0" 200 58169 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:29:21 -0800] "GET /ops/SP/play//edit/Main/Propagate_unmatched_extensions?topicparent=Main.ConfigurationVariables HTTP/1.0" 401 12816 +prxint-sxb3.e-i.net - - [08/Mar/2004:04:29:30 -0800] "GET /go/bin/test/TWikiDocGraphics/help.gif HTTP/1.0" 200 130 +64.242.88.10 - - [08/Mar/2004:04:33:25 -0800] "GET /mailman/admin/hs_support HTTP/1.1" 200 2120 +64.242.88.10 - - [08/Mar/2004:04:40:32 -0800] "GET /ops/SP/play//edit/Main/Always_bcc?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:04:43:52 -0800] "GET /ops/SP/play//view/TWiki/WelcomeGuest?rev=r1.5 HTTP/1.1" 200 9492 +64.242.88.10 - - [08/Mar/2004:04:52:13 -0800] "GET /ops/SP/play//rdiff/Main/TWikiGuest?rev1=1.5&rev2=1.4 HTTP/1.1" 200 6233 +64.242.88.10 - - [08/Mar/2004:04:55:40 -0800] "GET /ops/SP/play//edit/Main/Delay_warning_time?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:04:59:13 -0800] "GET /ops/SP/play//edit/TWiki/KlausWriessnegger?t=1078709735 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:05:00:42 -0800] "GET /ops/SP/play//rdiff/TWiki/StanleyKnutson HTTP/1.1" 200 5327 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:00:44 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:00:45 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:00:46 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:00:52 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:01:02 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:01:14 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +64.242.88.10 - - [08/Mar/2004:05:01:58 -0800] "GET /ops/SP/play//view/TWiki/WhatIsWikiWiki HTTP/1.1" 200 4234 +200.160.249.68.bmf.com.br - - [08/Mar/2004:05:02:06 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +200.160.249.68.bmf.com.br - - [08/Mar/2004:05:02:07 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +64.242.88.10 - - [08/Mar/2004:05:03:13 -0800] "GET /ops/SP/play//view/Main/WebIndex?rev=1.1 HTTP/1.1" 200 44960 +64.242.88.10 - - [08/Mar/2004:05:13:35 -0800] "GET /mailman/private/hs_support/ HTTP/1.1" 200 1549 +68-174-110-154.nyc.rr.com - - [08/Mar/2004:05:16:15 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +68-174-110-154.nyc.rr.com - - [08/Mar/2004:05:16:20 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +64.242.88.10 - - [08/Mar/2004:05:22:57 -0800] "GET /ops/SP/play//attach/Sandbox/WebHome HTTP/1.1" 401 12846 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:23:37 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +66-194-6-70.gen.twtelecom.net - - [08/Mar/2004:05:24:18 -0800] "GET / HTTP/1.1" 200 3169 +64.242.88.10 - - [08/Mar/2004:05:24:29 -0800] "GET /ops/SP/play//edit/TWiki/UnchangeableTopicBug?topicparent=TWiki.TWikiHistory HTTP/1.1" 401 12846 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:24:50 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:25:46 -0800] "GET /ops/SP/play//view/Main/Postfix HTTP/1.1" 200 3699 +64.242.88.10 - - [08/Mar/2004:05:26:02 -0800] "GET /ops/SP/play//view/Main/TWikiGuest?skin=print HTTP/1.1" 200 2372 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:26:06 -0800] "GET /ops/SP/play//edit/Main/UvscanAndPostFix?topicparent=Main.WebHome HTTP/1.1" 401 12851 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:26:08 -0800] "GET /go/bin/test/TWikiDocGraphics/help.gif HTTP/1.1" 200 130 +p213.54.168.132.tisdip.tiscali.de - - [08/Mar/2004:05:26:16 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +64.242.88.10 - - [08/Mar/2004:05:30:07 -0800] "GET /ops/SP/play//view/TWiki/SvenDowideit?rev=1.1 HTTP/1.1" 200 3564 +64.242.88.10 - - [08/Mar/2004:05:31:47 -0800] "GET /ops/SP/play//edit/Main/Maps_rbl_reject_code?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +lj1027.passgo.com - - [08/Mar/2004:05:32:01 -0800] "GET /ops/SP/play//view/TWiki/2fa HTTP/1.0" 200 4615 +64.242.88.10 - - [08/Mar/2004:05:34:33 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Web%20*Changes[^A-Za-z] HTTP/1.1" 200 4829 +64.242.88.10 - - [08/Mar/2004:05:36:56 -0800] "GET /ops/SP/play//edit/Main/WebStatistics?t=1078690975 HTTP/1.1" 401 12851 +68-174-110-154.nyc.rr.com - - [08/Mar/2004:05:38:57 -0800] "GET /razor.jsp HTTP/1.1" 304 - +64.242.88.10 - - [08/Mar/2004:05:42:06 -0800] "GET /ops/SP/play//view/Main/RelayGateway?rev=1.3 HTTP/1.1" 200 4232 +64.242.88.10 - - [08/Mar/2004:05:47:38 -0800] "GET /robots.txt HTTP/1.1" 200 68 +64.242.88.10 - - [08/Mar/2004:05:48:48 -0800] "GET /ops/SP/play//rdiff/TWiki/KevinKinnell?rev1=1.4&rev2=1.3 HTTP/1.1" 200 4369 +64.242.88.10 - - [08/Mar/2004:05:51:45 -0800] "GET /ops/SP/play//view/TWiki/WelcomeGuest?rev=r1.11 HTTP/1.1" 200 13102 +64.242.88.10 - - [08/Mar/2004:05:56:08 -0800] "GET /ops/SP/play//view/TWiki/TWikiRegistration?rev=r1.4 HTTP/1.1" 200 12113 +64.242.88.10 - - [08/Mar/2004:05:57:15 -0800] "GET /ops/SP/play//edit/TWiki/TWikiCodevTWikiEnhancementRequests?topicparent=TWiki.TWikiHistory HTTP/1.1" 401 12851 +64.242.88.10 - - [08/Mar/2004:05:58:39 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Peter%20*Fokkinga[^A-Za-z] HTTP/1.1" 200 4388 +64.242.88.10 - - [08/Mar/2004:06:01:51 -0800] "GET /ops/SP/play//attach/Main/WebPreferences HTTP/1.1" 401 12851 +64.242.88.10 - - [08/Mar/2004:06:09:37 -0800] "GET /mailman/admin/hs_rcafaculty HTTP/1.1" 200 2144 +64.242.88.10 - - [08/Mar/2004:06:17:13 -0800] "GET /ops/SP/play//rdiff/TWiki/WebChanges HTTP/1.1" 200 114167 +64.242.88.10 - - [08/Mar/2004:06:20:36 -0800] "GET /ops/SP/play//view/Main/JorisBenschop?skin=print HTTP/1.1" 200 2717 +64.242.88.10 - - [08/Mar/2004:06:23:52 -0800] "GET /ops/SP/play//edit/TWiki/TestArea?topicparent=TWiki.WelcomeGuest HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:06:32:14 -0800] "GET /ops/SP/play//view/TWiki/WelcomeGuest?rev=r1.6 HTTP/1.1" 200 12620 +64.242.88.10 - - [08/Mar/2004:06:37:19 -0800] "GET /ops/SP/play//rdiff/TWiki/HaroldGottschalk?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5389 +64.242.88.10 - - [08/Mar/2004:06:41:22 -0800] "GET /pipermail/techcomm/ HTTP/1.1" 200 1176 +64.242.88.10 - - [08/Mar/2004:06:42:29 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.19 HTTP/1.1" 200 20488 +64.242.88.10 - - [08/Mar/2004:06:43:32 -0800] "GET /ops/SP/play//edit/Sandbox/TestTopic2?topicparent=Sandbox.WebHome HTTP/1.1" 401 12846 +128.227.88.79 - - [08/Mar/2004:06:47:41 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +128.227.88.79 - - [08/Mar/2004:06:47:41 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +64.242.88.10 - - [08/Mar/2004:06:49:27 -0800] "GET /ops/SP/play//attach/TWiki/InterWikis HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:06:54:30 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiSkins?rev1=1.11&rev2=1.10 HTTP/1.1" 200 5711 +64.242.88.10 - - [08/Mar/2004:06:57:09 -0800] "GET /ops/SP/play//rdiff/TWiki/WebNotify HTTP/1.1" 200 11780 +128.227.88.79 - - [08/Mar/2004:06:57:46 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +128.227.88.79 - - [08/Mar/2004:06:57:46 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +64.242.88.10 - - [08/Mar/2004:07:00:15 -0800] "GET /ops/SP/play//view/TWiki/DontNotify?rev=1.1 HTTP/1.1" 200 3965 +64.242.88.10 - - [08/Mar/2004:07:07:13 -0800] "GET /ops/SP/play//edit/Main/Masquerade_classes?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +128.227.88.79 - - [08/Mar/2004:07:09:12 -0800] "GET /ops/SP/play//view/Main/SpamAssassin HTTP/1.1" 200 4081 +64.242.88.10 - - [08/Mar/2004:07:09:21 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=r1.10 HTTP/1.1" 200 8312 +64.242.88.10 - - [08/Mar/2004:07:10:26 -0800] "GET /ops/SP/play//view/TWiki/HaroldGottschalk?rev=1.2 HTTP/1.1" 200 3774 +64.242.88.10 - - [08/Mar/2004:07:11:37 -0800] "GET /ops/SP/play//edit/TWiki/TWikiCodevTWikiPlannedFeatures?topicparent=TWiki.TWikiHistory HTTP/1.1" 401 12851 +64.242.88.10 - - [08/Mar/2004:07:12:39 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=r1.44 HTTP/1.1" 200 41434 +64.242.88.10 - - [08/Mar/2004:07:22:13 -0800] "GET /ops/SP/play//view/TWiki/PeterFokkinga?rev=1.2 HTTP/1.1" 200 3748 +64.242.88.10 - - [08/Mar/2004:07:23:38 -0800] "GET /ops/SP/play//edit/TWiki/TWikiPlugins?t=1078696313 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:07:24:43 -0800] "GET /mailman/listinfo/webct HTTP/1.1" 200 6377 +64.242.88.10 - - [08/Mar/2004:07:25:56 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +64.242.88.10 - - [08/Mar/2004:07:27:01 -0800] "GET /mailman/listinfo/faculty HTTP/1.1" 200 6054 +61.9.4.61 - - [08/Mar/2004:07:27:36 -0800] "GET /_vti_bin/owssvr.dll?UL=1&ACT=4&BUILD=2614&STRMVER=4&CAPREQ=0 HTTP/1.0" 404 284 +61.9.4.61 - - [08/Mar/2004:07:27:36 -0800] "GET /SpamAssassin.jsp HTTP/1.0" 200 7368 +61.9.4.61 - - [08/Mar/2004:07:27:37 -0800] "GET /MSOffice/cltreq.asp?UL=1&ACT=4&BUILD=2614&STRMVER=4&CAPREQ=0 HTTP/1.0" 404 284 +64.242.88.10 - - [08/Mar/2004:07:28:29 -0800] "GET /mailman/admin/sswk HTTP/1.1" 200 2072 +64.242.88.10 - - [08/Mar/2004:07:29:56 -0800] "GET /mailman/listinfo/purchasing HTTP/1.1" 200 6050 +64.242.88.10 - - [08/Mar/2004:07:35:50 -0800] "GET /ops/SP/play//edit/Main/Invalid_hostname_reject_code?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:07:39:31 -0800] "GET /ops/SP/play//rdiff/Main/WebPreferences?rev1=1.14&rev2=1.13 HTTP/1.1" 200 7207 +64.242.88.10 - - [08/Mar/2004:07:40:54 -0800] "GET /ops/SP/play//rename/TWiki/TWikiHistory HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:07:43:21 -0800] "GET /ops/SP/play//view/TWiki/SearchDoesNotWork?rev=r1.2 HTTP/1.1" 200 4072 +64.242.88.10 - - [08/Mar/2004:07:44:53 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=r1.50 HTTP/1.1" 200 42285 +64.242.88.10 - - [08/Mar/2004:07:49:56 -0800] "GET /ops/SP/play//edit/TWiki/RyanFreebern?t=1078701457 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:07:51:39 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=r1.2 HTTP/1.1" 200 6061 +64.242.88.10 - - [08/Mar/2004:07:53:19 -0800] "GET /ops/SP/play//rdiff/TWiki/WebTopicEditTemplate HTTP/1.1" 200 7895 +mcl02.tnr.on.ca - - [08/Mar/2004:07:53:37 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +mcl02.tnr.on.ca - - [08/Mar/2004:07:53:38 -0800] "GET /images/image005.jpg HTTP/1.1" 200 21125 +mcl02.tnr.on.ca - - [08/Mar/2004:07:53:38 -0800] "GET /images/image004.jpg HTTP/1.1" 200 10936 +mcl02.tnr.on.ca - - [08/Mar/2004:07:53:38 -0800] "GET /images/msgops.JPG HTTP/1.1" 200 7939 +64.242.88.10 - - [08/Mar/2004:07:54:30 -0800] "GET /ops/SP/play//edit/Main/Unknown_local_recipient_reject_code?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:07:56:34 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Web%20*Index[^A-Za-z] HTTP/1.1" 200 4163 +64.242.88.10 - - [08/Mar/2004:08:04:46 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +p5083cd5d.dip0.t-ipconnect.de - - [08/Mar/2004:08:09:32 -0800] "GET /SpamAssassin.jsp HTTP/1.0" 200 7368 +64.242.88.10 - - [08/Mar/2004:08:12:50 -0800] "GET /ops/SP/play//view/TWiki/ChangePassword?rev=r1.6 HTTP/1.1" 200 5181 +64.242.88.10 - - [08/Mar/2004:08:14:15 -0800] "GET /ops/SP/play//edit/TWiki/HaroldGottschalk?t=1078717948 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:08:15:21 -0800] "GET /ops/SP/play//edit/Main/Expand_owner_alias?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:08:17:09 -0800] "GET /ops/SP/play//view/Main/WebIndex?rev=r1.2 HTTP/1.1" 200 45059 +64.242.88.10 - - [08/Mar/2004:08:18:52 -0800] "GET /rfc.jsp HTTP/1.1" 200 3103 +pool-68-160-195-60.ny325.east.verizon.net - - [08/Mar/2004:08:21:00 -0800] "GET / HTTP/1.1" 200 3169 +pool-68-160-195-60.ny325.east.verizon.net - - [08/Mar/2004:08:21:00 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +64.242.88.10 - - [08/Mar/2004:08:21:47 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=RBLs%20*How%20*To[^A-Za-z] HTTP/1.1" 200 3575 +64.242.88.10 - - [08/Mar/2004:08:25:37 -0800] "GET /ops/SP/play//rdiff/TWiki/WebTopicEditTemplate?rev1=1.5&rev2=1.4 HTTP/1.1" 200 4212 +212.92.37.62 - - [08/Mar/2004:08:26:41 -0800] "GET / HTTP/1.1" 200 3169 +212.92.37.62 - - [08/Mar/2004:08:27:04 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +212.92.37.62 - - [08/Mar/2004:08:27:08 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +64.242.88.10 - - [08/Mar/2004:08:27:14 -0800] "GET /ops/SP/play//rdiff/Main/SpamAssassin HTTP/1.1" 200 4445 +212.92.37.62 - - [08/Mar/2004:08:27:23 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +212.92.37.62 - - [08/Mar/2004:08:27:28 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +64.242.88.10 - - [08/Mar/2004:08:28:23 -0800] "GET /ops/SP/play//rdiff/Main/TokyoOffice?rev1=1.2&rev2=1.1 HTTP/1.1" 200 7316 +64.242.88.10 - - [08/Mar/2004:08:29:36 -0800] "GET /ops/SP/play//view/TWiki/TWikiCategoryTable HTTP/1.1" 200 3729 +219.95.17.51 - - [08/Mar/2004:08:29:57 -0800] "GET / HTTP/1.1" 200 3169 +212.92.37.62 - - [08/Mar/2004:08:30:25 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +212.92.37.62 - - [08/Mar/2004:08:31:37 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +10.0.0.176 - - [08/Mar/2004:08:32:24 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [08/Mar/2004:08:32:27 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +10.0.0.176 - - [08/Mar/2004:08:32:27 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +212.92.37.62 - - [08/Mar/2004:08:32:34 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +212.92.37.62 - - [08/Mar/2004:08:33:27 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +212.92.37.62 - - [08/Mar/2004:08:33:30 -0800] "GET /ops/SP/play//view/Main/PostfixCmd HTTP/1.1" 200 4173 +212.92.37.62 - - [08/Mar/2004:08:33:39 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.1" 200 3629 +64.242.88.10 - - [08/Mar/2004:08:33:51 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=r1.14 HTTP/1.1" 200 8820 +212.92.37.62 - - [08/Mar/2004:08:33:52 -0800] "GET /ops/SP/play//view/Main/SideBar HTTP/1.1" 200 3972 +212.92.37.62 - - [08/Mar/2004:08:33:57 -0800] "GET /ops/SP/play//view/Main/DCCGraphs HTTP/1.1" 200 5402 +212.92.37.62 - - [08/Mar/2004:08:34:09 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +64.242.88.10 - - [08/Mar/2004:08:34:53 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiHistory?rev1=1.8&rev2=1.7 HTTP/1.1" 200 4972 +64.242.88.10 - - [08/Mar/2004:08:36:05 -0800] "GET /ops/SP/play//view/TWiki/ChangePassword?rev=r1.3 HTTP/1.1" 200 5229 +92-moc-6.acn.waw.pl - - [08/Mar/2004:08:37:14 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +92-moc-6.acn.waw.pl - - [08/Mar/2004:08:37:14 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +92-moc-6.acn.waw.pl - - [08/Mar/2004:08:37:17 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +64.242.88.10 - - [08/Mar/2004:08:37:23 -0800] "GET /ops/SP/play//attach/TWiki/HaroldGottschalk HTTP/1.1" 401 12846 +66.213.206.2 - - [08/Mar/2004:08:37:53 -0800] "GET / HTTP/1.1" 200 3169 +64.242.88.10 - - [08/Mar/2004:08:40:15 -0800] "GET /LateEmail.jsp HTTP/1.1" 200 7649 +64.242.88.10 - - [08/Mar/2004:08:52:13 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.15 HTTP/1.1" 200 16746 +64.242.88.10 - - [08/Mar/2004:08:53:17 -0800] "GET /ops/SP/play//view/TWiki/TWikiTutorial HTTP/1.1" 200 14485 +64.242.88.10 - - [08/Mar/2004:08:55:12 -0800] "GET /mailman/private/dentalstudies/ HTTP/1.1" 200 1558 +spot.nnacorp.com - - [08/Mar/2004:09:02:14 -0800] "GET / HTTP/1.1" 200 3169 +spot.nnacorp.com - - [08/Mar/2004:09:02:21 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +spot.nnacorp.com - - [08/Mar/2004:09:02:21 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +10.0.0.176 - - [08/Mar/2004:09:02:29 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [08/Mar/2004:09:02:31 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 7326 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 7927 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7182 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8866 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9307 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6805 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6596 +10.0.0.176 - - [08/Mar/2004:09:02:32 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5499 +spot.nnacorp.com - - [08/Mar/2004:09:02:54 -0800] "GET /ops/SP/play//view/Main/TWikiUsers HTTP/1.1" 200 6697 +spot.nnacorp.com - - [08/Mar/2004:09:02:54 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +64.242.88.10 - - [08/Mar/2004:09:03:18 -0800] "GET /ststats/index.jsp HTTP/1.1" 200 2955 +64.242.88.10 - - [08/Mar/2004:09:05:54 -0800] "GET /ops/SP/play//edit/Sandbox/TestTopic6?topicparent=Sandbox.WebHome HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:09:09:55 -0800] "GET /ops/SP/play//view/TWiki/TablePlugin?skin=print HTTP/1.1" 200 1572 +64.242.88.10 - - [08/Mar/2004:09:12:54 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Spam%20*Assassin[^A-Za-z] HTTP/1.1" 200 8782 +lhr003a.dhl.com - - [08/Mar/2004:09:16:26 -0800] "GET / HTTP/1.0" 200 3169 +lhr003a.dhl.com - - [08/Mar/2004:09:17:16 -0800] "GET /ststats/index.jsp HTTP/1.0" 200 2955 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.0" 200 3040 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.0" 200 2341 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.0" 200 2271 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.0" 200 3302 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.0" 200 1663 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.0" 200 2521 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.0" 200 1918 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.0" 200 1580 +lhr003a.dhl.com - - [08/Mar/2004:09:17:17 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.0" 200 2202 +lhr003a.dhl.com - - [08/Mar/2004:09:17:18 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.0" 200 1822 +lhr003a.dhl.com - - [08/Mar/2004:09:17:18 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.0" 200 1526 +10.0.0.176 - - [08/Mar/2004:09:18:53 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [08/Mar/2004:09:18:56 -0800] "GET /ststats/index.jsp HTTP/1.1" 304 - +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3040 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2271 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2341 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3302 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1580 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 1918 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1663 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2202 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2521 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1822 +10.0.0.176 - - [08/Mar/2004:09:18:57 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1526 +64.242.88.10 - - [08/Mar/2004:09:23:03 -0800] "GET /ops/SP/play//view/TWiki/SearchDoesNotWork?rev=r1.1 HTTP/1.1" 200 3981 +64.242.88.10 - - [08/Mar/2004:09:25:42 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=TWiki%20*FAQ[^A-Za-z] HTTP/1.1" 200 12083 +lj1036.passgo.com - - [08/Mar/2004:09:29:35 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1027.passgo.com - - [08/Mar/2004:09:29:36 -0800] "GET /ops/SP/play//oops/Know/WinDoze95Crash HTTP/1.0" 200 209 +pool-68-160-195-60.ny325.east.verizon.net - - [08/Mar/2004:09:30:10 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +pool-68-160-195-60.ny325.east.verizon.net - - [08/Mar/2004:09:30:11 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +pool-68-160-195-60.ny325.east.verizon.net - - [08/Mar/2004:09:30:11 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +64.242.88.10 - - [08/Mar/2004:09:30:40 -0800] "GET /ops/SP/play//view/TWiki/WebSearch?rev=r1.10 HTTP/1.1" 200 9419 +64.242.88.10 - - [08/Mar/2004:09:32:32 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiDownload HTTP/1.1" 200 5933 +64.242.88.10 - - [08/Mar/2004:09:33:46 -0800] "GET /ops/SP/play//view/Main/SideBar?rev=1.1 HTTP/1.1" 200 3564 +lj1156.passgo.com - - [08/Mar/2004:09:33:53 -0800] "GET /ops/SP/play//oops/TWiki/TWikiAccessControl HTTP/1.0" 200 209 +64.242.88.10 - - [08/Mar/2004:09:34:58 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiFAQ HTTP/1.1" 200 43115 +64.242.88.10 - - [08/Mar/2004:09:36:35 -0800] "GET /ops/SP/play//edit/TWiki/WebNotification?topicparent=TWiki.TWikiUpgradeTo01May2000 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:09:38:11 -0800] "GET /ops/SP/play//view/Main/TWikiGuest?rev=r1.3 HTTP/1.1" 200 4604 +lj1156.passgo.com - - [08/Mar/2004:09:40:30 -0800] "GET /ops/SP/play//view/TWiki/d43 HTTP/1.0" 200 4619 +64.242.88.10 - - [08/Mar/2004:09:41:15 -0800] "GET /ops/SP/play//edit/Main/Export_environment?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:09:42:27 -0800] "GET /ops/SP/play//rdiff/Know/ReadmeFirst?rev1=1.6&rev2=1.5 HTTP/1.1" 200 4187 +64.242.88.10 - - [08/Mar/2004:09:45:15 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Change%20*Password[^A-Za-z] HTTP/1.1" 200 7226 +64.242.88.10 - - [08/Mar/2004:10:01:06 -0800] "GET /ops/SP/play//view/TWiki/TWikiTopics?rev=r1.4 HTTP/1.1" 200 5171 +64.242.88.10 - - [08/Mar/2004:10:05:40 -0800] "GET /ops/SP/play//view/TWiki/WebSearch?rev=r1.9 HTTP/1.1" 200 9469 +lj1164.passgo.com - - [08/Mar/2004:10:06:28 -0800] "GET /ops/SP/play//view/Main/DCCGraphs HTTP/1.0" 200 5383 +64.242.88.10 - - [08/Mar/2004:10:08:02 -0800] "GET /ops/SP/play//rename/TWiki/DefaultPlugin HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:10:09:52 -0800] "GET /ops/SP/play//view/Main/TWikiGuest?rev=r1.1 HTTP/1.1" 200 3763 +64.242.88.10 - - [08/Mar/2004:10:14:46 -0800] "GET /ops/SP/play//edit/TWiki/TWikiRegistration?t=1078670224 HTTP/1.1" 401 12851 +64.242.88.10 - - [08/Mar/2004:10:16:52 -0800] "GET /ops/SP/play//view/Main/TWikiAdminGroup?rev=1.6 HTTP/1.1" 200 4462 +64.242.88.10 - - [08/Mar/2004:10:18:21 -0800] "GET /ops/SP/play//rdiff/TWiki/WikiSyntax HTTP/1.1" 200 59454 +64.242.88.10 - - [08/Mar/2004:10:21:21 -0800] "GET /ops/SP/play//oops/TWiki/WikiCulture?template=oopsmore¶m1=1.8¶m2=1.8 HTTP/1.1" 200 11245 +64.242.88.10 - - [08/Mar/2004:10:30:56 -0800] "GET /ops/SP/play//view/TWiki/WikiTopic HTTP/1.1" 200 4646 +64.242.88.10 - - [08/Mar/2004:10:32:18 -0800] "GET /ops/SP/play//rdiff/TWiki/WebPreferences HTTP/1.1" 200 36410 +64.242.88.10 - - [08/Mar/2004:10:34:55 -0800] "GET /ops/SP/play//view/TWiki/WebSearch?skin=print HTTP/1.1" 200 7196 +64.242.88.10 - - [08/Mar/2004:10:40:09 -0800] "GET /ops/SP/play//view/TWiki/TWikiTopics?rev=r1.7 HTTP/1.1" 200 8540 +64.242.88.10 - - [08/Mar/2004:10:45:25 -0800] "GET /ops/SP/play//search/Main/SearchResult?scope=text®ex=on&search=Thanadon%20*Somdee[^A-Za-z] HTTP/1.1" 200 4287 +64.242.88.10 - - [08/Mar/2004:10:46:34 -0800] "GET /ops/SP/play//view/TWiki/TWikiUpgradeTo01May2000?rev=1.3 HTTP/1.1" 200 7441 +10.0.0.176 - - [08/Mar/2004:10:48:02 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [08/Mar/2004:10:48:05 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 7213 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 7970 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7254 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8821 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6866 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9312 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6596 +10.0.0.176 - - [08/Mar/2004:10:48:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5499 +64.242.88.10 - - [08/Mar/2004:10:48:19 -0800] "GET /ops/SP/play//edit/Main/Max_use?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/index.jsp HTTP/1.1" 304 - +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3080 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2224 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3299 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2481 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1667 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2346 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 1872 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1585 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2202 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1833 +10.0.0.176 - - [08/Mar/2004:10:48:37 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1521 +64.242.88.10 - - [08/Mar/2004:10:50:05 -0800] "GET /ops/SP/play//rdiff/TWiki/WebRss HTTP/1.1" 200 21483 +64.242.88.10 - - [08/Mar/2004:11:03:34 -0800] "GET /ops/SP/play//rdiff/TWiki/WikiCulture?rev1=1.8&rev2=1.7 HTTP/1.1" 200 5326 +128.227.88.79 - - [08/Mar/2004:11:06:20 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +128.227.88.79 - - [08/Mar/2004:11:06:20 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +128.227.88.79 - - [08/Mar/2004:11:06:28 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +64.242.88.10 - - [08/Mar/2004:11:09:24 -0800] "GET /ops/SP/play//edit/Main/Lmtp_mail_timeout?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +128.227.88.79 - - [08/Mar/2004:11:10:09 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +128.227.88.79 - - [08/Mar/2004:11:10:24 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +128.227.88.79 - - [08/Mar/2004:11:11:04 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +128.227.88.79 - - [08/Mar/2004:11:11:10 -0800] "GET /ops/SP/play//view/Main/TWikiGroups HTTP/1.1" 200 4816 +128.227.88.79 - - [08/Mar/2004:11:11:15 -0800] "GET /ops/SP/play//view/Main/TWikiAdminGroup HTTP/1.1" 200 4175 +128.227.88.79 - - [08/Mar/2004:11:11:26 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +64.242.88.10 - - [08/Mar/2004:11:11:51 -0800] "GET /ops/SP/play//edit/Main/TWikiGuest?t=1078713282 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:11:15:51 -0800] "GET /ops/SP/play//rdiff/TWiki/AdminSkillsAssumptions HTTP/1.1" 200 10368 +64.242.88.10 - - [08/Mar/2004:11:17:49 -0800] "GET /ops/SP/play//view/Sandbox/WebHome?rev=r1.3 HTTP/1.1" 200 8708 +64.242.88.10 - - [08/Mar/2004:11:19:43 -0800] "GET /ops/SP/play//edit/TWiki/WikiNotation?t=1078726052 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:11:24:12 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Wiki%20*Notation[^A-Za-z] HTTP/1.1" 200 6558 +64.242.88.10 - - [08/Mar/2004:11:25:16 -0800] "GET /ops/SP/play//oops/TWiki/WikiNotation?template=oopsmore¶m1=1.3¶m2=1.3 HTTP/1.1" 200 11263 +10.0.0.176 - - [08/Mar/2004:11:40:41 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 7226 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 8055 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8787 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7088 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6866 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6596 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9312 +10.0.0.176 - - [08/Mar/2004:11:40:42 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5499 +64.242.88.10 - - [08/Mar/2004:11:41:14 -0800] "GET /mailman/admin/artsscience HTTP/1.1" 200 2125 +64.242.88.10 - - [08/Mar/2004:11:43:17 -0800] "GET /ops/SP/play//search/Main/?scope=topic®ex=on&search=^d HTTP/1.1" 200 5036 +64.242.88.10 - - [08/Mar/2004:11:45:08 -0800] "GET /ops/SP/play//edit/TWiki/TWikiCodevFeatureToDo?topicparent=TWiki.TWikiHistory HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:11:47:52 -0800] "GET /ops/SP/play//rename/TWiki/ResetPassword HTTP/1.1" 401 12851 +64.242.88.10 - - [08/Mar/2004:11:49:23 -0800] "GET /ops/SP/play//edit/Main/Fast_flush_domains?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:11:51:20 -0800] "GET /ops/SP/play//edit/Main/SpamAssassin?t=1078709979 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:11:56:19 -0800] "GET /ops/SP/play//view/TWiki/TWikiTopics?rev=r1.10 HTTP/1.1" 200 14650 +64.242.88.10 - - [08/Mar/2004:11:57:28 -0800] "GET /ops/SP/play//view/TWiki/FileAttribute?rev=r1.2 HTTP/1.1" 200 3949 +64.242.88.10 - - [08/Mar/2004:12:00:26 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiEnhancementRequests HTTP/1.1" 200 10417 +64.242.88.10 - - [08/Mar/2004:12:06:03 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Kevin%20*Kinnell[^A-Za-z] HTTP/1.1" 200 4536 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 7192 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 8081 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 9065 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7206 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9312 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6866 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6596 +10.0.0.176 - - [08/Mar/2004:12:06:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5499 +64.242.88.10 - - [08/Mar/2004:12:07:13 -0800] "GET /ops/SP/play//view/TWiki/FileAttribute?rev=1.2 HTTP/1.1" 200 3949 +64.242.88.10 - - [08/Mar/2004:12:08:32 -0800] "GET /ops/SP/play//view/TWiki/WikiNotation?skin=print HTTP/1.1" 200 1435 +64.242.88.10 - - [08/Mar/2004:12:10:39 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiPlannedFeatures HTTP/1.1" 200 10577 +64.242.88.10 - - [08/Mar/2004:12:12:50 -0800] "GET /mailman/admin/deans HTTP/1.1" 200 2080 +64.242.88.10 - - [08/Mar/2004:12:15:36 -0800] "GET /pipermail/webber/ HTTP/1.1" 200 1161 +64.242.88.10 - - [08/Mar/2004:12:20:18 -0800] "GET /ops/SP/play//view/Main/PostSuper?rev=1.1 HTTP/1.1" 200 3629 +64.242.88.10 - - [08/Mar/2004:12:25:47 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=1.13 HTTP/1.1" 200 8770 +64.242.88.10 - - [08/Mar/2004:12:28:09 -0800] "GET /ops/SP/play//edit/Main/Mailq_path?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:12:31:32 -0800] "GET /ops/SP/play//view/TWiki/WebHome?rev=r1.49 HTTP/1.1" 200 12993 +64.242.88.10 - - [08/Mar/2004:12:33:09 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=r1.49 HTTP/1.1" 200 42243 +64.242.88.10 - - [08/Mar/2004:12:39:34 -0800] "GET /ops/SP/play//rdiff/TWiki/TWikiDocGraphics?rev1=1.11&rev2=1.10 HTTP/1.1" 200 6551 +64.242.88.10 - - [08/Mar/2004:12:40:36 -0800] "GET /ops/SP/play//view/TWiki/WebHome?rev=r1.47 HTTP/1.1" 200 12819 +64.242.88.10 - - [08/Mar/2004:12:42:04 -0800] "GET /ops/SP/play//view/Sandbox/WebStatistics HTTP/1.1" 200 6063 +64.242.88.10 - - [08/Mar/2004:12:43:08 -0800] "GET /pipermail/gisgrad/ HTTP/1.1" 200 1118 +64.242.88.10 - - [08/Mar/2004:12:45:13 -0800] "GET /mailman/admin/webber HTTP/1.1" 200 2089 +64.242.88.10 - - [08/Mar/2004:12:47:42 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=1.14 HTTP/1.1" 200 8820 +64.242.88.10 - - [08/Mar/2004:12:55:18 -0800] "GET /ops/SP/play//view/TWiki/KevinKinnell?rev=1.4 HTTP/1.1" 200 3730 +64.242.88.10 - - [08/Mar/2004:12:58:39 -0800] "GET /ops/SP/play//search/Main/?search=\\.*&scope=topic&order=modified&reverse=on®ex=on&nosearch=on&limit=800 HTTP/1.1" 200 43915 +market-mail.panduit.com - - [08/Mar/2004:12:58:50 -0800] "GET / HTTP/1.0" 200 3169 +market-mail.panduit.com - - [08/Mar/2004:12:58:50 -0800] "GET /favicon.ico HTTP/1.0" 200 1078 +market-mail.panduit.com - - [08/Mar/2004:12:59:18 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +market-mail.panduit.com - - [08/Mar/2004:12:59:34 -0800] "GET /ststats/index.jsp HTTP/1.0" 200 2955 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.0" 200 3095 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.0" 200 2272 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.0" 200 3279 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.0" 200 2349 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.0" 200 1659 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.0" 200 2542 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.0" 200 1927 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.0" 200 1580 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.0" 200 2201 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.0" 200 1829 +market-mail.panduit.com - - [08/Mar/2004:12:59:37 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.0" 200 1524 +market-mail.panduit.com - - [08/Mar/2004:12:59:55 -0800] "GET /DCC.jsp HTTP/1.0" 200 2878 +market-mail.panduit.com - - [08/Mar/2004:13:00:12 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +market-mail.panduit.com - - [08/Mar/2004:13:00:12 -0800] "GET /favicon.ico HTTP/1.0" 200 1078 +market-mail.panduit.com - - [08/Mar/2004:13:00:13 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +market-mail.panduit.com - - [08/Mar/2004:13:00:20 -0800] "GET /ops/SP/play//view/Main/DCC HTTP/1.0" 200 4377 +market-mail.panduit.com - - [08/Mar/2004:13:00:27 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.0" 200 5234 +64.242.88.10 - - [08/Mar/2004:13:00:40 -0800] "GET /ops/SP/play//oops/TWiki/HaroldGottschalk?template=oopsmore¶m1=1.3¶m2=1.3 HTTP/1.1" 200 11335 +market-mail.panduit.com - - [08/Mar/2004:13:01:27 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.0" 200 4004 +market-mail.panduit.com - - [08/Mar/2004:13:01:29 -0800] "GET /ops/SP/play//view/Main/PostfixCmd HTTP/1.0" 200 4154 +market-mail.panduit.com - - [08/Mar/2004:13:01:35 -0800] "GET /ops/SP/play//edit/Main/PostConf?topicparent=Main.PostfixCommands HTTP/1.0" 401 12816 +market-mail.panduit.com - - [08/Mar/2004:13:01:38 -0800] "GET /go/bin/test/TWikiDocGraphics/help.gif HTTP/1.0" 200 130 +64.242.88.10 - - [08/Mar/2004:13:01:42 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=John%20*Talintyre[^A-Za-z] HTTP/1.1" 200 8066 +market-mail.panduit.com - - [08/Mar/2004:13:01:42 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.0" 200 3617 +market-mail.panduit.com - - [08/Mar/2004:13:01:55 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.0" 200 4213 +market-mail.panduit.com - - [08/Mar/2004:13:02:03 -0800] "GET /ops/SP/play//view/Main/VerifingGatway HTTP/1.0" 200 4731 +market-mail.panduit.com - - [08/Mar/2004:13:02:16 -0800] "GET /ops/SP/play//view/Main/Relay_Domains HTTP/1.0" 200 4564 +64.242.88.10 - - [08/Mar/2004:13:04:14 -0800] "GET /ops/SP/play//attach/Main/TWikiGuest HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:07:16 -0800] "GET /ops/SP/play//view/Main/NicholasLee?rev=1.1 HTTP/1.1" 200 4456 +64.242.88.10 - - [08/Mar/2004:13:08:17 -0800] "GET /ops/SP/play//attach/TWiki/TWikiDocGraphics?filename=pencil.gif&revInfo=1 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:12:54 -0800] "GET /ops/SP/play//rdiff/TWiki/WebSiteTools?rev1=1.2&rev2=1.1 HTTP/1.1" 200 6640 +64.242.88.10 - - [08/Mar/2004:13:15:03 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=r1.55 HTTP/1.1" 200 44652 +64.242.88.10 - - [08/Mar/2004:13:16:11 -0800] "GET /ops/SP/play//attach/Main/SpamAssassinAndPostFix HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:17:23 -0800] "GET /mailman/private/artsscience/ HTTP/1.1" 200 1552 +64.242.88.10 - - [08/Mar/2004:13:18:57 -0800] "GET /ops/SP/play//search/TWiki/?scope=topic®ex=on&search=^l HTTP/1.1" 200 2937 +64.242.88.10 - - [08/Mar/2004:13:24:49 -0800] "GET /ops/SP/play//rdiff/Main/RelayGateway?rev1=1.3&rev2=1.2 HTTP/1.1" 200 5181 +64.242.88.10 - - [08/Mar/2004:13:29:37 -0800] "GET /ops/SP/play//rdiff/Main/RelayGateway?rev1=1.2&rev2=1.1 HTTP/1.1" 200 6029 +64.242.88.10 - - [08/Mar/2004:13:31:16 -0800] "GET /ops/SP/play//rdiff/TWiki/WikiReferences?rev1=1.2&rev2=1.1 HTTP/1.1" 200 10024 +64.242.88.10 - - [08/Mar/2004:13:32:35 -0800] "GET /ops/SP/play//view/Main/WebPreferences?rev=r1.9 HTTP/1.1" 200 7511 +64.242.88.10 - - [08/Mar/2004:13:35:02 -0800] "GET /ops/SP/play//edit/TWiki/WebSiteTools?t=1078731408 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:36:06 -0800] "GET /ops/SP/play//attach/TWiki/TWikiDocGraphics?filename=viewtopic.gif&revInfo=1 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:38:39 -0800] "GET /ops/SP/play//view/TWiki/SvenDowideit?rev=r1.1 HTTP/1.1" 200 3564 +64.242.88.10 - - [08/Mar/2004:13:45:46 -0800] "GET /ops/SP/play//edit/Main/Ignore_mx_lookup_error?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:48:06 -0800] "GET /ops/SP/play//oops/Main/DCCAndPostFix?template=oopsmore¶m1=1.2¶m2=1.2 HTTP/1.1" 200 6602 +64.242.88.10 - - [08/Mar/2004:13:49:47 -0800] "GET /ops/SP/play//view/TWiki/TWikiHistory?rev=r1.54 HTTP/1.1" 200 44644 +64.242.88.10 - - [08/Mar/2004:13:55:51 -0800] "GET /ops/SP/play//edit/Main/Allow_min_user?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:56:52 -0800] "GET /ops/SP/play//edit/TWiki/KevinKinnell?t=1078692967 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:13:57:52 -0800] "GET /pipermail/fcd/ HTTP/1.1" 200 468 +64.242.88.10 - - [08/Mar/2004:13:58:55 -0800] "GET /mailman/listinfo/mgt-157 HTTP/1.1" 200 6189 +64.242.88.10 - - [08/Mar/2004:14:00:08 -0800] "GET /mailman/admin/fcd HTTP/1.1" 200 2060 +64.242.88.10 - - [08/Mar/2004:14:01:36 -0800] "GET /mailman/listinfo/cnc_forestry HTTP/1.1" 200 6159 +64.242.88.10 - - [08/Mar/2004:14:07:26 -0800] "GET /ops/SP/play//edit/Main/Strict_8bitmime?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:14:11:28 -0800] "GET /ops/SP/play//view/TWiki/WelcomeGuest?rev=r1.19 HTTP/1.1" 200 13997 +64.242.88.10 - - [08/Mar/2004:14:12:49 -0800] "GET /ops/SP/play//view/TWiki/TWikiFAQ?rev=1.11 HTTP/1.1" 200 11950 +64.242.88.10 - - [08/Mar/2004:14:13:51 -0800] "GET /mailman/admin/gisgrad HTTP/1.1" 200 2093 +64.242.88.10 - - [08/Mar/2004:14:15:01 -0800] "GET /mailman/admin/jjec HTTP/1.1" 200 2088 +fw.aub.dk - - [08/Mar/2004:14:16:38 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +fw.aub.dk - - [08/Mar/2004:14:16:39 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +64.242.88.10 - - [08/Mar/2004:14:23:54 -0800] "GET /ops/SP/play//oops/TWiki/RyanFreebern?template=oopsmore¶m1=1.2¶m2=1.2 HTTP/1.1" 200 11263 +64.242.88.10 - - [08/Mar/2004:14:25:33 -0800] "GET /ops/SP/play//rdiff/TWiki/WebChangesAlert HTTP/1.1" 200 27035 +64.242.88.10 - - [08/Mar/2004:14:26:45 -0800] "GET /ops/SP/play//rdiff/Sandbox/WebTopicList HTTP/1.1" 200 4319 +64.242.88.10 - - [08/Mar/2004:14:27:46 -0800] "GET /ops/SP/play//edit/Main/Virtual_gid_maps?topicparent=Main.ConfigurationVariables HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:14:28:46 -0800] "GET /ops/SP/play//view/TWiki/NewUserTemplate?skin=print HTTP/1.1" 200 2449 +64.242.88.10 - - [08/Mar/2004:14:33:56 -0800] "GET /mailman/admin HTTP/1.1" 200 6872 +64.242.88.10 - - [08/Mar/2004:14:40:18 -0800] "GET /mailman/admin/ncbnpfaculty HTTP/1.1" 200 2136 +64.242.88.10 - - [08/Mar/2004:14:41:22 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Web%20*Topic%20*List[^A-Za-z] HTTP/1.1" 200 10700 +64.242.88.10 - - [08/Mar/2004:14:42:44 -0800] "GET /ops/SP/play//view/TWiki/WebSearch?rev=1.11 HTTP/1.1" 200 9419 +64.242.88.10 - - [08/Mar/2004:14:43:45 -0800] "GET /ops/SP/play//view/TWiki/MartinCleaver HTTP/1.1" 200 3634 +64.242.88.10 - - [08/Mar/2004:14:52:51 -0800] "GET /ops/SP/play//view/TWiki/WebIndex HTTP/1.1" 200 102154 +64.242.88.10 - - [08/Mar/2004:14:54:56 -0800] "GET /ops/SP/play//edit/Main/TokyoOffice?t=1078706364 HTTP/1.1" 401 12846 +64.242.88.10 - - [08/Mar/2004:14:57:19 -0800] "GET /ops/SP/play//rdiff/Main/SpamAssassinAndPostFix?rev1=1.2&rev2=1.1 HTTP/1.1" 200 5794 +64.242.88.10 - - [08/Mar/2004:14:58:58 -0800] "GET /ops/SP/play//rdiff/TWiki/WhatIsWikiWiki HTTP/1.1" 200 9412 +64.242.88.10 - - [08/Mar/2004:15:00:07 -0800] "GET /ops/SP/play//rdiff/Main/WebChanges?rev1=1.2&rev2=1.1 HTTP/1.1" 200 114220 +64.242.88.10 - - [08/Mar/2004:15:01:12 -0800] "GET /ops/SP/play//rdiff/TWiki/EditDoesNotIncreaseTheRevision HTTP/1.1" 200 6310 +64.242.88.10 - - [08/Mar/2004:15:02:29 -0800] "GET /ops/SP/play//rdiff/TWiki/WebTopicList HTTP/1.1" 200 14591 +64.242.88.10 - - [08/Mar/2004:15:03:49 -0800] "GET /antivirus.jsp HTTP/1.1" 200 3548 +64.242.88.10 - - [08/Mar/2004:15:07:41 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Harold%20*Gottschalk[^A-Za-z] HTTP/1.1" 200 4412 +ip-200-56-225-61-mty.marcatel.net.mx - - [08/Mar/2004:15:15:17 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +64.242.88.10 - - [08/Mar/2004:15:16:14 -0800] "GET /ops/SP/play//view/TWiki/TextFormattingRules?rev=r1.37 HTTP/1.1" 200 28922 +64.242.88.10 - - [08/Mar/2004:15:17:18 -0800] "GET /ops/SP/play//search/Main/?scope=topic®ex=on&search=^f HTTP/1.1" 200 3438 +64.242.88.10 - - [08/Mar/2004:15:19:35 -0800] "GET /RBL.jsp HTTP/1.1" 200 4114 +c-24-11-14-147.client.comcast.net - - [08/Mar/2004:16:54:47 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +c-24-11-14-147.client.comcast.net - - [08/Mar/2004:16:54:47 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +lj1036.passgo.com - - [08/Mar/2004:17:39:00 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1168.passgo.com - - [08/Mar/2004:17:39:01 -0800] "GET /ops/SP/play//oops/TWiki/TWikiVariables HTTP/1.0" 200 209 +calcite.rhyolite.com - - [08/Mar/2004:18:14:44 -0800] "GET /clients.jsp HTTP/1.1" 200 18767 +acbf6930.ipt.aol.com - - [08/Mar/2004:18:20:44 -0800] "GET /RBL.jsp HTTP/1.1" 200 4114 +acbf6930.ipt.aol.com - - [08/Mar/2004:18:20:44 -0800] "GET /LateEmail.jsp HTTP/1.1" 200 7649 +lj1018.passgo.com - - [08/Mar/2004:18:23:43 -0800] "GET /ops/SP/play//oops/Know/PublicSupported HTTP/1.0" 200 209 +barrie-ppp108371.sympatico.ca - - [08/Mar/2004:18:39:33 -0800] "GET /mailman/listinfo/webber HTTP/1.1" 200 6051 +barrie-ppp108371.sympatico.ca - - [08/Mar/2004:18:39:35 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +barrie-ppp108371.sympatico.ca - - [08/Mar/2004:18:39:35 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +barrie-ppp108371.sympatico.ca - - [08/Mar/2004:18:39:36 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +px7wh.vc.shawcable.net - - [08/Mar/2004:18:41:16 -0800] "GET /LateEmail.jsp HTTP/1.1" 200 7649 +user-0c8hdkf.cable.mindspring.com - - [08/Mar/2004:19:08:27 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +user-0c8hdkf.cable.mindspring.com - - [08/Mar/2004:19:08:28 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +user-0c8hdkf.cable.mindspring.com - - [08/Mar/2004:19:08:39 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.1" 200 4232 +user-0c8hdkf.cable.mindspring.com - - [08/Mar/2004:19:08:52 -0800] "GET /ops/SP/play//view/Main/VerifingGatway HTTP/1.1" 200 4750 +user-0c8hdkf.cable.mindspring.com - - [08/Mar/2004:19:10:06 -0800] "GET /ops/SP/play//view/Main/Relay_Domains HTTP/1.1" 200 4583 +lj1053.passgo.com - - [08/Mar/2004:19:24:42 -0800] "GET /ops/SP/play//oops/Main/SpamAssassinTaggingOnly HTTP/1.0" 200 209 +64.246.94.152 - - [08/Mar/2004:20:09:57 -0800] "HEAD /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 0 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:18 -0800] "GET / HTTP/1.0" 200 3169 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:18 -0800] "GET /favicon.ico HTTP/1.0" 200 1078 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:25 -0800] "GET /ststats/index.jsp HTTP/1.0" 200 2955 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:26 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.0" 200 3049 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:26 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.0" 200 2160 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:26 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.0" 200 2386 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:26 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.0" 200 3271 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:26 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.0" 200 1687 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:26 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.0" 200 2482 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:27 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.0" 200 1914 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:27 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.0" 200 1536 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:27 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.0" 200 2250 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:27 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.0" 200 1883 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:27 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.0" 200 1493 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:48 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:49 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:49 -0800] "GET /favicon.ico HTTP/1.0" 200 1078 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:48:53 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.0" 200 5234 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:50:59 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.0" 200 4022 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:51:01 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.0" 200 5672 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:51:51 -0800] "GET /ops/SP/play//view/Main/SpamAssassin HTTP/1.0" 200 4062 +ip68-228-43-49.tc.ph.cox.net - - [08/Mar/2004:20:52:01 -0800] "GET /ops/SP/play//view/Main/SpamAssassin HTTP/1.0" 200 4062 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:04 -0800] "GET / HTTP/1.0" 200 3169 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:28 -0800] "GET /ststats/index.jsp HTTP/1.0" 200 2955 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.0" 200 3238 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.0" 200 3032 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.0" 200 2160 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.0" 200 2369 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.0" 200 1671 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.0" 200 2485 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.0" 200 1533 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.0" 200 1906 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.0" 200 2251 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.0" 200 1875 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:29 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.0" 200 1483 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:44 -0800] "GET /SpamAssassin.jsp HTTP/1.0" 200 7368 +proxy0.haifa.ac.il - - [08/Mar/2004:22:03:52 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +proxy0.haifa.ac.il - - [08/Mar/2004:22:04:09 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +proxy0.haifa.ac.il - - [08/Mar/2004:22:04:10 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +proxy0.haifa.ac.il - - [08/Mar/2004:22:04:24 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.0" 200 4515 +proxy0.haifa.ac.il - - [08/Mar/2004:22:04:35 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.0" 200 4004 +alille-251-1-2-197.w82-124.abo.wanadoo.fr - - [08/Mar/2004:22:30:01 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +a213-84-36-192.adsl.xs4all.nl - - [08/Mar/2004:23:42:55 -0800] "GET / HTTP/1.1" 200 3169 +195.246.13.119 - - [09/Mar/2004:01:48:27 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +195.246.13.119 - - [09/Mar/2004:01:48:28 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +195.246.13.119 - - [09/Mar/2004:01:48:28 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +195.246.13.119 - - [09/Mar/2004:01:49:53 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +195.246.13.119 - - [09/Mar/2004:01:49:57 -0800] "GET /ops/SP/play//view/Main/KevinWGagel HTTP/1.1" 200 4901 +195.246.13.119 - - [09/Mar/2004:01:50:35 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +195.246.13.119 - - [09/Mar/2004:01:50:54 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +195.246.13.119 - - [09/Mar/2004:01:51:17 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +195.246.13.119 - - [09/Mar/2004:01:51:41 -0800] "GET /ops/SP/play//edit/Main/RazorAndPostFix?topicparent=Main.WebHome HTTP/1.1" 401 12851 +195.246.13.119 - - [09/Mar/2004:01:51:45 -0800] "GET /go/bin/test/TWikiDocGraphics/help.gif HTTP/1.1" 200 130 +195.246.13.119 - - [09/Mar/2004:01:51:54 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.1" 200 4232 +195.246.13.119 - - [09/Mar/2004:01:52:12 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.1" 200 4534 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:10 -0800] "GET /ststats/index.jsp HTTP/1.1" 200 2955 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:17 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3068 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:17 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2187 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:17 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3277 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:17 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2379 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1687 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2592 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 1983 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1545 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2222 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1866 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1494 +200-55-104-193.dsl.prima.net.ar - - [09/Mar/2004:02:33:18 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +lj1052.passgo.com - - [09/Mar/2004:02:39:17 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1162.passgo.com - - [09/Mar/2004:02:39:18 -0800] "GET /ops/SP/play//view/Main/SanJoseOffice HTTP/1.0" 200 3884 +lj1162.passgo.com - - [09/Mar/2004:03:10:39 -0800] "GET /ops/SP/play//view/Main/SanJoseOffice HTTP/1.0" 200 3884 +mail.geovariances.fr - - [09/Mar/2004:05:01:53 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +mail.geovariances.fr - - [09/Mar/2004:05:01:53 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +mail.geovariances.fr - - [09/Mar/2004:05:02:11 -0800] "GET /ops/SP/play//view/Main/SpamAssassin HTTP/1.1" 200 4081 +mail.geovariances.fr - - [09/Mar/2004:05:02:11 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:02:14 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +mail.geovariances.fr - - [09/Mar/2004:05:02:14 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:02:19 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +mail.geovariances.fr - - [09/Mar/2004:05:02:19 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:02:27 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +mail.geovariances.fr - - [09/Mar/2004:05:02:28 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:04:09 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +mail.geovariances.fr - - [09/Mar/2004:05:04:09 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:09:30 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +mail.geovariances.fr - - [09/Mar/2004:05:09:31 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:12:45 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:12:45 -0800] "GET /ops/SP/play//view/Main/ConfigurationVariables HTTP/1.1" 200 58292 +mail.geovariances.fr - - [09/Mar/2004:05:13:40 -0800] "GET /ops/SP/play//view/TWiki/WebHome HTTP/1.1" 200 15182 +mail.geovariances.fr - - [09/Mar/2004:05:13:40 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +mail.geovariances.fr - - [09/Mar/2004:05:13:40 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot131x64.gif HTTP/1.1" 200 7218 +mail.geovariances.fr - - [09/Mar/2004:05:13:40 -0800] "GET /go/bin/test/TWikiDocGraphics/tip.gif HTTP/1.1" 200 123 +mail.geovariances.fr - - [09/Mar/2004:05:13:40 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot88x31.gif HTTP/1.1" 200 3501 +mail.geovariances.fr - - [09/Mar/2004:05:14:13 -0800] "GET /ops/SP/play//view/Sandbox/WebHome HTTP/1.1" 200 8632 +mail.geovariances.fr - - [09/Mar/2004:05:14:14 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +66-194-6-70.gen.twtelecom.net - - [09/Mar/2004:05:20:20 -0800] "GET / HTTP/1.1" 200 3169 +195.230.181.122 - - [09/Mar/2004:06:29:03 -0800] "GET /AmavisNew.jsp HTTP/1.0" 200 2300 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:33:21 -0800] "GET / HTTP/1.1" 200 3169 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:51 -0800] "GET /ststats/index.jsp HTTP/1.1" 200 2955 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:53 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3027 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:53 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2148 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:54 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3200 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:54 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2341 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:55 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1686 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:55 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2534 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:56 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 1948 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:56 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1549 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:57 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2214 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:57 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1873 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:34:58 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1500 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:04 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6708 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:06 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 8232 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:09 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8857 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:10 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7175 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:13 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9391 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:13 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6922 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:17 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6618 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:17 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5615 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:35:42 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:36:28 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:36:29 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:36:51 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:37:00 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +ts04-ip92.hevanet.com - - [09/Mar/2004:06:37:40 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:27:10 -0800] "GET / HTTP/1.1" 200 3169 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:27:10 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:27:44 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:27:44 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:27:44 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:27:59 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:28:05 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:07:28:12 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +207.195.59.160 - - [09/Mar/2004:08:08:35 -0800] "GET / HTTP/1.1" 200 3169 +207.195.59.160 - - [09/Mar/2004:08:08:37 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +207.195.59.160 - - [09/Mar/2004:08:08:38 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +207.195.59.160 - - [09/Mar/2004:08:08:54 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +207.195.59.160 - - [09/Mar/2004:08:08:54 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +207.195.59.160 - - [09/Mar/2004:08:08:57 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +207.195.59.160 - - [09/Mar/2004:08:09:39 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.1" 200 4665 +207.195.59.160 - - [09/Mar/2004:08:09:39 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +207.195.59.160 - - [09/Mar/2004:08:09:58 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +207.195.59.160 - - [09/Mar/2004:08:09:58 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +207.195.59.160 - - [09/Mar/2004:08:10:04 -0800] "GET /ops/SP/play//edit/Main/PostConf?topicparent=Main.PostfixCommands HTTP/1.1" 401 12851 +207.195.59.160 - - [09/Mar/2004:08:10:06 -0800] "GET /go/bin/test/TWikiDocGraphics/help.gif HTTP/1.1" 200 130 +207.195.59.160 - - [09/Mar/2004:08:10:12 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.1" 200 4232 +207.195.59.160 - - [09/Mar/2004:08:10:12 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +207.195.59.160 - - [09/Mar/2004:08:10:20 -0800] "GET /ops/SP/play//view/Main/Relay_Domains HTTP/1.1" 200 4583 +fw1.millardref.com - - [09/Mar/2004:08:17:27 -0800] "GET / HTTP/1.1" 200 3169 +207.195.59.160 - - [09/Mar/2004:08:17:34 -0800] "GET /ops/SP/play//view/Main/VerifingGatway HTTP/1.1" 200 4750 +fw1.millardref.com - - [09/Mar/2004:08:17:50 -0800] "GET /RBL.jsp HTTP/1.1" 200 4114 +207.195.59.160 - - [09/Mar/2004:08:18:17 -0800] "GET /ops/SP/play//view/Main/SideBar HTTP/1.1" 200 3972 +207.195.59.160 - - [09/Mar/2004:08:18:17 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +fw1.millardref.com - - [09/Mar/2004:08:18:19 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +fw1.millardref.com - - [09/Mar/2004:08:18:25 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +fw1.millardref.com - - [09/Mar/2004:08:18:26 -0800] "GET /images/image004.jpg HTTP/1.1" 200 10936 +fw1.millardref.com - - [09/Mar/2004:08:18:27 -0800] "GET /images/image005.jpg HTTP/1.1" 200 21125 +fw1.millardref.com - - [09/Mar/2004:08:18:27 -0800] "GET /images/msgops.JPG HTTP/1.1" 200 7939 +207.195.59.160 - - [09/Mar/2004:08:18:50 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +207.195.59.160 - - [09/Mar/2004:08:19:04 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +lj1007.passgo.com - - [09/Mar/2004:09:55:44 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1125.passgo.com - - [09/Mar/2004:09:55:53 -0800] "GET /ops/SP/play//oops/TWiki/WebChangesAlert HTTP/1.0" 200 209 +80.58.35.111.proxycache.rima-tde.net - - [09/Mar/2004:10:08:07 -0800] "GET /RBL.jsp HTTP/1.0" 200 4114 +10.0.0.176 - - [09/Mar/2004:10:29:38 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [09/Mar/2004:10:29:40 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8830 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 7255 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6703 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7127 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9241 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6856 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6618 +10.0.0.176 - - [09/Mar/2004:10:29:41 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5615 +200.222.33.33 - - [09/Mar/2004:11:21:36 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +1-320.tnr.on.ca - - [09/Mar/2004:11:43:54 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +1-320.tnr.on.ca - - [09/Mar/2004:11:43:56 -0800] "GET /images/image005.jpg HTTP/1.1" 200 21125 +1-320.tnr.on.ca - - [09/Mar/2004:11:43:56 -0800] "GET /images/msgops.JPG HTTP/1.1" 200 7939 +1-320.tnr.on.ca - - [09/Mar/2004:11:43:56 -0800] "GET /images/image004.jpg HTTP/1.1" 200 10936 +l07v-1-17.d1.club-internet.fr - - [09/Mar/2004:11:57:20 -0800] "GET / HTTP/1.1" 200 3169 +wwwcache.lanl.gov - - [09/Mar/2004:12:16:06 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +trrc02m01-40.bctel.ca - - [09/Mar/2004:12:21:08 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +trrc02m01-40.bctel.ca - - [09/Mar/2004:12:21:09 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +trrc02m01-40.bctel.ca - - [09/Mar/2004:12:21:09 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +trrc02m01-40.bctel.ca - - [09/Mar/2004:12:21:10 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +fw.kcm.org - - [09/Mar/2004:12:21:49 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +fw.kcm.org - - [09/Mar/2004:12:21:49 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +lj1048.passgo.com - - [09/Mar/2004:12:52:21 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1031.passgo.com - - [09/Mar/2004:12:52:58 -0800] "GET /ops/SP/play//oops/TWiki/InterwikiPlugin HTTP/1.0" 200 209 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:14:53 -0800] "GET / HTTP/1.1" 200 3169 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:15:15 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:15:15 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:15:23 -0800] "GET /ops/SP/play//view/Main/SpamAssassin HTTP/1.1" 200 4081 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:15:33 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:15:49 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +c-24-20-163-223.client.comcast.net - - [09/Mar/2004:13:16:00 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +h194n2fls308o1033.telia.com - - [09/Mar/2004:13:49:05 -0800] "-" 408 - +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:14:43:02 -0800] "GET /mailman HTTP/1.1" 302 301 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:14:43:03 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:14:43:04 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:14:43:05 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:14:43:05 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:14:43:12 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:15 -0800] "GET / HTTP/1.1" 200 3169 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:23 -0800] "GET /mailman HTTP/1.1" 302 301 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:23 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:24 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:24 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:24 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:50:28 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +jacksonproject.tnr.on.ca - - [09/Mar/2004:14:56:15 -0800] "GET / HTTP/1.1" 304 - +home.yeungs.net - - [09/Mar/2004:15:03:55 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +203.147.138.233 - - [09/Mar/2004:15:25:03 -0800] "GET /ststats/index.jsp HTTP/1.1" 200 2955 +203.147.138.233 - - [09/Mar/2004:15:25:05 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +203.147.138.233 - - [09/Mar/2004:15:25:14 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3041 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1695 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2577 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3203 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 1970 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2181 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1550 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2314 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1850 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2213 +203.147.138.233 - - [09/Mar/2004:15:25:15 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1509 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:37:35 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:37:36 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:37:36 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:37:36 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:15:44:52 -0800] "GET / HTTP/1.1" 200 3169 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:15:44:52 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +208-38-57-205.ip.cal.radiant.net - - [09/Mar/2004:15:44:57 -0800] "GET /rejected.jsp HTTP/1.1" 200 3998 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:51:10 -0800] "GET /mailman/admin/ppwc HTTP/1.1" 200 2082 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:51:24 -0800] "POST /mailman/admin/ppwc HTTP/1.1" 200 2182 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:52:09 -0800] "POST /mailman/admin/ppwc HTTP/1.1" 200 2182 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:52:15 -0800] "POST /mailman/admin/ppwc HTTP/1.1" 200 19597 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:53:40 -0800] "GET /mailman/admin/ppwc/logout HTTP/1.1" 200 2103 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:53:49 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +h24-71-236-129.ca.clawio.org - - [09/Mar/2004:15:53:56 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +lj1123.passgo.com - - [09/Mar/2004:16:23:55 -0800] "GET /ops/SP/play//oops/TWiki/RegularExp HTTP/1.0" 200 209 +206-15-133-153.dialup.ziplink.net - - [09/Mar/2004:16:27:48 -0800] "HEAD /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 0 +lj1048.passgo.com - - [09/Mar/2004:17:10:26 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1061.passgo.com - - [09/Mar/2004:17:10:28 -0800] "GET /ops/SP/play//oops/TWiki/TablePlugin HTTP/1.0" 200 209 +korell2.cc.gatech.edu - - [09/Mar/2004:17:33:58 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +65-37-13-251.nrp2.roc.ny.frontiernet.net - - [09/Mar/2004:17:42:41 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +65-37-13-251.nrp2.roc.ny.frontiernet.net - - [09/Mar/2004:17:42:42 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +65-37-13-251.nrp2.roc.ny.frontiernet.net - - [09/Mar/2004:17:42:42 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +65-37-13-251.nrp2.roc.ny.frontiernet.net - - [09/Mar/2004:17:43:54 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.1" 200 4665 +65-37-13-251.nrp2.roc.ny.frontiernet.net - - [09/Mar/2004:17:45:02 -0800] "GET /ops/SP/play//view/Sandbox/WebHome HTTP/1.1" 200 8632 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:00:43 -0800] "GET /mailman/admin HTTP/1.1" 200 6872 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:00:44 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:00:44 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:00:44 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:01:11 -0800] "GET /mailman/admin/webct HTTP/1.1" 200 2080 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:01:24 -0800] "GET /mailman HTTP/1.1" 302 301 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:01:25 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:01:28 -0800] "GET /mailman/listinfo/administration HTTP/1.1" 200 6459 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:01:45 -0800] "GET /mailman/listinfo/cnc_notice HTTP/1.1" 200 6337 +cpe-203-51-137-224.vic.bigpond.net.au - - [09/Mar/2004:18:02:07 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +grandpa.mmlc.northwestern.edu - - [09/Mar/2004:18:06:27 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +grandpa.mmlc.northwestern.edu - - [09/Mar/2004:18:06:27 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:23:32 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:23:32 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:25:15 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:25:18 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +calcite.rhyolite.com - - [09/Mar/2004:20:34:55 -0800] "GET /clients.jsp HTTP/1.1" 200 18892 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:45:43 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:45:48 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +mth-fgw.ballarat.edu.au - - [09/Mar/2004:20:45:51 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +2-238.tnr.on.ca - - [09/Mar/2004:21:33:22 -0800] "GET / HTTP/1.1" 200 3169 +lj1048.passgo.com - - [09/Mar/2004:21:51:09 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1153.passgo.com - - [09/Mar/2004:21:51:16 -0800] "GET /ops/SP/play//oops/Main/ThanadonSomdee HTTP/1.0" 200 209 +mmscrm07-2.uah.goweb.net - - [09/Mar/2004:22:23:39 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1036.passgo.com - - [09/Mar/2004:22:31:21 -0800] "GET /ops/SP/play//oops/Know/TopicClassification HTTP/1.0" 200 209 +adsl-157-26-153.msy.bellsouth.net - - [09/Mar/2004:22:40:32 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +adsl-157-26-153.msy.bellsouth.net - - [09/Mar/2004:22:40:33 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +lj1164.passgo.com - - [09/Mar/2004:22:44:31 -0800] "GET /ops/SP/play//oops/TWiki/TextFormattingRules HTTP/1.0" 200 209 +66-194-6-79.gen.twtelecom.net - - [09/Mar/2004:23:36:11 -0800] "GET / HTTP/1.1" 200 3169 +lj1231.passgo.com - - [10/Mar/2004:00:21:51 -0800] "GET /ops/SP/play//oops/Main/TWikiUsers HTTP/1.0" 200 209 +212.21.228.26 - - [10/Mar/2004:00:24:58 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +yongsan-cache.korea.army.mil - - [10/Mar/2004:00:29:44 -0800] "GET /mailman/listinfo/cncce HTTP/1.1" 200 6208 +yongsan-cache.korea.army.mil - - [10/Mar/2004:00:29:44 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +yongsan-cache.korea.army.mil - - [10/Mar/2004:00:29:44 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +yongsan-cache.korea.army.mil - - [10/Mar/2004:00:29:45 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +pd9e761cf.dip.t-dialin.net - - [10/Mar/2004:02:07:27 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +lj1048.passgo.com - - [10/Mar/2004:02:31:33 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1160.passgo.com - - [10/Mar/2004:02:31:44 -0800] "GET /razor.jsp HTTP/1.0" 304 - +nb-bolz.cremona.polimi.it - - [10/Mar/2004:02:52:49 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +pc-030-040.eco.rug.nl - - [10/Mar/2004:02:55:00 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:11:40 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:11:50 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:11:53 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:12:07 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:12:20 -0800] "GET /ops/SP/play//view/Main/ConfigurationVariables HTTP/1.1" 200 58292 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:12:33 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.1" 200 4665 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:12:45 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:12:48 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.1" 200 3629 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:12:56 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.1" 200 4534 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:14:40 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:14:54 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:15:28 -0800] "GET /ops/SP/play//view/Main/SideBar HTTP/1.1" 200 3972 +pc3-registry-stockholm.telia.net - - [10/Mar/2004:03:15:33 -0800] "GET /ops/SP/play//view/Main/DCCGraphs HTTP/1.1" 200 5402 +80.58.14.235.proxycache.rima-tde.net - - [10/Mar/2004:03:52:49 -0800] "GET /mailman/listinfo/fnac HTTP/1.0" 200 5969 +80.58.14.235.proxycache.rima-tde.net - - [10/Mar/2004:03:52:51 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +80.58.14.235.proxycache.rima-tde.net - - [10/Mar/2004:03:52:51 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +80.58.14.235.proxycache.rima-tde.net - - [10/Mar/2004:03:52:52 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +66-194-6-70.gen.twtelecom.net - - [10/Mar/2004:05:21:38 -0800] "GET / HTTP/1.1" 200 3169 +pd9e50809.dip.t-dialin.net - - [10/Mar/2004:07:36:56 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +10.0.0.176 - - [10/Mar/2004:08:36:28 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:08:36:30 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 7783 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8845 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6274 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7071 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9328 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6976 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6619 +10.0.0.176 - - [10/Mar/2004:08:36:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5517 +10.0.0.176 - - [10/Mar/2004:08:36:57 -0800] "GET /ststats/index.jsp HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3020 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2287 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2332 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1673 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2583 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 1976 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3364 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2220 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1627 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1837 +10.0.0.176 - - [10/Mar/2004:08:36:58 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1528 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:51:31 -0800] "GET / HTTP/1.1" 304 - +ts05-ip44.hevanet.com - - [10/Mar/2004:08:52:13 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:52:16 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ts05-ip44.hevanet.com - - [10/Mar/2004:08:52:25 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.1" 200 5253 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:52:52 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:53:12 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:53:19 -0800] "GET /ops/SP/play//view/Main/PostfixCmd HTTP/1.1" 200 4173 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:53:33 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.1" 200 3629 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:54:15 -0800] "GET /ops/SP/play//view/Main/ConfigurationVariables HTTP/1.1" 200 58292 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:54:37 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.1" 200 4665 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:55:03 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.1" 200 4232 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:55:17 -0800] "GET /ops/SP/play//view/Main/VerifingGatway HTTP/1.1" 200 4750 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:55:40 -0800] "GET /ops/SP/play//view/Main/KevinWGagel HTTP/1.1" 200 4901 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:55:49 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.1" 200 4534 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:56:10 -0800] "GET /ops/SP/play//view/Main/SideBar HTTP/1.1" 200 3972 +ts05-ip44.hevanet.com - - [10/Mar/2004:08:56:13 -0800] "GET /ops/SP/play//view/Main/DCCGraphs HTTP/1.1" 200 5402 +lj1048.passgo.com - - [10/Mar/2004:09:05:59 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1145.passgo.com - - [10/Mar/2004:09:05:59 -0800] "GET /ops/SP/play//oops/TWiki/MoveTopic HTTP/1.0" 200 209 +cacher2-ext.wise.edt.ericsson.se - - [10/Mar/2004:09:41:56 -0800] "GET /razor.jsp HTTP/1.0" 200 2869 +adsl-64-173-42-65.dsl.snfc21.pacbell.net - - [10/Mar/2004:10:37:53 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +ic8234.upco.es - - [10/Mar/2004:10:38:04 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +ic8234.upco.es - - [10/Mar/2004:10:38:05 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +ic8234.upco.es - - [10/Mar/2004:10:38:23 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +ic8234.upco.es - - [10/Mar/2004:10:38:27 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.1" 200 3629 +ns.mou.cz - - [10/Mar/2004:10:59:06 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:12:51 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +lj1117.passgo.com - - [10/Mar/2004:11:13:21 -0800] "GET /ops/SP/play//view/Know/WebStatistics HTTP/1.0" 200 6394 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:18:59 -0800] "GET /mailman/admin/ppwc HTTP/1.1" 200 2082 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:19:00 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:19:00 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:19:00 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:19:32 -0800] "POST /mailman/admin/ppwc HTTP/1.1" 200 19597 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:41:25 -0800] "GET /mailman/admin/ppwc HTTP/1.1" 200 2082 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:41:25 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:41:25 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:41:25 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:41:52 -0800] "POST /mailman/admin/ppwc HTTP/1.1" 200 19597 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:43:26 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:44:13 -0800] "GET /mailman/admin/ppwc/members HTTP/1.1" 200 15271 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:44:27 -0800] "GET /mailman/admin/ppwc/members?letter=n HTTP/1.1" 200 15131 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:44:44 -0800] "GET /mailman/admin/ppwc/members?letter=p HTTP/1.1" 200 24507 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:45:22 -0800] "GET /mailman/admin/ppwc/passwords HTTP/1.1" 200 6217 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:45:51 -0800] "GET /mailman/admin/ppwc/gateway HTTP/1.1" 200 0 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:45:51 -0800] "GET /mailman/admin/ppwc/gateway HTTP/1.1" 200 8692 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:46:42 -0800] "GET /mailman/admin/ppwc/general HTTP/1.1" 200 19597 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:47:37 -0800] "GET /mailman/admin/ppwc/?VARHELP=general/owner HTTP/1.1" 200 3505 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:49:57 -0800] "GET /mailman/admin/ppwc HTTP/1.1" 200 2082 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:49:57 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:49:57 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:49:57 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:50:28 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:50:35 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:52:14 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +h24-71-236-129.ca.clawio.org - - [10/Mar/2004:11:52:42 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +10.0.0.176 - - [10/Mar/2004:12:02:38 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:43 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +10.0.0.176 - - [10/Mar/2004:12:02:43 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:45 -0800] "GET /mailman HTTP/1.1" 302 301 +10.0.0.176 - - [10/Mar/2004:12:02:46 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +10.0.0.176 - - [10/Mar/2004:12:02:46 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:46 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:46 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:50 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +10.0.0.176 - - [10/Mar/2004:12:02:50 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:50 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:50 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:52 -0800] "GET /mailman/admin/ppwc HTTP/1.1" 200 2082 +10.0.0.176 - - [10/Mar/2004:12:02:52 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:52 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:52 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:02:59 -0800] "POST /mailman/admin/ppwc HTTP/1.1" 200 19597 +10.0.0.176 - - [10/Mar/2004:12:03:00 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:00 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:00 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:03 -0800] "GET /mailman/admin/ppwc/members HTTP/1.1" 200 15271 +10.0.0.176 - - [10/Mar/2004:12:03:04 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:04 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:04 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:08 -0800] "GET /mailman/admin/ppwc/members?letter=p HTTP/1.1" 200 24507 +10.0.0.176 - - [10/Mar/2004:12:03:08 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:08 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:08 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:45 -0800] "GET /mailman/options/ppwc/ppwctwentynine--at--shaw.com HTTP/1.1" 200 14296 +10.0.0.176 - - [10/Mar/2004:12:03:45 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:45 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:03:45 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:06 -0800] "POST /mailman/options/ppwc/ppwctwentynine@shaw.com HTTP/1.1" 200 14579 +10.0.0.176 - - [10/Mar/2004:12:05:06 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:06 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:06 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:22 -0800] "GET /mailman/admin/ppwc HTTP/1.1" 200 19597 +10.0.0.176 - - [10/Mar/2004:12:05:22 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:22 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:22 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:38 -0800] "GET /mailman/admin/ppwc/members HTTP/1.1" 200 15271 +10.0.0.176 - - [10/Mar/2004:12:05:38 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:38 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:38 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:40 -0800] "GET /mailman/admin/ppwc/members?letter=p HTTP/1.1" 200 24525 +10.0.0.176 - - [10/Mar/2004:12:05:40 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:40 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:40 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:54 -0800] "POST /mailman/admin/ppwc/members?letter=p HTTP/1.1" 200 23169 +10.0.0.176 - - [10/Mar/2004:12:05:54 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:54 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:54 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:58 -0800] "GET /mailman/admin/ppwc/general HTTP/1.1" 200 19597 +10.0.0.176 - - [10/Mar/2004:12:05:58 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:58 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:05:58 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:06:07 -0800] "GET /mailman/admin/ppwc/members HTTP/1.1" 200 15271 +10.0.0.176 - - [10/Mar/2004:12:06:07 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:06:07 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:06:07 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:06:09 -0800] "GET /mailman/admin/ppwc/members/add HTTP/1.1" 200 6681 +10.0.0.176 - - [10/Mar/2004:12:06:09 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:06:09 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:06:09 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:07 -0800] "POST /mailman/admin/ppwc/members/add HTTP/1.1" 200 6762 +10.0.0.176 - - [10/Mar/2004:12:07:07 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:07 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:08 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:12 -0800] "GET /mailman/admin/ppwc/members/list HTTP/1.1" 200 15271 +10.0.0.176 - - [10/Mar/2004:12:07:12 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:12 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:13 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:14 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:14 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:14 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:14 -0800] "GET /mailman/admin/ppwc/members?letter=p HTTP/1.1" 200 24585 +10.0.0.176 - - [10/Mar/2004:12:07:25 -0800] "POST /mailman/admin/ppwc/members?letter=p HTTP/1.1" 200 24577 +10.0.0.176 - - [10/Mar/2004:12:07:25 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:25 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:07:25 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:16:59 -0800] "GET /mailman/admin/ppwc/logout HTTP/1.1" 200 2103 +10.0.0.176 - - [10/Mar/2004:12:16:59 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:16:59 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:16:59 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +142.27.64.35 - - [10/Mar/2004:12:19:02 -0800] "GET / HTTP/1.1" 304 - +142.27.64.35 - - [10/Mar/2004:12:19:05 -0800] "GET /mailman HTTP/1.1" 302 301 +142.27.64.35 - - [10/Mar/2004:12:19:05 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +142.27.64.35 - - [10/Mar/2004:12:19:06 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +142.27.64.35 - - [10/Mar/2004:12:19:06 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +142.27.64.35 - - [10/Mar/2004:12:19:06 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +142.27.64.35 - - [10/Mar/2004:12:19:08 -0800] "GET /mailman/listinfo/ppwc HTTP/1.1" 200 6271 +lj1216.passgo.com - - [10/Mar/2004:12:22:32 -0800] "GET /ops/SP/play//oops/TWiki/WikiTopic HTTP/1.0" 200 209 +10.0.0.176 - - [10/Mar/2004:12:25:25 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:12:25:28 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 8663 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6392 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7133 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 9449 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6895 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9403 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6619 +10.0.0.176 - - [10/Mar/2004:12:25:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5517 +c-411472d5.04-138-73746f22.cust.bredbandsbolaget.se - - [10/Mar/2004:13:13:23 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +3_343_lt_someone - - [10/Mar/2004:13:15:44 -0800] "GET / HTTP/1.1" 200 3169 +3_343_lt_someone - - [10/Mar/2004:13:15:53 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7142 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 5882 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6485 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8673 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6895 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9403 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6619 +3_343_lt_someone - - [10/Mar/2004:13:15:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5517 +watchguard.cgmatane.qc.ca - - [10/Mar/2004:13:41:37 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +watchguard.cgmatane.qc.ca - - [10/Mar/2004:13:42:23 -0800] "GET /RBL.jsp HTTP/1.1" 200 4114 +ppp2.p33.is.com.ua - - [10/Mar/2004:14:20:51 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +ppp2.p33.is.com.ua - - [10/Mar/2004:14:21:36 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +ppp2.p33.is.com.ua - - [10/Mar/2004:14:22:13 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +10.0.0.176 - - [10/Mar/2004:15:06:20 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [10/Mar/2004:15:06:24 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [10/Mar/2004:15:06:24 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 5871 +10.0.0.176 - - [10/Mar/2004:15:06:24 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6484 +10.0.0.176 - - [10/Mar/2004:15:06:24 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 7014 +10.0.0.176 - - [10/Mar/2004:15:06:24 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8821 +10.0.0.176 - - [10/Mar/2004:15:06:25 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9306 +10.0.0.176 - - [10/Mar/2004:15:06:25 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6937 +10.0.0.176 - - [10/Mar/2004:15:06:25 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5517 +10.0.0.176 - - [10/Mar/2004:15:06:25 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6619 +lj1024.passgo.com - - [10/Mar/2004:15:10:10 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1028.passgo.com - - [10/Mar/2004:15:10:13 -0800] "GET /ops/SP/play//oops/Main/T HTTP/1.0" 200 209 +lj1145.passgo.com - - [10/Mar/2004:15:49:55 -0800] "GET /ops/SP/play//oops/TWiki/NicholasLee HTTP/1.0" 200 209 +h24-68-45-227.gv.shawcable.net - - [10/Mar/2004:16:29:30 -0800] "GET /pipermail/cnc_notice/2004-February.txt HTTP/1.1" 200 6712 +64.246.94.141 - - [10/Mar/2004:16:31:19 -0800] "HEAD /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 0 +pntn02m05-129.bctel.ca - - [10/Mar/2004:16:33:04 -0800] "GET /pipermail/cncce/2004-January/000001.jsp HTTP/1.1" 200 3095 +calcite.rhyolite.com - - [10/Mar/2004:16:47:44 -0800] "GET /clients.jsp HTTP/1.1" 200 18971 +h24-68-45-227.gv.shawcable.net - - [10/Mar/2004:16:52:44 -0800] "GET /pipermail/cnc_notice/2003-December.txt HTTP/1.1" 200 6570 +h24-68-45-227.gv.shawcable.net - - [10/Mar/2004:16:54:36 -0800] "GET /pipermail/cnc_notice/2003-December/000002.jsp HTTP/1.1" 200 7074 +lj1117.passgo.com - - [10/Mar/2004:18:13:54 -0800] "GET /ops/SP/play//view/Main/VishaalGolam HTTP/1.0" 200 4577 +lj1073.passgo.com - - [10/Mar/2004:18:17:24 -0800] "GET /ops/SP/play//oops/TWiki/Wik HTTP/1.0" 200 209 +lj1024.passgo.com - - [10/Mar/2004:19:55:54 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1000.passgo.com - - [10/Mar/2004:19:55:56 -0800] "GET /ops/SP/play//view/Know/WebHome HTTP/1.0" 200 7529 +dialup-5-81.tulane.edu - - [10/Mar/2004:20:22:41 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +dialup-5-81.tulane.edu - - [10/Mar/2004:20:22:42 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +dialup-5-81.tulane.edu - - [10/Mar/2004:20:23:11 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +dialup-5-81.tulane.edu - - [10/Mar/2004:20:23:41 -0800] "GET /ops/SP/play//view/Main/TWikiGroups HTTP/1.1" 200 4816 +dialup-5-81.tulane.edu - - [10/Mar/2004:20:23:52 -0800] "GET /ops/SP/play//view/Main/TWikiAdminGroup HTTP/1.1" 200 4175 +lj1145.passgo.com - - [10/Mar/2004:21:56:34 -0800] "GET /ops/SP/play//oops/Main/WebStatistics HTTP/1.0" 200 209 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:58:46 -0800] "GET / HTTP/1.1" 200 3169 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:58:46 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:16 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:17 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 5664 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:17 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6403 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8837 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 6980 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9241 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6970 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6619 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:21:59:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5517 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:03 -0800] "GET /ststats/index.jsp HTTP/1.1" 200 2955 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:04 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3093 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2255 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3419 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2381 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1658 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2657 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 2008 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1598 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2223 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1924 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:22:00:05 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1550 +lj1220.passgo.com - - [10/Mar/2004:22:16:58 -0800] "GET /ops/SP/play//oops/TWiki/SvenDowideit HTTP/1.0" 200 209 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:28 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:30 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 5805 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:30 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6445 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:30 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8809 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 6882 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9241 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6970 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6619 +h24-70-69-74.ca.clawio.org - - [10/Mar/2004:23:08:31 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5517 +lj1024.passgo.com - - [11/Mar/2004:00:07:57 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1117.passgo.com - - [11/Mar/2004:00:07:58 -0800] "GET /ops/SP/play//oops/Know/WebStatistics HTTP/1.0" 200 209 +lj1120.passgo.com - - [11/Mar/2004:00:42:01 -0800] "GET /ops/SP/play//view/Main/DCCAndPostFix HTTP/1.0" 200 5234 +ns3.vonroll.ch - - [11/Mar/2004:00:43:57 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +ns3.vonroll.ch - - [11/Mar/2004:00:43:59 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.0" 200 2877 +ns3.vonroll.ch - - [11/Mar/2004:00:44:08 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.0" 200 4646 +lj1145.passgo.com - - [11/Mar/2004:01:39:53 -0800] "GET /ops/SP/play//view/Main/SimonMudd HTTP/1.0" 200 4612 +1513.cps.virtua.com.br - - [11/Mar/2004:02:27:39 -0800] "GET /pipermail/cipg/2003-november.txt HTTP/1.1" 404 309 +194.151.73.43 - - [11/Mar/2004:03:35:49 -0800] "GET /ie.htm HTTP/1.0" 200 3518 +194.151.73.43 - - [11/Mar/2004:03:35:57 -0800] "GET /images/image004.jpg HTTP/1.0" 200 10936 +194.151.73.43 - - [11/Mar/2004:03:35:57 -0800] "GET /images/image005.jpg HTTP/1.0" 200 21125 +194.151.73.43 - - [11/Mar/2004:03:35:58 -0800] "GET /images/msgops.JPG HTTP/1.0" 200 7939 +spica.ukc.ac.uk - - [11/Mar/2004:03:50:09 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +spica.ukc.ac.uk - - [11/Mar/2004:03:50:09 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +ogw.netinfo.nl - - [11/Mar/2004:06:11:19 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +ogw.netinfo.nl - - [11/Mar/2004:06:11:21 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +ogw.netinfo.nl - - [11/Mar/2004:06:11:38 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.1" 200 4016 +ogw.netinfo.nl - - [11/Mar/2004:06:11:39 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ogw.netinfo.nl - - [11/Mar/2004:06:11:46 -0800] "GET /ops/SP/play//view/Main/PostfixCmd HTTP/1.1" 200 4173 +ogw.netinfo.nl - - [11/Mar/2004:06:11:47 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ogw.netinfo.nl - - [11/Mar/2004:06:12:41 -0800] "GET /ops/SP/play//view/Main/PostQueue HTTP/1.1" 200 4280 +ogw.netinfo.nl - - [11/Mar/2004:06:12:43 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ogw.netinfo.nl - - [11/Mar/2004:06:13:07 -0800] "GET /ops/SP/play//view/Main/PostSuper HTTP/1.1" 200 3629 +ogw.netinfo.nl - - [11/Mar/2004:06:13:08 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ogw.netinfo.nl - - [11/Mar/2004:06:14:03 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.1" 200 4665 +ogw.netinfo.nl - - [11/Mar/2004:06:14:04 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ogw.netinfo.nl - - [11/Mar/2004:06:16:40 -0800] "GET /ops/SP/play//view/Main/RelayGateway HTTP/1.1" 200 4232 +ogw.netinfo.nl - - [11/Mar/2004:06:17:06 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.1" 200 4534 +ogw.netinfo.nl - - [11/Mar/2004:06:17:11 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +lj1024.passgo.com - - [11/Mar/2004:06:27:31 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1153.passgo.com - - [11/Mar/2004:06:27:36 -0800] "GET /ops/SP/play//oops/Sandbox/WebStatistics HTTP/1.0" 200 209 +208-186-146-13.nrp3.brv.mn.frontiernet.net - - [11/Mar/2004:06:48:05 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +208-186-146-13.nrp3.brv.mn.frontiernet.net - - [11/Mar/2004:06:48:05 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +ladybug.cns.vt.edu - - [11/Mar/2004:07:15:10 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +ladybug.cns.vt.edu - - [11/Mar/2004:07:15:11 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +ladybug.cns.vt.edu - - [11/Mar/2004:07:19:57 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +ladybug.cns.vt.edu - - [11/Mar/2004:07:20:05 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +ladybug.cns.vt.edu - - [11/Mar/2004:07:20:09 -0800] "GET /ops/SP/play//view/Main/SpamAssassinTaggingOnly HTTP/1.1" 200 5691 +osdlab.eic.nctu.edu.tw - - [11/Mar/2004:07:39:30 -0800] "GET /M83A HTTP/1.0" 404 269 +208.247.148.12 - - [11/Mar/2004:08:14:18 -0800] "GET /mailman/listinfo/ppwc HTTP/1.0" 200 6252 +208.247.148.12 - - [11/Mar/2004:08:14:18 -0800] "GET /icons/mailman.jpg HTTP/1.0" 200 2022 +208.247.148.12 - - [11/Mar/2004:08:14:18 -0800] "GET /icons/PythonPowered.png HTTP/1.0" 200 945 +208.247.148.12 - - [11/Mar/2004:08:14:18 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.0" 200 3049 +ogw.netinfo.nl - - [11/Mar/2004:08:45:41 -0800] "GET /ops/SP/play//view/Main/SpamAssassinAndPostFix HTTP/1.1" 200 4034 +ogw.netinfo.nl - - [11/Mar/2004:08:45:42 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +ogw.netinfo.nl - - [11/Mar/2004:08:45:49 -0800] "GET /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 5543 +ogw.netinfo.nl - - [11/Mar/2004:08:45:54 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +0x503e4fce.virnxx2.adsl-dhcp.tele.dk - - [11/Mar/2004:10:55:40 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +0x503e4fce.virnxx2.adsl-dhcp.tele.dk - - [11/Mar/2004:10:58:16 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +0x503e4fce.virnxx2.adsl-dhcp.tele.dk - - [11/Mar/2004:10:58:27 -0800] "GET /razor.jsp HTTP/1.1" 304 - +64-93-34-186.client.dsl.net - - [11/Mar/2004:11:12:40 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +d207-6-50-215.bchsia.telus.net - - [11/Mar/2004:11:33:35 -0800] "GET /pipermail/cncce/2004-January/000001.jsp HTTP/1.1" 200 3095 +10.0.0.176 - - [11/Mar/2004:11:49:51 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [11/Mar/2004:11:49:53 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 5622 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6357 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8728 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 6791 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9561 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 7087 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6427 +10.0.0.176 - - [11/Mar/2004:11:49:54 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5598 +1-729.tnr.on.ca - - [11/Mar/2004:11:54:59 -0800] "GET / HTTP/1.1" 200 3169 +1-729.tnr.on.ca - - [11/Mar/2004:11:55:22 -0800] "GET /mailman HTTP/1.1" 302 301 +1-729.tnr.on.ca - - [11/Mar/2004:11:55:22 -0800] "GET /mailman/listinfo HTTP/1.1" 200 6893 +1-729.tnr.on.ca - - [11/Mar/2004:11:55:22 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +1-729.tnr.on.ca - - [11/Mar/2004:11:55:23 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +1-729.tnr.on.ca - - [11/Mar/2004:11:55:23 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +1-729.tnr.on.ca - - [11/Mar/2004:11:55:26 -0800] "GET /mailman/listinfo/administration HTTP/1.1" 200 6459 +h24-71-236-129.ca.clawio.org - - [11/Mar/2004:12:28:50 -0800] "GET /mailman/admindb/ppwc HTTP/1.1" 200 2072 +h24-71-236-129.ca.clawio.org - - [11/Mar/2004:12:28:50 -0800] "GET /icons/mailman.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [11/Mar/2004:12:28:51 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [11/Mar/2004:12:28:51 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 304 - +h24-71-236-129.ca.clawio.org - - [11/Mar/2004:12:29:03 -0800] "POST /mailman/admindb/ppwc HTTP/1.1" 200 3407 +h24-71-236-129.ca.clawio.org - - [11/Mar/2004:12:29:27 -0800] "POST /mailman/admindb/ppwc HTTP/1.1" 200 1134 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:56:35 -0800] "GET /robots.txt HTTP/1.0" 200 68 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:56:58 -0800] "GET /ops/SP/play//view/TWiki/WebStatistics HTTP/1.0" 200 8193 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:57:18 -0800] "GET /ops/SP/play//view/Main/TWikiGuest HTTP/1.0" 200 4430 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:57:24 -0800] "GET /ops/SP/play//view/Main/WebHome?rev=1.25 HTTP/1.0" 200 9812 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:57:45 -0800] "GET /ops/SP/play//view/Main/WebNotify?rev=r1.6 HTTP/1.0" 200 4300 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:58:03 -0800] "GET /ops/SP/play//rdiff/TWiki/ManagingTopics?rev1=1.16&rev2=1.15 HTTP/1.0" 200 7912 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:58:37 -0800] "GET /ops/SP/play//view/Main/WebHome?rev=r1.8 HTTP/1.0" 200 8986 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:58:50 -0800] "GET /ops/SP/play//edit/Main/Max_idle?topicparent=Main.ConfigurationVariables HTTP/1.0" 401 12816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:59:07 -0800] "GET /ops/SP/play//view/Main/WebChanges HTTP/1.0" 200 40430 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:59:33 -0800] "GET /ops/SP/play//search/TWiki/SearchResult?scope=text®ex=on&search=Appendix%20*File%20*System%5B%5EA-Za-z%5D HTTP/1.0" 200 5794 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:12:59:52 -0800] "GET /ops/SP/play//oops/TWiki/AppendixFileSystem?template=oopsmore¶m1=1.12¶m2=1.12 HTTP/1.0" 200 11355 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:00:12 -0800] "GET /ops/SP/play//view/TWiki/WebTopicViewTemplate HTTP/1.0" 200 5420 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:00:47 -0800] "GET /ops/SP/play//rdiff/Main/WebHome HTTP/1.0" 200 69197 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:00:57 -0800] "GET /ops/SP/play//view/TWiki/WebPreferences?rev=r1.9 HTTP/1.0" 200 7875 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:01:21 -0800] "GET /ops/SP/play//rdiff/Main/ConfigurationVariables?rev1=1.2&rev2=1.1 HTTP/1.0" 200 59549 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:01:37 -0800] "GET /ops/SP/play//view/Main/AndreaSterbini HTTP/1.0" 200 3891 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:01:58 -0800] "GET /ops/SP/play//rdiff/Main/AndreaSterbini HTTP/1.0" 200 5567 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:02:22 -0800] "GET /ops/SP/play//rdiff/TWiki/WebNotify HTTP/1.0" 200 11733 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:02:42 -0800] "GET /ops/SP/play//rdiff/Main/WebHome?rev1=1.28&rev2=1.27 HTTP/1.0" 200 3577 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:03:06 -0800] "GET /ops/SP/play//view/Main/WebHome?skin=print HTTP/1.0" 200 8347 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:03:23 -0800] "GET /ops/SP/play//search/Main/SearchResult?search=%5C.*&scope=topic&order=modified&reverse=on®ex=on&nosearch=on HTTP/1.0" 200 43816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:03:48 -0800] "GET /ops/SP/play//view/TWiki/FormattedSearch HTTP/1.0" 200 20420 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:04:09 -0800] "GET /ops/SP/play//oops/Main/WebHome?template=oopsmore¶m1=1.28¶m2=1.8 HTTP/1.0" 200 7410 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:04:30 -0800] "GET /ops/SP/play//edit/TWiki/TextFormattingFAQ?t=1075982736 HTTP/1.0" 401 12816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:04:52 -0800] "GET /ops/SP/play//edit/Main/Allow_untrusted_routing?topicparent=Main.ConfigurationVariables HTTP/1.0" 401 12816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:05:13 -0800] "GET /ops/SP/play//edit/Main/Smtp_data_init_timeout?topicparent=Main.ConfigurationVariables HTTP/1.0" 401 12816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:05:33 -0800] "GET /ops/SP/play//view/TWiki/AppendixFileSystem?rev=1.10 HTTP/1.0" 200 34910 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:05:54 -0800] "GET /ops/SP/play//view/Main/AndreaSterbini?rev=r1.1 HTTP/1.0" 200 3732 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:06:17 -0800] "GET /ops/SP/play//view/Know/WebNotify HTTP/1.0" 200 4472 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:06:39 -0800] "GET /ops/SP/play//rdiff/Main/PeterThoeny HTTP/1.0" 200 18859 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:07:02 -0800] "GET /ops/SP/play//view/Main/WebHome?skin=print&rev=1.25 HTTP/1.0" 200 7762 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:07:20 -0800] "GET /ops/SP/play//edit/Main/Relayhost?topicparent=Main.ConfigurationVariables HTTP/1.0" 401 12816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:07:40 -0800] "GET /ops/SP/play//edit/Main/Unknown_virtual_mailbox_reject_code?topicparent=Main.ConfigurationVariables HTTP/1.0" 401 12816 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:08:03 -0800] "GET /ops/SP/play//view/TWiki/WebPreferences HTTP/1.0" 200 9109 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:08:44 -0800] "GET /ops/SP/play//view/Main/DCC HTTP/1.0" 200 4377 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:09:04 -0800] "GET /ops/SP/play//view/Know/WebHome HTTP/1.0" 200 7529 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:09:21 -0800] "GET /ops/SP/play//view/Main/WebNotify HTTP/1.0" 200 4449 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:09:24 -0800] "GET /ops/SP/play//oops/Main/WebHome?template=oopsmore¶m1=1.28¶m2=1.28 HTTP/1.0" 200 7411 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:09:52 -0800] "GET /ops/SP/play//view/Main/PostfixCommands HTTP/1.0" 200 4004 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:10:11 -0800] "GET /ops/SP/play//view/TWiki/WebHome HTTP/1.0" 200 15147 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:10:27 -0800] "GET /ops/SP/play//view/Main/RBLsHowTo HTTP/1.0" 200 4646 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:10:52 -0800] "GET /ops/SP/play//view/Main/WebTopicList HTTP/1.0" 200 7461 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:11:09 -0800] "GET /ops/SP/play//view/Main/WebHome?rev=1.27 HTTP/1.0" 200 10313 +cr020r01-3.uah.goweb.net - - [11/Mar/2004:13:11:41 -0800] "GET /ops/SP/play//view/Main/ConfigurationVariables HTTP/1.0" 200 58169 +4.37.97.186 - - [11/Mar/2004:13:12:54 -0800] "GET /pipermail/webber/2004-January/000000.jsp HTTP/1.1" 200 2446 +12.22.207.235 - - [11/Mar/2004:13:18:15 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +archserve.id.ucsb.edu - - [11/Mar/2004:13:22:32 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +archserve.id.ucsb.edu - - [11/Mar/2004:13:22:32 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +2-110.tnr.on.ca - - [11/Mar/2004:13:24:03 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +2-110.tnr.on.ca - - [11/Mar/2004:13:24:04 -0800] "GET /images/image005.jpg HTTP/1.1" 200 21125 +2-110.tnr.on.ca - - [11/Mar/2004:13:24:04 -0800] "GET /images/image004.jpg HTTP/1.1" 200 10936 +2-110.tnr.on.ca - - [11/Mar/2004:13:24:04 -0800] "GET /images/msgops.JPG HTTP/1.1" 200 7939 +2-110.tnr.on.ca - - [11/Mar/2004:13:26:38 -0800] "GET /images/image005.jpg HTTP/1.1" 304 - +2-110.tnr.on.ca - - [11/Mar/2004:13:26:38 -0800] "GET /images/image004.jpg HTTP/1.1" 304 - +2-110.tnr.on.ca - - [11/Mar/2004:13:26:38 -0800] "GET /images/msgops.JPG HTTP/1.1" 304 - +lj1024.passgo.com - - [11/Mar/2004:13:27:05 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1212.passgo.com - - [11/Mar/2004:13:27:05 -0800] "GET / HTTP/1.0" 200 3169 +2-110.tnr.on.ca - - [11/Mar/2004:14:14:44 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +2-110.tnr.on.ca - - [11/Mar/2004:14:14:47 -0800] "GET /images/image005.jpg HTTP/1.1" 200 21125 +2-110.tnr.on.ca - - [11/Mar/2004:14:14:47 -0800] "GET /images/msgops.JPG HTTP/1.1" 200 7939 +2-110.tnr.on.ca - - [11/Mar/2004:14:14:50 -0800] "GET /images/image004.jpg HTTP/1.1" 200 10936 +favr.go.de - - [11/Mar/2004:14:22:08 -0800] "GET /robots.txt HTTP/1.0" 200 68 +favr.go.de - - [11/Mar/2004:14:22:09 -0800] "GET /ops/SP/play//view/Main/WebSearch HTTP/1.0" 200 9263 +favr.go.de - - [11/Mar/2004:14:26:26 -0800] "GET /ops/SP/play//view/Sandbox/WebHome HTTP/1.0" 200 8605 +favr.go.de - - [11/Mar/2004:14:28:53 -0800] "GET /ops/SP/play//view/Sandbox/WebChanges HTTP/1.0" 200 9622 +favr.go.de - - [11/Mar/2004:14:29:44 -0800] "GET /ops/SP/play//view/Sandbox/WebPreferences HTTP/1.0" 200 8380 +favr.go.de - - [11/Mar/2004:14:29:52 -0800] "GET /ops/SP/play//view/Main/WebStatistics HTTP/1.0" 200 8331 +favr.go.de - - [11/Mar/2004:14:30:51 -0800] "GET /ops/SP/play//view/Main/WebTopicList HTTP/1.0" 200 7461 +favr.go.de - - [11/Mar/2004:14:31:43 -0800] "GET /ops/SP/play//view/Main/WebPreferences HTTP/1.0" 200 8793 +lj1008.passgo.com - - [11/Mar/2004:14:31:48 -0800] "GET /ops/SP/play//oops/TWiki/WikiWikiClones HTTP/1.0" 200 209 +favr.go.de - - [11/Mar/2004:14:33:01 -0800] "GET /ops/SP/play//view/Main/WebNotify HTTP/1.0" 200 4449 +64-249-27-114.client.dsl.net - - [11/Mar/2004:14:53:12 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +pd9eb1396.dip.t-dialin.net - - [11/Mar/2004:15:17:08 -0800] "GET /AmavisNew.jsp HTTP/1.1" 200 2300 +10.0.0.176 - - [11/Mar/2004:15:51:49 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [11/Mar/2004:15:52:07 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +10.0.0.176 - - [11/Mar/2004:15:52:07 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +10.0.0.176 - - [11/Mar/2004:15:52:12 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +10.0.0.176 - - [11/Mar/2004:15:52:12 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +10.0.0.176 - - [11/Mar/2004:15:52:18 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 6329 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8771 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6340 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 6846 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9523 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 6996 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6427 +10.0.0.176 - - [11/Mar/2004:15:52:19 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5598 +10.0.0.176 - - [11/Mar/2004:15:52:37 -0800] "GET /ststats/index.jsp HTTP/1.1" 304 - +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3241 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3327 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2434 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1676 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 2029 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1604 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2640 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2251 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1899 +10.0.0.176 - - [11/Mar/2004:15:52:38 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1556 +10.0.0.176 - - [11/Mar/2004:15:52:39 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2243 +lj1105.passgo.com - - [11/Mar/2004:16:02:37 -0800] "GET /ops/SP/play//oops/TWiki/1000 HTTP/1.0" 200 209 +wc01.piwa.pow.fr - - [11/Mar/2004:16:12:59 -0800] "GET /ie.htm HTTP/1.1" 200 3518 +wc01.piwa.pow.fr - - [11/Mar/2004:16:13:02 -0800] "GET /images/image005.jpg HTTP/1.1" 200 21125 +wc01.piwa.pow.fr - - [11/Mar/2004:16:13:02 -0800] "GET /images/msgops.JPG HTTP/1.1" 200 7939 +wc03.mtnk.rnc.net.cable.rogers.com - - [11/Mar/2004:16:13:03 -0800] "GET /images/image004.jpg HTTP/1.1" 200 10936 +206-15-133-154.dialup.ziplink.net - - [11/Mar/2004:16:33:23 -0800] "HEAD /ops/SP/play//view/Main/SpamAssassinDeleting HTTP/1.1" 200 0 +lj1024.passgo.com - - [11/Mar/2004:18:11:39 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1008.passgo.com - - [11/Mar/2004:18:11:40 -0800] "GET /ops/SP/play//oops/Main/Smtpd_recipient_limit HTTP/1.0" 200 209 +ipcorp-c8b07af1.terraempresas.com.br - - [11/Mar/2004:18:31:35 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 +66-194-6-79.gen.twtelecom.net - - [11/Mar/2004:18:57:52 -0800] "GET / HTTP/1.1" 200 3169 +lj1223.passgo.com - - [11/Mar/2004:20:12:24 -0800] "GET /ops/SP/play//view/Main/MikeMannix HTTP/1.0" 200 3674 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:32 -0800] "GET /ststats/ HTTP/1.1" 200 2955 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:37 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 3091 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:37 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2230 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:37 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2388 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:37 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3440 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1659 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2662 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 2064 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1624 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2243 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1879 +216-160-111-121.tukw.qwest.net - - [11/Mar/2004:20:49:38 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1575 +lj1073.passgo.com - - [11/Mar/2004:20:59:05 -0800] "GET /ops/SP/play//oops/TWiki/TWikiPlannedFeatures HTTP/1.0" 200 209 +mmscrm07-2.uah.goweb.net - - [11/Mar/2004:23:56:31 -0800] "GET /robots.txt HTTP/1.0" 200 68 +66-194-6-71.gen.twtelecom.net - - [12/Mar/2004:01:30:44 -0800] "GET / HTTP/1.1" 200 3169 +lj1024.passgo.com - - [12/Mar/2004:02:27:29 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1123.passgo.com - - [12/Mar/2004:02:27:32 -0800] "GET /ops/SP/play//view/Sandbox/WebIndex HTTP/1.0" 200 8667 +195.11.231.210 - - [12/Mar/2004:03:32:56 -0800] "GET /mailman/listinfo/webber HTTP/1.0" 200 6032 +80.58.33.42.proxycache.rima-tde.net - - [12/Mar/2004:04:57:20 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.0" 200 10392 +80.58.33.42.proxycache.rima-tde.net - - [12/Mar/2004:04:57:21 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +80.58.33.42.proxycache.rima-tde.net - - [12/Mar/2004:04:57:56 -0800] "GET /ops/SP/play//view/Main/LinksOfUse HTTP/1.1" 200 4534 +200.100.10.5 - - [12/Mar/2004:04:59:21 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +200.100.10.5 - - [12/Mar/2004:04:59:21 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +lj1115.passgo.com - - [12/Mar/2004:05:03:19 -0800] "GET /ops/SP/play//view/Main/TWikiAdminGroup HTTP/1.0" 200 4156 +lj1008.passgo.com - - [12/Mar/2004:05:19:31 -0800] "GET /ops/SP/play//oops/TWiki/Mana HTTP/1.0" 200 209 +71.134.70.5 - - [12/Mar/2004:05:25:20 -0800] "GET /mailman/listinfo/cncce HTTP/1.1" 200 6208 +71.134.70.5 - - [12/Mar/2004:05:25:24 -0800] "GET /icons/mailman.jpg HTTP/1.1" 200 2022 +71.134.70.5 - - [12/Mar/2004:05:25:24 -0800] "GET /icons/PythonPowered.png HTTP/1.1" 200 945 +71.134.70.5 - - [12/Mar/2004:05:25:25 -0800] "GET /icons/gnu-head-tiny.jpg HTTP/1.1" 200 3049 +200.100.10.5 - - [12/Mar/2004:05:44:35 -0800] "GET /ops/SP/play//view/Main/SpamAssassinUsingRazorAndDCC HTTP/1.1" 200 7435 +200.100.10.5 - - [12/Mar/2004:05:44:35 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +200.100.10.5 - - [12/Mar/2004:05:44:50 -0800] "GET /ops/SP/play//view/Main/DCC HTTP/1.1" 200 4396 +200.100.10.5 - - [12/Mar/2004:05:44:51 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 304 - +200.100.10.5 - - [12/Mar/2004:05:51:36 -0800] "GET /favicon.ico HTTP/1.1" 200 1078 +vlp181.vlp.fi - - [12/Mar/2004:08:33:32 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +lj1024.passgo.com - - [12/Mar/2004:09:12:01 -0800] "GET /robots.txt HTTP/1.0" 200 68 +lj1223.passgo.com - - [12/Mar/2004:09:12:02 -0800] "GET /ops/SP/play//oops/Main/Mi HTTP/1.0" 200 209 +10.0.0.176 - - [12/Mar/2004:11:01:26 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [12/Mar/2004:11:01:28 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 6405 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6413 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 6952 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8715 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 7001 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9514 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6644 +10.0.0.176 - - [12/Mar/2004:11:01:29 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5554 +fassys.org - - [12/Mar/2004:11:16:36 -0800] "GET /ststats/ HTTP/1.0" 200 2955 +fassys.org - - [12/Mar/2004:11:16:55 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.0" 200 2925 +fassys.org - - [12/Mar/2004:11:16:55 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.0" 200 2347 +fassys.org - - [12/Mar/2004:11:16:55 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.0" 200 3431 +fassys.org - - [12/Mar/2004:11:16:55 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.0" 200 2380 +fassys.org - - [12/Mar/2004:11:16:55 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.0" 200 1658 +fassys.org - - [12/Mar/2004:11:16:55 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.0" 200 2685 +fassys.org - - [12/Mar/2004:11:16:56 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.0" 200 2082 +fassys.org - - [12/Mar/2004:11:16:56 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.0" 200 1637 +fassys.org - - [12/Mar/2004:11:16:56 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.0" 200 2211 +fassys.org - - [12/Mar/2004:11:16:56 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.0" 200 1853 +fassys.org - - [12/Mar/2004:11:16:56 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.0" 200 1572 +67.131.107.5 - - [12/Mar/2004:11:39:14 -0800] "GET / HTTP/1.1" 200 3169 +67.131.107.5 - - [12/Mar/2004:11:39:25 -0800] "GET /ops/SP/play//view/Main/WebHome HTTP/1.1" 200 10419 +67.131.107.5 - - [12/Mar/2004:11:39:31 -0800] "GET /go/bin/test/TWikiLogos/twikiRobot46x50.gif HTTP/1.1" 200 2877 +10.0.0.176 - - [12/Mar/2004:12:23:11 -0800] "GET / HTTP/1.1" 304 - +10.0.0.176 - - [12/Mar/2004:12:23:17 -0800] "GET /forplus/mailgraph2.cgi HTTP/1.1" 200 2987 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0_err.png HTTP/1.1" 200 6324 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1.png HTTP/1.1" 200 8964 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_0.png HTTP/1.1" 200 6225 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2_err.png HTTP/1.1" 200 7001 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_2.png HTTP/1.1" 200 9514 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_1_err.png HTTP/1.1" 200 6949 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3.png HTTP/1.1" 200 6644 +10.0.0.176 - - [12/Mar/2004:12:23:18 -0800] "GET /forplus/mailgraph.cgi/mailgraph_3_err.png HTTP/1.1" 200 5554 +10.0.0.176 - - [12/Mar/2004:12:23:40 -0800] "GET /ststats/index.jsp HTTP/1.1" 304 - +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam.1day.png HTTP/1.1" 200 2964 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam-ratio.1day.png HTTP/1.1" 200 2341 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam-ratio.1week.png HTTP/1.1" 200 2346 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam.1week.png HTTP/1.1" 200 3438 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-hashes.1week.png HTTP/1.1" 200 1670 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam.1month.png HTTP/1.1" 200 2651 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam-ratio.1month.png HTTP/1.1" 200 2023 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-hashes.1month.png HTTP/1.1" 200 1636 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam.1year.png HTTP/1.1" 200 2262 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-spam-ratio.1year.png HTTP/1.1" 200 1906 +10.0.0.176 - - [12/Mar/2004:12:23:41 -0800] "GET /ststats/stats-hashes.1year.png HTTP/1.1" 200 1582 +216.139.185.45 - - [12/Mar/2004:13:04:01 -0800] "GET /mailman/listinfo/webber HTTP/1.1" 200 6051 +pd95f99f2.dip.t-dialin.net - - [12/Mar/2004:13:18:57 -0800] "GET /razor.jsp HTTP/1.1" 200 2869 +d97082.upc-d.chello.nl - - [12/Mar/2004:13:25:45 -0800] "GET /SpamAssassin.jsp HTTP/1.1" 200 7368 diff --git a/spring-5-mvc/pom.xml b/spring-5-mvc/pom.xml index db4ffa9abb..27dfec6939 100644 --- a/spring-5-mvc/pom.xml +++ b/spring-5-mvc/pom.xml @@ -66,7 +66,6 @@ com.fasterxml.jackson.module jackson-module-kotlin - 2.8.7 diff --git a/spring-5-mvc/src/test/kotlin/com/baeldung/LiveTest.java b/spring-5-mvc/src/test/kotlin/com/baeldung/LiveTest.java index 1b52f89117..b2f2852dbe 100644 --- a/spring-5-mvc/src/test/kotlin/com/baeldung/LiveTest.java +++ b/spring-5-mvc/src/test/kotlin/com/baeldung/LiveTest.java @@ -14,16 +14,19 @@ public class LiveTest { private static String APP_ROOT = "http://localhost:8081"; - @Test public void givenUser_whenResourceCreatedWithNullName_then400BadRequest() { - final Response response = givenAuth("user", "pass").contentType(MediaType.APPLICATION_JSON.toString()).body(resourceWithNullName()).post(APP_ROOT + "/foos"); + final Response response = givenAuth("user", "pass").contentType(MediaType.APPLICATION_JSON.toString()) + .body(resourceWithNullName()) + .post(APP_ROOT + "/foos"); assertEquals(400, response.getStatusCode()); } - + @Test public void givenUser_whenResourceCreated_then201Created() { - final Response response = givenAuth("user", "pass").contentType(MediaType.APPLICATION_JSON.toString()).body(resourceString()).post(APP_ROOT + "/foos"); + final Response response = givenAuth("user", "pass").contentType(MediaType.APPLICATION_JSON.toString()) + .body(resourceString()) + .post(APP_ROOT + "/foos"); assertEquals(201, response.getStatusCode()); } @@ -32,21 +35,22 @@ public class LiveTest { final Response response = givenAuth("user", "pass").get(APP_ROOT + "/foos"); assertEquals(200, response.getStatusCode()); }*/ - - // private final String resourceWithNullName() { return "{\"name\":null}"; } - + private final String resourceString() { return "{\"name\":\"" + randomAlphabetic(8) + "\"}"; - } + } private final RequestSpecification givenAuth(String username, String password) { - return RestAssured.given().auth().preemptive().basic(username, password); + return RestAssured.given() + .auth() + .preemptive() + .basic(username, password); } } \ No newline at end of file diff --git a/spring-5/README.md b/spring-5/README.md index 4ce0fd4c79..15e12cb5dc 100644 --- a/spring-5/README.md +++ b/spring-5/README.md @@ -9,3 +9,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Introduction to the Functional Web Framework in Spring 5](http://www.baeldung.com/spring-5-functional-web) - [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching) - [Spring 5 WebClient](http://www.baeldung.com/spring-5-webclient) +- [Spring 5 Functional Bean Registration](http://www.baeldung.com/spring-5-functional-beans) + diff --git a/spring-5/pom.xml b/spring-5/pom.xml index c2c565aef6..b77d89b532 100644 --- a/spring-5/pom.xml +++ b/spring-5/pom.xml @@ -1,188 +1,196 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - com.baeldung - spring-5 - 0.0.1-SNAPSHOT - jar + com.baeldung + spring-5 + 0.0.1-SNAPSHOT + jar - spring-5 - spring 5 sample project about new features + spring-5 + spring 5 sample project about new features - - org.springframework.boot - spring-boot-starter-parent - 2.0.0.M1 - - + + org.springframework.boot + spring-boot-starter-parent + 2.0.0.M1 + + - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.boot - spring-boot-starter-validation - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-webflux - - - org.projectreactor - reactor-spring - 1.0.1.RELEASE - + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-validation + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-webflux + + + org.projectreactor + reactor-spring + ${reactor-spring.version} + + + javax.json.bind + javax.json.bind-api + ${jsonb-api.version} + + + org.apache.geronimo.specs + geronimo-json_1.1_spec + ${geronimo-json_1.1_spec.version} + + + org.apache.johnzon + johnzon-jsonb + ${johnzon.version} + + + + org.apache.commons + commons-lang3 + - - - org.apache.commons - commons-lang3 - + - + + org.springframework.boot + spring-boot-devtools + runtime + + + com.h2database + h2 + runtime + - - org.springframework.boot - spring-boot-devtools - runtime - - - com.h2database - h2 - runtime - + + org.springframework + spring-test + + + org.springframework.boot + spring-boot-starter-test + test + - - org.springframework - spring-test - - - org.springframework.boot - spring-boot-starter-test - test - + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + + + org.junit.jupiter + junit-jupiter-engine + ${junit.jupiter.version} + test + + + org.junit.platform + junit-platform-surefire-provider + ${junit.platform.version} + test + + + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test + - - org.junit.jupiter - junit-jupiter-api - ${junit.jupiter.version} - - - org.junit.jupiter - junit-jupiter-engine - ${junit.jupiter.version} - test - - - org.junit.platform - junit-platform-surefire-provider - ${junit.platform.version} - test - - - org.junit.platform - junit-platform-runner - ${junit.platform.version} - test - + - + + + + org.springframework.boot + spring-boot-maven-plugin + + com.baeldung.Spring5Application + JAR + + - - - - org.springframework.boot - spring-boot-maven-plugin - - com.baeldung.Spring5Application - JAR - - + + org.apache.maven.plugins + maven-surefire-plugin + + 3 + true + methods + true + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - 3 - true - - **/*IntegrationTest.java - **/*LiveTest.java - - - + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - methods - true - - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - UTF-8 - UTF-8 - 1.8 - 1.0.0-M4 - 5.0.0-M4 - 2.20 - 5.0.0.RC2 - + + UTF-8 + UTF-8 + 1.8 + 1.0.0-M4 + 5.0.0-M4 + 2.20 + 5.0.0.RC2 + 1.0.1.RELEASE + 1.1.3 + 1.0 + 1.0 + diff --git a/spring-5/src/main/java/com/baeldung/Spring5Application.java b/spring-5/src/main/java/com/baeldung/Spring5Application.java index aaff1797ff..f321871646 100644 --- a/spring-5/src/main/java/com/baeldung/Spring5Application.java +++ b/spring-5/src/main/java/com/baeldung/Spring5Application.java @@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @SpringBootApplication -@ComponentScan(basePackages = {"com.baeldung.web"}) +@ComponentScan(basePackages = { "com.baeldung.web" }) public class Spring5Application { public static void main(String[] args) { diff --git a/spring-5/src/main/java/com/baeldung/functional/FormHandler.java b/spring-5/src/main/java/com/baeldung/functional/FormHandler.java index 857d22a67f..05069735bb 100644 --- a/spring-5/src/main/java/com/baeldung/functional/FormHandler.java +++ b/spring-5/src/main/java/com/baeldung/functional/FormHandler.java @@ -17,28 +17,25 @@ import static org.springframework.web.reactive.function.server.ServerResponse.ok public class FormHandler { Mono handleLogin(ServerRequest request) { - return request - .body(toFormData()) - .map(MultiValueMap::toSingleValueMap) - .filter(formData -> "baeldung".equals(formData.get("user"))) - .filter(formData -> "you_know_what_to_do".equals(formData.get("token"))) - .flatMap(formData -> ok().body(Mono.just("welcome back!"), String.class)) - .switchIfEmpty(ServerResponse.badRequest().build()); + return request.body(toFormData()) + .map(MultiValueMap::toSingleValueMap) + .filter(formData -> "baeldung".equals(formData.get("user"))) + .filter(formData -> "you_know_what_to_do".equals(formData.get("token"))) + .flatMap(formData -> ok().body(Mono.just("welcome back!"), String.class)) + .switchIfEmpty(ServerResponse.badRequest() + .build()); } Mono handleUpload(ServerRequest request) { - return request - .body(toDataBuffers()) - .collectList() - .flatMap(dataBuffers -> ok() - .body(fromObject(extractData(dataBuffers).toString()))); + return request.body(toDataBuffers()) + .collectList() + .flatMap(dataBuffers -> ok().body(fromObject(extractData(dataBuffers).toString()))); } private AtomicLong extractData(List dataBuffers) { AtomicLong atomicLong = new AtomicLong(0); - dataBuffers.forEach(d -> atomicLong.addAndGet(d - .asByteBuffer() - .array().length)); + dataBuffers.forEach(d -> atomicLong.addAndGet(d.asByteBuffer() + .array().length)); return atomicLong; } } diff --git a/spring-5/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java b/spring-5/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java index 8a808fc83a..f181dcb8e8 100644 --- a/spring-5/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java +++ b/spring-5/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java @@ -40,28 +40,25 @@ public class FunctionalSpringBootApplication { private RouterFunction routingFunction() { FormHandler formHandler = new FormHandler(); - RouterFunction restfulRouter = route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest - .bodyToMono(Actor.class) - .doOnNext(actors::add) - .then(ok().build())); + RouterFunction restfulRouter = route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest.bodyToMono(Actor.class) + .doOnNext(actors::add) + .then(ok().build())); - return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))) - .andRoute(POST("/login"), formHandler::handleLogin) - .andRoute(POST("/upload"), formHandler::handleUpload) - .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) - .andNest(path("/actor"), restfulRouter) - .filter((request, next) -> { - System.out.println("Before handler invocation: " + request.path()); - return next.handle(request); - }); + return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))).andRoute(POST("/login"), formHandler::handleLogin) + .andRoute(POST("/upload"), formHandler::handleUpload) + .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) + .andNest(path("/actor"), restfulRouter) + .filter((request, next) -> { + System.out.println("Before handler invocation: " + request.path()); + return next.handle(request); + }); } @Bean public ServletRegistrationBean servletRegistrationBean() throws Exception { - HttpHandler httpHandler = WebHttpHandlerBuilder - .webHandler((WebHandler) toHttpHandler(routingFunction())) - .prependFilter(new IndexRewriteFilter()) - .build(); + HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler((WebHandler) toHttpHandler(routingFunction())) + .prependFilter(new IndexRewriteFilter()) + .build(); ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(new RootServlet(httpHandler), "/"); registrationBean.setLoadOnStartup(1); registrationBean.setAsyncSupported(true); @@ -74,10 +71,9 @@ public class FunctionalSpringBootApplication { static class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(final HttpSecurity http) throws Exception { - http - .authorizeRequests() - .anyRequest() - .permitAll(); + http.authorizeRequests() + .anyRequest() + .permitAll(); } } diff --git a/spring-5/src/main/java/com/baeldung/functional/FunctionalWebApplication.java b/spring-5/src/main/java/com/baeldung/functional/FunctionalWebApplication.java index 29f9ea43da..2a4642c484 100644 --- a/spring-5/src/main/java/com/baeldung/functional/FunctionalWebApplication.java +++ b/spring-5/src/main/java/com/baeldung/functional/FunctionalWebApplication.java @@ -33,28 +33,25 @@ public class FunctionalWebApplication { private RouterFunction routingFunction() { FormHandler formHandler = new FormHandler(); - RouterFunction restfulRouter = route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest - .bodyToMono(Actor.class) - .doOnNext(actors::add) - .then(ok().build())); + RouterFunction restfulRouter = route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest.bodyToMono(Actor.class) + .doOnNext(actors::add) + .then(ok().build())); - return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))) - .andRoute(POST("/login"), formHandler::handleLogin) - .andRoute(POST("/upload"), formHandler::handleUpload) - .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) - .andNest(path("/actor"), restfulRouter) - .filter((request, next) -> { - System.out.println("Before handler invocation: " + request.path()); - return next.handle(request); - }); + return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))).andRoute(POST("/login"), formHandler::handleLogin) + .andRoute(POST("/upload"), formHandler::handleUpload) + .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) + .andNest(path("/actor"), restfulRouter) + .filter((request, next) -> { + System.out.println("Before handler invocation: " + request.path()); + return next.handle(request); + }); } WebServer start() throws Exception { WebHandler webHandler = (WebHandler) toHttpHandler(routingFunction()); - HttpHandler httpHandler = WebHttpHandlerBuilder - .webHandler(webHandler) - .prependFilter(new IndexRewriteFilter()) - .build(); + HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler(webHandler) + .prependFilter(new IndexRewriteFilter()) + .build(); Tomcat tomcat = new Tomcat(); tomcat.setHostname("localhost"); diff --git a/spring-5/src/main/java/com/baeldung/functional/IndexRewriteFilter.java b/spring-5/src/main/java/com/baeldung/functional/IndexRewriteFilter.java index d218bba581..3e91a0354b 100644 --- a/spring-5/src/main/java/com/baeldung/functional/IndexRewriteFilter.java +++ b/spring-5/src/main/java/com/baeldung/functional/IndexRewriteFilter.java @@ -11,17 +11,15 @@ class IndexRewriteFilter implements WebFilter { @Override public Mono filter(ServerWebExchange serverWebExchange, WebFilterChain webFilterChain) { ServerHttpRequest request = serverWebExchange.getRequest(); - if (request - .getURI() - .getPath() - .equals("/")) { - return webFilterChain.filter(serverWebExchange - .mutate() - .request(builder -> builder - .method(request.getMethod()) - .contextPath(request.getPath().toString()) - .path("/test")) - .build()); + if (request.getURI() + .getPath() + .equals("/")) { + return webFilterChain.filter(serverWebExchange.mutate() + .request(builder -> builder.method(request.getMethod()) + .contextPath(request.getPath() + .toString()) + .path("/test")) + .build()); } return webFilterChain.filter(serverWebExchange); } diff --git a/spring-5/src/main/java/com/baeldung/functional/MyService.java b/spring-5/src/main/java/com/baeldung/functional/MyService.java new file mode 100644 index 0000000000..b7b8b13d8b --- /dev/null +++ b/spring-5/src/main/java/com/baeldung/functional/MyService.java @@ -0,0 +1,11 @@ +package com.baeldung.functional; + +import java.util.Random; + +public class MyService { + + public int getRandomNumber() { + return (new Random().nextInt(10)); + } + +} diff --git a/spring-5/src/main/java/com/baeldung/functional/RootServlet.java b/spring-5/src/main/java/com/baeldung/functional/RootServlet.java index 922809e563..c0dd54cb4a 100644 --- a/spring-5/src/main/java/com/baeldung/functional/RootServlet.java +++ b/spring-5/src/main/java/com/baeldung/functional/RootServlet.java @@ -28,10 +28,9 @@ import org.springframework.web.server.WebHandler; public class RootServlet extends ServletHttpHandlerAdapter { public RootServlet() { - this(WebHttpHandlerBuilder - .webHandler((WebHandler) toHttpHandler(routingFunction())) - .prependFilter(new IndexRewriteFilter()) - .build()); + this(WebHttpHandlerBuilder.webHandler((WebHandler) toHttpHandler(routingFunction())) + .prependFilter(new IndexRewriteFilter()) + .build()); } RootServlet(HttpHandler httpHandler) { @@ -44,44 +43,36 @@ public class RootServlet extends ServletHttpHandlerAdapter { private static RouterFunction routingFunction() { - return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))) - .andRoute(POST("/login"), serverRequest -> serverRequest - .body(toFormData()) + return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))).andRoute(POST("/login"), serverRequest -> serverRequest.body(toFormData()) .map(MultiValueMap::toSingleValueMap) .map(formData -> { System.out.println("form data: " + formData.toString()); if ("baeldung".equals(formData.get("user")) && "you_know_what_to_do".equals(formData.get("token"))) { - return ok() - .body(Mono.just("welcome back!"), String.class) - .block(); + return ok().body(Mono.just("welcome back!"), String.class) + .block(); } - return ServerResponse - .badRequest() - .build() - .block(); + return ServerResponse.badRequest() + .build() + .block(); })) - .andRoute(POST("/upload"), serverRequest -> serverRequest - .body(toDataBuffers()) - .collectList() - .map(dataBuffers -> { - AtomicLong atomicLong = new AtomicLong(0); - dataBuffers.forEach(d -> atomicLong.addAndGet(d - .asByteBuffer() - .array().length)); - System.out.println("data length:" + atomicLong.get()); - return ok() - .body(fromObject(atomicLong.toString())) - .block(); - })) - .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) - .andNest(path("/actor"), route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest - .bodyToMono(Actor.class) - .doOnNext(actors::add) - .then(ok().build()))) - .filter((request, next) -> { - System.out.println("Before handler invocation: " + request.path()); - return next.handle(request); - }); + .andRoute(POST("/upload"), serverRequest -> serverRequest.body(toDataBuffers()) + .collectList() + .map(dataBuffers -> { + AtomicLong atomicLong = new AtomicLong(0); + dataBuffers.forEach(d -> atomicLong.addAndGet(d.asByteBuffer() + .array().length)); + System.out.println("data length:" + atomicLong.get()); + return ok().body(fromObject(atomicLong.toString())) + .block(); + })) + .and(RouterFunctions.resources("/files/**", new ClassPathResource("files/"))) + .andNest(path("/actor"), route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest.bodyToMono(Actor.class) + .doOnNext(actors::add) + .then(ok().build()))) + .filter((request, next) -> { + System.out.println("Before handler invocation: " + request.path()); + return next.handle(request); + }); } diff --git a/spring-5/src/main/java/com/baeldung/jsonb/Person.java b/spring-5/src/main/java/com/baeldung/jsonb/Person.java new file mode 100644 index 0000000000..99ebd54f0b --- /dev/null +++ b/spring-5/src/main/java/com/baeldung/jsonb/Person.java @@ -0,0 +1,139 @@ +package com.baeldung.jsonb; + +import java.math.BigDecimal; +import java.time.LocalDate; + +import javax.json.bind.annotation.JsonbDateFormat; +import javax.json.bind.annotation.JsonbNumberFormat; +import javax.json.bind.annotation.JsonbProperty; +import javax.json.bind.annotation.JsonbTransient; + +public class Person { + + @JsonbProperty("person-name") + private String name; + @JsonbProperty(nillable = true) + private String email; + @JsonbTransient + private int age; + @JsonbDateFormat("dd-MM-yyyy") + private LocalDate registeredDate; + private BigDecimal salary; + + public Person() { + } + + public Person(String name, String email, int age, LocalDate registeredDate, BigDecimal salary) { + super(); + this.name = name; + this.email = email; + this.age = age; + this.registeredDate = registeredDate; + this.salary = salary; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @JsonbNumberFormat(locale = "en_US", value = "#0.0") + public BigDecimal getSalary() { + return salary; + } + + public void setSalary(BigDecimal salary) { + this.salary = salary; + } + + public LocalDate getRegisteredDate() { + return registeredDate; + } + + public void setRegisteredDate(LocalDate registeredDate) { + this.registeredDate = registeredDate; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("Person [name="); + builder.append(name); + builder.append(", email="); + builder.append(email); + builder.append(", age="); + builder.append(age); + builder.append(", registeredDate="); + builder.append(registeredDate); + builder.append(", salary="); + builder.append(salary); + builder.append("]"); + return builder.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + age; + result = prime * result + ((email == null) ? 0 : email.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((registeredDate == null) ? 0 : registeredDate.hashCode()); + result = prime * result + ((salary == null) ? 0 : salary.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Person other = (Person) obj; + if (age != other.age) + return false; + if (email == null) { + if (other.email != null) + return false; + } else if (!email.equals(other.email)) + return false; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + if (registeredDate == null) { + if (other.registeredDate != null) + return false; + } else if (!registeredDate.equals(other.registeredDate)) + return false; + if (salary == null) { + if (other.salary != null) + return false; + } else if (!salary.equals(other.salary)) + return false; + return true; + } + +} diff --git a/spring-5/src/main/java/com/baeldung/jsonb/PersonController.java b/spring-5/src/main/java/com/baeldung/jsonb/PersonController.java new file mode 100644 index 0000000000..75fcd1e2cc --- /dev/null +++ b/spring-5/src/main/java/com/baeldung/jsonb/PersonController.java @@ -0,0 +1,58 @@ +package com.baeldung.jsonb; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.annotation.PostConstruct; + +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; + +@RestController("/person") +public class PersonController { + + List personRepository; + + @PostConstruct + public void init() { + // @formatter:off + personRepository = new ArrayList<>(Arrays.asList( + new Person("Jhon", "jhon@test.com", 20, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1000)), + new Person("Jhon", "jhon1@test.com", 20, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1500)), + new Person("Jhon", null, 20, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1000)), + new Person("Tom", "tom@test.com", 21, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1500)), + new Person("Mark", "mark@test.com", 21, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1200)), + new Person("Julia", "jhon@test.com", 20, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1000)))); + // @formatter:on + + } + + @GetMapping("/person/{id}") + @ResponseBody + public Person findById(@PathVariable final int id) { + return personRepository.get(id); + } + + @PostMapping("/person") + @ResponseStatus(HttpStatus.OK) + @ResponseBody + public boolean insertPerson(@RequestBody final Person person) { + return personRepository.add(person); + } + + @GetMapping("/person") + @ResponseBody + public List findAll() { + return personRepository; + } + +} diff --git a/spring-5/src/main/java/com/baeldung/jsonb/Spring5Application.java b/spring-5/src/main/java/com/baeldung/jsonb/Spring5Application.java new file mode 100644 index 0000000000..00fce06834 --- /dev/null +++ b/spring-5/src/main/java/com/baeldung/jsonb/Spring5Application.java @@ -0,0 +1,30 @@ +package com.baeldung.jsonb; + +import java.util.ArrayList; +import java.util.Collection; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.http.HttpMessageConverters; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.JsonbHttpMessageConverter; + +@SpringBootApplication +@ComponentScan(basePackages = { "com.baeldung.jsonb" }) +public class Spring5Application { + + public static void main(String[] args) { + SpringApplication.run(Spring5Application.class, args); + } + + @Bean + public HttpMessageConverters customConverters() { + Collection> messageConverters = new ArrayList<>(); + JsonbHttpMessageConverter jsonbHttpMessageConverter = new JsonbHttpMessageConverter(); + messageConverters.add(jsonbHttpMessageConverter); + return new HttpMessageConverters(true, messageConverters); + } + +} diff --git a/spring-5/src/main/java/com/baeldung/jupiter/ParameterAutowireUtils.java b/spring-5/src/main/java/com/baeldung/jupiter/ParameterAutowireUtils.java index 068c6af381..d1a4cc8b29 100644 --- a/spring-5/src/main/java/com/baeldung/jupiter/ParameterAutowireUtils.java +++ b/spring-5/src/main/java/com/baeldung/jupiter/ParameterAutowireUtils.java @@ -27,16 +27,14 @@ abstract class ParameterAutowireUtils { public static Object resolveDependency(Parameter parameter, Class containingClass, ApplicationContext applicationContext) { - boolean required = findMergedAnnotation(parameter, Autowired.class) - .map(Autowired::required) - .orElse(true); + boolean required = findMergedAnnotation(parameter, Autowired.class).map(Autowired::required) + .orElse(true); MethodParameter methodParameter = (parameter.getDeclaringExecutable() instanceof Method ? MethodParameterFactory.createSynthesizingMethodParameter(parameter) : MethodParameterFactory.createMethodParameter(parameter)); DependencyDescriptor descriptor = new DependencyDescriptor(methodParameter, required); descriptor.setContainingClass(containingClass); - return applicationContext - .getAutowireCapableBeanFactory() - .resolveDependency(descriptor, null); + return applicationContext.getAutowireCapableBeanFactory() + .resolveDependency(descriptor, null); } private static Optional findMergedAnnotation(AnnotatedElement element, Class annotationType) { diff --git a/spring-5/src/main/java/com/baeldung/jupiter/SpringExtension.java b/spring-5/src/main/java/com/baeldung/jupiter/SpringExtension.java index 08fa0c4768..0eb7c861f1 100644 --- a/spring-5/src/main/java/com/baeldung/jupiter/SpringExtension.java +++ b/spring-5/src/main/java/com/baeldung/jupiter/SpringExtension.java @@ -26,11 +26,9 @@ public class SpringExtension implements BeforeAllCallback, AfterAllCallback, Tes try { getTestContextManager(context).afterTestClass(); } finally { - context - .getStore(namespace) - .remove(context - .getTestClass() - .get()); + context.getStore(namespace) + .remove(context.getTestClass() + .get()); } } @@ -42,21 +40,18 @@ public class SpringExtension implements BeforeAllCallback, AfterAllCallback, Tes @Override public void beforeEach(TestExtensionContext context) throws Exception { Object testInstance = context.getTestInstance(); - Method testMethod = context - .getTestMethod() - .get(); + Method testMethod = context.getTestMethod() + .get(); getTestContextManager(context).beforeTestMethod(testInstance, testMethod); } @Override public void afterEach(TestExtensionContext context) throws Exception { Object testInstance = context.getTestInstance(); - Method testMethod = context - .getTestMethod() - .get(); - Throwable testException = context - .getTestException() - .orElse(null); + Method testMethod = context.getTestMethod() + .get(); + Throwable testException = context.getTestException() + .orElse(null); getTestContextManager(context).afterTestMethod(testInstance, testMethod, testException); } @@ -70,24 +65,21 @@ public class SpringExtension implements BeforeAllCallback, AfterAllCallback, Tes @Override public Object resolve(ParameterContext parameterContext, ExtensionContext extensionContext) { Parameter parameter = parameterContext.getParameter(); - Class testClass = extensionContext - .getTestClass() - .get(); + Class testClass = extensionContext.getTestClass() + .get(); ApplicationContext applicationContext = getApplicationContext(extensionContext); return ParameterAutowireUtils.resolveDependency(parameter, testClass, applicationContext); } private ApplicationContext getApplicationContext(ExtensionContext context) { - return getTestContextManager(context) - .getTestContext() - .getApplicationContext(); + return getTestContextManager(context).getTestContext() + .getApplicationContext(); } private TestContextManager getTestContextManager(ExtensionContext context) { Assert.notNull(context, "ExtensionContext must not be null"); - Class testClass = context - .getTestClass() - .get(); + Class testClass = context.getTestClass() + .get(); ExtensionContext.Store store = context.getStore(namespace); return store.getOrComputeIfAbsent(testClass, TestContextManager::new, TestContextManager.class); } diff --git a/spring-5/src/main/java/com/baeldung/jupiter/SpringJUnit5Config.java b/spring-5/src/main/java/com/baeldung/jupiter/SpringJUnit5Config.java index e8b9cc500f..8f02d71d49 100644 --- a/spring-5/src/main/java/com/baeldung/jupiter/SpringJUnit5Config.java +++ b/spring-5/src/main/java/com/baeldung/jupiter/SpringJUnit5Config.java @@ -26,8 +26,7 @@ public @interface SpringJUnit5Config { String[] locations() default {}; @AliasFor(annotation = ContextConfiguration.class) - Class>[] initializers() default {}; + Class>[] initializers() default {}; @AliasFor(annotation = ContextConfiguration.class) boolean inheritLocations() default true; diff --git a/spring-5/src/main/java/com/baeldung/persistence/DataSetupBean.java b/spring-5/src/main/java/com/baeldung/persistence/DataSetupBean.java index 7936a2b7af..9f5d9ff6c2 100644 --- a/spring-5/src/main/java/com/baeldung/persistence/DataSetupBean.java +++ b/spring-5/src/main/java/com/baeldung/persistence/DataSetupBean.java @@ -20,7 +20,8 @@ public class DataSetupBean implements InitializingBean { @Override public void afterPropertiesSet() throws Exception { - IntStream.range(1, 20).forEach(i -> repo.save(new Foo(randomAlphabetic(8)))); + IntStream.range(1, 20) + .forEach(i -> repo.save(new Foo(randomAlphabetic(8)))); } } diff --git a/spring-5/src/main/java/com/baeldung/web/FooController.java b/spring-5/src/main/java/com/baeldung/web/FooController.java index 0e7c94bd8f..925f2b49f4 100644 --- a/spring-5/src/main/java/com/baeldung/web/FooController.java +++ b/spring-5/src/main/java/com/baeldung/web/FooController.java @@ -23,7 +23,8 @@ public class FooController { @ResponseBody @Validated public Foo findById(@PathVariable @Min(0) final long id) { - return repo.findById(id).orElse(null); + return repo.findById(id) + .orElse(null); } @GetMapping @@ -36,7 +37,8 @@ public class FooController { @ResponseBody @Validated public List findPaginated(@RequestParam("page") @Min(0) final int page, @Max(100) @RequestParam("size") final int size) { - return repo.findAll(PageRequest.of(page, size)).getContent(); + return repo.findAll(PageRequest.of(page, size)) + .getContent(); } // API - write diff --git a/spring-5/src/main/java/com/baeldung/web/reactive/Task.java b/spring-5/src/main/java/com/baeldung/web/reactive/Task.java index 84193d9354..725fd931e1 100644 --- a/spring-5/src/main/java/com/baeldung/web/reactive/Task.java +++ b/spring-5/src/main/java/com/baeldung/web/reactive/Task.java @@ -23,9 +23,6 @@ public class Task { @Override public String toString() { - return "Task{" + - "name='" + name + '\'' + - ", id=" + id + - '}'; + return "Task{" + "name='" + name + '\'' + ", id=" + id + '}'; } } diff --git a/spring-5/src/main/java/com/baeldung/web/reactive/client/WebClientController.java b/spring-5/src/main/java/com/baeldung/web/reactive/client/WebClientController.java index 3a2e1b1a75..7bab288bab 100644 --- a/spring-5/src/main/java/com/baeldung/web/reactive/client/WebClientController.java +++ b/spring-5/src/main/java/com/baeldung/web/reactive/client/WebClientController.java @@ -33,17 +33,17 @@ public class WebClientController { WebClient.UriSpec request2 = createWebClientWithServerURLAndDefaultValues().post(); // request body specifications - WebClient.RequestBodySpec uri1 = createWebClientWithServerURLAndDefaultValues().method(HttpMethod.POST).uri("/resource"); - WebClient.RequestBodySpec uri2 = createWebClientWithServerURLAndDefaultValues().post().uri(URI.create("/resource")); + WebClient.RequestBodySpec uri1 = createWebClientWithServerURLAndDefaultValues().method(HttpMethod.POST) + .uri("/resource"); + WebClient.RequestBodySpec uri2 = createWebClientWithServerURLAndDefaultValues().post() + .uri(URI.create("/resource")); // request header specification WebClient.RequestHeadersSpec requestSpec1 = uri1.body(BodyInserters.fromPublisher(Mono.just("data"), String.class)); WebClient.RequestHeadersSpec requestSpec2 = uri2.body(BodyInserters.fromObject("data")); // inserters - BodyInserter, ReactiveHttpOutputMessage> inserter1 = BodyInserters - .fromPublisher(Subscriber::onComplete, String.class); - + BodyInserter, ReactiveHttpOutputMessage> inserter1 = BodyInserters.fromPublisher(Subscriber::onComplete, String.class); LinkedMultiValueMap map = new LinkedMultiValueMap<>(); map.add("key1", "value1"); @@ -53,14 +53,13 @@ public class WebClientController { BodyInserter inserter3 = BodyInserters.fromObject("body"); // responses - WebClient.ResponseSpec response1 = uri1 - .body(inserter3) - .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - .accept(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML) - .acceptCharset(Charset.forName("UTF-8")) - .ifNoneMatch("*") - .ifModifiedSince(ZonedDateTime.now()) - .retrieve(); + WebClient.ResponseSpec response1 = uri1.body(inserter3) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) + .accept(MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML) + .acceptCharset(Charset.forName("UTF-8")) + .ifNoneMatch("*") + .ifModifiedSince(ZonedDateTime.now()) + .retrieve(); WebClient.ResponseSpec response2 = requestSpec2.retrieve(); } @@ -74,13 +73,12 @@ public class WebClientController { } private WebClient createWebClientWithServerURLAndDefaultValues() { - return WebClient - .builder() - .baseUrl("http://localhost:8081") - .defaultCookie("cookieKey", "cookieValue") - .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - .defaultUriVariables(Collections.singletonMap("url", "http://localhost:8080")) - .build(); + return WebClient.builder() + .baseUrl("http://localhost:8081") + .defaultCookie("cookieKey", "cookieValue") + .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) + .defaultUriVariables(Collections.singletonMap("url", "http://localhost:8080")) + .build(); } } diff --git a/spring-5/src/test/java/com/baeldung/ParallelIntegrationTest.java b/spring-5/src/test/java/com/baeldung/ParallelIntegrationTest.java index cbb7a2867b..1ce96de4ef 100644 --- a/spring-5/src/test/java/com/baeldung/ParallelIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/ParallelIntegrationTest.java @@ -9,14 +9,14 @@ public class ParallelIntegrationTest { @Test public void runTests() { - final Class[] classes = {Example1IntegrationTest.class, Example2IntegrationTest.class}; + final Class[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; JUnitCore.runClasses(new Computer(), classes); } @Test public void runTestsInParallel() { - final Class[] classes = {Example1IntegrationTest.class, Example2IntegrationTest.class}; + final Class[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; JUnitCore.runClasses(new ParallelComputer(true, true), classes); } diff --git a/spring-5/src/test/java/com/baeldung/Spring5JUnit4ConcurrentIntegrationTest.java b/spring-5/src/test/java/com/baeldung/Spring5JUnit4ConcurrentIntegrationTest.java index a155de20fa..7e494465b2 100644 --- a/spring-5/src/test/java/com/baeldung/Spring5JUnit4ConcurrentIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/Spring5JUnit4ConcurrentIntegrationTest.java @@ -50,5 +50,3 @@ public class Spring5JUnit4ConcurrentIntegrationTest implements ApplicationContex } } - - diff --git a/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationTest.java b/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationTest.java new file mode 100644 index 0000000000..0b1542dbbc --- /dev/null +++ b/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationTest.java @@ -0,0 +1,42 @@ +package com.baeldung.functional; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.web.context.support.GenericWebApplicationContext; + +import com.baeldung.Spring5Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Spring5Application.class) +public class BeanRegistrationTest { + + @Autowired + private GenericWebApplicationContext context; + + @Test + public void whenRegisterBean_thenOk() { + context.registerBean(MyService.class, () -> new MyService()); + MyService myService = (MyService) context.getBean("com.baeldung.functional.MyService"); + assertTrue(myService.getRandomNumber() < 10); + } + + @Test + public void whenRegisterBeanWithName_thenOk() { + context.registerBean("mySecondService", MyService.class, () -> new MyService()); + MyService mySecondService = (MyService) context.getBean("mySecondService"); + assertTrue(mySecondService.getRandomNumber() < 10); + } + + @Test + public void whenRegisterBeanWithCallback_thenOk() { + context.registerBean("myCallbackService", MyService.class, () -> new MyService(), bd -> bd.setAutowireCandidate(false)); + MyService myCallbackService = (MyService) context.getBean("myCallbackService"); + assertTrue(myCallbackService.getRandomNumber() < 10); + } + +} diff --git a/spring-5/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java b/spring-5/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java index 6f39f11b00..a7b951b930 100644 --- a/spring-5/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java @@ -23,10 +23,9 @@ public class FunctionalWebApplicationIntegrationTest { @BeforeClass public static void setup() throws Exception { server = new FunctionalWebApplication().start(); - client = WebTestClient - .bindToServer() - .baseUrl("http://localhost:" + server.getPort()) - .build(); + client = WebTestClient.bindToServer() + .baseUrl("http://localhost:" + server.getPort()) + .build(); } @AfterClass @@ -36,26 +35,24 @@ public class FunctionalWebApplicationIntegrationTest { @Test public void givenRouter_whenGetTest_thenGotHelloWorld() throws Exception { - client - .get() - .uri("/test") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("helloworld"); + client.get() + .uri("/test") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("helloworld"); } @Test public void givenIndexFilter_whenRequestRoot_thenRewrittenToTest() throws Exception { - client - .get() - .uri("/") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("helloworld"); + client.get() + .uri("/") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("helloworld"); } @Test @@ -64,16 +61,15 @@ public class FunctionalWebApplicationIntegrationTest { formData.add("user", "baeldung"); formData.add("token", "you_know_what_to_do"); - client - .post() - .uri("/login") - .contentType(MediaType.APPLICATION_FORM_URLENCODED) - .body(BodyInserters.fromFormData(formData)) - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("welcome back!"); + client.post() + .uri("/login") + .contentType(MediaType.APPLICATION_FORM_URLENCODED) + .body(BodyInserters.fromFormData(formData)) + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("welcome back!"); } @Test @@ -82,70 +78,64 @@ public class FunctionalWebApplicationIntegrationTest { formData.add("user", "baeldung"); formData.add("token", "try_again"); - client - .post() - .uri("/login") - .contentType(MediaType.APPLICATION_FORM_URLENCODED) - .body(BodyInserters.fromFormData(formData)) - .exchange() - .expectStatus() - .isBadRequest(); + client.post() + .uri("/login") + .contentType(MediaType.APPLICATION_FORM_URLENCODED) + .body(BodyInserters.fromFormData(formData)) + .exchange() + .expectStatus() + .isBadRequest(); } @Test public void givenUploadForm_whenRequestWithMultipartData_thenSuccess() throws Exception { Resource resource = new ClassPathResource("/baeldung-weekly.png"); - client - .post() - .uri("/upload") - .contentType(MediaType.MULTIPART_FORM_DATA) - .body(fromResource(resource)) - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo(String.valueOf(resource.contentLength())); + client.post() + .uri("/upload") + .contentType(MediaType.MULTIPART_FORM_DATA) + .body(fromResource(resource)) + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo(String.valueOf(resource.contentLength())); } @Test public void givenActors_whenAddActor_thenAdded() throws Exception { - client - .get() - .uri("/actor") - .exchange() - .expectStatus() - .isOk() - .expectBodyList(Actor.class) - .hasSize(2); + client.get() + .uri("/actor") + .exchange() + .expectStatus() + .isOk() + .expectBodyList(Actor.class) + .hasSize(2); - client - .post() - .uri("/actor") - .body(fromObject(new Actor("Clint", "Eastwood"))) - .exchange() - .expectStatus() - .isOk(); + client.post() + .uri("/actor") + .body(fromObject(new Actor("Clint", "Eastwood"))) + .exchange() + .expectStatus() + .isOk(); - client - .get() - .uri("/actor") - .exchange() - .expectStatus() - .isOk() - .expectBodyList(Actor.class) - .hasSize(3); + client.get() + .uri("/actor") + .exchange() + .expectStatus() + .isOk() + .expectBodyList(Actor.class) + .hasSize(3); } @Test public void givenResources_whenAccess_thenGot() throws Exception { - client - .get() - .uri("/files/hello.txt") - .exchange() - .expectStatus() - .isOk() - .expectBody(String.class) - .isEqualTo("hello"); + client.get() + .uri("/files/hello.txt") + .exchange() + .expectStatus() + .isOk() + .expectBody(String.class) + .isEqualTo("hello"); } } diff --git a/spring-5/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java b/spring-5/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java new file mode 100644 index 0000000000..a31a16d610 --- /dev/null +++ b/spring-5/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java @@ -0,0 +1,44 @@ +package com.baeldung.jsonb; + +import static org.junit.Assert.assertTrue; + +import java.math.BigDecimal; +import java.time.LocalDate; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Spring5Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class JsonbIntegrationTest { + @Value("${security.user.name}") + private String username; + @Value("${security.user.password}") + private String password; + + @Autowired + private TestRestTemplate template; + + @Test + public void givenId_whenUriIsPerson_thenGetPerson() { + ResponseEntity response = template.withBasicAuth(username, password) + .getForEntity("/person/1", Person.class); + Person person = response.getBody(); + assertTrue(person.equals(new Person("Jhon", "jhon1@test.com", 0, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1500.0)))); + } + + @Test + public void whenSendPostAPerson_thenGetOkStatus() { + ResponseEntity response = template.withBasicAuth(username, password) + .postForEntity("/person", "{\"birthDate\":\"07-09-2017\",\"email\":\"jhon1@test.com\",\"person-name\":\"Jhon\"}", Boolean.class); + boolean value = response.getBody(); + assertTrue(true == value); + } + +} diff --git a/spring-5/src/test/java/com/baeldung/jsonb/JsonbTest.java b/spring-5/src/test/java/com/baeldung/jsonb/JsonbTest.java new file mode 100644 index 0000000000..7133999551 --- /dev/null +++ b/spring-5/src/test/java/com/baeldung/jsonb/JsonbTest.java @@ -0,0 +1,38 @@ +package com.baeldung.jsonb; + +import static org.junit.Assert.assertTrue; + +import java.math.BigDecimal; +import java.time.LocalDate; + +import javax.json.bind.Jsonb; +import javax.json.bind.JsonbBuilder; + +import org.junit.Before; +import org.junit.Test; + +public class JsonbTest { + + private Jsonb jsonb; + + @Before + public void setup() { + jsonb = JsonbBuilder.create(); + } + + @Test + public void givenPersonObject_whenSerializeWithJsonb_thenGetPersonJson() { + Person person = new Person("Jhon", "jhon@test.com", 20, LocalDate.of(2019, 9, 7), BigDecimal.valueOf(1000)); + String jsonPerson = jsonb.toJson(person); + assertTrue("{\"email\":\"jhon@test.com\",\"person-name\":\"Jhon\",\"registeredDate\":\"07-09-2019\",\"salary\":\"1000.0\"}".equals(jsonPerson)); + } + + @Test + public void givenPersonJson_whenDeserializeWithJsonb_thenGetPersonObject() { + Person person = new Person("Jhon", "jhon@test.com", 0, LocalDate.of(2019, 9, 7), BigDecimal.valueOf(1000.0)); + String jsonPerson = "{\"email\":\"jhon@test.com\",\"person-name\":\"Jhon\",\"registeredDate\":\"07-09-2019\",\"salary\":\"1000.0\"}"; + assertTrue(jsonb.fromJson(jsonPerson, Person.class) + .equals(person)); + } + +} diff --git a/spring-5/src/test/java/com/baeldung/jupiter/Spring5JUnit5ParallelIntegrationTest.java b/spring-5/src/test/java/com/baeldung/jupiter/Spring5JUnit5ParallelIntegrationTest.java index fb6bb27684..55b0fcf267 100644 --- a/spring-5/src/test/java/com/baeldung/jupiter/Spring5JUnit5ParallelIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/jupiter/Spring5JUnit5ParallelIntegrationTest.java @@ -11,18 +11,14 @@ class Spring5JUnit5ParallelIntegrationTest { @Test void givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingParallel() { - final Class[] classes = { - Example1IntegrationTest.class, Example2IntegrationTest.class - }; + final Class[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; JUnitCore.runClasses(new ParallelComputer(true, true), classes); } @Test void givenTwoTestClasses_whenJUnitRunParallel_thenTheTestsExecutingLinear() { - final Class[] classes = { - Example1IntegrationTest.class, Example2IntegrationTest.class - }; + final Class[] classes = { Example1IntegrationTest.class, Example2IntegrationTest.class }; JUnitCore.runClasses(new Computer(), classes); } diff --git a/spring-5/src/test/java/com/baeldung/jupiter/Spring5Java8NewFeaturesIntegrationTest.java b/spring-5/src/test/java/com/baeldung/jupiter/Spring5Java8NewFeaturesIntegrationTest.java index 2c3a71fb3e..f58bf9f3cd 100644 --- a/spring-5/src/test/java/com/baeldung/jupiter/Spring5Java8NewFeaturesIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/jupiter/Spring5Java8NewFeaturesIntegrationTest.java @@ -16,18 +16,16 @@ class Spring5Java8NewFeaturesIntegrationTest { } public class StringUtils { - FunctionalInterfaceExample - functionLambdaString = s -> Pattern.compile(" +").splitAsStream(s) - .map(word -> new StringBuilder(word).reverse()) - .collect(Collectors.joining(" ")); + FunctionalInterfaceExample functionLambdaString = s -> Pattern.compile(" +") + .splitAsStream(s) + .map(word -> new StringBuilder(word).reverse()) + .collect(Collectors.joining(" ")); } @Test - void givenStringUtil_whenSupplierCall_thenFunctionalInterfaceReverseString() - throws Exception { + void givenStringUtil_whenSupplierCall_thenFunctionalInterfaceReverseString() throws Exception { Supplier stringUtilsSupplier = StringUtils::new; - assertEquals(stringUtilsSupplier.get().functionLambdaString - .reverseString("hello"), "olleh"); + assertEquals(stringUtilsSupplier.get().functionLambdaString.reverseString("hello"), "olleh"); } } diff --git a/spring-5/src/test/java/com/baeldung/jupiter/Spring5ReactiveServerClientIntegrationTest.java b/spring-5/src/test/java/com/baeldung/jupiter/Spring5ReactiveServerClientIntegrationTest.java index 5c289c3e34..bbd852d625 100644 --- a/spring-5/src/test/java/com/baeldung/jupiter/Spring5ReactiveServerClientIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/jupiter/Spring5ReactiveServerClientIntegrationTest.java @@ -25,20 +25,15 @@ public class Spring5ReactiveServerClientIntegrationTest { @BeforeAll public static void setUp() throws Exception { HttpServer server = HttpServer.create("localhost", 8080); - RouterFunction route = RouterFunctions - .route(POST("/task/process"), request -> ServerResponse - .ok() - .body(request - .bodyToFlux(Task.class) - .map(ll -> new Task("TaskName", 1)), Task.class)) - .and(RouterFunctions.route(GET("/task"), request -> ServerResponse - .ok() - .body(Mono.just("server is alive"), String.class))); + RouterFunction route = RouterFunctions.route(POST("/task/process"), request -> ServerResponse.ok() + .body(request.bodyToFlux(Task.class) + .map(ll -> new Task("TaskName", 1)), Task.class)) + .and(RouterFunctions.route(GET("/task"), request -> ServerResponse.ok() + .body(Mono.just("server is alive"), String.class))); HttpHandler httpHandler = RouterFunctions.toHttpHandler(route); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler); - nettyContext = server - .newHandler(adapter) - .block(); + nettyContext = server.newHandler(adapter) + .block(); } @AfterAll @@ -46,55 +41,54 @@ public class Spring5ReactiveServerClientIntegrationTest { nettyContext.dispose(); } -// @Test -// public void givenCheckTask_whenServerHandle_thenServerResponseALiveString() throws Exception { -// WebClient client = WebClient.create("http://localhost:8080"); -// Mono result = client -// .get() -// .uri("/task") -// .exchange() -// .then(response -> response.bodyToMono(String.class)); -// -// assertThat(result.block()).isInstanceOf(String.class); -// } + // @Test + // public void givenCheckTask_whenServerHandle_thenServerResponseALiveString() throws Exception { + // WebClient client = WebClient.create("http://localhost:8080"); + // Mono result = client + // .get() + // .uri("/task") + // .exchange() + // .then(response -> response.bodyToMono(String.class)); + // + // assertThat(result.block()).isInstanceOf(String.class); + // } -// @Test -// public void givenThreeTasks_whenServerHandleTheTasks_thenServerResponseATask() throws Exception { -// URI uri = URI.create("http://localhost:8080/task/process"); -// ExchangeFunction exchange = ExchangeFunctions.create(new ReactorClientHttpConnector()); -// ClientRequest request = ClientRequest -// .method(HttpMethod.POST, uri) -// .body(BodyInserters.fromPublisher(getLatLngs(), Task.class)) -// .build(); -// -// Flux taskResponse = exchange -// .exchange(request) -// .flatMap(response -> response.bodyToFlux(Task.class)); -// -// assertThat(taskResponse.blockFirst()).isInstanceOf(Task.class); -// } + // @Test + // public void givenThreeTasks_whenServerHandleTheTasks_thenServerResponseATask() throws Exception { + // URI uri = URI.create("http://localhost:8080/task/process"); + // ExchangeFunction exchange = ExchangeFunctions.create(new ReactorClientHttpConnector()); + // ClientRequest request = ClientRequest + // .method(HttpMethod.POST, uri) + // .body(BodyInserters.fromPublisher(getLatLngs(), Task.class)) + // .build(); + // + // Flux taskResponse = exchange + // .exchange(request) + // .flatMap(response -> response.bodyToFlux(Task.class)); + // + // assertThat(taskResponse.blockFirst()).isInstanceOf(Task.class); + // } -// @Test -// public void givenCheckTask_whenServerHandle_thenOragicServerResponseALiveString() throws Exception { -// URI uri = URI.create("http://localhost:8080/task"); -// ExchangeFunction exchange = ExchangeFunctions.create(new ReactorClientHttpConnector()); -// ClientRequest request = ClientRequest -// .method(HttpMethod.GET, uri) -// .body(BodyInserters.fromPublisher(getLatLngs(), Task.class)) -// .build(); -// -// Flux taskResponse = exchange -// .exchange(request) -// .flatMap(response -> response.bodyToFlux(String.class)); -// -// assertThat(taskResponse.blockFirst()).isInstanceOf(String.class); -// } + // @Test + // public void givenCheckTask_whenServerHandle_thenOragicServerResponseALiveString() throws Exception { + // URI uri = URI.create("http://localhost:8080/task"); + // ExchangeFunction exchange = ExchangeFunctions.create(new ReactorClientHttpConnector()); + // ClientRequest request = ClientRequest + // .method(HttpMethod.GET, uri) + // .body(BodyInserters.fromPublisher(getLatLngs(), Task.class)) + // .build(); + // + // Flux taskResponse = exchange + // .exchange(request) + // .flatMap(response -> response.bodyToFlux(String.class)); + // + // assertThat(taskResponse.blockFirst()).isInstanceOf(String.class); + // } private static Flux getLatLngs() { - return Flux - .range(0, 3) - .zipWith(Flux.interval(Duration.ofSeconds(1))) - .map(x -> new Task("taskname", 1)) - .doOnNext(ll -> System.out.println("Produced: {}" + ll)); + return Flux.range(0, 3) + .zipWith(Flux.interval(Duration.ofSeconds(1))) + .map(x -> new Task("taskname", 1)) + .doOnNext(ll -> System.out.println("Produced: {}" + ll)); } } diff --git a/spring-5/src/test/java/com/baeldung/web/PathPatternsUsingHandlerMethodIntegrationTest.java b/spring-5/src/test/java/com/baeldung/web/PathPatternsUsingHandlerMethodIntegrationTest.java index 90e3e7c445..c2ed8ff071 100644 --- a/spring-5/src/test/java/com/baeldung/web/PathPatternsUsingHandlerMethodIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/web/PathPatternsUsingHandlerMethodIntegrationTest.java @@ -17,85 +17,85 @@ public class PathPatternsUsingHandlerMethodIntegrationTest { @BeforeClass public static void setUp() { client = WebTestClient.bindToController(new PathPatternController()) - .build(); + .build(); } @Test public void givenHandlerMethod_whenMultipleURIVariablePattern_then200() { client.get() - .uri("/spring5/ab/cd") - .exchange() - .expectStatus() - .is2xxSuccessful() - .expectBody() - .equals("/ab/cd"); + .uri("/spring5/ab/cd") + .exchange() + .expectStatus() + .is2xxSuccessful() + .expectBody() + .equals("/ab/cd"); } @Test public void givenHandlerMethod_whenURLWithWildcardTakingZeroOrMoreChar_then200() { client.get() - .uri("/spring5/userid") - .exchange() - .expectStatus() - .is2xxSuccessful() - .expectBody() - .equals("/spring5/*id"); + .uri("/spring5/userid") + .exchange() + .expectStatus() + .is2xxSuccessful() + .expectBody() + .equals("/spring5/*id"); } @Test public void givenHandlerMethod_whenURLWithWildcardTakingExactlyOneChar_then200() { client.get() - .uri("/string5") - .exchange() - .expectStatus() - .is2xxSuccessful() - .expectBody() - .equals("/s?ring5"); + .uri("/string5") + .exchange() + .expectStatus() + .is2xxSuccessful() + .expectBody() + .equals("/s?ring5"); } @Test public void givenHandlerMethod_whenURLWithWildcardTakingZeroOrMorePathSegments_then200() { client.get() - .uri("/resources/baeldung") - .exchange() - .expectStatus() - .is2xxSuccessful() - .expectBody() - .equals("/resources/**"); + .uri("/resources/baeldung") + .exchange() + .expectStatus() + .is2xxSuccessful() + .expectBody() + .equals("/resources/**"); } @Test public void givenHandlerMethod_whenURLWithRegexInPathVariable_thenExpectedOutput() { client.get() - .uri("/abc") - .exchange() - .expectStatus() - .is2xxSuccessful() - .expectBody() - .equals("abc"); + .uri("/abc") + .exchange() + .expectStatus() + .is2xxSuccessful() + .expectBody() + .equals("abc"); client.get() - .uri("/123") - .exchange() - .expectStatus() - .is4xxClientError(); + .uri("/123") + .exchange() + .expectStatus() + .is4xxClientError(); } @Test public void givenHandlerMethod_whenURLWithMultiplePathVariablesInSameSegment_then200() { client.get() - .uri("/baeldung_tutorial") - .exchange() - .expectStatus() - .is2xxSuccessful() - .expectBody() - .equals("Two variables are var1=baeldung and var2=tutorial"); + .uri("/baeldung_tutorial") + .exchange() + .expectStatus() + .is2xxSuccessful() + .expectBody() + .equals("Two variables are var1=baeldung and var2=tutorial"); } } diff --git a/spring-5/src/test/java/com/baeldung/web/client/WebTestClientTest.java b/spring-5/src/test/java/com/baeldung/web/client/WebTestClientTest.java index 4127f22c01..b05f903b4b 100644 --- a/spring-5/src/test/java/com/baeldung/web/client/WebTestClientTest.java +++ b/spring-5/src/test/java/com/baeldung/web/client/WebTestClientTest.java @@ -21,38 +21,40 @@ public class WebTestClientTest { @LocalServerPort private int port; - private final RouterFunction ROUTER_FUNCTION = RouterFunctions.route( - RequestPredicates.GET("/resource"), - request -> ServerResponse.ok().build() - ); + private final RouterFunction ROUTER_FUNCTION = RouterFunctions.route(RequestPredicates.GET("/resource"), request -> ServerResponse.ok() + .build()); private final WebHandler WEB_HANDLER = exchange -> Mono.empty(); @Test public void testWebTestClientWithServerWebHandler() { - WebTestClient.bindToWebHandler(WEB_HANDLER).build(); + WebTestClient.bindToWebHandler(WEB_HANDLER) + .build(); } @Test public void testWebTestClientWithRouterFunction() { - WebTestClient - .bindToRouterFunction(ROUTER_FUNCTION) - .build().get().uri("/resource") - .exchange() - .expectStatus().isOk() - .expectBody().isEmpty(); + WebTestClient.bindToRouterFunction(ROUTER_FUNCTION) + .build() + .get() + .uri("/resource") + .exchange() + .expectStatus() + .isOk() + .expectBody() + .isEmpty(); } @Test public void testWebTestClientWithServerURL() { - WebTestClient - .bindToServer() - .baseUrl("http://localhost:" + port) - .build() - .get() - .uri("/resource") - .exchange() - .expectStatus().is4xxClientError() - .expectBody(); + WebTestClient.bindToServer() + .baseUrl("http://localhost:" + port) + .build() + .get() + .uri("/resource") + .exchange() + .expectStatus() + .is4xxClientError() + .expectBody(); } } diff --git a/spring-activiti/README.md b/spring-activiti/README.md index fc6eea7f87..3580e29a52 100644 --- a/spring-activiti/README.md +++ b/spring-activiti/README.md @@ -1,3 +1,5 @@ ### Relevant articles - [A Guide to Activiti with Java](http://www.baeldung.com/java-activiti) +- [Introduction to Activiti with Spring](http://www.baeldung.com/spring-activiti) + diff --git a/spring-all/README.md b/spring-all/README.md index 29be01c79e..36bf7da778 100644 --- a/spring-all/README.md +++ b/spring-all/README.md @@ -9,7 +9,7 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant articles: - [Guide to Spring @Autowired](http://www.baeldung.com/spring-autowire) -- [Properties with Spring](http://www.baeldung.com/2012/02/06/properties-with-spring) - checkout the `org.baeldung.properties` package for all scenarios of properties injection and usage +- [Properties with Spring](http://www.baeldung.com/properties-with-spring) - checkout the `org.baeldung.properties` package for all scenarios of properties injection and usage - [Spring Profiles](http://www.baeldung.com/spring-profiles) - [A Spring Custom Annotation for a Better DAO](http://www.baeldung.com/spring-annotation-bean-pre-processor) - [What's New in Spring 4.3?](http://www.baeldung.com/whats-new-in-spring-4-3/) diff --git a/spring-all/src/main/java/org/baeldung/controller/controller/PassParametersController.java b/spring-all/src/main/java/org/baeldung/controller/controller/PassParametersController.java new file mode 100644 index 0000000000..c282ae6a62 --- /dev/null +++ b/spring-all/src/main/java/org/baeldung/controller/controller/PassParametersController.java @@ -0,0 +1,37 @@ +package org.baeldung.controller.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.servlet.ModelAndView; + +/** + * In this controller, Model, ModelMap and ModelAndView are shown as examples. + * They are all used to pass parameters to JSP pages. + * 04/09/2017 + * + * @author Ahmet Cetin + */ +@Controller +public class PassParametersController { + @GetMapping("/showViewPage") + public String passParametersWithModel(Model model) { + model.addAttribute("message", "Baeldung"); + return "viewPage"; + } + + @GetMapping("/printViewPage") + public String passParametersWithModelMap(ModelMap map) { + map.addAttribute("welcomeMessage", "welcome"); + map.addAttribute("message", "Baeldung"); + return "viewPage"; + } + + @GetMapping("/goToViewPage") + public ModelAndView passParametersWithModelAndView() { + ModelAndView modelAndView = new ModelAndView("viewPage"); + modelAndView.addObject("message", "Baeldung"); + return modelAndView; + } +} diff --git a/spring-all/src/main/webapp/WEB-INF/view/viewPage.jsp b/spring-all/src/main/webapp/WEB-INF/view/viewPage.jsp new file mode 100644 index 0000000000..ca638b33f5 --- /dev/null +++ b/spring-all/src/main/webapp/WEB-INF/view/viewPage.jsp @@ -0,0 +1,11 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + +
+ Web Application. Passed parameter : ${message} +
+ + diff --git a/spring-all/src/test/java/org/baeldung/controller/PassParametersControllerTest.java b/spring-all/src/test/java/org/baeldung/controller/PassParametersControllerTest.java new file mode 100644 index 0000000000..76ac14f292 --- /dev/null +++ b/spring-all/src/test/java/org/baeldung/controller/PassParametersControllerTest.java @@ -0,0 +1,69 @@ +package org.baeldung.controller; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.servlet.ModelAndView; + +/** + * This is the test class for {@link org.baeldung.controller.controller.PassParametersController} class. + * 09/09/2017 + * + * @author Ahmet Cetin + */ +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@ContextConfiguration({"classpath:test-mvc.xml"}) +public class PassParametersControllerTest { + private MockMvc mockMvc; + + @Autowired + private WebApplicationContext wac; + + @Before + public void setUp() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); + } + + @Test + public void testPassParametersWithModel() throws Exception { + ModelAndView mv = this.mockMvc.perform(MockMvcRequestBuilders.get("/showViewPage")).andReturn().getModelAndView(); + + //Validate view + Assert.assertEquals(mv.getViewName(), "viewPage"); + + //Validate attribute + Assert.assertEquals(mv.getModelMap().get("message").toString(), "Baeldung"); + } + + @Test + public void testPassParametersWithModelMap() throws Exception { + ModelAndView mv = this.mockMvc.perform(MockMvcRequestBuilders.get("/printViewPage")).andReturn().getModelAndView(); + + //Validate view + Assert.assertEquals(mv.getViewName(), "viewPage"); + + //Validate attribute + Assert.assertEquals(mv.getModelMap().get("message").toString(), "Baeldung"); + } + + @Test + public void testPassParametersWithModelAndView() throws Exception { + ModelAndView mv = this.mockMvc.perform(MockMvcRequestBuilders.get("/goToViewPage")).andReturn().getModelAndView(); + + //Validate view + Assert.assertEquals(mv.getViewName(), "viewPage"); + + //Validate attribute + Assert.assertEquals(mv.getModelMap().get("message").toString(), "Baeldung"); + } +} diff --git a/spring-batch/README.md b/spring-batch/README.md index 953e652cea..5f226e7fd7 100644 --- a/spring-batch/README.md +++ b/spring-batch/README.md @@ -5,3 +5,4 @@ ### Relevant Articles: - [Introduction to Spring Batch](http://www.baeldung.com/introduction-to-spring-batch) +- [Spring Batch using Partitioner](https://github.com/eugenp/tutorials/tree/master/spring-batch) diff --git a/spring-boot-bootstrap/README.md b/spring-boot-bootstrap/README.md index 75a2b35be7..ec6905bf6a 100644 --- a/spring-boot-bootstrap/README.md +++ b/spring-boot-bootstrap/README.md @@ -1,2 +1,3 @@ ### Relevant Articles: - [Bootstrap a Simple Application using Spring Boot](http://www.baeldung.com/spring-boot-start) +- [Spring Boot Dependency Management with a Custom Parent](http://www.baeldung.com/spring-boot-dependency-management-custom-parent) diff --git a/spring-boot-property-exp/README.md b/spring-boot-property-exp/README.md index 8a598e7a05..70cf6bdfac 100644 --- a/spring-boot-property-exp/README.md +++ b/spring-boot-property-exp/README.md @@ -1,5 +1,5 @@ ## The Module Holds Sources for the Following Articles - - [Automatic Property Expansion with Spring Boot](http://www.baeldung.com/property-expansion-spring-boot) + - [Automatic Property Expansion with Spring Boot](http://www.baeldung.com/spring-boot-auto-property-expansion) ### Module property-exp-default-config This module contains both a standard Maven Spring Boot build and the Gradle build which is Maven compatible. @@ -15,4 +15,4 @@ ### Module property-exp-custom-config This project is not using the standard Spring Boot parent and is configured manually. Run the following command: - `mvn exec:java` \ No newline at end of file + `mvn exec:java` diff --git a/spring-boot/README.MD b/spring-boot/README.MD index e837c88804..5d7eb11954 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -26,4 +26,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [How to Get All Spring-Managed Beans?](http://www.baeldung.com/spring-show-all-beans) - [A Java Client for a WebSockets API](http://www.baeldung.com/websockets-api-java-spring-client) - [Spring Boot and Togglz Aspect](http://www.baeldung.com/spring-togglz) +- [Getting Started with GraphQL and Spring Boot](http://www.baeldung.com/spring-graphql) diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java index d54fa5a7c1..774eb69889 100644 --- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java +++ b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java @@ -16,7 +16,7 @@ import com.baeldung.autoconfiguration.MySQLAutoconfiguration; * @ServletComponentScan(basePackageClasses = {AttrListener.class, HelloFilter.class, HelloServlet.class, EchoServlet.class}) * */ -@SpringBootApplication(exclude=MySQLAutoconfiguration.class) +@SpringBootApplication(exclude = MySQLAutoconfiguration.class) @ServletComponentScan("com.baeldung.annotation.servletcomponentscan.components") public class SpringBootAnnotatedApp { diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java index 44030f440b..580498e831 100644 --- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java +++ b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java @@ -5,7 +5,7 @@ import org.springframework.context.annotation.ComponentScan; import com.baeldung.autoconfiguration.MySQLAutoconfiguration; -@SpringBootApplication(exclude=MySQLAutoconfiguration.class) +@SpringBootApplication(exclude = MySQLAutoconfiguration.class) @ComponentScan(basePackages = "com.baeldung.annotation.servletcomponentscan.components") public class SpringBootPlainApp { diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java index bad39c52c4..95b4a1a191 100644 --- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java +++ b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java @@ -9,9 +9,8 @@ public class AttrListener implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent servletContextEvent) { - servletContextEvent - .getServletContext() - .setAttribute("servlet-context-attr", "test"); + servletContextEvent.getServletContext() + .setAttribute("servlet-context-attr", "test"); System.out.println("context init"); } diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java index 3419cd0eaf..a2995d1532 100644 --- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java +++ b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java @@ -16,9 +16,8 @@ public class EchoServlet extends HttpServlet { @Override public void doPost(HttpServletRequest request, HttpServletResponse response) { try { - Path path = File - .createTempFile("echo", "tmp") - .toPath(); + Path path = File.createTempFile("echo", "tmp") + .toPath(); Files.copy(request.getInputStream(), path, StandardCopyOption.REPLACE_EXISTING); Files.copy(path, response.getOutputStream()); Files.delete(path); diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java index dc2368c5b2..650dae9806 100644 --- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java +++ b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java @@ -18,9 +18,8 @@ public class HelloFilter implements Filter { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { - servletResponse - .getOutputStream() - .print(filterConfig.getInitParameter("msg")); + servletResponse.getOutputStream() + .print(filterConfig.getInitParameter("msg")); filterChain.doFilter(servletRequest, servletResponse); } diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java index aeae7aecc9..3c27b8416f 100644 --- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java +++ b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java @@ -8,22 +8,22 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -@WebServlet(urlPatterns = "/hello", initParams = { @WebInitParam(name = "msg", value = "hello")}) +@WebServlet(urlPatterns = "/hello", initParams = { @WebInitParam(name = "msg", value = "hello") }) public class HelloServlet extends HttpServlet { private ServletConfig servletConfig; @Override - public void init(ServletConfig servletConfig){ + public void init(ServletConfig servletConfig) { this.servletConfig = servletConfig; } @Override public void doGet(HttpServletRequest request, HttpServletResponse response) { try { - response - .getOutputStream() - .write(servletConfig.getInitParameter("msg").getBytes()); + response.getOutputStream() + .write(servletConfig.getInitParameter("msg") + .getBytes()); } catch (IOException e) { e.printStackTrace(); } diff --git a/spring-boot/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java b/spring-boot/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java index 09f387902d..6dd127a8c3 100644 --- a/spring-boot/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java +++ b/spring-boot/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java @@ -92,21 +92,19 @@ public class MySQLAutoconfiguration { static class HibernateCondition extends SpringBootCondition { - private static final String[] CLASS_NAMES = { - "org.hibernate.ejb.HibernateEntityManager", - "org.hibernate.jpa.HibernateEntityManager" }; + private static final String[] CLASS_NAMES = { "org.hibernate.ejb.HibernateEntityManager", "org.hibernate.jpa.HibernateEntityManager" }; @Override public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ConditionMessage.Builder message = ConditionMessage.forCondition("Hibernate"); return Arrays.stream(CLASS_NAMES) - .filter(className -> ClassUtils.isPresent(className, context.getClassLoader())) - .map(className -> ConditionOutcome - .match(message.found("class").items(Style.NORMAL, className))) - .findAny() - .orElseGet(() -> ConditionOutcome - .noMatch(message.didNotFind("class", "classes").items(Style.NORMAL, Arrays.asList(CLASS_NAMES)))); + .filter(className -> ClassUtils.isPresent(className, context.getClassLoader())) + .map(className -> ConditionOutcome.match(message.found("class") + .items(Style.NORMAL, className))) + .findAny() + .orElseGet(() -> ConditionOutcome.noMatch(message.didNotFind("class", "classes") + .items(Style.NORMAL, Arrays.asList(CLASS_NAMES)))); } } diff --git a/spring-boot/src/main/java/com/baeldung/autoconfiguration/example/MyUserRepository.java b/spring-boot/src/main/java/com/baeldung/autoconfiguration/example/MyUserRepository.java index fa411bc0b8..3d07e515b1 100644 --- a/spring-boot/src/main/java/com/baeldung/autoconfiguration/example/MyUserRepository.java +++ b/spring-boot/src/main/java/com/baeldung/autoconfiguration/example/MyUserRepository.java @@ -2,6 +2,6 @@ package com.baeldung.autoconfiguration.example; import org.springframework.data.jpa.repository.JpaRepository; -public interface MyUserRepository extends JpaRepository{ - +public interface MyUserRepository extends JpaRepository { + } diff --git a/spring-boot/src/main/java/com/baeldung/displayallbeans/Application.java b/spring-boot/src/main/java/com/baeldung/displayallbeans/Application.java index cd015e6554..6cc3f72cf6 100644 --- a/spring-boot/src/main/java/com/baeldung/displayallbeans/Application.java +++ b/spring-boot/src/main/java/com/baeldung/displayallbeans/Application.java @@ -10,13 +10,13 @@ public class Application { public static void main(String[] args) { applicationContext = SpringApplication.run(Application.class, args); - + displayAllBeans(); } - + public static void displayAllBeans() { String[] allBeanNames = applicationContext.getBeanDefinitionNames(); - for(String beanName : allBeanNames) { + for (String beanName : allBeanNames) { System.out.println(beanName); } } diff --git a/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/FooController.java b/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/FooController.java index 9f483b18d1..26f0a60bff 100644 --- a/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/FooController.java +++ b/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/FooController.java @@ -12,9 +12,9 @@ import com.baeldung.displayallbeans.service.FooService; public class FooController { @Autowired private FooService fooService; - - @RequestMapping(value="/displayallbeans") - public String getHeaderAndBody (Map model){ + + @RequestMapping(value = "/displayallbeans") + public String getHeaderAndBody(Map model) { model.put("header", fooService.getHeader()); model.put("message", fooService.getBody()); return "displayallbeans"; diff --git a/spring-boot/src/main/java/com/baeldung/displayallbeans/service/FooService.java b/spring-boot/src/main/java/com/baeldung/displayallbeans/service/FooService.java index e29f18c94a..1f3c15ee0e 100644 --- a/spring-boot/src/main/java/com/baeldung/displayallbeans/service/FooService.java +++ b/spring-boot/src/main/java/com/baeldung/displayallbeans/service/FooService.java @@ -4,15 +4,13 @@ import org.springframework.stereotype.Service; @Service public class FooService { - + public String getHeader() { return "Display All Beans"; } - + public String getBody() { - return "This is a sample application that displays all beans " - + "in Spring IoC container using ListableBeanFactory interface " - + "and Spring Boot Actuators."; + return "This is a sample application that displays all beans " + "in Spring IoC container using ListableBeanFactory interface " + "and Spring Boot Actuators."; } - + } diff --git a/spring-boot/src/main/java/com/baeldung/dynamicvalidation/config/PersistenceConfig.java b/spring-boot/src/main/java/com/baeldung/dynamicvalidation/config/PersistenceConfig.java index d89dfc5fcd..a2b171c156 100644 --- a/spring-boot/src/main/java/com/baeldung/dynamicvalidation/config/PersistenceConfig.java +++ b/spring-boot/src/main/java/com/baeldung/dynamicvalidation/config/PersistenceConfig.java @@ -18,7 +18,10 @@ public class PersistenceConfig { @Bean public DataSource dataSource() { EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); - EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2).addScript("schema-expressions.sql").addScript("data-expressions.sql").build(); + EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2) + .addScript("schema-expressions.sql") + .addScript("data-expressions.sql") + .build(); return db; } } diff --git a/spring-boot/src/main/java/com/baeldung/failureanalyzer/FailureAnalyzerApplication.java b/spring-boot/src/main/java/com/baeldung/failureanalyzer/FailureAnalyzerApplication.java index 9d379cbc09..84c96feb92 100644 --- a/spring-boot/src/main/java/com/baeldung/failureanalyzer/FailureAnalyzerApplication.java +++ b/spring-boot/src/main/java/com/baeldung/failureanalyzer/FailureAnalyzerApplication.java @@ -7,7 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import com.baeldung.autoconfiguration.MySQLAutoconfiguration; -@SpringBootApplication(exclude=MySQLAutoconfiguration.class) +@SpringBootApplication(exclude = MySQLAutoconfiguration.class) public class FailureAnalyzerApplication { @RolesAllowed("*") public static void main(String[] args) { diff --git a/spring-boot/src/main/java/com/baeldung/failureanalyzer/MyBeanNotOfRequiredTypeFailureAnalyzer.java b/spring-boot/src/main/java/com/baeldung/failureanalyzer/MyBeanNotOfRequiredTypeFailureAnalyzer.java index 2bbae8944a..04c7fdff9a 100644 --- a/spring-boot/src/main/java/com/baeldung/failureanalyzer/MyBeanNotOfRequiredTypeFailureAnalyzer.java +++ b/spring-boot/src/main/java/com/baeldung/failureanalyzer/MyBeanNotOfRequiredTypeFailureAnalyzer.java @@ -4,8 +4,7 @@ import org.springframework.beans.factory.BeanNotOfRequiredTypeException; import org.springframework.boot.diagnostics.AbstractFailureAnalyzer; import org.springframework.boot.diagnostics.FailureAnalysis; -public class MyBeanNotOfRequiredTypeFailureAnalyzer - extends AbstractFailureAnalyzer { +public class MyBeanNotOfRequiredTypeFailureAnalyzer extends AbstractFailureAnalyzer { @Override protected FailureAnalysis analyze(Throwable rootFailure, BeanNotOfRequiredTypeException cause) { @@ -13,16 +12,15 @@ public class MyBeanNotOfRequiredTypeFailureAnalyzer } private String getDescription(BeanNotOfRequiredTypeException ex) { - return String.format("The bean %s could not be injected as %s because it is of type %s", - ex.getBeanName(), - ex.getRequiredType().getName(), - ex.getActualType().getName()); + return String.format("The bean %s could not be injected as %s because it is of type %s", ex.getBeanName(), ex.getRequiredType() + .getName(), + ex.getActualType() + .getName()); } private String getAction(BeanNotOfRequiredTypeException ex) { - return String.format("Consider creating a bean with name %s of type %s", - ex.getBeanName(), - ex.getRequiredType().getName()); + return String.format("Consider creating a bean with name %s of type %s", ex.getBeanName(), ex.getRequiredType() + .getName()); } } diff --git a/spring-boot/src/main/java/com/baeldung/git/CommitIdApplication.java b/spring-boot/src/main/java/com/baeldung/git/CommitIdApplication.java index c077692edb..4655e36f83 100644 --- a/spring-boot/src/main/java/com/baeldung/git/CommitIdApplication.java +++ b/spring-boot/src/main/java/com/baeldung/git/CommitIdApplication.java @@ -8,7 +8,7 @@ import org.springframework.core.io.ClassPathResource; import com.baeldung.autoconfiguration.MySQLAutoconfiguration; -@SpringBootApplication(scanBasePackages = { "com.baeldung.git" }, exclude=MySQLAutoconfiguration.class) +@SpringBootApplication(scanBasePackages = { "com.baeldung.git" }, exclude = MySQLAutoconfiguration.class) public class CommitIdApplication { public static void main(String[] args) { SpringApplication.run(CommitIdApplication.class, args); diff --git a/spring-boot/src/main/java/com/baeldung/graphql/GraphqlConfiguration.java b/spring-boot/src/main/java/com/baeldung/graphql/GraphqlConfiguration.java index a7a864cf96..c5ae8bd772 100644 --- a/spring-boot/src/main/java/com/baeldung/graphql/GraphqlConfiguration.java +++ b/spring-boot/src/main/java/com/baeldung/graphql/GraphqlConfiguration.java @@ -23,7 +23,7 @@ public class GraphqlConfiguration { } return new PostDao(posts); } - + @Bean public AuthorDao authorDao() { List authors = new ArrayList<>(); @@ -36,12 +36,12 @@ public class GraphqlConfiguration { } return new AuthorDao(authors); } - + @Bean public PostResolver postResolver(AuthorDao authorDao) { return new PostResolver(authorDao); } - + @Bean public AuthorResolver authorResolver(PostDao postDao) { return new AuthorResolver(postDao); diff --git a/spring-boot/src/main/java/com/baeldung/graphql/Mutation.java b/spring-boot/src/main/java/com/baeldung/graphql/Mutation.java index 0e16e3c8b7..5ccc80dad1 100644 --- a/spring-boot/src/main/java/com/baeldung/graphql/Mutation.java +++ b/spring-boot/src/main/java/com/baeldung/graphql/Mutation.java @@ -13,7 +13,8 @@ public class Mutation implements GraphQLMutationResolver { public Post writePost(String title, String text, String category, String author) { Post post = new Post(); - post.setId(UUID.randomUUID().toString()); + post.setId(UUID.randomUUID() + .toString()); post.setTitle(title); post.setText(text); post.setCategory(category); diff --git a/spring-boot/src/main/java/com/baeldung/internationalization/InternationalizationApp.java b/spring-boot/src/main/java/com/baeldung/internationalization/InternationalizationApp.java index b743eb4b61..ca56437392 100644 --- a/spring-boot/src/main/java/com/baeldung/internationalization/InternationalizationApp.java +++ b/spring-boot/src/main/java/com/baeldung/internationalization/InternationalizationApp.java @@ -7,7 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import com.baeldung.autoconfiguration.MySQLAutoconfiguration; -@SpringBootApplication(exclude=MySQLAutoconfiguration.class) +@SpringBootApplication(exclude = MySQLAutoconfiguration.class) public class InternationalizationApp { @RolesAllowed("*") public static void main(String[] args) { diff --git a/spring-boot/src/main/java/com/baeldung/intro/App.java b/spring-boot/src/main/java/com/baeldung/intro/App.java index 9553d814ac..b865deea29 100644 --- a/spring-boot/src/main/java/com/baeldung/intro/App.java +++ b/spring-boot/src/main/java/com/baeldung/intro/App.java @@ -5,11 +5,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import com.baeldung.autoconfiguration.MySQLAutoconfiguration; -@SpringBootApplication(exclude=MySQLAutoconfiguration.class) -public class App -{ - public static void main( String[] args ) - { +@SpringBootApplication(exclude = MySQLAutoconfiguration.class) +public class App { + public static void main(String[] args) { SpringApplication.run(App.class, args); } } diff --git a/spring-boot/src/main/java/com/baeldung/intro/controller/HomeController.java b/spring-boot/src/main/java/com/baeldung/intro/controller/HomeController.java index 9109b0a292..2a82e58829 100644 --- a/spring-boot/src/main/java/com/baeldung/intro/controller/HomeController.java +++ b/spring-boot/src/main/java/com/baeldung/intro/controller/HomeController.java @@ -7,12 +7,12 @@ import org.springframework.web.bind.annotation.RestController; public class HomeController { @RequestMapping("/") - public String root(){ + public String root() { return "Index Page"; } - + @RequestMapping("/local") - public String local(){ + public String local() { return "/local"; } } diff --git a/spring-boot/src/main/java/com/baeldung/servlets/ApplicationMain.java b/spring-boot/src/main/java/com/baeldung/servlets/ApplicationMain.java index 8965e2f013..c8461e4efc 100644 --- a/spring-boot/src/main/java/com/baeldung/servlets/ApplicationMain.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/ApplicationMain.java @@ -7,7 +7,7 @@ import org.springframework.boot.web.support.SpringBootServletInitializer; import com.baeldung.autoconfiguration.MySQLAutoconfiguration; -@SpringBootApplication(exclude=MySQLAutoconfiguration.class) +@SpringBootApplication(exclude = MySQLAutoconfiguration.class) public class ApplicationMain extends SpringBootServletInitializer { public static void main(String[] args) { diff --git a/spring-boot/src/main/java/com/baeldung/servlets/configuration/WebMvcConfigure.java b/spring-boot/src/main/java/com/baeldung/servlets/configuration/WebMvcConfigure.java index 3d6a10c2ac..2d8298338c 100644 --- a/spring-boot/src/main/java/com/baeldung/servlets/configuration/WebMvcConfigure.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/configuration/WebMvcConfigure.java @@ -26,10 +26,13 @@ public class WebMvcConfigure extends WebMvcConfigurerAdapter { configurer.enable(); } - @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/resources/**").addResourceLocations("/resources/").setCachePeriod(3600).resourceChain(true).addResolver(new PathResourceResolver()); + registry.addResourceHandler("/resources/**") + .addResourceLocations("/resources/") + .setCachePeriod(3600) + .resourceChain(true) + .addResolver(new PathResourceResolver()); } @Bean diff --git a/spring-boot/src/main/java/com/baeldung/servlets/props/PropertySourcesLoader.java b/spring-boot/src/main/java/com/baeldung/servlets/props/PropertySourcesLoader.java index aa70bac777..bbab95c41f 100644 --- a/spring-boot/src/main/java/com/baeldung/servlets/props/PropertySourcesLoader.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/props/PropertySourcesLoader.java @@ -10,7 +10,8 @@ import org.springframework.core.env.ConfigurableEnvironment; @Configuration @ComponentScan(basePackages = { "com.baeldung.servlets.*" }) -@PropertySource("classpath:custom.properties") public class PropertySourcesLoader { +@PropertySource("classpath:custom.properties") +public class PropertySourcesLoader { private static final Logger log = LoggerFactory.getLogger(PropertySourcesLoader.class); diff --git a/spring-boot/src/main/java/com/baeldung/servlets/servlets/javaee/AnnotationServlet.java b/spring-boot/src/main/java/com/baeldung/servlets/servlets/javaee/AnnotationServlet.java index b50a7d5454..358ff5af2d 100644 --- a/spring-boot/src/main/java/com/baeldung/servlets/servlets/javaee/AnnotationServlet.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/servlets/javaee/AnnotationServlet.java @@ -7,14 +7,13 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -@WebServlet(name = "AnnotationServlet", - description = "Example Servlet Using Annotations", - urlPatterns = { "/annotationservlet" }) +@WebServlet(name = "AnnotationServlet", description = "Example Servlet Using Annotations", urlPatterns = { "/annotationservlet" }) public class AnnotationServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - request.getRequestDispatcher("/annotationservlet.jsp").forward(request, response); + request.getRequestDispatcher("/annotationservlet.jsp") + .forward(request, response); } } diff --git a/spring-boot/src/main/java/com/baeldung/toggle/EmployeeRepository.java b/spring-boot/src/main/java/com/baeldung/toggle/EmployeeRepository.java index 7ea7c11fde..4e75fc6411 100644 --- a/spring-boot/src/main/java/com/baeldung/toggle/EmployeeRepository.java +++ b/spring-boot/src/main/java/com/baeldung/toggle/EmployeeRepository.java @@ -2,6 +2,6 @@ package com.baeldung.toggle; import org.springframework.data.repository.CrudRepository; -public interface EmployeeRepository extends CrudRepository{ +public interface EmployeeRepository extends CrudRepository { } diff --git a/spring-boot/src/main/java/com/baeldung/toggle/MyFeatures.java b/spring-boot/src/main/java/com/baeldung/toggle/MyFeatures.java index 245415a2a0..b05ec2bf52 100644 --- a/spring-boot/src/main/java/com/baeldung/toggle/MyFeatures.java +++ b/spring-boot/src/main/java/com/baeldung/toggle/MyFeatures.java @@ -10,13 +10,15 @@ import org.togglz.core.context.FeatureContext; public enum MyFeatures implements Feature { - @Label("Employee Management Feature") @EnabledByDefault @DefaultActivationStrategy(id = SystemPropertyActivationStrategy.ID, - parameters = { @ActivationParameter(name = SystemPropertyActivationStrategy.PARAM_PROPERTY_NAME, value = "employee.feature"), - @ActivationParameter(name = SystemPropertyActivationStrategy.PARAM_PROPERTY_VALUE, value = "true") }) + @Label("Employee Management Feature") + @EnabledByDefault + @DefaultActivationStrategy(id = SystemPropertyActivationStrategy.ID, parameters = { @ActivationParameter(name = SystemPropertyActivationStrategy.PARAM_PROPERTY_NAME, value = "employee.feature"), + @ActivationParameter(name = SystemPropertyActivationStrategy.PARAM_PROPERTY_VALUE, value = "true") }) EMPLOYEE_MANAGEMENT_FEATURE; public boolean isActive() { - return FeatureContext.getFeatureManager().isActive(this); + return FeatureContext.getFeatureManager() + .isActive(this); } } diff --git a/spring-boot/src/main/java/com/baeldung/utils/UtilsApplication.java b/spring-boot/src/main/java/com/baeldung/utils/UtilsApplication.java index b63ada9eee..4b00247c4a 100644 --- a/spring-boot/src/main/java/com/baeldung/utils/UtilsApplication.java +++ b/spring-boot/src/main/java/com/baeldung/utils/UtilsApplication.java @@ -8,13 +8,13 @@ import org.springframework.context.annotation.ComponentScan; import com.baeldung.autoconfiguration.MySQLAutoconfiguration; -@SpringBootApplication(exclude=MySQLAutoconfiguration.class) -@ComponentScan(basePackages="com.baeldung.utils") +@SpringBootApplication(exclude = MySQLAutoconfiguration.class) +@ComponentScan(basePackages = "com.baeldung.utils") public class UtilsApplication { - @RolesAllowed("*") - public static void main(String[] args) { - SpringApplication.run(UtilsApplication.class, args); - } + @RolesAllowed("*") + public static void main(String[] args) { + SpringApplication.run(UtilsApplication.class, args); + } } diff --git a/spring-boot/src/main/java/com/baeldung/utils/controller/UtilsController.java b/spring-boot/src/main/java/com/baeldung/utils/controller/UtilsController.java index 7b4827cdf2..7c66391bd2 100644 --- a/spring-boot/src/main/java/com/baeldung/utils/controller/UtilsController.java +++ b/spring-boot/src/main/java/com/baeldung/utils/controller/UtilsController.java @@ -13,37 +13,37 @@ import org.springframework.web.util.WebUtils; @Controller public class UtilsController { - @GetMapping("/utils") - public String webUtils(Model model) { - return "utils"; - } - - @PostMapping("/setParam") - public String post(HttpServletRequest request, Model model) { - String param = ServletRequestUtils.getStringParameter(request, "param", "DEFAULT"); - -// Long param = ServletRequestUtils.getLongParameter(request, "param",1L); -// boolean param = ServletRequestUtils.getBooleanParameter(request, "param", true); -// double param = ServletRequestUtils.getDoubleParameter(request, "param", 1000); -// float param = ServletRequestUtils.getFloatParameter(request, "param", (float) 1.00); -// int param = ServletRequestUtils.getIntParameter(request, "param", 100); - -// try { -// ServletRequestUtils.getRequiredStringParameter(request, "param"); -// } catch (ServletRequestBindingException e) { -// e.printStackTrace(); -// } - - WebUtils.setSessionAttribute(request, "parameter", param); - model.addAttribute("parameter", "You set: "+(String) WebUtils.getSessionAttribute(request, "parameter")); - return "utils"; - } - - @GetMapping("/other") - public String other(HttpServletRequest request, Model model) { - String param = (String) WebUtils.getSessionAttribute(request, "parameter"); - model.addAttribute("parameter", param); - return "other"; - } - + @GetMapping("/utils") + public String webUtils(Model model) { + return "utils"; + } + + @PostMapping("/setParam") + public String post(HttpServletRequest request, Model model) { + String param = ServletRequestUtils.getStringParameter(request, "param", "DEFAULT"); + + // Long param = ServletRequestUtils.getLongParameter(request, "param",1L); + // boolean param = ServletRequestUtils.getBooleanParameter(request, "param", true); + // double param = ServletRequestUtils.getDoubleParameter(request, "param", 1000); + // float param = ServletRequestUtils.getFloatParameter(request, "param", (float) 1.00); + // int param = ServletRequestUtils.getIntParameter(request, "param", 100); + + // try { + // ServletRequestUtils.getRequiredStringParameter(request, "param"); + // } catch (ServletRequestBindingException e) { + // e.printStackTrace(); + // } + + WebUtils.setSessionAttribute(request, "parameter", param); + model.addAttribute("parameter", "You set: " + (String) WebUtils.getSessionAttribute(request, "parameter")); + return "utils"; + } + + @GetMapping("/other") + public String other(HttpServletRequest request, Model model) { + String param = (String) WebUtils.getSessionAttribute(request, "parameter"); + model.addAttribute("parameter", param); + return "other"; + } + } diff --git a/spring-boot/src/main/java/com/baeldung/webjar/WebjarsdemoApplication.java b/spring-boot/src/main/java/com/baeldung/webjar/WebjarsdemoApplication.java index 44d48f5f8f..8704b42166 100644 --- a/spring-boot/src/main/java/com/baeldung/webjar/WebjarsdemoApplication.java +++ b/spring-boot/src/main/java/com/baeldung/webjar/WebjarsdemoApplication.java @@ -6,7 +6,7 @@ import org.springframework.context.annotation.ComponentScan; import com.baeldung.autoconfiguration.MySQLAutoconfiguration; -@SpringBootApplication(exclude=MySQLAutoconfiguration.class) +@SpringBootApplication(exclude = MySQLAutoconfiguration.class) public class WebjarsdemoApplication { public static void main(String[] args) { diff --git a/spring-boot/src/main/java/org/baeldung/Application.java b/spring-boot/src/main/java/org/baeldung/Application.java index 8b49f4d6ab..1c1e466afc 100644 --- a/spring-boot/src/main/java/org/baeldung/Application.java +++ b/spring-boot/src/main/java/org/baeldung/Application.java @@ -6,7 +6,7 @@ import org.springframework.context.ApplicationContext; import com.baeldung.autoconfiguration.MySQLAutoconfiguration; -@SpringBootApplication(exclude=MySQLAutoconfiguration.class) +@SpringBootApplication(exclude = MySQLAutoconfiguration.class) public class Application { private static ApplicationContext applicationContext; diff --git a/spring-boot/src/main/java/org/baeldung/boot/DemoApplication.java b/spring-boot/src/main/java/org/baeldung/boot/DemoApplication.java index 5de4134739..cb269f77f1 100644 --- a/spring-boot/src/main/java/org/baeldung/boot/DemoApplication.java +++ b/spring-boot/src/main/java/org/baeldung/boot/DemoApplication.java @@ -7,7 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import com.baeldung.autoconfiguration.MySQLAutoconfiguration; import org.springframework.context.annotation.Import; -@SpringBootApplication(exclude=MySQLAutoconfiguration.class) +@SpringBootApplication(exclude = MySQLAutoconfiguration.class) @Import(GraphqlConfiguration.class) public class DemoApplication { diff --git a/spring-boot/src/main/java/org/baeldung/boot/components/FooService.java b/spring-boot/src/main/java/org/baeldung/boot/components/FooService.java index 235fd43299..4ff8e9fdd4 100644 --- a/spring-boot/src/main/java/org/baeldung/boot/components/FooService.java +++ b/spring-boot/src/main/java/org/baeldung/boot/components/FooService.java @@ -10,11 +10,11 @@ public class FooService { @Autowired private FooRepository fooRepository; - + public Foo getFooWithId(Integer id) throws Exception { return fooRepository.findOne(id); } - + public Foo getFooWithName(String name) { return fooRepository.findByName(name); } diff --git a/spring-boot/src/main/java/org/baeldung/boot/exceptions/CommonException.java b/spring-boot/src/main/java/org/baeldung/boot/exceptions/CommonException.java index 1f008440e6..e03b859eab 100644 --- a/spring-boot/src/main/java/org/baeldung/boot/exceptions/CommonException.java +++ b/spring-boot/src/main/java/org/baeldung/boot/exceptions/CommonException.java @@ -1,13 +1,13 @@ package org.baeldung.boot.exceptions; -public class CommonException extends RuntimeException{ +public class CommonException extends RuntimeException { /** * */ private static final long serialVersionUID = 3080004140659213332L; - public CommonException(String message){ + public CommonException(String message) { super(message); } } diff --git a/spring-boot/src/main/java/org/baeldung/boot/exceptions/FooNotFoundException.java b/spring-boot/src/main/java/org/baeldung/boot/exceptions/FooNotFoundException.java index 68ef3fa389..0b04bd2759 100644 --- a/spring-boot/src/main/java/org/baeldung/boot/exceptions/FooNotFoundException.java +++ b/spring-boot/src/main/java/org/baeldung/boot/exceptions/FooNotFoundException.java @@ -1,13 +1,13 @@ package org.baeldung.boot.exceptions; -public class FooNotFoundException extends RuntimeException{ +public class FooNotFoundException extends RuntimeException { /** * */ private static final long serialVersionUID = 9042200028456133589L; - public FooNotFoundException(String message){ + public FooNotFoundException(String message) { super(message); } } diff --git a/spring-boot/src/main/java/org/baeldung/boot/model/Foo.java b/spring-boot/src/main/java/org/baeldung/boot/model/Foo.java index ac8a8fe429..d373e25b85 100644 --- a/spring-boot/src/main/java/org/baeldung/boot/model/Foo.java +++ b/spring-boot/src/main/java/org/baeldung/boot/model/Foo.java @@ -21,7 +21,6 @@ public class Foo implements Serializable { this.name = name; } - public Foo(Integer id, String name) { super(); this.id = id; diff --git a/spring-boot/src/main/java/org/baeldung/boot/service/FooController.java b/spring-boot/src/main/java/org/baeldung/boot/service/FooController.java index 834fa342e2..d400c3bf9e 100644 --- a/spring-boot/src/main/java/org/baeldung/boot/service/FooController.java +++ b/spring-boot/src/main/java/org/baeldung/boot/service/FooController.java @@ -18,7 +18,7 @@ public class FooController { public Foo getFooWithId(@PathVariable Integer id) throws Exception { return fooService.getFooWithId(id); } - + @GetMapping("/") public Foo getFooWithName(@RequestParam String name) throws Exception { return fooService.getFooWithName(name); diff --git a/spring-boot/src/main/java/org/baeldung/controller/GenericEntityController.java b/spring-boot/src/main/java/org/baeldung/controller/GenericEntityController.java index 7d1ad7d899..a9e7dee0b7 100644 --- a/spring-boot/src/main/java/org/baeldung/controller/GenericEntityController.java +++ b/spring-boot/src/main/java/org/baeldung/controller/GenericEntityController.java @@ -39,21 +39,31 @@ public class GenericEntityController { @RequestMapping("/entity/findby/{id}") public GenericEntity findById(@PathVariable Long id) { - return entityList.stream().filter(entity -> entity.getId().equals(id)).findFirst().get(); + return entityList.stream() + .filter(entity -> entity.getId() + .equals(id)) + .findFirst() + .get(); } @GetMapping("/entity/findbydate/{date}") public GenericEntity findByDate(@PathVariable("date") LocalDateTime date) { - return entityList.stream().findFirst().get(); + return entityList.stream() + .findFirst() + .get(); } @GetMapping("/entity/findbymode/{mode}") public GenericEntity findByEnum(@PathVariable("mode") Modes mode) { - return entityList.stream().findFirst().get(); + return entityList.stream() + .findFirst() + .get(); } @GetMapping("/entity/findbyversion") public ResponseEntity findByVersion(@Version String version) { - return version != null ? new ResponseEntity(entityList.stream().findFirst().get(), HttpStatus.OK) : new ResponseEntity(HttpStatus.NOT_FOUND); + return version != null ? new ResponseEntity(entityList.stream() + .findFirst() + .get(), HttpStatus.OK) : new ResponseEntity(HttpStatus.NOT_FOUND); } } diff --git a/spring-boot/src/main/java/org/baeldung/endpoints/MyHealthCheck.java b/spring-boot/src/main/java/org/baeldung/endpoints/MyHealthCheck.java index 1a175aed48..68fbffda6e 100644 --- a/spring-boot/src/main/java/org/baeldung/endpoints/MyHealthCheck.java +++ b/spring-boot/src/main/java/org/baeldung/endpoints/MyHealthCheck.java @@ -10,9 +10,13 @@ public class MyHealthCheck implements HealthIndicator { public Health health() { int errorCode = check(); // perform some specific health check if (errorCode != 0) { - return Health.down().withDetail("Error Code", errorCode).withDetail("Description", "You custom MyHealthCheck endpoint is down").build(); + return Health.down() + .withDetail("Error Code", errorCode) + .withDetail("Description", "You custom MyHealthCheck endpoint is down") + .build(); } - return Health.up().build(); + return Health.up() + .build(); } public int check() { diff --git a/spring-boot/src/main/java/org/baeldung/jsoncomponent/UserCombinedSerializer.java b/spring-boot/src/main/java/org/baeldung/jsoncomponent/UserCombinedSerializer.java index 2001340197..cb1b838ca4 100644 --- a/spring-boot/src/main/java/org/baeldung/jsoncomponent/UserCombinedSerializer.java +++ b/spring-boot/src/main/java/org/baeldung/jsoncomponent/UserCombinedSerializer.java @@ -21,8 +21,7 @@ public class UserCombinedSerializer { @Override public void serialize(User user, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { jsonGenerator.writeStartObject(); - jsonGenerator.writeStringField("favoriteColor", - getColorAsWebColor(user.getFavoriteColor())); + jsonGenerator.writeStringField("favoriteColor", getColorAsWebColor(user.getFavoriteColor())); jsonGenerator.writeEndObject(); } @@ -37,7 +36,8 @@ public class UserCombinedSerializer { public static class UserJsonDeserializer extends JsonDeserializer { @Override public User deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { - TreeNode treeNode = jsonParser.getCodec().readTree(jsonParser); + TreeNode treeNode = jsonParser.getCodec() + .readTree(jsonParser); TextNode favoriteColor = (TextNode) treeNode.get("favoriteColor"); return new User(Color.web(favoriteColor.asText())); } diff --git a/spring-boot/src/main/java/org/baeldung/jsoncomponent/UserJsonDeserializer.java b/spring-boot/src/main/java/org/baeldung/jsoncomponent/UserJsonDeserializer.java index d18de7e3f1..a310dcba5a 100644 --- a/spring-boot/src/main/java/org/baeldung/jsoncomponent/UserJsonDeserializer.java +++ b/spring-boot/src/main/java/org/baeldung/jsoncomponent/UserJsonDeserializer.java @@ -15,7 +15,8 @@ import java.io.IOException; public class UserJsonDeserializer extends JsonDeserializer { @Override public User deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { - TreeNode treeNode = jsonParser.getCodec().readTree(jsonParser); + TreeNode treeNode = jsonParser.getCodec() + .readTree(jsonParser); TextNode favoriteColor = (TextNode) treeNode.get("favoriteColor"); return new User(Color.web(favoriteColor.asText())); } diff --git a/spring-boot/src/main/java/org/baeldung/jsoncomponent/UserJsonSerializer.java b/spring-boot/src/main/java/org/baeldung/jsoncomponent/UserJsonSerializer.java index d90f662a4b..845bc3aac5 100644 --- a/spring-boot/src/main/java/org/baeldung/jsoncomponent/UserJsonSerializer.java +++ b/spring-boot/src/main/java/org/baeldung/jsoncomponent/UserJsonSerializer.java @@ -15,8 +15,7 @@ public class UserJsonSerializer extends JsonSerializer { @Override public void serialize(User user, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { jsonGenerator.writeStartObject(); - jsonGenerator.writeStringField("favoriteColor", - getColorAsWebColor(user.getFavoriteColor())); + jsonGenerator.writeStringField("favoriteColor", getColorAsWebColor(user.getFavoriteColor())); jsonGenerator.writeEndObject(); } diff --git a/spring-boot/src/main/java/org/baeldung/main/SpringBootApplication.java b/spring-boot/src/main/java/org/baeldung/main/SpringBootApplication.java index 872426d850..2d118b0eae 100644 --- a/spring-boot/src/main/java/org/baeldung/main/SpringBootApplication.java +++ b/spring-boot/src/main/java/org/baeldung/main/SpringBootApplication.java @@ -20,7 +20,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @RestController -@EnableAutoConfiguration(exclude=MySQLAutoconfiguration.class) +@EnableAutoConfiguration(exclude = MySQLAutoconfiguration.class) @ComponentScan({ "org.baeldung.common.error", "org.baeldung.common.error.controller", "org.baeldung.common.properties", "org.baeldung.common.resources", "org.baeldung.endpoints", "org.baeldung.service", "org.baeldung.monitor.jmx", "org.baeldung.service" }) public class SpringBootApplication { diff --git a/spring-boot/src/main/java/org/baeldung/monitor/jmx/MonitoringConfig.java b/spring-boot/src/main/java/org/baeldung/monitor/jmx/MonitoringConfig.java index 8100e61629..40f36ef924 100644 --- a/spring-boot/src/main/java/org/baeldung/monitor/jmx/MonitoringConfig.java +++ b/spring-boot/src/main/java/org/baeldung/monitor/jmx/MonitoringConfig.java @@ -14,7 +14,8 @@ public class MonitoringConfig { @Bean public JmxReporter jmxReporter() { - JmxReporter reporter = JmxReporter.forRegistry(registry).build(); + JmxReporter reporter = JmxReporter.forRegistry(registry) + .build(); reporter.start(); return reporter; } diff --git a/spring-boot/src/main/java/org/baeldung/service/LoginServiceImpl.java b/spring-boot/src/main/java/org/baeldung/service/LoginServiceImpl.java index ed0090f8e4..6d89f7f695 100644 --- a/spring-boot/src/main/java/org/baeldung/service/LoginServiceImpl.java +++ b/spring-boot/src/main/java/org/baeldung/service/LoginServiceImpl.java @@ -16,7 +16,8 @@ public class LoginServiceImpl implements LoginService { public boolean login(String userName, char[] password) { boolean success; - if (userName.equals("admin") && "secret".toCharArray().equals(password)) { + if (userName.equals("admin") && "secret".toCharArray() + .equals(password)) { counterService.increment("counter.login.success"); success = true; } else { diff --git a/spring-boot/src/main/java/org/baeldung/session/exception/Application.java b/spring-boot/src/main/java/org/baeldung/session/exception/Application.java index 9f8dadbe55..c0cc669420 100644 --- a/spring-boot/src/main/java/org/baeldung/session/exception/Application.java +++ b/spring-boot/src/main/java/org/baeldung/session/exception/Application.java @@ -10,7 +10,7 @@ import org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean; import com.baeldung.autoconfiguration.MySQLAutoconfiguration; @EntityScan(basePackageClasses = Foo.class) -@SpringBootApplication(exclude=MySQLAutoconfiguration.class) +@SpringBootApplication(exclude = MySQLAutoconfiguration.class) public class Application { public static void main(String[] args) { System.setProperty("spring.config.name", "exception"); diff --git a/spring-boot/src/main/java/org/baeldung/session/exception/repository/FooRepositoryImpl.java b/spring-boot/src/main/java/org/baeldung/session/exception/repository/FooRepositoryImpl.java index 83de888e5e..36d87e6dad 100644 --- a/spring-boot/src/main/java/org/baeldung/session/exception/repository/FooRepositoryImpl.java +++ b/spring-boot/src/main/java/org/baeldung/session/exception/repository/FooRepositoryImpl.java @@ -14,12 +14,14 @@ public class FooRepositoryImpl implements FooRepository { @Override public void save(Foo foo) { - sessionFactory.getCurrentSession().saveOrUpdate(foo); + sessionFactory.getCurrentSession() + .saveOrUpdate(foo); } @Override public Foo get(Integer id) { - return sessionFactory.getCurrentSession().get(Foo.class, id); + return sessionFactory.getCurrentSession() + .get(Foo.class, id); } } \ No newline at end of file diff --git a/spring-boot/src/main/java/org/baeldung/websocket/client/Message.java b/spring-boot/src/main/java/org/baeldung/websocket/client/Message.java index bcab44870b..2744c49f62 100644 --- a/spring-boot/src/main/java/org/baeldung/websocket/client/Message.java +++ b/spring-boot/src/main/java/org/baeldung/websocket/client/Message.java @@ -20,6 +20,5 @@ public class Message { public void setText(String text) { this.text = text; } - - + } diff --git a/spring-boot/src/main/java/org/baeldung/websocket/client/MyStompSessionHandler.java b/spring-boot/src/main/java/org/baeldung/websocket/client/MyStompSessionHandler.java index 35bf1827ea..45fbf2b623 100644 --- a/spring-boot/src/main/java/org/baeldung/websocket/client/MyStompSessionHandler.java +++ b/spring-boot/src/main/java/org/baeldung/websocket/client/MyStompSessionHandler.java @@ -17,12 +17,12 @@ import java.lang.reflect.Type; * */ public class MyStompSessionHandler extends StompSessionHandlerAdapter { - + private Logger logger = Logger.getLogger(MyStompSessionHandler.class); - + @Override public void afterConnected(StompSession session, StompHeaders connectedHeaders) { - logger.info("New session established : "+session.getSessionId()); + logger.info("New session established : " + session.getSessionId()); session.subscribe("/topic/messages", this); logger.info("Subscribed to /topic/messages"); session.send("/app/chat", getSampleMessage()); @@ -41,15 +41,15 @@ public class MyStompSessionHandler extends StompSessionHandlerAdapter { @Override public void handleFrame(StompHeaders headers, Object payload) { - Message msg = (Message)payload; - logger.info("Received : "+ msg.getText()+ " from : "+msg.getFrom()); + Message msg = (Message) payload; + logger.info("Received : " + msg.getText() + " from : " + msg.getFrom()); } - + /** * A sample message instance. * @return instance of Message */ - private Message getSampleMessage(){ + private Message getSampleMessage() { Message msg = new Message(); msg.setFrom("Nicky"); msg.setText("Howdy!!"); diff --git a/spring-boot/src/main/java/org/baeldung/websocket/client/StompClient.java b/spring-boot/src/main/java/org/baeldung/websocket/client/StompClient.java index 71f5471fb1..2bff07186d 100644 --- a/spring-boot/src/main/java/org/baeldung/websocket/client/StompClient.java +++ b/spring-boot/src/main/java/org/baeldung/websocket/client/StompClient.java @@ -19,9 +19,9 @@ public class StompClient { public static void main(String[] args) { WebSocketClient client = new StandardWebSocketClient(); WebSocketStompClient stompClient = new WebSocketStompClient(client); - + stompClient.setMessageConverter(new MappingJackson2MessageConverter()); - + StompSessionHandler sessionHandler = new MyStompSessionHandler(); stompClient.connect(URL, sessionHandler); diff --git a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java index 660b461ab6..b2b14f766e 100644 --- a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java @@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringBootAnnotatedApp.class) @AutoConfigureMockMvc -@TestPropertySource(properties = {"security.basic.enabled=false"}) +@TestPropertySource(properties = { "security.basic.enabled=false" }) public class SpringBootWithServletComponentIntegrationTest { @Autowired @@ -40,9 +40,8 @@ public class SpringBootWithServletComponentIntegrationTest { FilterRegistration filterRegistration = servletContext.getFilterRegistration("hello filter"); assertNotNull(filterRegistration); - assertTrue(filterRegistration - .getServletNameMappings() - .contains("echo servlet")); + assertTrue(filterRegistration.getServletNameMappings() + .contains("echo servlet")); } @Autowired @@ -62,7 +61,4 @@ public class SpringBootWithServletComponentIntegrationTest { assertEquals("filtering echo", responseEntity.getBody()); } - } - - diff --git a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java index 31bb2ab195..a13cd250a2 100644 --- a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java @@ -21,7 +21,7 @@ import static org.junit.Assert.assertNull; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringBootPlainApp.class) @AutoConfigureMockMvc -@TestPropertySource(properties = {"security.basic.enabled=false"}) +@TestPropertySource(properties = { "security.basic.enabled=false" }) public class SpringBootWithoutServletComponentIntegrationTest { @Autowired @@ -50,5 +50,3 @@ public class SpringBootWithoutServletComponentIntegrationTest { } } - - diff --git a/spring-boot/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationIntegrationTest.java index e886042c8d..30ba397b46 100644 --- a/spring-boot/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationIntegrationTest.java @@ -12,7 +12,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = AutoconfigurationApplication.class) -@EnableJpaRepositories(basePackages = {"com.baeldung.autoconfiguration.example"}) +@EnableJpaRepositories(basePackages = { "com.baeldung.autoconfiguration.example" }) public class AutoconfigurationIntegrationTest { @Autowired diff --git a/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java index 413f6980ce..8bd9c20c5e 100644 --- a/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java @@ -25,7 +25,7 @@ import static org.junit.Assert.assertTrue; @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@TestPropertySource(properties = {"management.port=0", "endpoints.beans.id=springbeans", "endpoints.beans.sensitive=false"}) +@TestPropertySource(properties = { "management.port=0", "endpoints.beans.id=springbeans", "endpoints.beans.sensitive=false" }) public class DisplayBeanIntegrationTest { @LocalServerPort @@ -42,8 +42,7 @@ public class DisplayBeanIntegrationTest { @Test public void givenRestTemplate_whenAccessServerUrl_thenHttpStatusOK() throws Exception { - ResponseEntity entity = this.testRestTemplate.getForEntity( - "http://localhost:" + this.port + "/displayallbeans", String.class); + ResponseEntity entity = this.testRestTemplate.getForEntity("http://localhost:" + this.port + "/displayallbeans", String.class); then(entity.getStatusCode()).isEqualTo(HttpStatus.OK); } @@ -51,8 +50,7 @@ public class DisplayBeanIntegrationTest { @Test public void givenRestTemplate_whenAccessEndpointUrl_thenHttpStatusOK() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity entity = this.testRestTemplate.getForEntity( - "http://localhost:" + this.mgt + "/springbeans", List.class); + ResponseEntity entity = this.testRestTemplate.getForEntity("http://localhost:" + this.mgt + "/springbeans", List.class); then(entity.getStatusCode()).isEqualTo(HttpStatus.OK); } @@ -60,11 +58,13 @@ public class DisplayBeanIntegrationTest { @Test public void givenRestTemplate_whenAccessEndpointUrl_thenReturnsBeanNames() throws Exception { @SuppressWarnings("rawtypes") - ResponseEntity entity = this.testRestTemplate.getForEntity( - "http://localhost:" + this.mgt + "/springbeans", List.class); + ResponseEntity entity = this.testRestTemplate.getForEntity("http://localhost:" + this.mgt + "/springbeans", List.class); - List> allBeans = (List) ((Map) entity.getBody().get(0)).get("beans"); - List beanNamesList = allBeans.stream().map(x -> (String) x.get("bean")).collect(Collectors.toList()); + List> allBeans = (List) ((Map) entity.getBody() + .get(0)).get("beans"); + List beanNamesList = allBeans.stream() + .map(x -> (String) x.get("bean")) + .collect(Collectors.toList()); assertThat(beanNamesList, hasItem("fooController")); assertThat(beanNamesList, hasItem("fooService")); diff --git a/spring-boot/src/test/java/com/baeldung/intro/AppLiveTest.java b/spring-boot/src/test/java/com/baeldung/intro/AppLiveTest.java index fa05dbab66..4856c17c7d 100644 --- a/spring-boot/src/test/java/com/baeldung/intro/AppLiveTest.java +++ b/spring-boot/src/test/java/com/baeldung/intro/AppLiveTest.java @@ -18,7 +18,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc -@TestPropertySource(properties = {"security.basic.enabled=false"}) +@TestPropertySource(properties = { "security.basic.enabled=false" }) public class AppLiveTest { @Autowired @@ -26,16 +26,18 @@ public class AppLiveTest { @Test public void getIndex() throws Exception { - mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(equalTo("Index Page"))); + mvc.perform(MockMvcRequestBuilders.get("/") + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(equalTo("Index Page"))); } @Test public void getLocal() throws Exception { - mvc.perform(MockMvcRequestBuilders.get("/local").accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(equalTo("/local"))); + mvc.perform(MockMvcRequestBuilders.get("/local") + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(equalTo("/local"))); } } \ No newline at end of file diff --git a/spring-boot/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java index ca6230e8f5..5b70fa3cbe 100644 --- a/spring-boot/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java @@ -35,7 +35,8 @@ public class ToggleIntegrationTest { @Before public void setup() { - this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac) + .build(); } @Test @@ -45,7 +46,8 @@ public class ToggleIntegrationTest { System.setProperty("employee.feature", "false"); - mockMvc.perform(post("/increaseSalary").param("id", emp.getId() + "")).andExpect(status().is(200)); + mockMvc.perform(post("/increaseSalary").param("id", emp.getId() + "")) + .andExpect(status().is(200)); emp = employeeRepository.findOne(1L); assertEquals("salary incorrect", 2000, emp.getSalary(), 0.5); @@ -58,7 +60,8 @@ public class ToggleIntegrationTest { System.setProperty("employee.feature", "true"); - mockMvc.perform(post("/increaseSalary").param("id", emp.getId() + "")).andExpect(status().is(200)); + mockMvc.perform(post("/increaseSalary").param("id", emp.getId() + "")) + .andExpect(status().is(200)); emp = employeeRepository.findOne(1L); assertEquals("salary incorrect", 2200, emp.getSalary(), 0.5); diff --git a/spring-boot/src/test/java/com/baeldung/utils/UtilsControllerIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/utils/UtilsControllerIntegrationTest.java index edb40e9a1f..5a80e13791 100644 --- a/spring-boot/src/test/java/com/baeldung/utils/UtilsControllerIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/utils/UtilsControllerIntegrationTest.java @@ -22,18 +22,16 @@ public class UtilsControllerIntegrationTest { public void setup() { MockitoAnnotations.initMocks(this); this.mockMvc = MockMvcBuilders.standaloneSetup(utilsController) - .build(); + .build(); } @Test public void givenParameter_setRequestParam_andSetSessionAttribute() throws Exception { String param = "testparam"; - this.mockMvc.perform( - post("/setParam") - .param("param", param) + this.mockMvc.perform(post("/setParam").param("param", param) .sessionAttr("parameter", param)) - .andExpect(status().isOk()); + .andExpect(status().isOk()); } } diff --git a/spring-boot/src/test/java/com/baeldung/websocket/client/MyStompSessionHandlerIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/websocket/client/MyStompSessionHandlerIntegrationTest.java index b52ab5b1d3..4dc4793ce2 100644 --- a/spring-boot/src/test/java/com/baeldung/websocket/client/MyStompSessionHandlerIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/websocket/client/MyStompSessionHandlerIntegrationTest.java @@ -14,8 +14,9 @@ public class MyStompSessionHandlerIntegrationTest { StompHeaders mockHeader = Mockito.mock(StompHeaders.class); MyStompSessionHandler sessionHandler = new MyStompSessionHandler(); sessionHandler.afterConnected(mockSession, mockHeader); - Mockito.verify(mockSession).subscribe("/topic/messages", sessionHandler); - Mockito.verify(mockSession).send(Mockito.anyString(), Mockito.anyObject()); + Mockito.verify(mockSession) + .subscribe("/topic/messages", sessionHandler); + Mockito.verify(mockSession) + .send(Mockito.anyString(), Mockito.anyObject()); } } - diff --git a/spring-boot/src/test/java/org/baeldung/SpringBootApplicationIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/SpringBootApplicationIntegrationTest.java index c5cca3c5fb..358ba942d9 100644 --- a/spring-boot/src/test/java/org/baeldung/SpringBootApplicationIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/SpringBootApplicationIntegrationTest.java @@ -33,36 +33,56 @@ public class SpringBootApplicationIntegrationTest { @Before public void setupMockMvc() { - mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); + mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext) + .build(); } @Test public void givenRequestHasBeenMade_whenMeetsAllOfGivenConditions_thenCorrect() throws Exception { MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); - mockMvc.perform(MockMvcRequestBuilders.get("/entity/all")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)).andExpect(jsonPath("$", hasSize(4))); + mockMvc.perform(MockMvcRequestBuilders.get("/entity/all")) + .andExpect(MockMvcResultMatchers.status() + .isOk()) + .andExpect(MockMvcResultMatchers.content() + .contentType(contentType)) + .andExpect(jsonPath("$", hasSize(4))); } @Test public void givenRequestHasBeenMade_whenMeetsFindByDateOfGivenConditions_thenCorrect() throws Exception { MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); - mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbydate/{date}", "2011-12-03T10:15:30")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)) - .andExpect(jsonPath("$.id", equalTo(1))); + mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbydate/{date}", "2011-12-03T10:15:30")) + .andExpect(MockMvcResultMatchers.status() + .isOk()) + .andExpect(MockMvcResultMatchers.content() + .contentType(contentType)) + .andExpect(jsonPath("$.id", equalTo(1))); } @Test public void givenRequestHasBeenMade_whenMeetsFindByModeOfGivenConditions_thenCorrect() throws Exception { MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); - mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbymode/{mode}", Modes.ALPHA.name())).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)).andExpect(jsonPath("$.id", equalTo(1))); + mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbymode/{mode}", Modes.ALPHA.name())) + .andExpect(MockMvcResultMatchers.status() + .isOk()) + .andExpect(MockMvcResultMatchers.content() + .contentType(contentType)) + .andExpect(jsonPath("$.id", equalTo(1))); } @Test public void givenRequestHasBeenMade_whenMeetsFindByVersionOfGivenConditions_thenCorrect() throws Exception { MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); - mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbyversion").header("Version", "1.0.0")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)) - .andExpect(jsonPath("$.id", equalTo(1))); + mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbyversion") + .header("Version", "1.0.0")) + .andExpect(MockMvcResultMatchers.status() + .isOk()) + .andExpect(MockMvcResultMatchers.content() + .contentType(contentType)) + .andExpect(jsonPath("$.id", equalTo(1))); } } \ No newline at end of file diff --git a/spring-boot/src/test/java/org/baeldung/SpringBootMailIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/SpringBootMailIntegrationTest.java index 10e3d6d60b..0e8a698f41 100644 --- a/spring-boot/src/test/java/org/baeldung/SpringBootMailIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/SpringBootMailIntegrationTest.java @@ -62,11 +62,15 @@ public class SpringBootMailIntegrationTest { } private String getMessage(WiserMessage wiserMessage) throws MessagingException, IOException { - return wiserMessage.getMimeMessage().getContent().toString().trim(); + return wiserMessage.getMimeMessage() + .getContent() + .toString() + .trim(); } private String getSubject(WiserMessage wiserMessage) throws MessagingException { - return wiserMessage.getMimeMessage().getSubject(); + return wiserMessage.getMimeMessage() + .getSubject(); } private SimpleMailMessage composeEmailMessage() { diff --git a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeControllerIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeControllerIntegrationTest.java index 6623a6396f..2146fc09bc 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeControllerIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeControllerIntegrationTest.java @@ -45,9 +45,9 @@ public class EmployeeControllerIntegrationTest { given(service.save(Mockito.anyObject())).willReturn(alex); mvc.perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON) - .content(JsonUtil.toJson(alex))) - .andExpect(status().isCreated()) - .andExpect(jsonPath("$.name", is("alex"))); + .content(JsonUtil.toJson(alex))) + .andExpect(status().isCreated()) + .andExpect(jsonPath("$.name", is("alex"))); verify(service, VerificationModeFactory.times(1)).save(Mockito.anyObject()); reset(service); } @@ -63,11 +63,11 @@ public class EmployeeControllerIntegrationTest { given(service.getAllEmployees()).willReturn(allEmployees); mvc.perform(get("/api/employees").contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(jsonPath("$", hasSize(3))) - .andExpect(jsonPath("$[0].name", is(alex.getName()))) - .andExpect(jsonPath("$[1].name", is(john.getName()))) - .andExpect(jsonPath("$[2].name", is(bob.getName()))); + .andExpect(status().isOk()) + .andExpect(jsonPath("$", hasSize(3))) + .andExpect(jsonPath("$[0].name", is(alex.getName()))) + .andExpect(jsonPath("$[1].name", is(john.getName()))) + .andExpect(jsonPath("$[2].name", is(bob.getName()))); verify(service, VerificationModeFactory.times(1)).getAllEmployees(); reset(service); } diff --git a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRepositoryIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRepositoryIntegrationTest.java index 952ff19707..ebde0e243a 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRepositoryIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRepositoryIntegrationTest.java @@ -65,7 +65,7 @@ public class EmployeeRepositoryIntegrationTest { List allEmployees = employeeRepository.findAll(); assertThat(allEmployees).hasSize(3) - .extracting(Employee::getName) - .containsOnly(alex.getName(), ron.getName(), bob.getName()); + .extracting(Employee::getName) + .containsOnly(alex.getName(), ron.getName(), bob.getName()); } } diff --git a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRestControllerIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRestControllerIntegrationTest.java index c1d8c52eb9..9e5613ab10 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRestControllerIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRestControllerIntegrationTest.java @@ -49,11 +49,11 @@ public class EmployeeRestControllerIntegrationTest { public void whenValidInput_thenCreateEmployee() throws IOException, Exception { Employee bob = new Employee("bob"); mvc.perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON) - .content(JsonUtil.toJson(bob))); + .content(JsonUtil.toJson(bob))); List found = repository.findAll(); assertThat(found).extracting(Employee::getName) - .containsOnly("bob"); + .containsOnly("bob"); } @Test @@ -63,12 +63,12 @@ public class EmployeeRestControllerIntegrationTest { createTestEmployee("alex"); mvc.perform(get("/api/employees").contentType(MediaType.APPLICATION_JSON)) - .andDo(print()) - .andExpect(status().isOk()) - .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$", hasSize(greaterThanOrEqualTo(2)))) - .andExpect(jsonPath("$[0].name", is("bob"))) - .andExpect(jsonPath("$[1].name", is("alex"))); + .andDo(print()) + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(jsonPath("$", hasSize(greaterThanOrEqualTo(2)))) + .andExpect(jsonPath("$[0].name", is("bob"))) + .andExpect(jsonPath("$[1].name", is("alex"))); } private void createTestEmployee(String name) { diff --git a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeServiceImplIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeServiceImplIntegrationTest.java index 5bd6b34c40..9837b02df6 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeServiceImplIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeServiceImplIntegrationTest.java @@ -44,17 +44,17 @@ public class EmployeeServiceImplIntegrationTest { List allEmployees = Arrays.asList(john, bob, alex); Mockito.when(employeeRepository.findByName(john.getName())) - .thenReturn(john); + .thenReturn(john); Mockito.when(employeeRepository.findByName(alex.getName())) - .thenReturn(alex); + .thenReturn(alex); Mockito.when(employeeRepository.findByName("wrong_name")) - .thenReturn(null); + .thenReturn(null); Mockito.when(employeeRepository.findById(john.getId())) - .thenReturn(john); + .thenReturn(john); Mockito.when(employeeRepository.findAll()) - .thenReturn(allEmployees); + .thenReturn(allEmployees); Mockito.when(employeeRepository.findById(-99L)) - .thenReturn(null); + .thenReturn(null); } @Test @@ -62,8 +62,7 @@ public class EmployeeServiceImplIntegrationTest { String name = "alex"; Employee found = employeeService.getEmployeeByName(name); - assertThat(found.getName()) - .isEqualTo(name); + assertThat(found.getName()).isEqualTo(name); } @Test @@ -114,25 +113,25 @@ public class EmployeeServiceImplIntegrationTest { List allEmployees = employeeService.getAllEmployees(); verifyFindAllEmployeesIsCalledOnce(); assertThat(allEmployees).hasSize(3) - .extracting(Employee::getName) - .contains(alex.getName(), john.getName(), bob.getName()); + .extracting(Employee::getName) + .contains(alex.getName(), john.getName(), bob.getName()); } private void verifyFindByNameIsCalledOnce(String name) { Mockito.verify(employeeRepository, VerificationModeFactory.times(1)) - .findByName(name); + .findByName(name); Mockito.reset(employeeRepository); } private void verifyFindByIdIsCalledOnce() { Mockito.verify(employeeRepository, VerificationModeFactory.times(1)) - .findById(Mockito.anyLong()); + .findById(Mockito.anyLong()); Mockito.reset(employeeRepository); } private void verifyFindAllEmployeesIsCalledOnce() { Mockito.verify(employeeRepository, VerificationModeFactory.times(1)) - .findAll(); + .findAll(); Mockito.reset(employeeRepository); } } diff --git a/spring-boot/src/test/java/org/baeldung/client/DetailsServiceClientIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/client/DetailsServiceClientIntegrationTest.java index 5627855aa3..0f6c13ae1f 100644 --- a/spring-boot/src/test/java/org/baeldung/client/DetailsServiceClientIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/client/DetailsServiceClientIntegrationTest.java @@ -30,7 +30,8 @@ public class DetailsServiceClientIntegrationTest { @Before public void setUp() throws Exception { String detailsString = objectMapper.writeValueAsString(new Details("John Smith", "john")); - this.server.expect(requestTo("/john/details")).andRespond(withSuccess(detailsString, MediaType.APPLICATION_JSON)); + this.server.expect(requestTo("/john/details")) + .andRespond(withSuccess(detailsString, MediaType.APPLICATION_JSON)); } @Test diff --git a/spring-boot/src/test/java/org/baeldung/jsoncomponent/UserJsonSerializerIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/jsoncomponent/UserJsonSerializerIntegrationTest.java index c1b4c8912c..ac47c5e5d9 100644 --- a/spring-boot/src/test/java/org/baeldung/jsoncomponent/UserJsonSerializerIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/jsoncomponent/UserJsonSerializerIntegrationTest.java @@ -1,6 +1,5 @@ package org.baeldung.jsoncomponent; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import javafx.scene.paint.Color; diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index e36f5265b2..44e72535f8 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -15,6 +15,7 @@ spring-cloud-ribbon-client spring-cloud-rest spring-cloud-zookeeper + spring-cloud-gateway pom diff --git a/spring-cloud/spring-cloud-gateway/README.MD b/spring-cloud/spring-cloud-gateway/README.MD new file mode 100644 index 0000000000..48fbf41b8e --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/README.MD @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Explore the new Spring Cloud Gateway](http://www.baeldung.com/spring-cloud-gateway) diff --git a/spring-cloud/spring-cloud-gateway/gateway-service/pom.xml b/spring-cloud/spring-cloud-gateway/gateway-service/pom.xml new file mode 100644 index 0000000000..14cde4901a --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/gateway-service/pom.xml @@ -0,0 +1,79 @@ + + 4.0.0 + + gateway-service + 1.0.0-SNAPSHOT + jar + + Spring Cloud Gateway Service + + + com.baeldung.spring.cloud + spring-cloud-gateway + 1.0.0-SNAPSHOT + .. + + + + 2.0.0.M2 + + + + + org.springframework.boot + spring-boot-actuator + ${version} + + + org.springframework.boot + spring-boot-starter-webflux + ${version} + + + org.springframework.cloud + spring-cloud-gateway-core + ${version} + + + org.springframework.cloud + spring-cloud-starter-eureka + ${version} + + + org.hibernate + hibernate-validator-cdi + 6.0.2.Final + + + javax.validation + validation-api + 2.0.0.Final + + + io.projectreactor.ipc + reactor-netty + 0.7.0.M1 + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/gateway-service/src/main/java/com/baeldung/spring/cloud/GatewayApplication.java b/spring-cloud/spring-cloud-gateway/gateway-service/src/main/java/com/baeldung/spring/cloud/GatewayApplication.java new file mode 100644 index 0000000000..4d5f61315f --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/gateway-service/src/main/java/com/baeldung/spring/cloud/GatewayApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.spring.cloud; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class GatewayApplication { + + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class, args); + } +} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/gateway-service/src/main/resources/application.yml b/spring-cloud/spring-cloud-gateway/gateway-service/src/main/resources/application.yml new file mode 100644 index 0000000000..8b981f8071 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/gateway-service/src/main/resources/application.yml @@ -0,0 +1,13 @@ +server: + port: 80 +spring: + cloud: + gateway: + routes: + - id: baeldung_route + uri: http://www.baeldung.com + predicates: + - Path=/baeldung +management: + security: + enabled: false \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/pom.xml b/spring-cloud/spring-cloud-gateway/pom.xml new file mode 100644 index 0000000000..095ca4ea31 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + com.baeldung.spring.cloud + spring-cloud-gateway + 1.0.0-SNAPSHOT + + gateway-service + + pom + + Spring Cloud Gateway + + + com.baeldung.spring.cloud + spring-cloud + 1.0.0-SNAPSHOT + .. + + + + UTF-8 + 3.6.0 + 1.4.2.RELEASE + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 1.8 + 1.8 + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} + + + + + diff --git a/spring-hibernate5/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationMainIntegrationTest.java b/spring-hibernate5/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationMainIntegrationTest.java index 2ec1246961..9a536a0f80 100644 --- a/spring-hibernate5/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationMainIntegrationTest.java +++ b/spring-hibernate5/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationMainIntegrationTest.java @@ -47,8 +47,8 @@ public class HibernateManyToManyAnnotationMainIntegrationTest { Employee employee = new Employee(emp.split(" ")[0], emp.split(" ")[1]); assertEquals(0, employee.getProjects().size()); employee.setProjects(projects); - assertNotNull(employee); session.persist(employee); + assertNotNull(employee); } } diff --git a/spring-ldap/README.md b/spring-ldap/README.md index f77572d982..e2517b9d4b 100644 --- a/spring-ldap/README.md +++ b/spring-ldap/README.md @@ -4,6 +4,7 @@ - [Spring LDAP Overview](http://www.baeldung.com/spring-ldap) - [Spring LDAP Example Project](http://www.baeldung.com/spring-ldap-overview/) +- [Guide to Spring Data LDAP](http://www.baeldung.com/spring-data-ldap) diff --git a/spring-ldap/pom.xml b/spring-ldap/pom.xml index 05baf8c66d..2f806e89f8 100644 --- a/spring-ldap/pom.xml +++ b/spring-ldap/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung spring-ldap 0.1-SNAPSHOT jar diff --git a/spring-ldap/src/test/java/com/baeldung/ldap/client/LdapDataRepositoryTest.java b/spring-ldap/src/test/java/com/baeldung/ldap/client/LdapDataRepositoryIntegrationTest.java similarity index 95% rename from spring-ldap/src/test/java/com/baeldung/ldap/client/LdapDataRepositoryTest.java rename to spring-ldap/src/test/java/com/baeldung/ldap/client/LdapDataRepositoryIntegrationTest.java index 9f38af9263..a7c0380867 100644 --- a/spring-ldap/src/test/java/com/baeldung/ldap/client/LdapDataRepositoryTest.java +++ b/spring-ldap/src/test/java/com/baeldung/ldap/client/LdapDataRepositoryIntegrationTest.java @@ -1,67 +1,67 @@ -package com.baeldung.ldap.client; - -import com.baeldung.ldap.data.service.UserService; -import com.baeldung.ldap.javaconfig.TestConfig; -import org.hamcrest.Matchers; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; - -@RunWith(SpringJUnit4ClassRunner.class) -@ActiveProfiles("testlive") -@ContextConfiguration(classes = {TestConfig.class}, loader = AnnotationConfigContextLoader.class) -public class LdapDataRepositoryTest { - - private static final String USER2 = "TEST02"; - private static final String USER3 = "TEST03"; - private static final String USER4 = "TEST04"; - - private static final String USER2_PWD = "TEST02"; - private static final String USER3_PWD = "TEST03"; - private static final String USER4_PWD = "TEST04"; - - private static final String SEARCH_STRING = "TEST*"; - - @Autowired - private UserService userService; - - @Test - public void givenLdapClient_whenCorrectCredentials_thenSuccessfulLogin() { - Boolean isValid = userService.authenticate(USER3, USER3_PWD); - assertEquals(true, isValid); - } - - @Test - public void givenLdapClient_whenIncorrectCredentials_thenFailedLogin() { - Boolean isValid = userService.authenticate(USER3, USER2_PWD); - assertEquals(false, isValid); - } - - @Test - public void givenLdapClient_whenCorrectSearchFilter_thenEntriesReturned() { - List userList = userService.search(SEARCH_STRING); - assertThat(userList, Matchers.containsInAnyOrder(USER2, USER3)); - } - - @Test - public void givenLdapClientNotExists_whenDataProvided_thenNewUserCreated() { - userService.create(USER4, USER4_PWD); - userService.authenticate(USER4, USER4_PWD); - } - - @Test - public void givenLdapClientExists_whenDataProvided_thenExistingUserModified() { - userService.modify(USER2, USER3_PWD); - userService.authenticate(USER2, USER3_PWD); - } - -} +package com.baeldung.ldap.client; + +import com.baeldung.ldap.data.service.UserService; +import com.baeldung.ldap.javaconfig.TestConfig; +import org.hamcrest.Matchers; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + +@RunWith(SpringJUnit4ClassRunner.class) +@ActiveProfiles("testlive") +@ContextConfiguration(classes = {TestConfig.class}, loader = AnnotationConfigContextLoader.class) +public class LdapDataRepositoryIntegrationTest { + + private static final String USER2 = "TEST02"; + private static final String USER3 = "TEST03"; + private static final String USER4 = "TEST04"; + + private static final String USER2_PWD = "TEST02"; + private static final String USER3_PWD = "TEST03"; + private static final String USER4_PWD = "TEST04"; + + private static final String SEARCH_STRING = "TEST*"; + + @Autowired + private UserService userService; + + @Test + public void givenLdapClient_whenCorrectCredentials_thenSuccessfulLogin() { + Boolean isValid = userService.authenticate(USER3, USER3_PWD); + assertEquals(true, isValid); + } + + @Test + public void givenLdapClient_whenIncorrectCredentials_thenFailedLogin() { + Boolean isValid = userService.authenticate(USER3, USER2_PWD); + assertEquals(false, isValid); + } + + @Test + public void givenLdapClient_whenCorrectSearchFilter_thenEntriesReturned() { + List userList = userService.search(SEARCH_STRING); + assertThat(userList, Matchers.containsInAnyOrder(USER2, USER3)); + } + + @Test + public void givenLdapClientNotExists_whenDataProvided_thenNewUserCreated() { + userService.create(USER4, USER4_PWD); + userService.authenticate(USER4, USER4_PWD); + } + + @Test + public void givenLdapClientExists_whenDataProvided_thenExistingUserModified() { + userService.modify(USER2, USER3_PWD); + userService.authenticate(USER2, USER3_PWD); + } + +} diff --git a/spring-mustache/src/main/java/com/baeldung/springmustache/SpringMustacheApplication.java b/spring-mustache/src/main/java/com/baeldung/springmustache/SpringMustacheApplication.java index addd1fa088..8cdf89d08a 100644 --- a/spring-mustache/src/main/java/com/baeldung/springmustache/SpringMustacheApplication.java +++ b/spring-mustache/src/main/java/com/baeldung/springmustache/SpringMustacheApplication.java @@ -1,5 +1,6 @@ package com.baeldung.springmustache; +import com.samskivert.mustache.Mustache; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.mustache.MustacheEnvironmentCollector; @@ -7,8 +8,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.core.env.Environment; -import com.samskivert.mustache.Mustache; - @SpringBootApplication @ComponentScan(basePackages = {"com.baeldung"}) public class SpringMustacheApplication { @@ -23,11 +22,10 @@ public class SpringMustacheApplication { MustacheEnvironmentCollector collector = new MustacheEnvironmentCollector(); collector.setEnvironment(environment); - Mustache.Compiler compiler = Mustache.compiler() + return Mustache.compiler() .defaultValue("Some Default Value") .withLoader(templateLoader) .withCollector(collector); - return compiler; } } diff --git a/spring-mustache/src/main/java/com/baeldung/springmustache/controller/ArticleController.java b/spring-mustache/src/main/java/com/baeldung/springmustache/controller/ArticleController.java index b24625e7d5..5fc34c9f07 100644 --- a/spring-mustache/src/main/java/com/baeldung/springmustache/controller/ArticleController.java +++ b/spring-mustache/src/main/java/com/baeldung/springmustache/controller/ArticleController.java @@ -1,31 +1,26 @@ package com.baeldung.springmustache.controller; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import java.util.stream.IntStream; - +import com.baeldung.springmustache.model.Article; import org.fluttercode.datafactory.impl.DataFactory; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; -import com.baeldung.springmustache.model.Article; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.IntStream; @Controller public class ArticleController { - @RequestMapping("/article") + @GetMapping("/article") public ModelAndView displayArticle(Map model) { - List
articles = new LinkedList<>(); - IntStream.range(0, 10) - .forEach(count -> { - articles.add(generateArticle("Article Title " + count)); - }); + List
articles = IntStream.range(0, 10) + .mapToObj(i -> generateArticle("Article Title " + i)) + .collect(Collectors.toList()); Map modelMap = new HashMap<>(); modelMap.put("articles", articles); diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/BeanA.java b/spring-mvc-java/src/main/java/com/baeldung/web/BeanA.java index 79fac724f7..60da29f354 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/web/BeanA.java +++ b/spring-mvc-java/src/main/java/com/baeldung/web/BeanA.java @@ -12,5 +12,4 @@ public class BeanA { public BeanA() { super(); } - } diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/BeanB.java b/spring-mvc-java/src/main/java/com/baeldung/web/BeanB.java index 05c9560a0c..9e713d59ab 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/web/BeanB.java +++ b/spring-mvc-java/src/main/java/com/baeldung/web/BeanB.java @@ -8,5 +8,4 @@ public class BeanB { public BeanB() { super(); } - } diff --git a/spring-mvc-kotlin/pom.xml b/spring-mvc-kotlin/pom.xml index 5375ecae7c..2d1dac5e29 100644 --- a/spring-mvc-kotlin/pom.xml +++ b/spring-mvc-kotlin/pom.xml @@ -35,9 +35,21 @@ 4.3.10.RELEASE - javax.servlet - jstl - 1.2 + org.thymeleaf + thymeleaf + 3.0.7.RELEASE + + + + org.thymeleaf + thymeleaf-spring4 + 3.0.7.RELEASE + + + org.springframework + spring-test + 4.3.10.RELEASE + test @@ -49,7 +61,12 @@ kotlin-maven-plugin org.jetbrains.kotlin 1.1.4 - + + + spring + + 1.8 + compile @@ -58,7 +75,6 @@ compile - test-compile test-compile @@ -67,6 +83,13 @@ + + + org.jetbrains.kotlin + kotlin-maven-allopen + 1.1.4-3 + + diff --git a/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/allopen/SimpleConfiguration.kt b/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/allopen/SimpleConfiguration.kt new file mode 100644 index 0000000000..5d0a3e13bf --- /dev/null +++ b/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/allopen/SimpleConfiguration.kt @@ -0,0 +1,7 @@ +package com.baeldung.kotlin.allopen + +import org.springframework.context.annotation.Configuration + +@Configuration +class SimpleConfiguration { +} \ No newline at end of file diff --git a/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/mvc/ApplicationWebConfig.kt b/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/mvc/ApplicationWebConfig.kt index 4907e46efb..23aadf282a 100644 --- a/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/mvc/ApplicationWebConfig.kt +++ b/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/mvc/ApplicationWebConfig.kt @@ -1,21 +1,26 @@ package com.baeldung.kotlin.mvc +import org.springframework.context.ApplicationContext +import org.springframework.context.ApplicationContextAware import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration -import org.springframework.web.servlet.ViewResolver import org.springframework.web.servlet.config.annotation.EnableWebMvc import org.springframework.web.servlet.config.annotation.ViewControllerRegistry import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter -import org.springframework.web.servlet.view.InternalResourceViewResolver -import org.springframework.web.servlet.view.JstlView - - - - +import org.thymeleaf.spring4.SpringTemplateEngine +import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver +import org.thymeleaf.spring4.view.ThymeleafViewResolver +import org.thymeleaf.templatemode.TemplateMode @EnableWebMvc @Configuration -open class ApplicationWebConfig: WebMvcConfigurerAdapter() { +open class ApplicationWebConfig : WebMvcConfigurerAdapter(), ApplicationContextAware { + + private var applicationContext: ApplicationContext? = null + + override fun setApplicationContext(applicationContext: ApplicationContext?) { + this.applicationContext = applicationContext + } override fun addViewControllers(registry: ViewControllerRegistry?) { super.addViewControllers(registry) @@ -24,14 +29,24 @@ open class ApplicationWebConfig: WebMvcConfigurerAdapter() { } @Bean - open fun viewResolver(): ViewResolver { - val bean = InternalResourceViewResolver() - - bean.setViewClass(JstlView::class.java) - bean.setPrefix("/WEB-INF/view/") - bean.setSuffix(".jsp") - - return bean + open fun templateResolver(): SpringResourceTemplateResolver { + return SpringResourceTemplateResolver() + .apply { prefix = "/WEB-INF/view/" } + .apply { suffix = ".html"} + .apply { templateMode = TemplateMode.HTML } + .apply { setApplicationContext(applicationContext) } } + @Bean + open fun templateEngine(): SpringTemplateEngine { + return SpringTemplateEngine() + .apply { setTemplateResolver(templateResolver()) } + } + + @Bean + open fun viewResolver(): ThymeleafViewResolver { + return ThymeleafViewResolver() + .apply { templateEngine = templateEngine() } + .apply { order = 1 } + } } \ No newline at end of file diff --git a/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/mvc/ApplicationWebInitializer.kt b/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/mvc/ApplicationWebInitializer.kt index a4d1614271..4c1a35823c 100644 --- a/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/mvc/ApplicationWebInitializer.kt +++ b/spring-mvc-kotlin/src/main/kotlin/com/baeldung/kotlin/mvc/ApplicationWebInitializer.kt @@ -1,9 +1,8 @@ package com.baeldung.kotlin.mvc -import com.baeldung.kotlin.mvc.ApplicationWebConfig import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer -class ApplicationWebInitializer: AbstractAnnotationConfigDispatcherServletInitializer() { +class ApplicationWebInitializer : AbstractAnnotationConfigDispatcherServletInitializer() { override fun getRootConfigClasses(): Array>? { return null diff --git a/spring-mvc-kotlin/src/main/webapp/WEB-INF/spring-web-config.xml b/spring-mvc-kotlin/src/main/webapp/WEB-INF/spring-web-config.xml index ffe83a66fa..c7f110ea94 100644 --- a/spring-mvc-kotlin/src/main/webapp/WEB-INF/spring-web-config.xml +++ b/spring-mvc-kotlin/src/main/webapp/WEB-INF/spring-web-config.xml @@ -12,13 +12,26 @@ - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-mvc-kotlin/src/test/kotlin/com/baeldung/kotlin/allopen/SimpleConfigurationTest.kt b/spring-mvc-kotlin/src/test/kotlin/com/baeldung/kotlin/allopen/SimpleConfigurationTest.kt new file mode 100644 index 0000000000..65a60c7157 --- /dev/null +++ b/spring-mvc-kotlin/src/test/kotlin/com/baeldung/kotlin/allopen/SimpleConfigurationTest.kt @@ -0,0 +1,19 @@ +package com.baeldung.kotlin.allopen + +import org.junit.Test +import org.junit.runner.RunWith +import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner +import org.springframework.test.context.support.AnnotationConfigContextLoader + +@RunWith(SpringJUnit4ClassRunner::class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader::class, + classes = arrayOf(SimpleConfiguration::class)) +class SimpleConfigurationTest { + + @Test + fun contextLoads() { + } + +} \ No newline at end of file diff --git a/spring-mvc-simple/README.md b/spring-mvc-simple/README.md index ffb02c846a..197a22cbac 100644 --- a/spring-mvc-simple/README.md +++ b/spring-mvc-simple/README.md @@ -1,3 +1,4 @@ ## Relevant articles: - [HandlerAdapters in Spring MVC](http://www.baeldung.com/spring-mvc-handler-adapters) +- [Template Engines for Spring](http://www.baeldung.com/spring-template-engines) diff --git a/spring-rest-angular/README.md b/spring-rest-angular/README.md new file mode 100644 index 0000000000..3c1b418d95 --- /dev/null +++ b/spring-rest-angular/README.md @@ -0,0 +1,4 @@ +## Spring REST Angular Example Project + +### Relevant Articles: + diff --git a/spring-rest-angular/pom.xml b/spring-rest-angular/pom.xml index 06741bfd0c..3fc429f626 100644 --- a/spring-rest-angular/pom.xml +++ b/spring-rest-angular/pom.xml @@ -1,11 +1,10 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 spring-rest-angular spring-rest-angular - com.baeldung 1.0 war @@ -95,6 +94,7 @@ **/*IntegrationTest.java + **/*UnitTest.java @@ -113,6 +113,7 @@ 19.0 3.5 + org.baeldung.web.main.Application diff --git a/spring-rest-angular/src/test/java/org/baeldung/web/service/StudentServiceIntegrationTest.java b/spring-rest-angular/src/test/java/org/baeldung/web/service/StudentServiceIntegrationTest.java index 48c985fb9d..4d65c02fff 100644 --- a/spring-rest-angular/src/test/java/org/baeldung/web/service/StudentServiceIntegrationTest.java +++ b/spring-rest-angular/src/test/java/org/baeldung/web/service/StudentServiceIntegrationTest.java @@ -1,10 +1,5 @@ package org.baeldung.web.service; -import static io.restassured.RestAssured.given; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsCollectionContaining.hasItems; -import static org.hamcrest.core.IsEqual.equalTo; - import org.apache.commons.lang3.RandomStringUtils; import org.baeldung.web.main.Application; import org.junit.Test; @@ -13,6 +8,11 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.test.context.junit4.SpringRunner; +import static io.restassured.RestAssured.given; +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsCollectionContaining.hasItems; +import static org.hamcrest.core.IsEqual.equalTo; + @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.DEFINED_PORT) public class StudentServiceIntegrationTest { @@ -21,7 +21,8 @@ public class StudentServiceIntegrationTest { @Test public void givenRequestForStudents_whenPageIsOne_expectContainsNames() { - given().params("page", "0", "size", "2").get(ENDPOINT).then().assertThat().body("content.name", hasItems("Bryan", "Ben")); + given().params("page", "0", "size", "2").get(ENDPOINT).then().assertThat() + .body("content.name", hasItems("Bryan", "Ben")); } @Test @@ -58,5 +59,4 @@ public class StudentServiceIntegrationTest { public void givenResourcesExist_whenFirstPageIsRetrieved_thenPageContainsResources() { given().params("page", "0", "size", "2").get(ENDPOINT).then().assertThat().body("first", equalTo(true)); } - } diff --git a/spring-rest/README.md b/spring-rest/README.md index 2cea315188..7c0ba325b7 100644 --- a/spring-rest/README.md +++ b/spring-rest/README.md @@ -16,3 +16,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [HTTP PUT vs HTTP PATCH in a REST API](http://www.baeldung.com/http-put-patch-difference-spring) - [Exploring the Spring Boot TestRestTemplate](http://www.baeldung.com/spring-boot-testresttemplate) - [Spring – Log Incoming Requests](http://www.baeldung.com/spring-http-logging) +- [RequestBody and ResponseBody Annotations](http://www.baeldung.com/requestbody-and-responsebody-annotations) diff --git a/spring-rest/pom.xml b/spring-rest/pom.xml index 6065d7e529..06747ffd41 100644 --- a/spring-rest/pom.xml +++ b/spring-rest/pom.xml @@ -199,7 +199,6 @@ cargo-maven2-plugin ${cargo-maven2-plugin.version} - true tomcat8x embedded @@ -240,6 +239,7 @@ **/*IntegrationTest.java + **/*UnitTest.java diff --git a/spring-rest/src/main/java/com/baeldung/controllers/ExamplePostController.java b/spring-rest/src/main/java/com/baeldung/controllers/ExamplePostController.java new file mode 100644 index 0000000000..93f96756b4 --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/controllers/ExamplePostController.java @@ -0,0 +1,38 @@ +package com.baeldung.controllers; + +import com.baeldung.services.ExampleService; +import com.baeldung.transfer.ResponseTransfer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import com.baeldung.transfer.LoginForm; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +@RequestMapping("/post") +public class ExamplePostController { + + private static Logger log = LoggerFactory.getLogger(ExamplePostController.class); + + @Autowired ExampleService exampleService; + + @PostMapping("/request") + public ResponseEntity postController(@RequestBody LoginForm loginForm) { + log.debug("POST received - serializing LoginForm: " + loginForm.getPassword() + " " + loginForm.getUsername()); + exampleService.fakeAuthenticate(loginForm); + return ResponseEntity.ok(HttpStatus.OK); + } + + @PostMapping("/response") + @ResponseBody + public ResponseTransfer postResponseController(@RequestBody LoginForm loginForm) { + log.debug("POST received - serializing LoginForm: " + loginForm.getPassword() + " " + loginForm.getUsername()); + return new ResponseTransfer("Thanks For Posting!!!"); + } +} \ No newline at end of file diff --git a/spring-rest/src/main/java/com/baeldung/controllers/ViewController.java b/spring-rest/src/main/java/com/baeldung/controllers/ViewController.java new file mode 100644 index 0000000000..8eab0ce6da --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/controllers/ViewController.java @@ -0,0 +1,14 @@ +package com.baeldung.controllers; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class ViewController { + + @GetMapping("/") + public String welcome() { + return "index"; + } + +} diff --git a/spring-rest/src/main/java/com/baeldung/services/ExampleService.java b/spring-rest/src/main/java/com/baeldung/services/ExampleService.java new file mode 100644 index 0000000000..48d98b41db --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/services/ExampleService.java @@ -0,0 +1,12 @@ +package com.baeldung.services; + +import com.baeldung.transfer.LoginForm; +import org.springframework.stereotype.Service; + +@Service +public class ExampleService { + + public boolean fakeAuthenticate(LoginForm lf) { + return true; + } +} \ No newline at end of file diff --git a/spring-rest/src/main/java/com/baeldung/transfer/LoginForm.java b/spring-rest/src/main/java/com/baeldung/transfer/LoginForm.java new file mode 100644 index 0000000000..19c9b0a349 --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/transfer/LoginForm.java @@ -0,0 +1,25 @@ +package com.baeldung.transfer; + +public class LoginForm { + private String username; + private String password; + + public LoginForm() { + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} \ No newline at end of file diff --git a/spring-rest/src/main/java/com/baeldung/transfer/ResponseTransfer.java b/spring-rest/src/main/java/com/baeldung/transfer/ResponseTransfer.java new file mode 100644 index 0000000000..d4fb282c1b --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/transfer/ResponseTransfer.java @@ -0,0 +1,18 @@ +package com.baeldung.transfer; + +public class ResponseTransfer { + + private String text; + + public ResponseTransfer(String text) { + this.setText(text); + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } +} \ No newline at end of file diff --git a/spring-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerRequestUnitTest.java b/spring-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerRequestUnitTest.java new file mode 100644 index 0000000000..c20f968704 --- /dev/null +++ b/spring-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerRequestUnitTest.java @@ -0,0 +1,56 @@ +package com.baeldung.controllers; + +import com.baeldung.services.ExampleService; +import com.baeldung.transfer.LoginForm; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.baeldung.config.MainApplication; + +import static org.mockito.Mockito.when; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = MainApplication.class) +public class ExamplePostControllerRequestUnitTest { + + MockMvc mockMvc; + @Mock private ExampleService exampleService; + @InjectMocks private ExamplePostController exampleController; + private final String jsonBody = "{\"username\": \"username\", \"password\": \"password\"}"; + private LoginForm lf = new LoginForm(); + + @Before + public void preTest() { + MockitoAnnotations.initMocks(this); + mockMvc = MockMvcBuilders + .standaloneSetup(exampleController) + .build(); + lf.setPassword("password"); + lf.setUsername("username"); + } + + @Test + public void requestBodyTest() { + try { + when(exampleService.fakeAuthenticate(lf)).thenReturn(true); + mockMvc + .perform(post("/post/request") + .content(jsonBody) + .contentType("application/json")) + .andDo(print()) + .andExpect(status().isOk()); + } catch (Exception e) { + System.out.println("Exception: " + e); + } + } +} \ No newline at end of file diff --git a/spring-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerResponseUnitTest.java b/spring-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerResponseUnitTest.java new file mode 100644 index 0000000000..3d09622c47 --- /dev/null +++ b/spring-rest/src/test/java/com/baeldung/controllers/ExamplePostControllerResponseUnitTest.java @@ -0,0 +1,59 @@ +package com.baeldung.controllers; + +import com.baeldung.services.ExampleService; +import com.baeldung.transfer.LoginForm; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; + +import static org.mockito.Mockito.when; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import org.baeldung.config.MainApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = MainApplication.class) +public class ExamplePostControllerResponseUnitTest { + + MockMvc mockMvc; + @Mock private ExampleService exampleService; + @InjectMocks private ExamplePostController exampleController; + private final String jsonBody = "{\"username\": \"username\", \"password\": \"password\"}"; + private LoginForm lf = new LoginForm(); + + @Before + public void preTest() { + MockitoAnnotations.initMocks(this); + mockMvc = MockMvcBuilders + .standaloneSetup(exampleController) + .build(); + lf.setPassword("password"); + lf.setUsername("username"); + } + + @Test + public void requestBodyTest() { + try { + when(exampleService.fakeAuthenticate(lf)).thenReturn(true); + mockMvc + .perform(post("/post/response") + .content(jsonBody) + .contentType("application/json")) + .andDo(print()) + .andExpect(status().isOk()) + .andExpect(content().json("{\"text\":\"Thanks For Posting!!!\"}")); + } catch (Exception e) { + System.out.println("Exception: " + e); + } + } +} \ No newline at end of file diff --git a/spring-security-mvc-boot/README.MD b/spring-security-mvc-boot/README.MD index feda6efcd7..32976b0896 100644 --- a/spring-security-mvc-boot/README.MD +++ b/spring-security-mvc-boot/README.MD @@ -8,3 +8,4 @@ The "REST With Spring" Classes: http://github.learnspringsecurity.com - [Two Login Pages with Spring Security](http://www.baeldung.com/spring-security-two-login-pages) - [Multiple Entry Points in Spring Security](http://www.baeldung.com/spring-security-multiple-entry-points) - [Multiple Authentication Providers in Spring Security](http://www.baeldung.com/spring-security-multiple-auth-providers) +- [Granted Authority Versus Role in Spring Security](http://www.baeldung.com/spring-security-granted-authority-vs-role) diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/CustomAuthenticationProvider.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/CustomAuthenticationProvider.java new file mode 100644 index 0000000000..d7195ac358 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/CustomAuthenticationProvider.java @@ -0,0 +1,38 @@ +package org.baeldung.rolesauthorities; + +import org.baeldung.rolesauthorities.model.User; +import org.baeldung.rolesauthorities.persistence.UserRepository; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.authentication.dao.DaoAuthenticationProvider; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.userdetails.UserDetailsService; + +public class CustomAuthenticationProvider extends DaoAuthenticationProvider { + + private final UserRepository userRepository; + @SuppressWarnings("unused") + private UserDetailsService userDetailsService; + + public CustomAuthenticationProvider(UserRepository userRepository, UserDetailsService userDetailsService){ + super(); + this.setUserDetailsService(userDetailsService); + this.userRepository = userRepository; + } + + @Override + public Authentication authenticate(Authentication auth) throws AuthenticationException { + final User user = userRepository.findByEmail(auth.getName()); + if ((user == null)) { + throw new BadCredentialsException("Invalid username or password"); + } + final Authentication result = super.authenticate(auth); + return new UsernamePasswordAuthenticationToken(user, result.getCredentials(), result.getAuthorities()); + } + + @Override + public boolean supports(Class authentication) { + return authentication.equals(UsernamePasswordAuthenticationToken.class); + } +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyLogoutSuccessHandler.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyLogoutSuccessHandler.java new file mode 100644 index 0000000000..b0dc0b7537 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyLogoutSuccessHandler.java @@ -0,0 +1,26 @@ +package org.baeldung.rolesauthorities; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; +import org.springframework.stereotype.Component; + +@Component("myLogoutSuccessHandler") +public class MyLogoutSuccessHandler implements LogoutSuccessHandler { + + @Override + public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { + final HttpSession session = request.getSession(); + if (session != null) { + session.removeAttribute("user"); + } + + response.sendRedirect("/"); + } +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyUserDetailsService.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyUserDetailsService.java new file mode 100644 index 0000000000..f38b867a75 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/MyUserDetailsService.java @@ -0,0 +1,61 @@ +package org.baeldung.rolesauthorities; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +import org.baeldung.rolesauthorities.model.Role; +import org.baeldung.rolesauthorities.model.User; +import org.baeldung.rolesauthorities.persistence.UserRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service("userDetailsService") +@Transactional +public class MyUserDetailsService implements UserDetailsService { + + @Autowired + private UserRepository userRepository; + + public MyUserDetailsService() { + super(); + } + + // API + + @Override + public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException { + + try { + User user = userRepository.findByEmail(email); + if (user == null) { + throw new UsernameNotFoundException("No user found with username: " + email); + } + org.springframework.security.core.userdetails.User userDetails = new org.springframework.security.core.userdetails.User(user.getEmail(), user.getPassword(), user.isEnabled(), true, true, true, getAuthorities(user.getRoles())); + return userDetails; + } catch (final Exception e) { + throw new RuntimeException(e); + } + } + + // UTIL + + private final Collection getAuthorities(Collection roles) { + List authorities = new ArrayList(); + for (Role role: roles) { + authorities.add(new SimpleGrantedAuthority(role.getName())); + authorities.addAll(role.getPrivileges() + .stream() + .map(p -> new SimpleGrantedAuthority(p.getName())) + .collect(Collectors.toList())); + } + return authorities; + } +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/RolesAuthoritiesApplication.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/RolesAuthoritiesApplication.java new file mode 100644 index 0000000000..1c55c145b3 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/RolesAuthoritiesApplication.java @@ -0,0 +1,17 @@ +package org.baeldung.rolesauthorities; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.web.support.SpringBootServletInitializer; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableAutoConfiguration +@ComponentScan("org.baeldung.rolesauthorities") +public class RolesAuthoritiesApplication extends SpringBootServletInitializer { + public static void main(String[] args) { + System.setProperty("spring.profiles.default", "rolesauthorities"); + SpringApplication.run(RolesAuthoritiesApplication.class, args); + } +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/MvcConfig.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/MvcConfig.java new file mode 100644 index 0000000000..d2edfed749 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/MvcConfig.java @@ -0,0 +1,47 @@ +package org.baeldung.rolesauthorities.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; +import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +@Configuration +@EnableWebMvc +public class MvcConfig extends WebMvcConfigurerAdapter { + + public MvcConfig() { + super(); + } + + // + @Bean + public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { + return new PropertySourcesPlaceholderConfigurer(); + } + + @Override + public void configureDefaultServletHandling(final DefaultServletHandlerConfigurer configurer) { + configurer.enable(); + } + + @Override + public void addViewControllers(final ViewControllerRegistry registry) { + super.addViewControllers(registry); + registry.addViewController("/").setViewName("forward:/home"); + registry.addViewController("/protectedbynothing").setViewName("rolesauthorities/protectedbynothing"); + registry.addViewController("/protectedbyrole").setViewName("rolesauthorities/protectedbyrole"); + registry.addViewController("/protectedbyauthority").setViewName("rolesauthorities/protectedbyauthority"); + registry.addViewController("/login").setViewName("rolesauthorities/login"); + registry.addViewController("/home").setViewName("rolesauthorities/home"); + registry.addViewController("/logout"); + } + + @Override + public void addResourceHandlers(final ResourceHandlerRegistry registry) { + registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); + } +} \ No newline at end of file diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/SecurityConfig.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/SecurityConfig.java new file mode 100644 index 0000000000..7624dd7d39 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/config/SecurityConfig.java @@ -0,0 +1,90 @@ +package org.baeldung.rolesauthorities.config; + +import org.baeldung.rolesauthorities.CustomAuthenticationProvider; +import org.baeldung.rolesauthorities.persistence.UserRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.authentication.dao.DaoAuthenticationProvider; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; + +@Configuration +@ComponentScan(basePackages = { "org.baeldung.rolesauthorities" }) +@EnableWebSecurity +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Autowired + private UserRepository userRepository; + + @Autowired + private UserDetailsService userDetailsService; + + @Autowired + private LogoutSuccessHandler myLogoutSuccessHandler; + + public SecurityConfig() { + super(); + } + + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception { + auth.authenticationProvider(authProvider()); + } + + @Override + public void configure(WebSecurity web) throws Exception { + web.ignoring() + .antMatchers("/resources/**"); + } + + + @Override + protected void configure(HttpSecurity http) throws Exception { + + // @formatter:off + http + .csrf().disable() + .authorizeRequests() + .antMatchers("/login*", "/logout*", "/protectedbynothing*", "/home*").permitAll() + .antMatchers("/protectedbyrole").hasRole("USER") + .antMatchers("/protectedbyauthority").hasAuthority("READ_PRIVILEGE") + .and() + .formLogin() + .loginPage("/login") + .failureUrl("/login?error=true") + .permitAll() + .and() + .logout() + .logoutSuccessHandler(myLogoutSuccessHandler) + .invalidateHttpSession(false) + .logoutSuccessUrl("/logout.html?logSucc=true") + .deleteCookies("JSESSIONID") + .permitAll(); + // @formatter:on + } + + // beans + + @Bean + public DaoAuthenticationProvider authProvider() { + final CustomAuthenticationProvider authProvider + = new CustomAuthenticationProvider(userRepository, userDetailsService); + authProvider.setPasswordEncoder(encoder()); + return authProvider; + } + + @Bean + public PasswordEncoder encoder() { + return new BCryptPasswordEncoder(11); + } + +} \ No newline at end of file diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Privilege.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Privilege.java new file mode 100644 index 0000000000..ab2cd08610 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Privilege.java @@ -0,0 +1,89 @@ +package org.baeldung.rolesauthorities.model; + +import java.util.Collection; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToMany; + +@Entity +public class Privilege { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + private String name; + + @ManyToMany(mappedBy = "privileges") + private Collection roles; + + public Privilege() { + super(); + } + + public Privilege(String name) { + super(); + this.name = name; + } + + // + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Collection getRoles() { + return roles; + } + + public void setRoles(Collection roles) { + this.roles = roles; + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Privilege other = (Privilege) obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Privilege [name=").append(name).append("]").append("[id=").append(id).append("]"); + return builder.toString(); + } +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Role.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Role.java new file mode 100644 index 0000000000..ac33e32fcf --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/Role.java @@ -0,0 +1,104 @@ +package org.baeldung.rolesauthorities.model; + +import java.util.Collection; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; + +@Entity +public class Role { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + @ManyToMany(mappedBy = "roles") + private Collection users; + + @ManyToMany + @JoinTable(name = "roles_privileges", joinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "privilege_id", referencedColumnName = "id")) + private Collection privileges; + + private String name; + + public Role() { + super(); + } + + public Role(String name) { + super(); + this.name = name; + } + + // + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Collection getUsers() { + return users; + } + + public void setUsers(Collection users) { + this.users = users; + } + + public Collection getPrivileges() { + return privileges; + } + + public void setPrivileges(Collection privileges) { + this.privileges = privileges; + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + Role role = (Role) obj; + if (!role.equals(role.name)) { + return false; + } + return true; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("Role [name=").append(name).append("]").append("[id=").append(id).append("]"); + return builder.toString(); + } +} \ No newline at end of file diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/User.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/User.java new file mode 100644 index 0000000000..dc1096541d --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/model/User.java @@ -0,0 +1,147 @@ +package org.baeldung.rolesauthorities.model; + +import java.util.Collection; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.Table; + + +@Entity +@Table(name = "user_account") +public class User { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + private String firstName; + + private String lastName; + + private String email; + + @Column(length = 60) + private String password; + + private boolean enabled; + + private boolean isUsing2FA; + + // + + @ManyToMany(fetch = FetchType.EAGER) + @JoinTable(name = "users_roles", joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id")) + private Collection roles; + + public User() { + super(); + this.enabled = false; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + 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 String getEmail() { + return email; + } + + public void setEmail(String username) { + this.email = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Collection getRoles() { + return roles; + } + + public void setRoles(Collection roles) { + this.roles = roles; + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public boolean isUsing2FA() { + return isUsing2FA; + } + + public void setUsing2FA(boolean isUsing2FA) { + this.isUsing2FA = isUsing2FA; + } + + @Override + public int hashCode() { + int prime = 31; + int result = 1; + result = (prime * result) + ((email == null) ? 0 : email.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + User user = (User) obj; + if (!email.equals(user.email)) { + return false; + } + return true; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("User [id=").append(id).append(", firstName=") + .append(firstName).append(", lastName=").append(lastName).append(", email=").append(email).append(", password=").append(password).append(", enabled=").append(enabled).append(", roles=").append(roles).append("]"); + return builder.toString(); + } + +} \ No newline at end of file diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/IUserService.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/IUserService.java new file mode 100644 index 0000000000..2c508cbd20 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/IUserService.java @@ -0,0 +1,9 @@ +package org.baeldung.rolesauthorities.persistence; + +import org.baeldung.rolesauthorities.model.User; + +public interface IUserService { + + User findUserByEmail(String email); + +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/PersistenceJPAConfig.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/PersistenceJPAConfig.java new file mode 100644 index 0000000000..a993e41a83 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/PersistenceJPAConfig.java @@ -0,0 +1,77 @@ +package org.baeldung.rolesauthorities.persistence; + +import java.util.Properties; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@Configuration +@EnableTransactionManagement +@PropertySource({ "classpath:persistence.properties" }) +@ComponentScan({ "org.baeldung.rolesauthorities.persistence" }) +@EnableJpaRepositories(basePackages = "org.baeldung.rolesauthorities.persistence") +public class PersistenceJPAConfig { + + @Autowired + private Environment env; + + public PersistenceJPAConfig() { + super(); + } + + // + + @Bean + public LocalContainerEntityManagerFactoryBean entityManagerFactory() { + LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(dataSource()); + em.setPackagesToScan(new String[] { "org.baeldung.rolesauthorities" }); + HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); + em.setJpaVendorAdapter(vendorAdapter); + em.setJpaProperties(additionalProperties()); + return em; + } + + @Bean + public DataSource dataSource() { + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName")); + dataSource.setUrl(env.getProperty("jdbc.url")); + dataSource.setUsername(env.getProperty("jdbc.user")); + dataSource.setPassword(env.getProperty("jdbc.pass")); + return dataSource; + } + + @Bean + public JpaTransactionManager transactionManager() { + JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(entityManagerFactory().getObject()); + return transactionManager; + } + + @Bean + public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { + return new PersistenceExceptionTranslationPostProcessor(); + } + + protected Properties additionalProperties() { + Properties hibernateProperties = new Properties(); + hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); + return hibernateProperties; + } + +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/PrivilegeRepository.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/PrivilegeRepository.java new file mode 100644 index 0000000000..05d5f2b870 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/PrivilegeRepository.java @@ -0,0 +1,12 @@ +package org.baeldung.rolesauthorities.persistence; + +import org.baeldung.rolesauthorities.model.Privilege; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface PrivilegeRepository extends JpaRepository { + + Privilege findByName(String name); + + void delete(Privilege privilege); + +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/RoleRepository.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/RoleRepository.java new file mode 100644 index 0000000000..25e3b3a1f6 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/RoleRepository.java @@ -0,0 +1,12 @@ +package org.baeldung.rolesauthorities.persistence; + +import org.baeldung.rolesauthorities.model.Role; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface RoleRepository extends JpaRepository { + + Role findByName(String name); + + void delete(Role role); + +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/SetupDataLoader.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/SetupDataLoader.java new file mode 100644 index 0000000000..46dad4f06d --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/SetupDataLoader.java @@ -0,0 +1,97 @@ +package org.baeldung.rolesauthorities.persistence; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import org.baeldung.rolesauthorities.model.Privilege; +import org.baeldung.rolesauthorities.model.Role; +import org.baeldung.rolesauthorities.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + + +@Component +public class SetupDataLoader implements ApplicationListener { + + private boolean alreadySetup = false; + + @Autowired + private UserRepository userRepository; + + @Autowired + private RoleRepository roleRepository; + + @Autowired + private PrivilegeRepository privilegeRepository; + + @Autowired + private PasswordEncoder passwordEncoder; + + @Override + @Transactional + public void onApplicationEvent(ContextRefreshedEvent event) { + if (alreadySetup) { + return; + } + + // == create initial privileges + Privilege readPrivilege = createPrivilegeIfNotFound("READ_PRIVILEGE"); + Privilege writePrivilege = createPrivilegeIfNotFound("WRITE_PRIVILEGE"); + + // == create initial roles + List adminPrivileges = Arrays.asList(readPrivilege, writePrivilege); + createRoleIfNotFound("ROLE_ADMIN", adminPrivileges); + List rolePrivileges = new ArrayList<>(); + createRoleIfNotFound("ROLE_USER", rolePrivileges); + + Role adminRole = roleRepository.findByName("ROLE_ADMIN"); + User user = new User(); + user.setFirstName("Admin"); + user.setLastName("Admin"); + user.setEmail("admin@test.com"); + user.setPassword(passwordEncoder.encode("admin")); + user.setRoles(Arrays.asList(adminRole)); + user.setEnabled(true); + userRepository.save(user); + + Role basicRole = roleRepository.findByName("ROLE_USER"); + User basicUser = new User(); + basicUser.setFirstName("User"); + basicUser.setLastName("User"); + basicUser.setEmail("user@test.com"); + basicUser.setPassword(passwordEncoder.encode("user")); + basicUser.setRoles(Arrays.asList(basicRole)); + basicUser.setEnabled(true); + userRepository.save(basicUser); + + alreadySetup = true; + } + + @Transactional + private Privilege createPrivilegeIfNotFound(String name) { + Privilege privilege = privilegeRepository.findByName(name); + if (privilege == null) { + privilege = new Privilege(name); + privilegeRepository.save(privilege); + } + return privilege; + } + + @Transactional + private Role createRoleIfNotFound(String name, Collection privileges) { + Role role = roleRepository.findByName(name); + if (role == null) { + role = new Role(name); + role.setPrivileges(privileges); + roleRepository.save(role); + } + return role; + } + +} \ No newline at end of file diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserRepository.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserRepository.java new file mode 100644 index 0000000000..bca2953153 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserRepository.java @@ -0,0 +1,12 @@ +package org.baeldung.rolesauthorities.persistence; + +import org.baeldung.rolesauthorities.model.User; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UserRepository extends JpaRepository { + + User findByEmail(String email); + + void delete(User user); + +} diff --git a/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserService.java b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserService.java new file mode 100644 index 0000000000..3b16c78898 --- /dev/null +++ b/spring-security-mvc-boot/src/main/java/org/baeldung/rolesauthorities/persistence/UserService.java @@ -0,0 +1,19 @@ +package org.baeldung.rolesauthorities.persistence; + +import javax.transaction.Transactional; + +import org.baeldung.rolesauthorities.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +@Transactional +public class UserService implements IUserService { + + @Autowired + private UserRepository repository; + + public User findUserByEmail(String email) { + return repository.findByEmail(email); + } +} \ No newline at end of file diff --git a/spring-security-mvc-boot/src/main/resources/application-rolesauthorities.properties b/spring-security-mvc-boot/src/main/resources/application-rolesauthorities.properties new file mode 100644 index 0000000000..030c79c542 --- /dev/null +++ b/spring-security-mvc-boot/src/main/resources/application-rolesauthorities.properties @@ -0,0 +1,10 @@ +server.port=8082 +server.context-path=/ +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.url=jdbc:h2:mem:security_permission;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +spring.datasource.username=sa +spring.datasource.password= +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.database=H2 +spring.jpa.show-sql=false +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect \ No newline at end of file diff --git a/spring-security-mvc-boot/src/main/resources/persistence.properties b/spring-security-mvc-boot/src/main/resources/persistence.properties new file mode 100644 index 0000000000..b2255cd479 --- /dev/null +++ b/spring-security-mvc-boot/src/main/resources/persistence.properties @@ -0,0 +1,11 @@ +####### H2 +#################### DataSource Configuration ########################## +jdbc.driverClassName=org.h2.Driver +jdbc.url=jdbc:h2:mem:registration_02;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +jdbc.user=sa +jdbc.pass= +init-db=false +#################### Hibernate Configuration ########################## +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=false +hibernate.hbm2ddl.auto=create-drop \ No newline at end of file diff --git a/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/home.html b/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/home.html new file mode 100644 index 0000000000..a302721570 --- /dev/null +++ b/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/home.html @@ -0,0 +1,25 @@ + + + + + +Role vs Granted Authority Example + + + + + + + + \ No newline at end of file diff --git a/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/login.html b/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/login.html new file mode 100644 index 0000000000..eacde18459 --- /dev/null +++ b/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/login.html @@ -0,0 +1,57 @@ + + + + +Login + + + + + + +
+
+

Login

+

+ +
+ + + + +

+ + + +

+ + +
+
+
+ + + \ No newline at end of file diff --git a/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyauthority.html b/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyauthority.html new file mode 100644 index 0000000000..c62a111ebc --- /dev/null +++ b/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyauthority.html @@ -0,0 +1,24 @@ + + + + +Protected By Authority + + + +
+

Protected By Authority

+
+ + + + diff --git a/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbynothing.html b/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbynothing.html new file mode 100644 index 0000000000..a6cd0666db --- /dev/null +++ b/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbynothing.html @@ -0,0 +1,21 @@ + + + + +Protected By Nothing + + + +
+

Protected By Nothing

+
+ + + + diff --git a/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyrole.html b/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyrole.html new file mode 100644 index 0000000000..f4bac55b55 --- /dev/null +++ b/spring-security-mvc-boot/src/main/resources/templates/rolesauthorities/protectedbyrole.html @@ -0,0 +1,24 @@ + + + + +Protected By Role + + + +
+

Protected By Role

+
+ + + + diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAccessDeniedHandler.java b/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAccessDeniedHandler.java index 843f5f4dcd..64698072bc 100644 --- a/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAccessDeniedHandler.java +++ b/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAccessDeniedHandler.java @@ -25,7 +25,7 @@ public class CustomAccessDeniedHandler implements AccessDeniedHandler { if (auth != null) { LOG.warn("User: " + auth.getName() + " attempted to access the protected URL: " + request.getRequestURI()); } - + response.sendRedirect(request.getContextPath() + "/accessDenied"); } diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-mvc-login/src/main/java/org/baeldung/spring/SecSecurityConfig.java index 7331d7bb18..d9a43d48d0 100644 --- a/spring-security-mvc-login/src/main/java/org/baeldung/spring/SecSecurityConfig.java +++ b/spring-security-mvc-login/src/main/java/org/baeldung/spring/SecSecurityConfig.java @@ -65,9 +65,9 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter { public LogoutSuccessHandler logoutSuccessHandler() { return new CustomLogoutSuccessHandler(); } - + @Bean - public AccessDeniedHandler accessDeniedHandler(){ + public AccessDeniedHandler accessDeniedHandler() { return new CustomAccessDeniedHandler(); } diff --git a/spring-security-mvc-login/src/test/java/org/baeldung/security/RedirectionSecurityIntegrationTest.java b/spring-security-mvc-login/src/test/java/org/baeldung/security/RedirectionSecurityIntegrationTest.java index 1d7fae8b60..2b7a8ce5b9 100644 --- a/spring-security-mvc-login/src/test/java/org/baeldung/security/RedirectionSecurityIntegrationTest.java +++ b/spring-security-mvc-login/src/test/java/org/baeldung/security/RedirectionSecurityIntegrationTest.java @@ -29,65 +29,58 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @WebAppConfiguration public class RedirectionSecurityIntegrationTest { - @Autowired private WebApplicationContext context; + @Autowired + private WebApplicationContext context; - @Autowired private UserDetailsService userDetailsService; + @Autowired + private UserDetailsService userDetailsService; private MockMvc mvc; private UserDetails userDetails; @Before public void setup() { - mvc = MockMvcBuilders - .webAppContextSetup(context) - .apply(springSecurity()) - .build(); + mvc = MockMvcBuilders.webAppContextSetup(context) + .apply(springSecurity()) + .build(); userDetails = userDetailsService.loadUserByUsername("user1"); } @Test public void givenSecuredResource_whenAccessUnauthenticated_thenRequiresAuthentication() throws Exception { - mvc - .perform(get("/secured")) - .andExpect(status().is3xxRedirection()) - .andExpect(redirectedUrlPattern("**/login")); + mvc.perform(get("/secured")) + .andExpect(status().is3xxRedirection()) + .andExpect(redirectedUrlPattern("**/login")); } @Test public void givenCredentials_whenAccessSecuredResource_thenSuccess() throws Exception { - mvc - .perform(get("/secured").with(user(userDetails))) - .andExpect(status().isOk()); + mvc.perform(get("/secured").with(user(userDetails))) + .andExpect(status().isOk()); } @Test public void givenAccessSecuredResource_whenAuthenticated_thenRedirectedBack() throws Exception { MockHttpServletRequestBuilder securedResourceAccess = get("/secured"); - MvcResult unauthenticatedResult = mvc - .perform(securedResourceAccess) - .andExpect(status().is3xxRedirection()) - .andReturn(); + MvcResult unauthenticatedResult = mvc.perform(securedResourceAccess) + .andExpect(status().is3xxRedirection()) + .andReturn(); - MockHttpSession session = (MockHttpSession) unauthenticatedResult - .getRequest() - .getSession(); - String loginUrl = unauthenticatedResult - .getResponse() - .getRedirectedUrl(); - mvc - .perform(post(loginUrl) - .param("username", userDetails.getUsername()) + MockHttpSession session = (MockHttpSession) unauthenticatedResult.getRequest() + .getSession(); + String loginUrl = unauthenticatedResult.getResponse() + .getRedirectedUrl(); + mvc.perform(post(loginUrl).param("username", userDetails.getUsername()) .param("password", userDetails.getPassword()) .session(session) .with(csrf())) - .andExpect(status().is3xxRedirection()) - .andExpect(redirectedUrlPattern("**/secured")) - .andReturn(); + .andExpect(status().is3xxRedirection()) + .andExpect(redirectedUrlPattern("**/secured")) + .andReturn(); - mvc - .perform(securedResourceAccess.session(session)) - .andExpect(status().isOk()); + mvc.perform(securedResourceAccess.session(session)) + .andExpect(status().isOk()); } diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java index 7006619d35..d7b57d1829 100644 --- a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java +++ b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java @@ -88,8 +88,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .authorizeRequests() .antMatchers("/", "/index", "/authenticate") .permitAll() - .antMatchers("/secured/**/**", - "/secured/success", "/secured/socket", "/secured/success") + .antMatchers("/secured/**/**", "/secured/socket", "/secured/success") .authenticated() .anyRequest().authenticated() .and() diff --git a/spring-security-rest-basic-auth/README.md b/spring-security-rest-basic-auth/README.md index 43ab08b8ca..f92fcfe36b 100644 --- a/spring-security-rest-basic-auth/README.md +++ b/spring-security-rest-basic-auth/README.md @@ -6,8 +6,8 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com ### Relevant Articles: -- [RestTemplate with Basic Authentication in Spring](http://www.baeldung.com/2012/04/16/how-to-use-resttemplate-with-basic-authentication-in-spring-3-1) +- [RestTemplate with Basic Authentication in Spring](http://www.baeldung.com/how-to-use-resttemplate-with-basic-authentication-in-spring) - [HttpClient Timeout](http://www.baeldung.com/httpclient-timeout) - [HttpClient with SSL](http://www.baeldung.com/httpclient-ssl) - [Writing a Custom Filter in Spring Security](http://www.baeldung.com/spring-security-custom-filter) -- [Spring Security Basic Authentication](http://www.baeldung.com/spring-security-basic-authentication) \ No newline at end of file +- [Spring Security Basic Authentication](http://www.baeldung.com/spring-security-basic-authentication) diff --git a/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiApplication.java b/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiApplication.java index c0ad5eb690..a222224c59 100644 --- a/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiApplication.java +++ b/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiApplication.java @@ -2,12 +2,10 @@ package org.baeldung.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; import org.springframework.web.context.request.RequestContextListener; -@EnableOAuth2Sso @SpringBootApplication public class UiApplication extends SpringBootServletInitializer { diff --git a/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiSecurityConfig.java b/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiSecurityConfig.java index 5dbe9ada34..f9119e20f5 100644 --- a/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiSecurityConfig.java +++ b/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiSecurityConfig.java @@ -1,9 +1,11 @@ package org.baeldung.config; +import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +@EnableOAuth2Sso @Configuration public class UiSecurityConfig extends WebSecurityConfigurerAdapter { diff --git a/spring-swagger-codegen/pom.xml b/spring-swagger-codegen/pom.xml new file mode 100644 index 0000000000..79e244d2db --- /dev/null +++ b/spring-swagger-codegen/pom.xml @@ -0,0 +1,12 @@ + + 4.0.0 + com.baeldung + spring-swagger-codegen + 0.0.1-SNAPSHOT + pom + + spring-swagger-codegen-api-client + spring-swagger-codegen-app + + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/.gitignore b/spring-swagger-codegen/spring-swagger-codegen-api-client/.gitignore new file mode 100644 index 0000000000..a530464afa --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/.swagger-codegen-ignore b/spring-swagger-codegen/spring-swagger-codegen-api-client/.swagger-codegen-ignore new file mode 100644 index 0000000000..c5fa491b4c --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/.swagger-codegen/VERSION b/spring-swagger-codegen/spring-swagger-codegen-api-client/.swagger-codegen/VERSION new file mode 100644 index 0000000000..6b4d157738 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3 \ No newline at end of file diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/.travis.yml b/spring-swagger-codegen/spring-swagger-codegen-api-client/.travis.yml new file mode 100644 index 0000000000..70cb81a67c --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/.travis.yml @@ -0,0 +1,17 @@ +# +# Generated by: https://github.com/swagger-api/swagger-codegen.git +# +language: java +jdk: + - oraclejdk8 + - oraclejdk7 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + - mvn test + # uncomment below to test using gradle + # - gradle test + # uncomment below to test using sbt + # - sbt test diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/README.md b/spring-swagger-codegen/spring-swagger-codegen-api-client/README.md new file mode 100644 index 0000000000..b1b7a63a9c --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/README.md @@ -0,0 +1,155 @@ +# spring-swagger-codegen-api-client + +## Requirements + +Building the API client library requires [Maven](https://maven.apache.org/) to be installed. + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn deploy +``` + +Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + com.baeldung + spring-swagger-codegen-api-client + 0.0.1-SNAPSHOT + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "com.baeldung:spring-swagger-codegen-api-client:0.0.1-SNAPSHOT" +``` + +### Others + +At first generate the JAR by executing: + + mvn package + +Then manually install the following JARs: + +* target/spring-swagger-codegen-api-client-0.0.1-SNAPSHOT.jar +* target/lib/*.jar + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +import com.baeldung.petstore.client.invoker.*; +import com.baeldung.petstore.client.invoker.auth.*; +import com.baeldung.petstore.client.model.*; +import com.baeldung.petstore.client.api.PetApi; + +import java.io.File; +import java.util.*; + +public class PetApiExample { + + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + + PetApi apiInstance = new PetApi(); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [Category](docs/Category.md) + - [ModelApiResponse](docs/ModelApiResponse.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + +## Documentation for Authorization + +Authentication schemes defined for the API: +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + +apiteam@swagger.io + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/build.gradle b/spring-swagger-codegen/spring-swagger-codegen-api-client/build.gradle new file mode 100644 index 0000000000..36716a3436 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/build.gradle @@ -0,0 +1,114 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = 'com.baeldung' +version = '0.0.1-SNAPSHOT' + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.5.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' + } +} + +repositories { + jcenter() +} + + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 23 + buildToolsVersion '23.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 22 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided 'javax.annotation:jsr250-api:1.0' + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven' + + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + + install { + repositories.mavenInstaller { + pom.artifactId = 'spring-swagger-codegen-api-client' + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + swagger_annotations_version = "1.5.15" + jackson_version = "2.8.9" + spring_web_version = "4.3.9.RELEASE" + jodatime_version = "2.9.9" + junit_version = "4.12" +} + +dependencies { + compile "io.swagger:swagger-annotations:$swagger_annotations_version" + compile "org.springframework:spring-web:$spring_web_version" + compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" + compile "joda-time:joda-time:$jodatime_version" + testCompile "junit:junit:$junit_version" +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/build.sbt b/spring-swagger-codegen/spring-swagger-codegen-api-client/build.sbt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/Category.md b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/Category.md new file mode 100644 index 0000000000..e2df080327 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/Category.md @@ -0,0 +1,11 @@ + +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/ModelApiResponse.md b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/ModelApiResponse.md new file mode 100644 index 0000000000..3eec8686cc --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/ModelApiResponse.md @@ -0,0 +1,12 @@ + +# ModelApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/Order.md b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/Order.md new file mode 100644 index 0000000000..a1089f5384 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/Order.md @@ -0,0 +1,24 @@ + +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**petId** | **Long** | | [optional] +**quantity** | **Integer** | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] +**complete** | **Boolean** | | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- +PLACED | "placed" +APPROVED | "approved" +DELIVERED | "delivered" + + + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/Pet.md b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/Pet.md new file mode 100644 index 0000000000..5b63109ef9 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/Pet.md @@ -0,0 +1,24 @@ + +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List<String>** | | +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] + + + +## Enum: StatusEnum +Name | Value +---- | ----- +AVAILABLE | "available" +PENDING | "pending" +SOLD | "sold" + + + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/PetApi.md b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/PetApi.md new file mode 100644 index 0000000000..c81b8d014c --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/PetApi.md @@ -0,0 +1,448 @@ +# PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image + + + +# **addPet** +> addPet(body) + +Add a new pet to the store + + + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiClient; +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.invoker.Configuration; +//import com.baeldung.petstore.client.invoker.auth.*; +//import com.baeldung.petstore.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Pet body = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.addPet(body); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiClient; +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.invoker.Configuration; +//import com.baeldung.petstore.client.invoker.auth.*; +//import com.baeldung.petstore.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | Pet id to delete +String apiKey = "apiKey_example"; // String | +try { + apiInstance.deletePet(petId, apiKey); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **findPetsByStatus** +> List<Pet> findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiClient; +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.invoker.Configuration; +//import com.baeldung.petstore.client.invoker.auth.*; +//import com.baeldung.petstore.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **findPetsByTags** +> List<Pet> findPetsByTags(tags) + +Finds Pets by tags + +Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiClient; +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.invoker.Configuration; +//import com.baeldung.petstore.client.invoker.auth.*; +//import com.baeldung.petstore.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +List tags = Arrays.asList("tags_example"); // List | Tags to filter by +try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<String>**](String.md)| Tags to filter by | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiClient; +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.invoker.Configuration; +//import com.baeldung.petstore.client.invoker.auth.*; +//import com.baeldung.petstore.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure API key authorization: api_key +ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); +api_key.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.setApiKeyPrefix("Token"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet to return +try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **updatePet** +> updatePet(body) + +Update an existing pet + + + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiClient; +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.invoker.Configuration; +//import com.baeldung.petstore.client.invoker.auth.*; +//import com.baeldung.petstore.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Pet body = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.updatePet(body); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiClient; +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.invoker.Configuration; +//import com.baeldung.petstore.client.invoker.auth.*; +//import com.baeldung.petstore.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet that needs to be updated +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet +try { + apiInstance.updatePetWithForm(petId, name, status); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/xml, application/json + + +# **uploadFile** +> ModelApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + + + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiClient; +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.invoker.Configuration; +//import com.baeldung.petstore.client.invoker.auth.*; +//import com.baeldung.petstore.client.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 789L; // Long | ID of pet to update +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server +File file = new File("/path/to/file.txt"); // File | file to upload +try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/StoreApi.md b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/StoreApi.md new file mode 100644 index 0000000000..7beaa75b86 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/StoreApi.md @@ -0,0 +1,197 @@ +# StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet + + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +Long orderId = 789L; // Long | ID of the order that needs to be deleted +try { + apiInstance.deleteOrder(orderId); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **Long**| ID of the order that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getInventory** +> Map<String, Integer> getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiClient; +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.invoker.Configuration; +//import com.baeldung.petstore.client.invoker.auth.*; +//import com.baeldung.petstore.client.api.StoreApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure API key authorization: api_key +ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); +api_key.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.setApiKeyPrefix("Token"); + +StoreApi apiInstance = new StoreApi(); +try { + Map result = apiInstance.getInventory(); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Map<String, Integer>**](Map.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +Long orderId = 789L; // Long | ID of pet that needs to be fetched +try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **Long**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **placeOrder** +> Order placeOrder(body) + +Place an order for a pet + + + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +Order body = new Order(); // Order | order placed for purchasing the pet +try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/Tag.md b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/Tag.md new file mode 100644 index 0000000000..de6814b55d --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/Tag.md @@ -0,0 +1,11 @@ + +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/User.md b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/User.md new file mode 100644 index 0000000000..8b6753dd28 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/User.md @@ -0,0 +1,17 @@ + +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **Integer** | User Status | [optional] + + + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/UserApi.md b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/UserApi.md new file mode 100644 index 0000000000..bc5733b201 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/docs/UserApi.md @@ -0,0 +1,370 @@ +# UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createUser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + + +# **createUser** +> createUser(body) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +User body = new User(); // User | Created user object +try { + apiInstance.createUser(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(body) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +List body = Arrays.asList(new User()); // List | List of user object +try { + apiInstance.createUsersWithArrayInput(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **createUsersWithListInput** +> createUsersWithListInput(body) + +Creates list of users with given input array + + + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +List body = Arrays.asList(new User()); // List | List of user object +try { + apiInstance.createUsersWithListInput(body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List<User>**](User.md)| List of user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be deleted +try { + apiInstance.deleteUser(username); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. +try { + User result = apiInstance.getUserByName(username); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The user name for login +String password = "password_example"; // String | The password for login in clear text +try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +try { + apiInstance.logoutUser(); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +# **updateUser** +> updateUser(username, body) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import com.baeldung.petstore.client.invoker.ApiException; +//import com.baeldung.petstore.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | name that need to be updated +User body = new User(); // User | Updated user object +try { + apiInstance.updateUser(username, body); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be updated | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/git_push.sh b/spring-swagger-codegen/spring-swagger-codegen-api-client/git_push.sh new file mode 100644 index 0000000000..ed374619b1 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/gradle.properties b/spring-swagger-codegen/spring-swagger-codegen-api-client/gradle.properties new file mode 100644 index 0000000000..05644f0754 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/gradle.properties @@ -0,0 +1,2 @@ +# Uncomment to build for Android +#target = android \ No newline at end of file diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/gradle/wrapper/gradle-wrapper.jar b/spring-swagger-codegen/spring-swagger-codegen-api-client/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..2c6137b878 Binary files /dev/null and b/spring-swagger-codegen/spring-swagger-codegen-api-client/gradle/wrapper/gradle-wrapper.jar differ diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/gradle/wrapper/gradle-wrapper.properties b/spring-swagger-codegen/spring-swagger-codegen-api-client/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..b7a3647395 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue May 17 23:08:05 CST 2016 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/gradlew b/spring-swagger-codegen/spring-swagger-codegen-api-client/gradlew new file mode 100644 index 0000000000..9d82f78915 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/gradlew.bat b/spring-swagger-codegen/spring-swagger-codegen-api-client/gradlew.bat new file mode 100644 index 0000000000..5f192121eb --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/pom.xml b/spring-swagger-codegen/spring-swagger-codegen-api-client/pom.xml new file mode 100644 index 0000000000..fb25a888fd --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/pom.xml @@ -0,0 +1,243 @@ + + 4.0.0 + com.baeldung + spring-swagger-codegen-api-client + jar + spring-swagger-codegen-api-client + 0.0.1-SNAPSHOT + https://github.com/swagger-api/swagger-codegen + Swagger Java + + scm:git:git@github.com:swagger-api/swagger-codegen.git + scm:git:git@github.com:swagger-api/swagger-codegen.git + https://github.com/swagger-api/swagger-codegen + + + 2.2.0 + + + + + Unlicense + http://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + Swagger + apiteam@swagger.io + Swagger + http://swagger.io + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + pertest + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + jar + test-jar + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.10 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + + + + org.springframework + spring-web + ${spring-web-version} + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + + + joda-time + joda-time + ${jodatime-version} + + + + + junit + junit + ${junit-version} + test + + + + UTF-8 + 1.5.15 + 4.3.9.RELEASE + 2.8.9 + 2.9.9 + 1.0.0 + 4.12 + + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/settings.gradle b/spring-swagger-codegen/spring-swagger-codegen-api-client/settings.gradle new file mode 100644 index 0000000000..3687afd41a --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "spring-swagger-codegen-api-client" \ No newline at end of file diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/AndroidManifest.xml b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..cd581f9f78 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/api/PetApi.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/api/PetApi.java new file mode 100644 index 0000000000..04f37b4235 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/api/PetApi.java @@ -0,0 +1,367 @@ +package com.baeldung.petstore.client.api; + +import com.baeldung.petstore.client.invoker.ApiClient; + +import java.io.File; +import com.baeldung.petstore.client.model.ModelApiResponse; +import com.baeldung.petstore.client.model.Pet; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.util.UriComponentsBuilder; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.core.io.FileSystemResource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +@Component("com.baeldung.petstore.client.api.PetApi") +public class PetApi { + private ApiClient apiClient; + + public PetApi() { + this(new ApiClient()); + } + + @Autowired + public PetApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Add a new pet to the store + * + *

405 - Invalid input + * @param body Pet object that needs to be added to the store + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void addPet(Pet body) throws RestClientException { + Object postBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling addPet"); + } + + String path = UriComponentsBuilder.fromPath("/pet").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { + "application/json", "application/xml" + }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Deletes a pet + * + *

400 - Invalid ID supplied + *

404 - Pet not found + * @param petId Pet id to delete + * @param apiKey The apiKey parameter + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void deletePet(Long petId, String apiKey) throws RestClientException { + Object postBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling deletePet"); + } + + // create path and map variables + final Map uriVariables = new HashMap(); + uriVariables.put("petId", petId); + String path = UriComponentsBuilder.fromPath("/pet/{petId}").buildAndExpand(uriVariables).toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + if (apiKey != null) + headerParams.add("api_key", apiClient.parameterToString(apiKey)); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + *

200 - successful operation + *

400 - Invalid status value + * @param status Status values that need to be considered for filter + * @return List<Pet> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public List findPetsByStatus(List status) throws RestClientException { + Object postBody = null; + + // verify the required parameter 'status' is set + if (status == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'status' when calling findPetsByStatus"); + } + + String path = UriComponentsBuilder.fromPath("/pet/findByStatus").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("multi".toUpperCase()), "status", status)); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference> returnType = new ParameterizedTypeReference>() {}; + return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Finds Pets by tags + * Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + *

200 - successful operation + *

400 - Invalid tag value + * @param tags Tags to filter by + * @return List<Pet> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public List findPetsByTags(List tags) throws RestClientException { + Object postBody = null; + + // verify the required parameter 'tags' is set + if (tags == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'tags' when calling findPetsByTags"); + } + + String path = UriComponentsBuilder.fromPath("/pet/findByTags").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("multi".toUpperCase()), "tags", tags)); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference> returnType = new ParameterizedTypeReference>() {}; + return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Find pet by ID + * Returns a single pet + *

200 - successful operation + *

400 - Invalid ID supplied + *

404 - Pet not found + * @param petId ID of pet to return + * @return Pet + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public Pet getPetById(Long petId) throws RestClientException { + Object postBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling getPetById"); + } + + // create path and map variables + final Map uriVariables = new HashMap(); + uriVariables.put("petId", petId); + String path = UriComponentsBuilder.fromPath("/pet/{petId}").buildAndExpand(uriVariables).toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { "api_key" }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Update an existing pet + * + *

400 - Invalid ID supplied + *

404 - Pet not found + *

405 - Validation exception + * @param body Pet object that needs to be added to the store + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void updatePet(Pet body) throws RestClientException { + Object postBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling updatePet"); + } + + String path = UriComponentsBuilder.fromPath("/pet").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { + "application/json", "application/xml" + }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Updates a pet in the store with form data + * + *

405 - Invalid input + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void updatePetWithForm(Long petId, String name, String status) throws RestClientException { + Object postBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling updatePetWithForm"); + } + + // create path and map variables + final Map uriVariables = new HashMap(); + uriVariables.put("petId", petId); + String path = UriComponentsBuilder.fromPath("/pet/{petId}").buildAndExpand(uriVariables).toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + if (name != null) + formParams.add("name", name); + if (status != null) + formParams.add("status", status); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { + "application/x-www-form-urlencoded" + }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * uploads an image + * + *

200 - successful operation + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + * @return ModelApiResponse + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws RestClientException { + Object postBody = null; + + // verify the required parameter 'petId' is set + if (petId == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'petId' when calling uploadFile"); + } + + // create path and map variables + final Map uriVariables = new HashMap(); + uriVariables.put("petId", petId); + String path = UriComponentsBuilder.fromPath("/pet/{petId}/uploadImage").buildAndExpand(uriVariables).toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + if (additionalMetadata != null) + formParams.add("additionalMetadata", additionalMetadata); + if (file != null) + formParams.add("file", new FileSystemResource(file)); + + final String[] accepts = { + "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { + "multipart/form-data" + }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { "petstore_auth" }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/api/StoreApi.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/api/StoreApi.java new file mode 100644 index 0000000000..040830f334 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/api/StoreApi.java @@ -0,0 +1,187 @@ +package com.baeldung.petstore.client.api; + +import com.baeldung.petstore.client.invoker.ApiClient; + +import com.baeldung.petstore.client.model.Order; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.util.UriComponentsBuilder; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.core.io.FileSystemResource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +@Component("com.baeldung.petstore.client.api.StoreApi") +public class StoreApi { + private ApiClient apiClient; + + public StoreApi() { + this(new ApiClient()); + } + + @Autowired + public StoreApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Delete purchase order by ID + * For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors + *

400 - Invalid ID supplied + *

404 - Order not found + * @param orderId ID of the order that needs to be deleted + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void deleteOrder(Long orderId) throws RestClientException { + Object postBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'orderId' when calling deleteOrder"); + } + + // create path and map variables + final Map uriVariables = new HashMap(); + uriVariables.put("orderId", orderId); + String path = UriComponentsBuilder.fromPath("/store/order/{orderId}").buildAndExpand(uriVariables).toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + *

200 - successful operation + * @return Map<String, Integer> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public Map getInventory() throws RestClientException { + Object postBody = null; + + String path = UriComponentsBuilder.fromPath("/store/inventory").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { "api_key" }; + + ParameterizedTypeReference> returnType = new ParameterizedTypeReference>() {}; + return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Find purchase order by ID + * For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions + *

200 - successful operation + *

400 - Invalid ID supplied + *

404 - Order not found + * @param orderId ID of pet that needs to be fetched + * @return Order + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public Order getOrderById(Long orderId) throws RestClientException { + Object postBody = null; + + // verify the required parameter 'orderId' is set + if (orderId == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'orderId' when calling getOrderById"); + } + + // create path and map variables + final Map uriVariables = new HashMap(); + uriVariables.put("orderId", orderId); + String path = UriComponentsBuilder.fromPath("/store/order/{orderId}").buildAndExpand(uriVariables).toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Place an order for a pet + * + *

200 - successful operation + *

400 - Invalid Order + * @param body order placed for purchasing the pet + * @return Order + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public Order placeOrder(Order body) throws RestClientException { + Object postBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling placeOrder"); + } + + String path = UriComponentsBuilder.fromPath("/store/order").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/api/UserApi.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/api/UserApi.java new file mode 100644 index 0000000000..2b14bc7a4e --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/api/UserApi.java @@ -0,0 +1,337 @@ +package com.baeldung.petstore.client.api; + +import com.baeldung.petstore.client.invoker.ApiClient; + +import com.baeldung.petstore.client.model.User; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.util.UriComponentsBuilder; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.core.io.FileSystemResource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +@Component("com.baeldung.petstore.client.api.UserApi") +public class UserApi { + private ApiClient apiClient; + + public UserApi() { + this(new ApiClient()); + } + + @Autowired + public UserApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create user + * This can only be done by the logged in user. + *

0 - successful operation + * @param body Created user object + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void createUser(User body) throws RestClientException { + Object postBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling createUser"); + } + + String path = UriComponentsBuilder.fromPath("/user").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Creates list of users with given input array + * + *

0 - successful operation + * @param body List of user object + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void createUsersWithArrayInput(List body) throws RestClientException { + Object postBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling createUsersWithArrayInput"); + } + + String path = UriComponentsBuilder.fromPath("/user/createWithArray").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Creates list of users with given input array + * + *

0 - successful operation + * @param body List of user object + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void createUsersWithListInput(List body) throws RestClientException { + Object postBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling createUsersWithListInput"); + } + + String path = UriComponentsBuilder.fromPath("/user/createWithList").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Delete user + * This can only be done by the logged in user. + *

400 - Invalid username supplied + *

404 - User not found + * @param username The name that needs to be deleted + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void deleteUser(String username) throws RestClientException { + Object postBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'username' when calling deleteUser"); + } + + // create path and map variables + final Map uriVariables = new HashMap(); + uriVariables.put("username", username); + String path = UriComponentsBuilder.fromPath("/user/{username}").buildAndExpand(uriVariables).toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Get user by user name + * + *

200 - successful operation + *

400 - Invalid username supplied + *

404 - User not found + * @param username The name that needs to be fetched. Use user1 for testing. + * @return User + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public User getUserByName(String username) throws RestClientException { + Object postBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'username' when calling getUserByName"); + } + + // create path and map variables + final Map uriVariables = new HashMap(); + uriVariables.put("username", username); + String path = UriComponentsBuilder.fromPath("/user/{username}").buildAndExpand(uriVariables).toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Logs user into the system + * + *

200 - successful operation + *

400 - Invalid username/password supplied + * @param username The user name for login + * @param password The password for login in clear text + * @return String + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public String loginUser(String username, String password) throws RestClientException { + Object postBody = null; + + // verify the required parameter 'username' is set + if (username == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'username' when calling loginUser"); + } + + // verify the required parameter 'password' is set + if (password == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'password' when calling loginUser"); + } + + String path = UriComponentsBuilder.fromPath("/user/login").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "username", username)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "password", password)); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Logs out current logged in user session + * + *

0 - successful operation + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void logoutUser() throws RestClientException { + Object postBody = null; + + String path = UriComponentsBuilder.fromPath("/user/logout").build().toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } + /** + * Updated user + * This can only be done by the logged in user. + *

400 - Invalid user supplied + *

404 - User not found + * @param username name that need to be updated + * @param body Updated user object + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void updateUser(String username, User body) throws RestClientException { + Object postBody = body; + + // verify the required parameter 'username' is set + if (username == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'username' when calling updateUser"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling updateUser"); + } + + // create path and map variables + final Map uriVariables = new HashMap(); + uriVariables.put("username", username); + String path = UriComponentsBuilder.fromPath("/user/{username}").buildAndExpand(uriVariables).toUriString(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] accepts = { + "application/xml", "application/json" + }; + final List accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; + apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/ApiClient.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/ApiClient.java new file mode 100644 index 0000000000..dd47a39496 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/ApiClient.java @@ -0,0 +1,626 @@ +package com.baeldung.petstore.client.invoker; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpRequest; +import org.springframework.http.HttpStatus; +import org.springframework.http.InvalidMediaTypeException; +import org.springframework.http.MediaType; +import org.springframework.http.RequestEntity; +import org.springframework.http.RequestEntity.BodyBuilder; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.BufferingClientHttpRequestFactory; +import org.springframework.http.client.ClientHttpRequestExecution; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.util.StringUtils; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.text.DateFormat; +import java.text.ParseException; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TimeZone; + +import com.baeldung.petstore.client.invoker.auth.Authentication; +import com.baeldung.petstore.client.invoker.auth.HttpBasicAuth; +import com.baeldung.petstore.client.invoker.auth.ApiKeyAuth; +import com.baeldung.petstore.client.invoker.auth.OAuth; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +@Component("com.baeldung.petstore.client.invoker.ApiClient") +public class ApiClient { + public enum CollectionFormat { + CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null); + + private final String separator; + private CollectionFormat(String separator) { + this.separator = separator; + } + + private String collectionToString(Collection collection) { + return StringUtils.collectionToDelimitedString(collection, separator); + } + } + + private boolean debugging = false; + + private HttpHeaders defaultHeaders = new HttpHeaders(); + + private String basePath = "http://petstore.swagger.io/v2"; + + private RestTemplate restTemplate; + + private Map authentications; + + private HttpStatus statusCode; + private MultiValueMap responseHeaders; + + private DateFormat dateFormat; + + public ApiClient() { + this.restTemplate = buildRestTemplate(); + init(); + } + + @Autowired + public ApiClient(RestTemplate restTemplate) { + this.restTemplate = restTemplate; + init(); + } + + protected void init() { + // Use RFC3339 format for date and datetime. + // See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14 + this.dateFormat = new RFC3339DateFormat(); + + // Use UTC as the default time zone. + this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + + // Set default User-Agent. + setUserAgent("Java-SDK"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap(); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("petstore_auth", new OAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Get the current base path + * @return String the base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set the base path, which should include the host + * @param basePath the base path + * @return ApiClient this client + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Gets the status code of the previous request + * @return HttpStatus the status code + */ + public HttpStatus getStatusCode() { + return statusCode; + } + + /** + * Gets the response headers of the previous request + * @return MultiValueMap a map of response headers + */ + public MultiValueMap getResponseHeaders() { + return responseHeaders; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * @return Map the currently configured authentication types + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * @param username the username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * @param password the password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * @param apiKey the API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * @param apiKeyPrefix the API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * @param accessToken the access token + */ + public void setAccessToken(String accessToken) { + for (Authentication auth : authentications.values()) { + if (auth instanceof OAuth) { + ((OAuth) auth).setAccessToken(accessToken); + return; + } + } + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * @param userAgent the user agent string + * @return ApiClient this client + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param name The header's name + * @param value The header's value + * @return ApiClient this client + */ + public ApiClient addDefaultHeader(String name, String value) { + defaultHeaders.add(name, value); + return this; + } + + public void setDebugging(boolean debugging) { + List currentInterceptors = this.restTemplate.getInterceptors(); + if(debugging) { + if (currentInterceptors == null) { + currentInterceptors = new ArrayList(); + } + ClientHttpRequestInterceptor interceptor = new ApiClientHttpRequestInterceptor(); + currentInterceptors.add(interceptor); + this.restTemplate.setInterceptors(currentInterceptors); + } else { + if (currentInterceptors != null && !currentInterceptors.isEmpty()) { + Iterator iter = currentInterceptors.iterator(); + while (iter.hasNext()) { + ClientHttpRequestInterceptor interceptor = iter.next(); + if (interceptor instanceof ApiClientHttpRequestInterceptor) { + iter.remove(); + } + } + this.restTemplate.setInterceptors(currentInterceptors); + } + } + this.debugging = debugging; + } + + /** + * Check that whether debugging is enabled for this API client. + * @return boolean true if this client is enabled for debugging, false otherwise + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Get the date format used to parse/format date parameters. + * @return DateFormat format + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Set the date format used to parse/format date parameters. + * @param dateFormat Date format + * @return API client + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + return this; + } + + /** + * Parse the given string into Date object. + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given Date object into string. + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + * @param param the object to convert + * @return String the parameter represented as a String + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate( (Date) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection) param) { + if(b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Converts a parameter to a {@link MultiValueMap} for use in REST requests + * @param collectionFormat The format to convert to + * @param name The name of the parameter + * @param value The parameter's value + * @return a Map containing the String value(s) of the input parameter + */ + public MultiValueMap parameterToMultiValueMap(CollectionFormat collectionFormat, String name, Object value) { + final MultiValueMap params = new LinkedMultiValueMap(); + + if (name == null || name.isEmpty() || value == null) { + return params; + } + + if(collectionFormat == null) { + collectionFormat = CollectionFormat.CSV; + } + + Collection valueCollection = null; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + params.add(name, parameterToString(value)); + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + if (collectionFormat.equals(CollectionFormat.MULTI)) { + for (Object item : valueCollection) { + params.add(name, parameterToString(item)); + } + return params; + } + + List values = new ArrayList(); + for(Object o : valueCollection) { + values.add(parameterToString(o)); + } + params.add(name, collectionFormat.collectionToString(values)); + + return params; + } + + /** + * Check if the given {@code String} is a JSON MIME. + * @param mediaType the input MediaType + * @return boolean true if the MediaType represents JSON, false otherwise + */ + public boolean isJsonMime(String mediaType) { + try { + return isJsonMime(MediaType.parseMediaType(mediaType)); + } catch (InvalidMediaTypeException e) { + } + return false; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * @param mediaType the input MediaType + * @return boolean true if the MediaType represents JSON, false otherwise + */ + public boolean isJsonMime(MediaType mediaType) { + return mediaType != null && (MediaType.APPLICATION_JSON.isCompatibleWith(mediaType) || mediaType.getSubtype().matches("^.*\\+json[;]?\\s*$")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return List The list of MediaTypes to use for the Accept header + */ + public List selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + MediaType mediaType = MediaType.parseMediaType(accept); + if (isJsonMime(mediaType)) { + return Collections.singletonList(mediaType); + } + } + return MediaType.parseMediaTypes(StringUtils.arrayToCommaDelimitedString(accepts)); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return MediaType The Content-Type header to use. If the given array is empty, JSON will be used. + */ + public MediaType selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return MediaType.APPLICATION_JSON; + } + for (String contentType : contentTypes) { + MediaType mediaType = MediaType.parseMediaType(contentType); + if (isJsonMime(mediaType)) { + return mediaType; + } + } + return MediaType.parseMediaType(contentTypes[0]); + } + + /** + * Select the body to use for the request + * @param obj the body object + * @param formParams the form parameters + * @param contentType the content type of the request + * @return Object the selected body + */ + protected Object selectBody(Object obj, MultiValueMap formParams, MediaType contentType) { + boolean isForm = MediaType.MULTIPART_FORM_DATA.isCompatibleWith(contentType) || MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(contentType); + return isForm ? formParams : obj; + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param the return type to use + * @param path The sub-path of the HTTP URL + * @param method The request method + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType The return type into which to deserialize the response + * @return The response body in chosen type + */ + public T invokeAPI(String path, HttpMethod method, MultiValueMap queryParams, Object body, HttpHeaders headerParams, MultiValueMap formParams, List accept, MediaType contentType, String[] authNames, ParameterizedTypeReference returnType) throws RestClientException { + updateParamsForAuth(authNames, queryParams, headerParams); + + final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(path); + if (queryParams != null) { + builder.queryParams(queryParams); + } + + final BodyBuilder requestBuilder = RequestEntity.method(method, builder.build().toUri()); + if(accept != null) { + requestBuilder.accept(accept.toArray(new MediaType[accept.size()])); + } + if(contentType != null) { + requestBuilder.contentType(contentType); + } + + addHeadersToRequest(headerParams, requestBuilder); + addHeadersToRequest(defaultHeaders, requestBuilder); + + RequestEntity requestEntity = requestBuilder.body(selectBody(body, formParams, contentType)); + + ResponseEntity responseEntity = restTemplate.exchange(requestEntity, returnType); + + statusCode = responseEntity.getStatusCode(); + responseHeaders = responseEntity.getHeaders(); + + if (responseEntity.getStatusCode() == HttpStatus.NO_CONTENT) { + return null; + } else if (responseEntity.getStatusCode().is2xxSuccessful()) { + if (returnType == null) { + return null; + } + return responseEntity.getBody(); + } else { + // The error handler built into the RestTemplate should handle 400 and 500 series errors. + throw new RestClientException("API returned " + statusCode + " and it wasn't handled by the RestTemplate error handler"); + } + } + + /** + * Add headers to the request that is being built + * @param headers The headers to add + * @param requestBuilder The current request + */ + protected void addHeadersToRequest(HttpHeaders headers, BodyBuilder requestBuilder) { + for (Entry> entry : headers.entrySet()) { + List values = entry.getValue(); + for(String value : values) { + if (value != null) { + requestBuilder.header(entry.getKey(), value); + } + } + } + } + + /** + * Build the RestTemplate used to make HTTP requests. + * @return RestTemplate + */ + protected RestTemplate buildRestTemplate() { + RestTemplate restTemplate = new RestTemplate(); + // This allows us to read the response more than once - Necessary for debugging. + restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(restTemplate.getRequestFactory())); + return restTemplate; + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams The query parameters + * @param headerParams The header parameters + */ + private void updateParamsForAuth(String[] authNames, MultiValueMap queryParams, HttpHeaders headerParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RestClientException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams); + } + } + + private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor { + private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class); + + @Override + public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { + logRequest(request, body); + ClientHttpResponse response = execution.execute(request, body); + logResponse(response); + return response; + } + + private void logRequest(HttpRequest request, byte[] body) throws UnsupportedEncodingException { + log.info("URI: " + request.getURI()); + log.info("HTTP Method: " + request.getMethod()); + log.info("HTTP Headers: " + headersToString(request.getHeaders())); + log.info("Request Body: " + new String(body, StandardCharsets.UTF_8)); + } + + private void logResponse(ClientHttpResponse response) throws IOException { + log.info("HTTP Status Code: " + response.getRawStatusCode()); + log.info("Status Text: " + response.getStatusText()); + log.info("HTTP Headers: " + headersToString(response.getHeaders())); + log.info("Response Body: " + bodyToString(response.getBody())); + } + + private String headersToString(HttpHeaders headers) { + StringBuilder builder = new StringBuilder(); + for(Entry> entry : headers.entrySet()) { + builder.append(entry.getKey()).append("=["); + for(String value : entry.getValue()) { + builder.append(value).append(","); + } + builder.setLength(builder.length() - 1); // Get rid of trailing comma + builder.append("],"); + } + builder.setLength(builder.length() - 1); // Get rid of trailing comma + return builder.toString(); + } + + private String bodyToString(InputStream body) throws IOException { + StringBuilder builder = new StringBuilder(); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8)); + String line = bufferedReader.readLine(); + while (line != null) { + builder.append(line).append(System.lineSeparator()); + line = bufferedReader.readLine(); + } + bufferedReader.close(); + return builder.toString(); + } + } +} \ No newline at end of file diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/RFC3339DateFormat.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/RFC3339DateFormat.java new file mode 100644 index 0000000000..b33d21a899 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/RFC3339DateFormat.java @@ -0,0 +1,32 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package com.baeldung.petstore.client.invoker; + +import com.fasterxml.jackson.databind.util.ISO8601DateFormat; +import com.fasterxml.jackson.databind.util.ISO8601Utils; + +import java.text.FieldPosition; +import java.util.Date; + + +public class RFC3339DateFormat extends ISO8601DateFormat { + + // Same as ISO8601DateFormat but serializing milliseconds. + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + String value = ISO8601Utils.format(date, true); + toAppendTo.append(value); + return toAppendTo; + } + +} \ No newline at end of file diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/ApiKeyAuth.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/ApiKeyAuth.java new file mode 100644 index 0000000000..35cb5e28d3 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/ApiKeyAuth.java @@ -0,0 +1,60 @@ +package com.baeldung.petstore.client.invoker.auth; + +import org.springframework.http.HttpHeaders; +import org.springframework.util.MultiValueMap; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if (location.equals("query")) { + queryParams.add(paramName, value); + } else if (location.equals("header")) { + headerParams.add(paramName, value); + } + } +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/Authentication.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/Authentication.java new file mode 100644 index 0000000000..59188957a5 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/Authentication.java @@ -0,0 +1,13 @@ +package com.baeldung.petstore.client.invoker.auth; + +import org.springframework.http.HttpHeaders; +import org.springframework.util.MultiValueMap; + +public interface Authentication { + /** + * Apply authentication settings to header and / or query parameters. + * @param queryParams The query parameters for the request + * @param headerParams The header parameters for the request + */ + public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams); +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/HttpBasicAuth.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/HttpBasicAuth.java new file mode 100644 index 0000000000..16c88a4bc6 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/HttpBasicAuth.java @@ -0,0 +1,39 @@ +package com.baeldung.petstore.client.invoker.auth; + +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; + +import org.springframework.http.HttpHeaders; +import org.springframework.util.Base64Utils; +import org.springframework.util.MultiValueMap; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams) { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString(str.getBytes(StandardCharsets.UTF_8))); + } +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/OAuth.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/OAuth.java new file mode 100644 index 0000000000..d458b33ae6 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/OAuth.java @@ -0,0 +1,24 @@ +package com.baeldung.petstore.client.invoker.auth; + +import org.springframework.http.HttpHeaders; +import org.springframework.util.MultiValueMap; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +public class OAuth implements Authentication { + private String accessToken; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + @Override + public void applyToParams(MultiValueMap queryParams, HttpHeaders headerParams) { + if (accessToken != null) { + headerParams.add(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken); + } + } +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/OAuthFlow.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/OAuthFlow.java new file mode 100644 index 0000000000..235e0b7f55 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/invoker/auth/OAuthFlow.java @@ -0,0 +1,5 @@ +package com.baeldung.petstore.client.invoker.auth; + +public enum OAuthFlow { + accessCode, implicit, password, application +} \ No newline at end of file diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/Category.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/Category.java new file mode 100644 index 0000000000..8f93b599c9 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/Category.java @@ -0,0 +1,113 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package com.baeldung.petstore.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Category + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +public class Category { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("name") + private String name = null; + + public Category id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Category name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/ModelApiResponse.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/ModelApiResponse.java new file mode 100644 index 0000000000..f968b3bbac --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/ModelApiResponse.java @@ -0,0 +1,136 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package com.baeldung.petstore.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * ModelApiResponse + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +public class ModelApiResponse { + @JsonProperty("code") + private Integer code = null; + + @JsonProperty("type") + private String type = null; + + @JsonProperty("message") + private String message = null; + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @ApiModelProperty(value = "") + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(value = "") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @ApiModelProperty(value = "") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/Order.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/Order.java new file mode 100644 index 0000000000..a585f42910 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/Order.java @@ -0,0 +1,243 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package com.baeldung.petstore.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.joda.time.DateTime; + +/** + * Order + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +public class Order { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("petId") + private Long petId = null; + + @JsonProperty("quantity") + private Integer quantity = null; + + @JsonProperty("shipDate") + private DateTime shipDate = null; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("status") + private StatusEnum status = null; + + @JsonProperty("complete") + private Boolean complete = false; + + public Order id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + **/ + @ApiModelProperty(value = "") + public Long getPetId() { + return petId; + } + + public void setPetId(Long petId) { + this.petId = petId; + } + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @ApiModelProperty(value = "") + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Order shipDate(DateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @ApiModelProperty(value = "") + public DateTime getShipDate() { + return shipDate; + } + + public void setShipDate(DateTime shipDate) { + this.shipDate = shipDate; + } + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + **/ + @ApiModelProperty(value = "Order Status") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + **/ + @ApiModelProperty(value = "") + public Boolean getComplete() { + return complete; + } + + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/Pet.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/Pet.java new file mode 100644 index 0000000000..34905d8611 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/Pet.java @@ -0,0 +1,259 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package com.baeldung.petstore.client.model; + +import java.util.Objects; +import com.baeldung.petstore.client.model.Category; +import com.baeldung.petstore.client.model.Tag; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +/** + * Pet + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +public class Pet { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("category") + private Category category = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("photoUrls") + private List photoUrls = new ArrayList(); + + @JsonProperty("tags") + private List tags = null; + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("status") + private StatusEnum status = null; + + public Pet id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Pet category(Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + **/ + @ApiModelProperty(value = "") + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + public Pet name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "doggie", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @ApiModelProperty(required = true, value = "") + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @ApiModelProperty(value = "") + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + **/ + @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/Tag.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/Tag.java new file mode 100644 index 0000000000..42fc205b28 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/Tag.java @@ -0,0 +1,113 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package com.baeldung.petstore.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Tag + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +public class Tag { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("name") + private String name = null; + + public Tag id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Tag name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/User.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/User.java new file mode 100644 index 0000000000..41049e8638 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/java/com/baeldung/petstore/client/model/User.java @@ -0,0 +1,251 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package com.baeldung.petstore.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * User + */ +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-08-29T12:04:37.072+02:00") +public class User { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("username") + private String username = null; + + @JsonProperty("firstName") + private String firstName = null; + + @JsonProperty("lastName") + private String lastName = null; + + @JsonProperty("email") + private String email = null; + + @JsonProperty("password") + private String password = null; + + @JsonProperty("phone") + private String phone = null; + + @JsonProperty("userStatus") + private Integer userStatus = null; + + public User id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public User username(String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @ApiModelProperty(value = "") + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @ApiModelProperty(value = "") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @ApiModelProperty(value = "") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public User email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @ApiModelProperty(value = "") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public User password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(value = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public User phone(String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @ApiModelProperty(value = "") + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @ApiModelProperty(value = "User Status") + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/test/java/com/baeldung/petstore/client/api/PetApiTest.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/test/java/com/baeldung/petstore/client/api/PetApiTest.java new file mode 100644 index 0000000000..0b94027df0 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/test/java/com/baeldung/petstore/client/api/PetApiTest.java @@ -0,0 +1,169 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package com.baeldung.petstore.client.api; + +import java.io.File; +import com.baeldung.petstore.client.model.ModelApiResponse; +import com.baeldung.petstore.client.model.Pet; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +@Ignore +public class PetApiTest { + + private final PetApi api = new PetApi(); + + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void addPetTest() { + Pet body = null; + api.addPet(body); + + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deletePetTest() { + Long petId = null; + String apiKey = null; + api.deletePet(petId, apiKey); + + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByStatusTest() { + List status = null; + List response = api.findPetsByStatus(status); + + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void findPetsByTagsTest() { + List tags = null; + List response = api.findPetsByTags(tags); + + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getPetByIdTest() { + Long petId = null; + Pet response = api.getPetById(petId); + + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetTest() { + Pet body = null; + api.updatePet(body); + + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updatePetWithFormTest() { + Long petId = null; + String name = null; + String status = null; + api.updatePetWithForm(petId, name, status); + + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void uploadFileTest() { + Long petId = null; + String additionalMetadata = null; + File file = null; + ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + + // TODO: test validations + } + +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/test/java/com/baeldung/petstore/client/api/StoreApiTest.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/test/java/com/baeldung/petstore/client/api/StoreApiTest.java new file mode 100644 index 0000000000..ce332bee0d --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/test/java/com/baeldung/petstore/client/api/StoreApiTest.java @@ -0,0 +1,97 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package com.baeldung.petstore.client.api; + +import com.baeldung.petstore.client.model.Order; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +@Ignore +public class StoreApiTest { + + private final StoreApi api = new StoreApi(); + + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteOrderTest() { + Long orderId = null; + api.deleteOrder(orderId); + + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getInventoryTest() { + Map response = api.getInventory(); + + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getOrderByIdTest() { + Long orderId = null; + Order response = api.getOrderById(orderId); + + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void placeOrderTest() { + Order body = null; + Order response = api.placeOrder(body); + + // TODO: test validations + } + +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/test/java/com/baeldung/petstore/client/api/UserApiTest.java b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/test/java/com/baeldung/petstore/client/api/UserApiTest.java new file mode 100644 index 0000000000..59e7a39679 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/test/java/com/baeldung/petstore/client/api/UserApiTest.java @@ -0,0 +1,163 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package com.baeldung.petstore.client.api; + +import com.baeldung.petstore.client.model.User; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +@Ignore +public class UserApiTest { + + private final UserApi api = new UserApi(); + + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUserTest() { + User body = null; + api.createUser(body); + + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithArrayInputTest() { + List body = null; + api.createUsersWithArrayInput(body); + + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void createUsersWithListInputTest() { + List body = null; + api.createUsersWithListInput(body); + + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void deleteUserTest() { + String username = null; + api.deleteUser(username); + + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void getUserByNameTest() { + String username = null; + User response = api.getUserByName(username); + + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void loginUserTest() { + String username = null; + String password = null; + String response = api.loginUser(username, password); + + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void logoutUserTest() { + api.logoutUser(); + + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void updateUserTest() { + String username = null; + User body = null; + api.updateUser(username, body); + + // TODO: test validations + } + +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml new file mode 100644 index 0000000000..f42fc5c2e2 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml @@ -0,0 +1,41 @@ + + 4.0.0 + + com.baeldung + spring-swagger-codegen-app + 0.0.1-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-parent + 1.5.6.RELEASE + + + + + com.baeldung + spring-swagger-codegen-api-client + 0.0.1-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-web + + + + + 1.8 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/DefaultPetService.java b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/DefaultPetService.java new file mode 100644 index 0000000000..72c011d6f5 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/DefaultPetService.java @@ -0,0 +1,30 @@ +package com.baeldung.petstore.app; + +import java.util.Arrays; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baeldung.petstore.client.api.PetApi; +import com.baeldung.petstore.client.model.Pet; + +@Service +public class DefaultPetService implements PetService { + + @Autowired + private PetApi petApi; + + public List findAvailablePets() { + return petApi.findPetsByStatus(Arrays.asList("available")); + } + + public List findPendingPets() { + return petApi.findPetsByStatus(Arrays.asList("pending")); + } + + public List findSoldPets() { + return petApi.findPetsByStatus(Arrays.asList("sold")); + } + +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/PetController.java b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/PetController.java new file mode 100644 index 0000000000..d5105e2f78 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/PetController.java @@ -0,0 +1,26 @@ +package com.baeldung.petstore.app; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class PetController { + + @Autowired + private PetService petService; + + + @RequestMapping("/pets") + @ResponseBody + public String listAvailablePets() { + StringBuilder sb = new StringBuilder("

Available pets:

"); + sb.append("
    "); + petService.findAvailablePets() + .forEach( p -> sb.append("
  • " + p.getName() + "
  • ")); + sb.append("
"); + return sb.toString(); + } + +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/PetService.java b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/PetService.java new file mode 100644 index 0000000000..257183d81f --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/PetService.java @@ -0,0 +1,27 @@ +package com.baeldung.petstore.app; + +import java.util.List; + +import com.baeldung.petstore.client.model.Pet; + +public interface PetService { + + /** + * Find available pets + * @return List of available pets + */ + List findAvailablePets(); + + /** + * Find Pending pets + * @return List of pending pets + */ + List findPendingPets(); + + /** + * Find sold pets + * @return List of sold pets + */ + List findSoldPets(); + +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/PetStoreApplication.java b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/PetStoreApplication.java new file mode 100644 index 0000000000..d8abeaddaa --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/PetStoreApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.petstore.app; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Import; + +@SpringBootApplication +@Import(PetStoreIntegrationConfig.class) +public class PetStoreApplication { + + public static void main(String[] args) throws Exception { + SpringApplication.run(PetStoreApplication.class, args); + } + +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/PetStoreIntegrationConfig.java b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/PetStoreIntegrationConfig.java new file mode 100644 index 0000000000..a70be4120f --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/java/com/baeldung/petstore/app/PetStoreIntegrationConfig.java @@ -0,0 +1,23 @@ +package com.baeldung.petstore.app; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.baeldung.petstore.client.api.PetApi; +import com.baeldung.petstore.client.invoker.ApiClient; + +@Configuration +public class PetStoreIntegrationConfig { + + @Bean + public PetApi petpi() { + return new PetApi(apiClient()); + } + + @Bean + public ApiClient apiClient() { + ApiClient apiClient = new ApiClient(); + return apiClient; + } + +} diff --git a/testing/README.md b/testing/README.md index a691737e4f..3171b67b60 100644 --- a/testing/README.md +++ b/testing/README.md @@ -13,3 +13,5 @@ - [Testing with JGoTesting](http://www.baeldung.com/jgotesting) - [Introduction to JUnitParams](http://www.baeldung.com/junit-params) - [Cucumber Java 8 Support](http://www.baeldung.com/cucumber-java-8-support) +- [Introduction to Lambda Behave](http://www.baeldung.com/lambda-behave) + diff --git a/testing/pom.xml b/testing/pom.xml index 72ec2b2f0c..8f5c6ddb3d 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -86,6 +86,12 @@ jgotesting ${jgotesting.version} test + + + org.jukito + jukito + 1.5 + test diff --git a/testing/src/main/java/com/baeldung/introductionjukito/Calculator.java b/testing/src/main/java/com/baeldung/introductionjukito/Calculator.java new file mode 100644 index 0000000000..fd75e1bd9e --- /dev/null +++ b/testing/src/main/java/com/baeldung/introductionjukito/Calculator.java @@ -0,0 +1,7 @@ +package com.baeldung.introductionjukito; + +public interface Calculator { + + public double add(double a, double b); + +} diff --git a/testing/src/main/java/com/baeldung/introductionjukito/ScientificCalculator.java b/testing/src/main/java/com/baeldung/introductionjukito/ScientificCalculator.java new file mode 100644 index 0000000000..2501569afc --- /dev/null +++ b/testing/src/main/java/com/baeldung/introductionjukito/ScientificCalculator.java @@ -0,0 +1,5 @@ +package com.baeldung.introductionjukito; + +public class ScientificCalculator extends SimpleCalculator { + +} diff --git a/testing/src/main/java/com/baeldung/introductionjukito/SimpleCalculator.java b/testing/src/main/java/com/baeldung/introductionjukito/SimpleCalculator.java new file mode 100644 index 0000000000..933baa3cd0 --- /dev/null +++ b/testing/src/main/java/com/baeldung/introductionjukito/SimpleCalculator.java @@ -0,0 +1,10 @@ +package com.baeldung.introductionjukito; + +public class SimpleCalculator implements Calculator { + + @Override + public double add(double a, double b) { + return a+b; + } + +} diff --git a/testing/src/test/java/com/baeldung/introductionjukito/CalculatorTest.java b/testing/src/test/java/com/baeldung/introductionjukito/CalculatorTest.java new file mode 100644 index 0000000000..313e1d2938 --- /dev/null +++ b/testing/src/test/java/com/baeldung/introductionjukito/CalculatorTest.java @@ -0,0 +1,62 @@ +package com.baeldung.introductionjukito; + +import org.jukito.All; +import org.jukito.JukitoModule; +import org.jukito.JukitoRunner; +import org.junit.Test; +import org.junit.runner.RunWith; +import static org.junit.Assert.*; + +@RunWith(JukitoRunner.class) +public class CalculatorTest { + + public static class Module extends JukitoModule { + + @Override + protected void configureTest() { + bindMany(Calculator.class, SimpleCalculator.class, + ScientificCalculator.class); + bindManyInstances(AdditionTest.class, new AdditionTest(1, 1, 2), + new AdditionTest(10, 10, 20), + new AdditionTest(18, 24, 42)); + bindManyNamedInstances(Integer.class, "even", 2, 4, 6); + bindManyNamedInstances(Integer.class, "odd", 1, 3, 5); + } + } + + public static class AdditionTest { + + int a; + int b; + int expected; + + public AdditionTest(int a, int b, int expected) { + this.a = a; + this.b = b; + this.expected = expected; + } + } + + @Test + public void givenTwoNumbers_WhenAdd_ThenSumBoth(@All Calculator calc) { + double result = calc.add(1, 1); + assertEquals(2, result, .1); + } + + @Test + public void givenTwoNumbers_WhenAdd_ThenSumBoth(@All Calculator calc, + @All AdditionTest addTest) { + double result = calc.add(addTest.a, addTest.b); + assertEquals(addTest.expected, result, .1); + } + + @Test + public void givenEvenNumbers_whenPrint_thenOutput(@All("even") Integer i) { + System.out.println("even " + i); + } + + @Test + public void givenOddNumbers_whenPrint_thenOutput(@All("odd") Integer i) { + System.out.println("odd " + i); + } +} diff --git a/undertow/README.md b/undertow/README.md new file mode 100644 index 0000000000..8bfb4832e2 --- /dev/null +++ b/undertow/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Introduction to JBoss Undertow](http://www.baeldung.com/jboss-undertow) diff --git a/vavr/README.md b/vavr/README.md index d7816f3f9f..24b8c5a615 100644 --- a/vavr/README.md +++ b/vavr/README.md @@ -5,4 +5,4 @@ - [Property Testing Example With Vavr](http://www.baeldung.com/javaslang-property-testing) - [Exceptions in Lambda Expression Using Vavr](http://www.baeldung.com/exceptions-using-vavr) - [Vavr (ex-Javaslang) Support in Spring Data](http://www.baeldung.com/spring-vavr) - +- [Collection Factory Methods for Vavr](http://www.baeldung.com/vavr-collection-factory-methods) diff --git a/vavr/pom.xml b/vavr/pom.xml index 426155263c..2efaf7fd8c 100644 --- a/vavr/pom.xml +++ b/vavr/pom.xml @@ -40,6 +40,13 @@ org.springframework.boot spring-boot-starter-test + + + org.awaitility + awaitility + ${awaitility.version} + test + @@ -67,8 +74,9 @@ 1.8 - 0.9.0 + 0.9.1 4.12 + 3.0.0 diff --git a/vavr/src/test/java/com/baeldung/vavr/collections/CollectionAPIUnitTest.java b/vavr/src/test/java/com/baeldung/vavr/collections/CollectionAPIUnitTest.java index 4b4eb55fc5..b4e7628e84 100644 --- a/vavr/src/test/java/com/baeldung/vavr/collections/CollectionAPIUnitTest.java +++ b/vavr/src/test/java/com/baeldung/vavr/collections/CollectionAPIUnitTest.java @@ -2,8 +2,9 @@ package com.baeldung.vavr.collections; import io.vavr.Tuple; import io.vavr.Tuple2; -import io.vavr.collection.Array; -import io.vavr.collection.CharSeq; +import io.vavr.collection.*; +import io.vavr.collection.BitSet; +import io.vavr.collection.HashMap; import io.vavr.collection.HashSet; import io.vavr.collection.Iterator; import io.vavr.collection.List; @@ -12,13 +13,12 @@ import io.vavr.collection.Queue; import io.vavr.collection.Set; import io.vavr.collection.SortedMap; import io.vavr.collection.SortedSet; -import io.vavr.collection.Stream; import io.vavr.collection.TreeMap; import io.vavr.collection.TreeSet; import io.vavr.collection.Vector; import org.junit.Test; -import java.util.Comparator; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -30,16 +30,67 @@ import static org.junit.Assert.assertTrue; public class CollectionAPIUnitTest { + @Test - public void givenEmptyList_whenStacked_thenCorrect() { + public void givenParams_whenListAPI_thenCorrect() { + + List list + = List.of("Java", "PHP", "Jquery", "JavaScript", "JShell", "JAVA"); + + List list1 = list.drop(2); + assertFalse(list1.contains("Java") && list1.contains("PHP")); + + List list2 = list.dropRight(2); + assertFalse(list2.contains("JAVA") && list2.contains("JShell")); + + List list3 = list.dropUntil(s -> s.contains("Shell")); + assertEquals(list3.size(), 2); + + List list4 = list.dropWhile(s -> s.length() > 0); + assertTrue(list4.isEmpty()); + + List list5 = list.take(1); + assertEquals(list5.single(), "Java"); + + List list6 = list.takeRight(1); + assertEquals(list6.single(), "JAVA"); + + List list7 = list.takeUntil(s -> s.length() > 6); + assertEquals(list7.size(), 3); + + List list8 + = list.distinctBy( (s1, s2) -> s1.startsWith(s2.charAt(0)+"") ? 0 : 1); + assertEquals(list8.size(), 2); + + Iterator> iterator = list.grouped(2); + assertEquals(iterator.head().size(), 2); + + Map> map = list.groupBy(e -> e.startsWith("J")); + assertEquals(map.size(), 2); + assertEquals(map.get(false).get().size(), 1); + assertEquals(map.get(true).get().size(), 5); + + String words = List.of("Boys", "Girls") + .intersperse("and") + .reduce((s1, s2) -> s1.concat( " " + s2 )) + .trim(); + + assertEquals(words, "Boys and Girls"); + + } + + @Test + public void givenEmptyList_whenStackAPI_thenCorrect() { + List intList = List.empty(); - List anotherList = intList.push(4) - .push(0); - Iterator iterator = anotherList.iterator(); + List intList1 = intList.pushAll(List.rangeClosed(5,10)); + + assertEquals(intList1.peek(), Integer.valueOf(10)); + + List intList2 = intList1.pop(); + assertEquals(intList2.size(), (intList1.size() - 1) ); - assertEquals(new Integer(0), iterator.next()); - assertEquals(new Integer(4), iterator.next()); } @Test @@ -61,27 +112,36 @@ public class CollectionAPIUnitTest { @Test public void givenQueue_whenEnqueued_thenCorrect() { + Queue queue = Queue.of(1, 2, 3); - Queue secondQueue = queue.enqueue(4) - .enqueue(5); + Queue secondQueue = queue.enqueueAll(List.of(4,5)); assertEquals(3, queue.size()); assertEquals(5, secondQueue.size()); Tuple2> result = secondQueue.dequeue(); - Integer headValue = result.apply((head, tail) -> head); - assertEquals(new Integer(1), headValue); + assertEquals(Integer.valueOf(1), result._1); - Iterator iterator = result.apply((head, tail) -> tail.iterator()); + Queue tailQueue = result._2; + assertFalse(tailQueue.contains(secondQueue.get(0))); - assertEquals(new Integer(2), iterator.next()); - assertEquals(new Integer(3), iterator.next()); - assertEquals(new Integer(4), iterator.next()); - assertEquals(new Integer(5), iterator.next()); + Queue> queue1 = queue.combinations(2); + assertEquals(queue1.get(2).toCharSeq(), CharSeq.of("23")); } @Test public void givenStream_whenProcessed_thenCorrect() { + + Stream s1 = Stream.tabulate(5, (i)-> i + 1); + assertEquals(s1.get(2).intValue(), 3); + + Stream s = Stream.of(2,1,3,4); + + Stream> s2 = s.zip(List.of(7,8,9)); + Tuple2 t1 = s2.get(0); + assertEquals(t1._1().intValue(), 2); + assertEquals(t1._2().intValue(), 7); + Stream intStream = Stream.iterate(0, i -> i + 1) .take(10); @@ -92,21 +152,27 @@ public class CollectionAPIUnitTest { .longValue(); assertEquals(20, evenSum); - assertEquals(new Integer(5), intStream.get(5)); } @Test public void givenArray_whenQueried_thenCorrect() { + + Array rArray = Array.range(1, 5); + assertFalse(rArray.contains(5)); + + Array rArray2 = Array.rangeClosed(1, 5); + assertTrue(rArray2.contains(5)); + + Array rArray3 = Array.rangeClosedBy(1,6,2); + assertEquals(rArray3.size(), 3); + Array intArray = Array.of(1, 2, 3); Array newArray = intArray.removeAt(1); - - assertEquals(3, intArray.size()); assertEquals(2, newArray.size()); + assertEquals(3, newArray.get(1).intValue()); - assertEquals(new Integer(1), intArray.get(0)); - assertEquals(new Integer(2), intArray.get(1)); - assertEquals(new Integer(3), intArray.get(2)); - assertEquals(new Integer(3), newArray.get(1)); + Array array2 = intArray.replace(1, 5); + assertEquals(array2.get(0).intValue(), 5); } @Test @@ -117,10 +183,8 @@ public class CollectionAPIUnitTest { assertEquals(4, intVector.size()); assertEquals(4, newVector.size()); - assertEquals(new Integer(1), intVector.get(0)); - assertEquals(new Integer(2), intVector.get(1)); - assertEquals(new Integer(3), intVector.get(2)); - assertEquals(new Integer(6), newVector.get(1)); + assertEquals(2, intVector.get(1).intValue()); + assertEquals(6, newVector.get(1).intValue()); } @Test @@ -143,57 +207,86 @@ public class CollectionAPIUnitTest { assertEquals(3, set.size()); assertEquals(4, newSet.size()); - assertFalse(set.contains("Yellow")); assertTrue(newSet.contains("Yellow")); + + HashSet set0 = HashSet.rangeClosed(1,5); + HashSet set1 = HashSet.rangeClosed(3, 6); + + assertEquals(set0.union(set1), HashSet.rangeClosed(1,6)); + assertEquals(set0.diff(set1), HashSet.rangeClosed(1,2)); + assertEquals(set0.intersect(set1), HashSet.rangeClosed(3,5)); + + } @Test public void givenSortedSet_whenIterated_thenCorrect() { SortedSet set = TreeSet.of("Red", "Green", "Blue"); + assertEquals("Blue", set.head()); - Iterator iterator = set.iterator(); - assertEquals("Blue", iterator.next()); - assertEquals("Green", iterator.next()); - assertEquals("Red", iterator.next()); + SortedSet intSet = TreeSet.of(1,2,3); + assertEquals(2, intSet.average().get().intValue()); + } @Test public void givenSortedSet_whenReversed_thenCorrect() { - SortedSet set = TreeSet.of(Comparator.reverseOrder(), "Green", "Red", "Blue"); + SortedSet reversedSet + = TreeSet.of(Comparator.reverseOrder(), "Green", "Red", "Blue"); + assertEquals("Red", reversedSet.head()); - Iterator iterator = set.iterator(); - assertEquals("Red", iterator.next()); - assertEquals("Green", iterator.next()); - assertEquals("Blue", iterator.next()); + String str = reversedSet.mkString(" and "); + assertEquals("Red and Green and Blue", str); } @Test - public void givenMap_whenIterated_thenCorrect() { + public void giveBitSet_whenApiMethods_thenCorrect() { + + BitSet bitSet = BitSet.of(1,2,3,4,5,6,7,8); + + BitSet bitSet1 = bitSet.takeUntil(i -> i > 4); + assertEquals(bitSet1.size(), 4); + + } + + @Test + public void givenMap_whenMapApi_thenCorrect() { Map> map = List.rangeClosed(0, 10) .groupBy(i -> i % 2); - + assertEquals(2, map.size()); + assertEquals(6, map.get(0).get().size()); + assertEquals(5, map.get(1).get().size()); - Iterator>> iterator = map.iterator(); - assertEquals(6, iterator.next() - ._2() - .size()); - assertEquals(5, iterator.next() - ._2() - .size()); + Map map1 + = HashMap.of("key1", "val1", "key2", "val2", "key3", "val3"); + + Map fMap + = map1.filterKeys(k -> k.contains("1") || k.contains("2")); + assertFalse(fMap.containsKey("key3")); + + Map fMap2 + = map1.filterValues(v -> v.contains("3")); + assertEquals(fMap2.size(), 1); + assertTrue(fMap2.containsValue("val3")); + + Map map2 = map1.map( + (k, v) -> Tuple.of(k, Integer.valueOf(v.charAt(v.length() - 1) + "") )); + assertEquals(map2.get("key1").get().intValue(), 1); } @Test public void givenTreeMap_whenIterated_thenCorrect() { - SortedMap map = TreeMap.of(3, "Three", 2, "Two", 4, "Four", 1, "One"); + SortedMap map + = TreeMap.of(3, "Three", 2, "Two", 4, "Four", 1, "One"); + + assertEquals(1, map.keySet().toJavaArray()[0]); + assertEquals("Four", map.get(4).get()); + + TreeMap treeMap2 = + TreeMap.of(Comparator.reverseOrder(), 3,"three", 6, "six", 1, "one"); + assertEquals(treeMap2.keySet().mkString(), "631"); - Iterator> iterator = map.iterator(); - assertEquals(new Integer(1), iterator.next() - ._1()); - assertEquals(new Integer(2), iterator.next() - ._1()); - assertEquals(new Integer(3), iterator.next() - ._1()); } @Test @@ -202,14 +295,13 @@ public class CollectionAPIUnitTest { List vavrList = List.ofAll(javaList); assertEquals(4, vavrList.size()); - assertEquals(new Integer(1), vavrList.head()); + assertEquals(1, vavrList.head().intValue()); java.util.stream.Stream javaStream = javaList.stream(); Set vavrSet = HashSet.ofAll(javaStream); assertEquals(4, vavrSet.size()); - assertEquals(new Integer(2), vavrSet.tail() - .head()); + assertEquals(2, vavrSet.tail().head().intValue()); } @Test @@ -220,7 +312,7 @@ public class CollectionAPIUnitTest { .collect(List.collector()); assertEquals(4, vavrList.size()); - assertEquals(new Integer(2), vavrList.head()); + assertEquals(2, vavrList.head().intValue()); } @Test @@ -231,7 +323,7 @@ public class CollectionAPIUnitTest { java.util.Map map = List.of("1", "2", "3") .toJavaMap(i -> Tuple.of(i, Integer.valueOf(i))); - assertEquals(new Integer(2), map.get("2")); + assertEquals(2, map.get("2").intValue()); } @Test @@ -240,8 +332,7 @@ public class CollectionAPIUnitTest { .collect(Collectors.toSet()); assertEquals(3, javaSet.size()); - assertEquals(new Integer(1), javaSet.iterator() - .next()); + assertEquals(1, javaSet.toArray()[0]); } @Test @@ -250,7 +341,7 @@ public class CollectionAPIUnitTest { .asJavaMutable(); javaList.add(4); - assertEquals(new Integer(4), javaList.get(3)); + assertEquals(4, javaList.get(3).intValue()); } @Test(expected = UnsupportedOperationException.class) @@ -258,7 +349,7 @@ public class CollectionAPIUnitTest { java.util.List javaList = List.of(1, 2, 3) .asJava(); - assertEquals(new Integer(3), javaList.get(2)); + assertEquals(3, javaList.get(2).intValue()); javaList.add(4); } diff --git a/vavr/src/test/java/com/baeldung/vavr/collections/CollectionFactoryMethodsUnitTest.java b/vavr/src/test/java/com/baeldung/vavr/collections/CollectionFactoryMethodsUnitTest.java new file mode 100644 index 0000000000..60359d6803 --- /dev/null +++ b/vavr/src/test/java/com/baeldung/vavr/collections/CollectionFactoryMethodsUnitTest.java @@ -0,0 +1,107 @@ +package com.baeldung.vavr.collections; + +import static io.vavr.API.Array; +import static io.vavr.API.Failure; +import static io.vavr.API.List; +import static io.vavr.API.None; +import static io.vavr.API.Some; +import static io.vavr.API.Stream; +import static io.vavr.API.Success; +import static io.vavr.API.Tuple; +import static io.vavr.API.Vector; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import io.vavr.Tuple3; +import io.vavr.collection.Array; +import io.vavr.collection.List; +import io.vavr.collection.Stream; +import io.vavr.collection.Vector; +import io.vavr.control.Option; +import io.vavr.control.Try; + +public class CollectionFactoryMethodsUnitTest { + + @Test + public void givenANoneOptionElement_whenCreated_thenCorrect() { + Option none = None(); + assertFalse(none == null); + assertEquals(none, Option.none()); + } + + @Test + public void givenASomeOptionElement_whenCreated_thenCorrect() { + Option some = Some(1); + assertFalse(some == null); + assertTrue(some.contains(1)); + } + + @Test + public void givenATupleElement_whenCreated_thenCorrect() { + Tuple3 tuple = Tuple('a', "chain", 2); + assertTrue(tuple!=null); + assertEquals(tuple._1(), new Character('a')); + assertEquals(tuple._2(), "chain"); + assertEquals(tuple._3().intValue(), 2); + } + + @Test + public void givenASuccessObject_whenEvaluated_thenSuccess() { + Try integer = Success(55); + assertEquals(integer.get().intValue(), 55); + } + @Test + public void givenAFailureObject_whenEvaluated_thenExceptionThrown() { + Try failure = Failure(new Exception("Exception X encapsulated here")); + + try { + Integer i = failure.get();// evaluate a failure raise the exception + System.out.println(i);// not executed + } catch (Exception e) { + assertEquals(e.getMessage(), "Exception X encapsulated here"); + } + } + + @Test + public void givenAList_whenCreated_thenCorrect() { + List list = List(1, 2, 3, 4, 5); + + assertEquals(list.size(), 5); + assertEquals(list.get(0).intValue(), 1); + } + + @Test + public void givenAnEmptyList_whenCreated_thenCorrect() { + List empty = List(); + + assertEquals(empty.size(), 0); + assertEquals(empty, List.empty()); + } + + @Test + public void givenAnArray_whenCreated_thenCorrect() { + Array array = Array(1, 2, 3, 4, 5); + + assertEquals(array.size(), 5); + assertEquals(array.get(0).intValue(), 1); + } + + @Test + public void givenAStream_whenCreated_thenCorrect() { + Stream stream = Stream(1, 2, 3, 4, 5); + + assertEquals(stream.size(), 5); + assertEquals(stream.get(0).intValue(), 1); + } + + @Test + public void givenAVector_whenCreated_thenCorrect() { + Vector vector = Vector(1, 2, 3, 4, 5); + + assertEquals(vector.size(), 5); + assertEquals(vector.get(0).intValue(), 1); + } +} diff --git a/vavr/src/test/java/com/baeldung/vavr/future/FutureUnitTest.java b/vavr/src/test/java/com/baeldung/vavr/future/FutureUnitTest.java new file mode 100644 index 0000000000..437742c964 --- /dev/null +++ b/vavr/src/test/java/com/baeldung/vavr/future/FutureUnitTest.java @@ -0,0 +1,289 @@ +package com.baeldung.vavr.future; + +import static io.vavr.API.$; +import static io.vavr.API.Case; +import static io.vavr.API.Match; +import static io.vavr.Predicates.exists; +import static io.vavr.Predicates.forAll; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.concurrent.CancellationException; +import java.util.function.Consumer; +import java.util.function.Predicate; + +import org.junit.Test; +import org.mockito.Mockito; +import org.mockito.internal.verification.VerificationModeFactory; +import org.mockito.verification.Timeout; + +import io.vavr.Tuple; +import io.vavr.Tuple2; +import io.vavr.collection.List; +import io.vavr.concurrent.Future; +import io.vavr.control.Try; + +public class FutureUnitTest { + + private final String SUCCESS = "Success"; + private final String FAILURE = "Failure"; + + @Test + public void givenFunctionReturnInteger_WhenCallWithFuture_ShouldReturnFunctionValue() { + Future future = Future.of(() -> 1); + + assertEquals(1, future.get().intValue()); + } + + @Test + public void givenFunctionGetRemoteHttpResourceAsString_WhenCallSuccessWithFuture_ShouldReturnContentValueAsString() { + String url = "http://resource"; + String content = "Content from " + url; + Future future = Future.of(() -> getResource(url)); + + assertEquals(content, future.get()); + } + + @Test + public void givenFunctionThrowException_WhenCallWithFuture_ShouldReturnFailure() { + Future future = Future.of(() -> getResourceThrowException("")); + future.await(); + + assertTrue(future.isFailure()); + } + + @Test + public void givenAFutureReturnZero_WhenCheckFutureWithExistEvenValue_ShouldReturnRight() { + Future future = Future.of(() -> 2); + boolean result = future.exists(i -> i % 2 == 0); + + assertTrue(result); + } + + @Test + public void givenFunction_WhenCallWithFutureAndRegisterConsumerForSuccess_ShouldCallConsumerToStoreValue() { + Future future = Future.of(() -> 1); + MockConsumer consumer = Mockito.mock(MockConsumer.class); + future.onSuccess(consumer); + Mockito.verify(consumer, new Timeout(1000, VerificationModeFactory.times(1))).accept(1); + } + + @Test + public void givenFunctionThrowException_WhenCallWithFutureAndRegisterConsumerForFailer_ShouldCallConsumerToStoreException() { + Future future = Future.of(() -> getResourceThrowException("")); + MockThrowableConsumer consumer = Mockito.mock(MockThrowableConsumer.class); + future.onFailure(consumer); + Mockito.verify(consumer, new Timeout(1000, VerificationModeFactory.times(1))).accept(Mockito.any()); + } + + @Test + public void givenAFuture_WhenAddAndThenConsumer_ShouldCallConsumerWithResultOfFutureAction() { + MockTryConsumer consumer1 = Mockito.mock(MockTryConsumer.class); + MockTryConsumer consumer2 = Mockito.mock(MockTryConsumer.class); + Future future = Future.of(() -> 1); + Future andThenFuture = future.andThen(consumer1).andThen(consumer2); + andThenFuture.await(); + Mockito.verify(consumer1, VerificationModeFactory.times(1)).accept(Try.success(1)); + Mockito.verify(consumer2, VerificationModeFactory.times(1)).accept(Try.success(1)); + } + + @Test + public void givenAFailureFuture_WhenCallOrElseFunction_ShouldReturnNewFuture() { + Future future = Future.failed(new RuntimeException()); + Future future2 = future.orElse(Future.of(() -> 2)); + + assertEquals(2, future2.get().intValue()); + } + + @Test(expected = CancellationException.class) + public void givenAFuture_WhenCallCancel_ShouldReturnCancellationException() { + long waitTime = 1000; + Future future = Future.of(() -> { + Thread.sleep(waitTime); + return 1; + }); + future.cancel(); + future.await(); + future.get(); + } + + @Test + public void givenAFuture_WhenCallFallBackWithSuccessFuture_ShouldReturnFutureResult() { + String expectedResult = "take this"; + Future future = Future.of(() -> expectedResult); + Future secondFuture = Future.of(() -> "take that"); + Future futureResult = future.fallbackTo(secondFuture); + futureResult.await(); + + assertEquals(expectedResult, futureResult.get()); + } + + @Test + public void givenAFuture_WhenCallFallBackWithFailureFuture_ShouldReturnValueOfFallBackFuture() { + String expectedResult = "take that"; + Future future = Future.failed(new RuntimeException()); + Future fallbackFuture = Future.of(() -> expectedResult); + Future futureResult = future.fallbackTo(fallbackFuture); + + assertEquals(expectedResult, futureResult.get()); + } + + @Test + public void givenAFuture_WhenTransformByAddingOne_ShouldReturn() { + Future future = Future.of(() -> 1).transformValue(f -> Try.of(() -> "Hello: " + f.get())); + + assertEquals("Hello: 1", future.get()); + } + + @Test + public void givenAFutureOfInt_WhenMapToString_ShouldCombineAndReturn() { + Future future = Future.of(()->1).map(i -> "Hello: " + i); + + assertEquals("Hello: 1", future.get()); + } + + @Test + public void givenAFutureOfInt_WhenFlatMapToString_ShouldCombineAndReturn() { + Future futureMap = Future.of(() -> 1).flatMap((i) -> Future.of(() -> "Hello: " + i)); + + assertEquals("Hello: 1", futureMap.get()); + } + + @Test + public void givenAFutureOf2String_WhenZip_ShouldReturnTupleOf2String() { + Future> future = Future.of(() -> "hello").zip(Future.of(() -> "world")); + + assertEquals(Tuple.of("hello", "world"), future.get()); + } + + @Test + public void givenGetResourceWithFuture_WhenWaitAndMatchWithPredicate_ShouldReturnSuccess() { + String url = "http://resource"; + Future future = Future.of(() -> getResource(url)); + future.await(); + String s = Match(future).of( + Case($(future0 -> future0.isSuccess()), SUCCESS), + Case($(), FAILURE)); + + assertEquals(SUCCESS, s); + } + + @Test + public void givenAFailedFuture_WhenWaitAndMatchWithPredicateCheckSuccess_ShouldReturnFailed() { + Future future = Future.failed(new RuntimeException()); + future.await(); + String s = Match(future).of( + Case($(future0 -> future0.isSuccess()), SUCCESS), + Case($(), FAILURE)); + + assertEquals(FAILURE, s); + } + + @Test + public void givenAFuture_WhenMatchWithFuturePredicate_ShouldReturnSuccess() { + Future future = Future.of(() -> { + Thread.sleep(10); + return 1; + }); + Predicate> predicate = f -> f.exists(i -> i % 2 == 1); + + String s = Match(future).of( + Case($(predicate), "Even"), + Case($(), "Odd")); + + assertEquals("Even", s); + } + + @Test + public void givenAListOfFutureReturnFist3Integers_WhenMatchWithExistEvenNumberPredicate_ShouldReturnSuccess() { + List> futures = getFutureOfFirst3Number(); + Predicate> predicate0 = future -> future.exists(i -> i % 2 == 0); + String s = Match(futures).of( + Case($(exists(predicate0)), "Even"), + Case($(), "Odd")); + + assertEquals("Even", s); + } + + @Test + public void givenAListOfFutureReturnFist3Integers_WhenMatchWithForAllNumberBiggerThanZeroPredicate_ShouldReturnSuccess() { + List> futures = getFutureOfFirst3Number(); + Predicate> predicate0 = future -> future.exists(i -> i > 0); + String s = Match(futures).of( + Case($(forAll(predicate0)), "Positive numbers"), + Case($(), "None")); + + assertEquals("Positive numbers", s); + } + + @Test + public void givenAListOfFutureReturnFist3Integers_WhenMatchWithForAllNumberSmallerThanZeroPredicate_ShouldReturnFailed() { + List> futures = getFutureOfFirst3Number(); + Predicate> predicate0 = future -> future.exists(i -> i < 0); + String s = Match(futures).of( + Case($(forAll(predicate0)), "Negative numbers"), + Case($(), "None")); + + assertEquals("None", s); + } + + private String getResource(String url) { + try { + Thread.sleep(10); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + return "Content from " + url; + } + + private String getResourceThrowException(String url) { + throw new RuntimeException("Exception when get resource " + url); + } + + private List> getFutureOfFirst3Number() { + List> futures = List.of(Future.of(() -> 1), Future.of(() -> 2), Future.of(() -> 3)); + return futures; + } + + private static void checkOnSuccessFunction() { + Future future = Future.of(() -> 1); + future.onSuccess(i -> System.out.println("Future finish with result: " + i)); + } + + private static void checkOnFailureFunction() { + Future future = Future.of(() -> {throw new RuntimeException("Failed");}); + future.onFailure(t -> System.out.println("Future failures with exception: " + t)); + } + + private static void runAndThenConsumer() { + Future future = Future.of(() -> 1); + future.andThen(i -> System.out.println("Do side-effect action 1 with input: " + i.get())). + andThen((i) -> System.out.println("Do side-effect action 2 with input: " + i.get())); + } + + public static void main(String[] args) throws InterruptedException { + checkOnSuccessFunction(); + checkOnFailureFunction(); + runAndThenConsumer(); + Thread.sleep(1000); + } +} + + +class MockConsumer implements Consumer { + @Override + public void accept(Integer t) { + } +} + +class MockTryConsumer implements Consumer> { + @Override + public void accept(Try t) { + } +} + +class MockThrowableConsumer implements Consumer { + @Override + public void accept(Throwable t) { + } +} diff --git a/vavr/vavr-validation/src/main/java/com/baeldung/vavrvalidation/application/Application.java b/vavr/vavr-validation/src/main/java/com/baeldung/vavrvalidation/application/Application.java new file mode 100644 index 0000000000..8acc4522af --- /dev/null +++ b/vavr/vavr-validation/src/main/java/com/baeldung/vavrvalidation/application/Application.java @@ -0,0 +1,17 @@ +package com.baeldung.vavrvalidation.application; + +import com.baeldung.vavrvalidation.model.User; +import com.baeldung.vavrvalidation.validator.UserValidator; +import io.vavr.collection.Seq; +import io.vavr.control.Validation; + +public class Application { + + public static void main(String[] args) { + + UserValidator userValidator = new UserValidator(); + Validation, User> validation = userValidator.validateUser("John", "john@domain.com"); + + // process validation results here + } +} diff --git a/vavr/vavr-validation/src/main/java/com/baeldung/vavrvalidation/model/User.java b/vavr/vavr-validation/src/main/java/com/baeldung/vavrvalidation/model/User.java new file mode 100644 index 0000000000..f1477a1ed3 --- /dev/null +++ b/vavr/vavr-validation/src/main/java/com/baeldung/vavrvalidation/model/User.java @@ -0,0 +1,18 @@ +package com.baeldung.vavrvalidation.model; + +public class User { + private String name; + private String email; + + public User(String name, String email) { + this.name = name; + this.email = email; + } + + @Override + public String toString() { + return "User [name=" + name + ", email=" + email + "]"; + } + + // standard setters and getters +} diff --git a/vavr/vavr-validation/src/main/java/com/baeldung/vavrvalidation/validator/UserValidator.java b/vavr/vavr-validation/src/main/java/com/baeldung/vavrvalidation/validator/UserValidator.java new file mode 100644 index 0000000000..1cec006816 --- /dev/null +++ b/vavr/vavr-validation/src/main/java/com/baeldung/vavrvalidation/validator/UserValidator.java @@ -0,0 +1,29 @@ +package com.baeldung.vavrvalidation.validator; + +import com.baeldung.vavrvalidation.model.User; +import io.vavr.collection.CharSeq; +import io.vavr.collection.Seq; +import io.vavr.control.Validation; + +public class UserValidator { + + private static final String NAME_PATTERN = "^[a-zA-Z0-9]+$"; + private static final String NAME_ERROR = "Name contains invalid characters"; + private static final String EMAIL_PATTERN = + "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; + private static final String EMAIL_ERROR = "Email must be a well-formed email address"; + + public Validation, User> validateUser(String name, String email) { + return Validation + .combine(validateField(name, NAME_PATTERN, NAME_ERROR) + ,validateField(email, EMAIL_PATTERN, EMAIL_ERROR)) + .ap(User::new); + } + + private Validation validateField(String field, String pattern, String error) { + return CharSeq.of(field).replaceAll(pattern, "").transform(seq -> seq.isEmpty() + ? Validation.valid(field) + : Validation.invalid(error)); + } +} diff --git a/vavr/vavr-validation/src/test/java/com/baeldung/vavrvalidation/validator/UserValidatorTest.java b/vavr/vavr-validation/src/test/java/com/baeldung/vavrvalidation/validator/UserValidatorTest.java new file mode 100644 index 0000000000..cb9557fa53 --- /dev/null +++ b/vavr/vavr-validation/src/test/java/com/baeldung/vavrvalidation/validator/UserValidatorTest.java @@ -0,0 +1,23 @@ +package com.baeldung.vavrvalidation.validator; + +import static org.junit.Assert.*; +import static org.hamcrest.CoreMatchers.instanceOf; +import org.junit.Test; +import com.baeldung.vavrvalidation.validator.UserValidator; +import io.vavr.control.Validation.Invalid; +import io.vavr.control.Validation.Valid; + +public class UserValidatorTest { + + @Test + public void givenValidUserParams_whenValidated_thenInstanceOfValid() { + UserValidator userValidator = new UserValidator(); + assertThat(userValidator.validateUser("John", "john@domain.com"), instanceOf(Valid.class)); + } + + @Test + public void givenInvalidUserParams_whenValidated_thenInstanceOfInvalid() { + UserValidator userValidator = new UserValidator(); + assertThat(userValidator.validateUser("John", "no-email"), instanceOf(Invalid.class)); + } +} diff --git a/vavr/vavr-validation/src/test/java/com/baeldung/vavrvalidation/validator/ValidationTest.java b/vavr/vavr-validation/src/test/java/com/baeldung/vavrvalidation/validator/ValidationTest.java new file mode 100644 index 0000000000..c89b43b5e3 --- /dev/null +++ b/vavr/vavr-validation/src/test/java/com/baeldung/vavrvalidation/validator/ValidationTest.java @@ -0,0 +1,68 @@ +package com.baeldung.vavrvalidation.validator; + +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import com.baeldung.vavrvalidation.model.User; +import io.vavr.collection.Seq; +import io.vavr.control.Either.Right; +import io.vavr.control.Validation.Invalid; +import io.vavr.control.Validation.Valid; + +public class ValidationTest { + + private static UserValidator userValidator; + + @BeforeClass + public static void setUpUserValidatorInstance() { + userValidator = new UserValidator(); + } + + @AfterClass + public static void teardownUserValidatorInstance() { + userValidator = null; + } + + @Test + public void givenInvalidUserParams_whenValidated_thenInvalidInstance() { + assertThat(userValidator.validateUser("John", "no-email"), instanceOf(Invalid.class)); + } + + @Test + public void givenValidUserParams_whenValidated_thenValidInstance() { + assertThat(userValidator.validateUser("John", "john@domain.com"), instanceOf(Valid.class)); + } + + @Test + public void givenInvalidUserParams_whenValidated_thenTrueWithIsInvalidMethod() { + assertTrue(userValidator.validateUser("John", "no-email").isInvalid()); + } + + @Test + public void givenValidUserParams_whenValidated_thenTrueWithIsValidMethod() { + assertTrue(userValidator.validateUser("John", "john@domain.com").isValid()); + } + + @Test + public void givenInValidUserParams_withGetErrorMethod_thenGetErrorMessages() { + assertEquals("Name contains invalid characters, Email must be a well-formed email address", userValidator.validateUser(" ", "no-email") + .getError().intersperse(", ").fold("", String::concat)); + } + + @Test + public void givenValidUserParams_withGetMethod_thenGetUserInstance() { + assertThat(userValidator.validateUser("John", "john@domain.com").get(), instanceOf(User.class)); + } + + @Test + public void givenValidUserParams_withtoEitherMethod_thenRightInstance() { + assertThat(userValidator.validateUser("John", "john@domain.com").toEither(), instanceOf(Right.class)); + } + + @Test + public void givenValidUserParams_withFoldMethodWithListlengthUserHashCode_thenEqualstoParamsLength() { + assertEquals(2, (int) userValidator.validateUser(" ", " ").fold(Seq::length, User::hashCode)); + } +} diff --git a/vertx-and-rxjava/pom.xml b/vertx-and-rxjava/pom.xml new file mode 100644 index 0000000000..9c2c9bfd48 --- /dev/null +++ b/vertx-and-rxjava/pom.xml @@ -0,0 +1,70 @@ + + + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + 4.0.0 + vertx-and-rxjava + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + + + io.vertx + vertx-rx-java2 + 3.5.0.Beta1 + + + io.vertx + vertx-core + 3.5.0.Beta1 + + + io.vertx + vertx-unit + 3.5.0.Beta1 + test + + + junit + junit + 4.12 + test + + + org.slf4j + slf4j-api + 1.7.25 + + + ch.qos.logback + logback-classic + 1.2.3 + + + junit + junit + 4.12 + + + + + \ No newline at end of file diff --git a/vertx-and-rxjava/pom.xml.orig b/vertx-and-rxjava/pom.xml.orig new file mode 100644 index 0000000000..47510e60f7 --- /dev/null +++ b/vertx-and-rxjava/pom.xml.orig @@ -0,0 +1,71 @@ + + + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + 4.0.0 + com.baeldung + vertx-and-rxjava + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + + + io.vertx + vertx-rx-java2 + 3.5.0.Beta1 + + + io.vertx + vertx-core + 3.5.0.Beta1 + + + io.vertx + vertx-unit + 3.5.0.Beta1 + test + + + junit + junit + 4.12 + test + + + org.slf4j + slf4j-api + 1.7.25 + + + ch.qos.logback + logback-classic + 1.2.3 + + + junit + junit + 4.12 + + + + + \ No newline at end of file diff --git a/vertx-and-rxjava/src/test/java/com/baeldung/weather/CityAndDayLength.java b/vertx-and-rxjava/src/test/java/com/baeldung/weather/CityAndDayLength.java new file mode 100644 index 0000000000..f725c8255e --- /dev/null +++ b/vertx-and-rxjava/src/test/java/com/baeldung/weather/CityAndDayLength.java @@ -0,0 +1,19 @@ +package com.baeldung.weather; + +import java.text.MessageFormat; + +class CityAndDayLength { + + private final String city; + private final double dayLengthInHours; + + CityAndDayLength(String city, long dayLengthInSeconds) { + this.city = city; + this.dayLengthInHours = dayLengthInSeconds / (60.0 * 60.0); + } + + @Override + public String toString() { + return MessageFormat.format("In {0} there are {1,number,#0.0} hours of light.", city, dayLengthInHours); + } +} diff --git a/vertx-and-rxjava/src/test/java/com/baeldung/weather/MetaWeatherClient.java b/vertx-and-rxjava/src/test/java/com/baeldung/weather/MetaWeatherClient.java new file mode 100644 index 0000000000..0dc1f8ac95 --- /dev/null +++ b/vertx-and-rxjava/src/test/java/com/baeldung/weather/MetaWeatherClient.java @@ -0,0 +1,45 @@ +package com.baeldung.weather; + +import io.reactivex.Flowable; +import io.vertx.core.http.RequestOptions; +import io.vertx.reactivex.core.http.HttpClient; +import io.vertx.reactivex.core.http.HttpClientRequest; +import io.vertx.reactivex.core.http.HttpClientResponse; + +import static java.lang.String.format; + +class MetaWeatherClient { + + private static RequestOptions metawether = new RequestOptions() + .setHost("www.metaweather.com") + .setPort(443) + .setSsl(true); + + /** + * @return A flowable backed by vertx that automatically sends an HTTP request at soon as the first subscription is received. + */ + private static Flowable autoPerformingReq(HttpClient httpClient, String uri) { + HttpClientRequest req = httpClient.get(new RequestOptions(metawether).setURI(uri)); + return req.toFlowable() + .doOnSubscribe(subscription -> req.end()); + } + + static Flowable searchByCityName(HttpClient httpClient, String cityName) { + HttpClientRequest req = httpClient.get( + new RequestOptions() + .setHost("www.metaweather.com") + .setPort(443) + .setSsl(true) + .setURI(format("/api/location/search/?query=%s", cityName))); + return req + .toFlowable() + .doOnSubscribe(subscription -> req.end()); + } + + static Flowable getDataByPlaceId(HttpClient httpClient, long placeId) { + return autoPerformingReq( + httpClient, + format("/api/location/%s/", placeId)); + } + +} diff --git a/vertx-and-rxjava/src/test/java/com/baeldung/weather/VertxWithRxJavaIntegrationTest.java b/vertx-and-rxjava/src/test/java/com/baeldung/weather/VertxWithRxJavaIntegrationTest.java new file mode 100644 index 0000000000..a2ddbe5007 --- /dev/null +++ b/vertx-and-rxjava/src/test/java/com/baeldung/weather/VertxWithRxJavaIntegrationTest.java @@ -0,0 +1,92 @@ +package com.baeldung.weather; + +import io.reactivex.Flowable; +import io.reactivex.functions.Function; +import io.vertx.core.json.JsonObject; +import io.vertx.reactivex.core.Vertx; +import io.vertx.reactivex.core.buffer.Buffer; +import io.vertx.reactivex.core.file.FileSystem; +import io.vertx.reactivex.core.http.HttpClient; +import io.vertx.reactivex.core.http.HttpClientResponse; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.reactivestreams.Publisher; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.ZonedDateTime; + +import static com.baeldung.weather.MetaWeatherClient.getDataByPlaceId; +import static com.baeldung.weather.MetaWeatherClient.searchByCityName; + +public class VertxWithRxJavaIntegrationTest { + + private Vertx vertx; + private HttpClient httpClient; + private FileSystem fileSystem; + private static Logger log = LoggerFactory.getLogger(VertxWithRxJavaIntegrationTest.class); + + @Before + public void setUp() { + vertx = Vertx.vertx(); + httpClient = vertx.createHttpClient(); + fileSystem = vertx.fileSystem(); + } + + @After + public void tearDown() { + vertx.close(); + } + + @Test + public void shouldDisplayLightLenghts() throws InterruptedException { + + // read the file that contains one city name per line + fileSystem + .rxReadFile("cities.txt").toFlowable() + .doOnNext(buffer -> log.info("File buffer ---\n{}\n---", buffer)) + .flatMap(buffer -> Flowable.fromArray(buffer.toString().split("\\r?\\n"))) + .doOnNext(city -> log.info("City from file: '{}'", city)) + .filter(city -> !city.startsWith("#")) + .doOnNext(city -> log.info("City that survived filtering: '{}'", city)) + .flatMap(city -> searchByCityName(httpClient, city)) + .flatMap(HttpClientResponse::toFlowable) + .doOnNext(buffer -> log.info("JSON of city detail: '{}'", buffer)) + .map(extractingWoeid()) + .flatMap(cityId -> getDataByPlaceId(httpClient, cityId)) + .flatMap(toBufferFlowable()) + .doOnNext(buffer -> log.info("JSON of place detail: '{}'", buffer)) + .map(Buffer::toJsonObject) + .map(toCityAndDayLength()) + .subscribe(System.out::println, Throwable::printStackTrace); + + Thread.sleep(20000); // enough to give time to complete the execution + } + + private static Function> toBufferFlowable() { + return response -> response + .toObservable() + .reduce( + Buffer.buffer(), + Buffer::appendBuffer).toFlowable(); + } + + private static Function extractingWoeid() { + return cityBuffer -> cityBuffer + .toJsonArray() + .getJsonObject(0) + .getLong("woeid"); + } + + private static Function toCityAndDayLength() { + return json -> { + ZonedDateTime sunRise = ZonedDateTime.parse(json.getString("sun_rise")); + ZonedDateTime sunSet = ZonedDateTime.parse(json.getString("sun_set")); + String cityName = json.getString("title"); + return new CityAndDayLength( + cityName, sunSet.toEpochSecond() - sunRise.toEpochSecond()); + }; + } + +} diff --git a/vertx-and-rxjava/src/test/resources/cities.txt b/vertx-and-rxjava/src/test/resources/cities.txt new file mode 100644 index 0000000000..dbe6e96758 --- /dev/null +++ b/vertx-and-rxjava/src/test/resources/cities.txt @@ -0,0 +1,6 @@ +Milan +Chicago +Cairo +Santiago +Moscow +Auckland \ No newline at end of file diff --git a/vertx-and-rxjava/src/test/resources/logback-test.xml b/vertx-and-rxjava/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..71e05a4e24 --- /dev/null +++ b/vertx-and-rxjava/src/test/resources/logback-test.xml @@ -0,0 +1,12 @@ + + + + [%thread{32}] %-5level %msg - %logger%n + + + + + + + + \ No newline at end of file