From 263534caab0e507bee38211a33829a2006d4332b Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Wed, 13 Sep 2017 22:34:26 +0530 Subject: [PATCH 01/22] #631 - Partial Response : Added module to project. --- partial-response/pom.xml | 15 +++++++++++++++ pom.xml | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 partial-response/pom.xml diff --git a/partial-response/pom.xml b/partial-response/pom.xml new file mode 100644 index 000000000..0afd5bddc --- /dev/null +++ b/partial-response/pom.xml @@ -0,0 +1,15 @@ + + + + java-design-patterns + com.iluwatar + 1.17.0-SNAPSHOT + + 4.0.0 + + partial-response + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index f2b6b7ccb..59b7cf078 100644 --- a/pom.xml +++ b/pom.xml @@ -146,7 +146,8 @@ event-sourcing data-transfer-object throttling - + partial-response + From 7ca5342819493538708cb59f01426b631b9d6546 Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Wed, 13 Sep 2017 22:58:34 +0530 Subject: [PATCH 02/22] #631 - Partial Response : Add video model. --- .../com/iluwatar/partialresponse/Video.java | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 partial-response/src/main/java/com/iluwatar/partialresponse/Video.java diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java new file mode 100644 index 000000000..656ab091b --- /dev/null +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -0,0 +1,55 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2017 Gopinath Langote + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.iluwatar.partialresponse; + +/** + * {@link Video} is a entity to serve from server.It contains all video related information.. + *

+ */ +public class Video { + private String id; + private String title; + private Long length; + private String description; + private String publisher; + private String status; + + /** + * @param id video unique id + * @param title video title + * @param length video length in seconds + * @param description video description by publisher + * @param publisher video publisher name + * @param status video status {private, public} + */ + public Video(String id, String title, Long length, String description, String publisher, String status) { + this.id = id; + this.title = title; + this.length = length; + this.description = description; + this.publisher = publisher; + this.status = status; + } +} From 5828ef9dd144b7c3c298f875806aa641135137be Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 10:08:56 +0530 Subject: [PATCH 03/22] #631 - Partial Response : Get video details by id. --- .../java/com/iluwatar/partialresponse/VideoResource.java | 4 ++++ .../java/com/iluwatar/partialresponse/VideoResourceTest.java | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java create mode 100644 partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java new file mode 100644 index 000000000..c3d526187 --- /dev/null +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -0,0 +1,4 @@ +package com.iluwatar.partialresponse; + +public class VideoResource { +} diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java new file mode 100644 index 000000000..cd304c81d --- /dev/null +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java @@ -0,0 +1,5 @@ +import static org.junit.Assert.*; + +public class VideoResourceTest { + +} \ No newline at end of file From f38119c565d9e5c46c3437fbc4b6ecda094515d2 Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 10:09:02 +0530 Subject: [PATCH 04/22] #631 - Partial Response : Get video details by id. --- partial-response/pom.xml | 6 +++ .../com/iluwatar/partialresponse/Video.java | 12 +++++ .../partialresponse/VideoResource.java | 35 ++++++++++++++ .../partialresponse/VideoResourceTest.java | 47 ++++++++++++++++++- 4 files changed, 99 insertions(+), 1 deletion(-) diff --git a/partial-response/pom.xml b/partial-response/pom.xml index 0afd5bddc..e4f4db4ae 100644 --- a/partial-response/pom.xml +++ b/partial-response/pom.xml @@ -10,6 +10,12 @@ 4.0.0 partial-response + + + junit + junit + + \ No newline at end of file diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java index 656ab091b..2879b96ed 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -52,4 +52,16 @@ public class Video { this.publisher = publisher; this.status = status; } + + @Override + public String toString() { + return "Video{" + + "id='" + id + '\'' + + ", title='" + title + '\'' + + ", length=" + length + + ", description='" + description + '\'' + + ", publisher='" + publisher + '\'' + + ", status='" + status + '\'' + + '}'; + } } diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java index c3d526187..546377b16 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -1,4 +1,39 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2017 Gopinath Langote + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + package com.iluwatar.partialresponse; +import java.util.Map; + public class VideoResource { + private Map videos; + + public VideoResource(Map videos) { + this.videos = videos; + } + + public String getDenials(String id) { + return videos.get(id).toString(); + } } diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java index cd304c81d..43d670f9f 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java @@ -1,5 +1,50 @@ -import static org.junit.Assert.*; +/* + * The MIT License (MIT) + * + * Copyright (c) 2017 Gopinath Langote + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.iluwatar.partialresponse; + +import org.junit.Before; +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; public class VideoResourceTest { + private VideoResource resource; + @Before + public void setUp() { + Map videos = new HashMap<>(); + videos.put("1", new Video("1", "title 1", 100L, "", "", "")); + videos.put("1", new Video("2", "title 2", 100L, "", "", "")); + videos.put("1", new Video("3", "title 3", 100L, "", "", "")); + resource = new VideoResource(videos); + } + + @Test + public void shouldGiveVideoDetailsById() { + String details = resource.getDenials("1"); + System.out.println(details); + } } \ No newline at end of file From 87d485384630d4e8a525ddef24359651d509488a Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 18:47:46 +0530 Subject: [PATCH 05/22] #631 - Partial Response : [Refactor] Rename GetDetails method by id. --- .../main/java/com/iluwatar/partialresponse/VideoResource.java | 2 +- .../java/com/iluwatar/partialresponse/VideoResourceTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java index 546377b16..fb95e05c7 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -33,7 +33,7 @@ public class VideoResource { this.videos = videos; } - public String getDenials(String id) { + public String getDetails(String id) { return videos.get(id).toString(); } } diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java index 43d670f9f..6f3524611 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java @@ -44,7 +44,7 @@ public class VideoResourceTest { @Test public void shouldGiveVideoDetailsById() { - String details = resource.getDenials("1"); + String details = resource.getDetails("1"); System.out.println(details); } } \ No newline at end of file From b7dbb4049c853ba66a5262831100aca0cabc9935 Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 19:15:44 +0530 Subject: [PATCH 06/22] #631 - Partial Response : [Refactor] Modify video model fields. --- .../com/iluwatar/partialresponse/Video.java | 22 +++++++++---------- .../partialresponse/VideoResourceTest.java | 6 ++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java index 2879b96ed..3717d8db2 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -31,26 +31,26 @@ package com.iluwatar.partialresponse; public class Video { private String id; private String title; - private Long length; + private Integer length; private String description; - private String publisher; - private String status; + private String director; + private String language; /** * @param id video unique id * @param title video title - * @param length video length in seconds + * @param length video length in minutes * @param description video description by publisher - * @param publisher video publisher name - * @param status video status {private, public} + * @param director video director name + * @param language video language {private, public} */ - public Video(String id, String title, Long length, String description, String publisher, String status) { + public Video(String id, String title, Integer length, String description, String director, String language) { this.id = id; this.title = title; this.length = length; this.description = description; - this.publisher = publisher; - this.status = status; + this.director = director; + this.language = language; } @Override @@ -60,8 +60,8 @@ public class Video { ", title='" + title + '\'' + ", length=" + length + ", description='" + description + '\'' + - ", publisher='" + publisher + '\'' + - ", status='" + status + '\'' + + ", director='" + director + '\'' + + ", language='" + language + '\'' + '}'; } } diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java index 6f3524611..67d34edba 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java @@ -36,9 +36,9 @@ public class VideoResourceTest { @Before public void setUp() { Map videos = new HashMap<>(); - videos.put("1", new Video("1", "title 1", 100L, "", "", "")); - videos.put("1", new Video("2", "title 2", 100L, "", "", "")); - videos.put("1", new Video("3", "title 3", 100L, "", "", "")); + videos.put("1", new Video("1", "Avatar", 178, "epic science fiction film", "James Cameron", "English")); + videos.put("1", new Video("2", "Godzilla Resurgence", 120, "Action & drama movie|", "Hideaki Anno", "Japanese")); + videos.put("1", new Video("3", "Interstellar", 169, "Adventure & Sci-Fi", "Christopher Nolan", "English")); resource = new VideoResource(videos); } From a0c081f5eabc58432c7a58044d9d0593c9cade68 Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 19:27:46 +0530 Subject: [PATCH 07/22] #631 - Partial Response : Return video details as json string. --- .../com/iluwatar/partialresponse/Video.java | 23 +++++++++---------- .../partialresponse/VideoResource.java | 6 ++--- .../partialresponse/VideoResourceTest.java | 16 ++++++++----- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java index 3717d8db2..de6239911 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -29,7 +29,7 @@ package com.iluwatar.partialresponse; *

*/ public class Video { - private String id; + private Integer id; private String title; private Integer length; private String description; @@ -41,10 +41,10 @@ public class Video { * @param title video title * @param length video length in minutes * @param description video description by publisher - * @param director video director name - * @param language video language {private, public} + * @param director video director name + * @param language video language {private, public} */ - public Video(String id, String title, Integer length, String description, String director, String language) { + public Video(Integer id, String title, Integer length, String description, String director, String language) { this.id = id; this.title = title; this.length = length; @@ -55,13 +55,12 @@ public class Video { @Override public String toString() { - return "Video{" + - "id='" + id + '\'' + - ", title='" + title + '\'' + - ", length=" + length + - ", description='" + description + '\'' + - ", director='" + director + '\'' + - ", language='" + language + '\'' + - '}'; + return "{" + + "\"id\": \"" + id + "\"," + + "\"title\": \"" + title + "\"," + + "\"description\": \"" + description + "\"," + + "\"director\": \"" + director + "\"," + + "\"language\": \"" + language + "\"," + + "}"; } } diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java index fb95e05c7..b233c42d3 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -27,13 +27,13 @@ package com.iluwatar.partialresponse; import java.util.Map; public class VideoResource { - private Map videos; + private Map videos; - public VideoResource(Map videos) { + public VideoResource(Map videos) { this.videos = videos; } - public String getDetails(String id) { + public String getDetails(Integer id) { return videos.get(id).toString(); } } diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java index 67d34edba..4fcf2b718 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java @@ -30,21 +30,25 @@ import org.junit.Test; import java.util.HashMap; import java.util.Map; +import static org.junit.Assert.assertEquals; + public class VideoResourceTest { private VideoResource resource; @Before public void setUp() { - Map videos = new HashMap<>(); - videos.put("1", new Video("1", "Avatar", 178, "epic science fiction film", "James Cameron", "English")); - videos.put("1", new Video("2", "Godzilla Resurgence", 120, "Action & drama movie|", "Hideaki Anno", "Japanese")); - videos.put("1", new Video("3", "Interstellar", 169, "Adventure & Sci-Fi", "Christopher Nolan", "English")); + Map videos = new HashMap<>(); + videos.put(1, new Video(1, "Avatar", 178, "epic science fiction film", "James Cameron", "English")); + videos.put(2, new Video(2, "Godzilla Resurgence", 120, "Action & drama movie|", "Hideaki Anno", "Japanese")); + videos.put(3, new Video(3, "Interstellar", 169, "Adventure & Sci-Fi", "Christopher Nolan", "English")); resource = new VideoResource(videos); } @Test public void shouldGiveVideoDetailsById() { - String details = resource.getDetails("1"); - System.out.println(details); + String details = resource.getDetails(1); + + String expectedDetails = "{\"id\": \"1\",\"title\": \"Avatar\",\"description\": \"epic science fiction film\",\"director\": \"James Cameron\",\"language\": \"English\",}"; + assertEquals(details, expectedDetails); } } \ No newline at end of file From d0ad0f7ea93c18f9a9ea79758d6dc91372a1517c Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 19:35:52 +0530 Subject: [PATCH 08/22] #631 - Partial Response : Add missing length in video details --- .../src/main/java/com/iluwatar/partialresponse/Video.java | 1 + .../java/com/iluwatar/partialresponse/VideoResourceTest.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java index de6239911..d8d80fd00 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -58,6 +58,7 @@ public class Video { return "{" + "\"id\": \"" + id + "\"," + "\"title\": \"" + title + "\"," + + "\"length\": " + length + "," + "\"description\": \"" + description + "\"," + "\"director\": \"" + director + "\"," + "\"language\": \"" + language + "\"," + diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java index 4fcf2b718..329b10087 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java @@ -48,7 +48,7 @@ public class VideoResourceTest { public void shouldGiveVideoDetailsById() { String details = resource.getDetails(1); - String expectedDetails = "{\"id\": \"1\",\"title\": \"Avatar\",\"description\": \"epic science fiction film\",\"director\": \"James Cameron\",\"language\": \"English\",}"; - assertEquals(details, expectedDetails); + String expectedDetails = "{\"id\": \"1\",\"title\": \"Avatar\",\"length\": 178,\"description\": \"epic science fiction film\",\"director\": \"James Cameron\",\"language\": \"English\",}"; + assertEquals(expectedDetails, details); } } \ No newline at end of file From 6d3dce065d14c24dde2342c5ccdb031ef4132c63 Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 19:45:56 +0530 Subject: [PATCH 09/22] #631 - Partial Response : Get specified fields response. --- partial-response/pom.xml | 4 +++ .../partialresponse/FieldJsonMapper.java | 31 +++++++++++++++++++ .../partialresponse/VideoResource.java | 11 +++++-- .../partialresponse/VideoResourceTest.java | 28 +++++++++++++++-- 4 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java diff --git a/partial-response/pom.xml b/partial-response/pom.xml index e4f4db4ae..7ce36ecec 100644 --- a/partial-response/pom.xml +++ b/partial-response/pom.xml @@ -15,6 +15,10 @@ junit junit + + org.mockito + mockito-core + diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java b/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java new file mode 100644 index 000000000..32e9ae83d --- /dev/null +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java @@ -0,0 +1,31 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2017 Gopinath Langote + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.iluwatar.partialresponse; + +public class FieldJsonMapper { + public String toJson(Video video, String[] fields) { + return null; + } +} diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java index b233c42d3..8c571e6d6 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -27,13 +27,18 @@ package com.iluwatar.partialresponse; import java.util.Map; public class VideoResource { + private FieldJsonMapper fieldJsonMapper; private Map videos; - public VideoResource(Map videos) { + public VideoResource(FieldJsonMapper fieldJsonMapper, Map videos) { + this.fieldJsonMapper = fieldJsonMapper; this.videos = videos; } - public String getDetails(Integer id) { - return videos.get(id).toString(); + public String getDetails(Integer id, String... fields) { + if (fields.length == 0) { + return videos.get(id).toString(); + } + return fieldJsonMapper.toJson(videos.get(id), fields); } } diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java index 329b10087..df25c2dea 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java @@ -26,13 +26,23 @@ package com.iluwatar.partialresponse; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; import java.util.HashMap; import java.util.Map; import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.when; +@RunWith(MockitoJUnitRunner.class) public class VideoResourceTest { + @Mock + private FieldJsonMapper fieldJsonMapper; + private VideoResource resource; @Before @@ -41,14 +51,26 @@ public class VideoResourceTest { videos.put(1, new Video(1, "Avatar", 178, "epic science fiction film", "James Cameron", "English")); videos.put(2, new Video(2, "Godzilla Resurgence", 120, "Action & drama movie|", "Hideaki Anno", "Japanese")); videos.put(3, new Video(3, "Interstellar", 169, "Adventure & Sci-Fi", "Christopher Nolan", "English")); - resource = new VideoResource(videos); + resource = new VideoResource(fieldJsonMapper, videos); } @Test public void shouldGiveVideoDetailsById() { - String details = resource.getDetails(1); + String actualDetails = resource.getDetails(1); String expectedDetails = "{\"id\": \"1\",\"title\": \"Avatar\",\"length\": 178,\"description\": \"epic science fiction film\",\"director\": \"James Cameron\",\"language\": \"English\",}"; - assertEquals(expectedDetails, details); + assertEquals(expectedDetails, actualDetails); + } + + @Test + public void shouldGiveSpecifiedFieldsInformationOfVideo() { + String[] fields = new String[]{"title", "length"}; + + String expectedDetails = "{\"id\": \"1\",\"title\": \"Avatar\",\"length\": 178}"; + when(fieldJsonMapper.toJson(any(Video.class), eq(fields))).thenReturn(expectedDetails); + + String actualFieldsDetails = resource.getDetails(2, fields); + + assertEquals(expectedDetails, actualFieldsDetails); } } \ No newline at end of file From c89bf0eb44d905c1d0322af41c3c44d863573d0a Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 21:50:40 +0530 Subject: [PATCH 10/22] #631 - Partial Response : Add java doc --- .../partialresponse/FieldJsonMapper.java | 9 +++++++++ .../com/iluwatar/partialresponse/Video.java | 19 +++++++++++-------- .../partialresponse/VideoResource.java | 13 +++++++++++++ .../partialresponse/VideoResourceTest.java | 6 +++++- 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java b/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java index 32e9ae83d..dce164f0d 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java @@ -24,7 +24,16 @@ package com.iluwatar.partialresponse; +/** + * Map a video to json + */ public class FieldJsonMapper { + + /** + * @param video object containing video information + * @param fields fields information to get + * @return json of required fields from video + */ public String toJson(Video video, String[] fields) { return null; } diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java index d8d80fd00..7310f26b0 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -53,15 +53,18 @@ public class Video { this.language = language; } + /** + * @return json representaion of video + */ @Override public String toString() { - return "{" + - "\"id\": \"" + id + "\"," + - "\"title\": \"" + title + "\"," + - "\"length\": " + length + "," + - "\"description\": \"" + description + "\"," + - "\"director\": \"" + director + "\"," + - "\"language\": \"" + language + "\"," + - "}"; + return "{" + + "\"id\": \"" + id + "\"," + + "\"title\": \"" + title + "\"," + + "\"length\": " + length + "," + + "\"description\": \"" + description + "\"," + + "\"director\": \"" + director + "\"," + + "\"language\": \"" + language + "\"," + + "}"; } } diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java index 8c571e6d6..457ecec00 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -26,15 +26,28 @@ package com.iluwatar.partialresponse; import java.util.Map; +/** + * The resource class which serves video information. + * This class act as server in the demo. Which has all video details. + */ public class VideoResource { private FieldJsonMapper fieldJsonMapper; private Map videos; + /** + * @param fieldJsonMapper map object to json. + * @param videos initialize resource with existing videos. Act as database. + */ public VideoResource(FieldJsonMapper fieldJsonMapper, Map videos) { this.fieldJsonMapper = fieldJsonMapper; this.videos = videos; } + /** + * @param id video id + * @param fields fields to get information about + * @return json of specified fields of particular video by id + */ public String getDetails(Integer id, String... fields) { if (fields.length == 0) { return videos.get(id).toString(); diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java index df25c2dea..d420863a8 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java @@ -38,6 +38,9 @@ import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.when; +/** + * tests {@link VideoResource}. + */ @RunWith(MockitoJUnitRunner.class) public class VideoResourceTest { @Mock @@ -58,7 +61,8 @@ public class VideoResourceTest { public void shouldGiveVideoDetailsById() { String actualDetails = resource.getDetails(1); - String expectedDetails = "{\"id\": \"1\",\"title\": \"Avatar\",\"length\": 178,\"description\": \"epic science fiction film\",\"director\": \"James Cameron\",\"language\": \"English\",}"; + String expectedDetails = "{\"id\": \"1\",\"title\": \"Avatar\",\"length\": 178,\"description\": " + + "\"epic science fiction film\",\"director\": \"James Cameron\",\"language\": \"English\",}"; assertEquals(expectedDetails, actualDetails); } From c5b9c63b39a5948a50795740be28450cdd436172 Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 21:52:07 +0530 Subject: [PATCH 11/22] #631 - Partial Response : Add puml file --- .../etc/partial-response.urm.puml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 partial-response/etc/partial-response.urm.puml diff --git a/partial-response/etc/partial-response.urm.puml b/partial-response/etc/partial-response.urm.puml new file mode 100644 index 000000000..8331ad086 --- /dev/null +++ b/partial-response/etc/partial-response.urm.puml @@ -0,0 +1,25 @@ +@startuml +package com.iluwatar.partialresponse { + class FieldJsonMapper { + + FieldJsonMapper() + + toJson(video : Video, fields : String[]) : String + } + class Video { + - description : String + - director : String + - id : Integer + - language : String + - length : Integer + - title : String + + Video(id : Integer, title : String, length : Integer, description : String, director : String, language : String) + + toString() : String + } + class VideoResource { + - fieldJsonMapper : FieldJsonMapper + - videos : Map + + VideoResource(fieldJsonMapper : FieldJsonMapper, videos : Map) + + getDetails(id : Integer, fields : String[]) : String + } +} +VideoResource --> "-fieldJsonMapper" FieldJsonMapper +@enduml \ No newline at end of file From 44e4b3c803178304e56eeecbf741c3758ec98532 Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 22:34:02 +0530 Subject: [PATCH 12/22] #631 - Partial Response : Implement Field to json conversion --- .../partialresponse/FieldJsonMapper.java | 24 ++++++++- .../com/iluwatar/partialresponse/Video.java | 2 +- .../partialresponse/VideoResource.java | 2 +- .../partialresponse/FieldJsonMapperTest.java | 53 +++++++++++++++++++ .../partialresponse/VideoResourceTest.java | 10 ++-- 5 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 partial-response/src/test/java/com/iluwatar/partialresponse/FieldJsonMapperTest.java diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java b/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java index dce164f0d..8a8ae087a 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java @@ -24,6 +24,8 @@ package com.iluwatar.partialresponse; +import java.lang.reflect.Field; + /** * Map a video to json */ @@ -34,7 +36,25 @@ public class FieldJsonMapper { * @param fields fields information to get * @return json of required fields from video */ - public String toJson(Video video, String[] fields) { - return null; + public String toJson(Video video, String[] fields) throws Exception { + StringBuilder json = new StringBuilder().append("{"); + + for (int i = 0, fieldsLength = fields.length; i < fieldsLength; i++) { + json.append(getString(video, Video.class.getDeclaredField(fields[i]))); + if (i != fieldsLength - 1) { + json.append(","); + } + } + json.append("}"); + return json.toString(); + } + + private String getString(Video video, Field declaredField) throws IllegalAccessException { + declaredField.setAccessible(true); + Object value = declaredField.get(video); + if (declaredField.get(video) instanceof Integer) { + return "\"" + declaredField.getName() + "\"" + ": " + value; + } + return "\"" + declaredField.getName() + "\"" + ": " + "\"" + value.toString() + "\""; } } diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java index 7310f26b0..d5d56f4fd 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -59,7 +59,7 @@ public class Video { @Override public String toString() { return "{" - + "\"id\": \"" + id + "\"," + + "\"id\": " + id + "," + "\"title\": \"" + title + "\"," + "\"length\": " + length + "," + "\"description\": \"" + description + "\"," diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java index 457ecec00..ed5bc4db3 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -48,7 +48,7 @@ public class VideoResource { * @param fields fields to get information about * @return json of specified fields of particular video by id */ - public String getDetails(Integer id, String... fields) { + public String getDetails(Integer id, String... fields) throws Exception { if (fields.length == 0) { return videos.get(id).toString(); } diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/FieldJsonMapperTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/FieldJsonMapperTest.java new file mode 100644 index 000000000..d8ddd5881 --- /dev/null +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/FieldJsonMapperTest.java @@ -0,0 +1,53 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2017 Gopinath Langote + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.iluwatar.partialresponse; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * tests {@link FieldJsonMapper}. + */ +public class FieldJsonMapperTest { + private FieldJsonMapper mapper; + + @Before + public void setUp() { + mapper = new FieldJsonMapper(); + } + + @Test + public void shouldReturnJsonForSpecifiedFieldsInVideo() throws Exception { + String[] fields = new String[]{"id", "title", "length"}; + Video video = new Video(2, "Godzilla Resurgence", 120, "Action & drama movie|", "Hideaki Anno", "Japanese"); + + String jsonFieldResponse = mapper.toJson(video, fields); + + String expectedDetails = "{\"id\": 2,\"title\": \"Godzilla Resurgence\",\"length\": 120}"; + assertEquals(expectedDetails, jsonFieldResponse); + } +} \ No newline at end of file diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java index d420863a8..1415e77b2 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java @@ -58,19 +58,19 @@ public class VideoResourceTest { } @Test - public void shouldGiveVideoDetailsById() { + public void shouldGiveVideoDetailsById() throws Exception { String actualDetails = resource.getDetails(1); - String expectedDetails = "{\"id\": \"1\",\"title\": \"Avatar\",\"length\": 178,\"description\": " + String expectedDetails = "{\"id\": 1,\"title\": \"Avatar\",\"length\": 178,\"description\": " + "\"epic science fiction film\",\"director\": \"James Cameron\",\"language\": \"English\",}"; assertEquals(expectedDetails, actualDetails); } @Test - public void shouldGiveSpecifiedFieldsInformationOfVideo() { - String[] fields = new String[]{"title", "length"}; + public void shouldGiveSpecifiedFieldsInformationOfVideo() throws Exception { + String[] fields = new String[]{"id", "title", "length"}; - String expectedDetails = "{\"id\": \"1\",\"title\": \"Avatar\",\"length\": 178}"; + String expectedDetails = "{\"id\": 1,\"title\": \"Avatar\",\"length\": 178}"; when(fieldJsonMapper.toJson(any(Video.class), eq(fields))).thenReturn(expectedDetails); String actualFieldsDetails = resource.getDetails(2, fields); From 711f3faf675d9ff52bf21ddb111ea383f3a79f97 Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 22:51:16 +0530 Subject: [PATCH 13/22] #631 - Partial Response : Implement video partial response consuming client. --- .../partialresponse/VideoClientApp.java | 75 +++++++++++++++++++ .../partialresponse/VideoResource.java | 2 +- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 partial-response/src/main/java/com/iluwatar/partialresponse/VideoClientApp.java diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoClientApp.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoClientApp.java new file mode 100644 index 000000000..af1d48029 --- /dev/null +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoClientApp.java @@ -0,0 +1,75 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2017 Gopinath Langote + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.iluwatar.partialresponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.HashMap; +import java.util.Map; + +/** + * The Partial response pattern is a design pattern in which client specifies fields to fetch to serve. + * Here {@link VideoClientApp} is playing as client for {@link VideoResource} server. + * Client ask for specific fields information in video to server. + *

+ *

+ * {@link VideoResource} act as server to serve video information. + */ + +public class VideoClientApp { + private static final Logger LOGGER = LoggerFactory.getLogger(VideoClientApp.class); + + /** + * Method as act client and request to server for video details. + * + * @param args program argument. + */ + public static void main(String[] args) throws Exception { + Map videos = new HashMap<>(); + videos.put(1, new Video(1, "Avatar", 178, "epic science fiction film", "James Cameron", "English")); + videos.put(2, new Video(2, "Godzilla Resurgence", 120, "Action & drama movie|", "Hideaki Anno", "Japanese")); + videos.put(3, new Video(3, "Interstellar", 169, "Adventure & Sci-Fi", "Christopher Nolan", "English")); + FieldJsonMapper fieldJsonMapper = new FieldJsonMapper(); + VideoResource videoResource = new VideoResource(fieldJsonMapper, videos); + + + LOGGER.info("Retrieving full response from server:-"); + LOGGER.info("Get all video information:"); + String videoDetails = videoResource.getDetails(1); + LOGGER.info(videoDetails); + + LOGGER.info("----------------------------------------------------------"); + + LOGGER.info("Retrieving partial response from server:-"); + LOGGER.info("Get video @id, @title, @director:"); + String specificFieldsDetails = videoResource.getDetails(3, "id", "title", "director"); + LOGGER.info(specificFieldsDetails); + + LOGGER.info("Get video @id, @length:"); + String videoLength = videoResource.getDetails(3, "id", "length"); + LOGGER.info(videoLength); + } +} diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java index ed5bc4db3..fefb7277c 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -46,7 +46,7 @@ public class VideoResource { /** * @param id video id * @param fields fields to get information about - * @return json of specified fields of particular video by id + * @return full response if no fields specified else partial response for given field. */ public String getDetails(Integer id, String... fields) throws Exception { if (fields.length == 0) { From fb3a998c04d344b8e0b668c8960d3eddbda1d4d9 Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 22:52:29 +0530 Subject: [PATCH 14/22] #631 - Partial Response : Modified puml digram --- partial-response/etc/partial-response.urm.puml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/partial-response/etc/partial-response.urm.puml b/partial-response/etc/partial-response.urm.puml index 8331ad086..69efd0454 100644 --- a/partial-response/etc/partial-response.urm.puml +++ b/partial-response/etc/partial-response.urm.puml @@ -2,6 +2,7 @@ package com.iluwatar.partialresponse { class FieldJsonMapper { + FieldJsonMapper() + - getString(video : Video, declaredField : Field) : String + toJson(video : Video, fields : String[]) : String } class Video { @@ -14,6 +15,11 @@ package com.iluwatar.partialresponse { + Video(id : Integer, title : String, length : Integer, description : String, director : String, language : String) + toString() : String } + class VideoClientApp { + - LOGGER : Logger {static} + + VideoClientApp() + + main(args : String[]) {static} + } class VideoResource { - fieldJsonMapper : FieldJsonMapper - videos : Map From 91048a49b47168a137283f1d58fc6d300081fa2f Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Thu, 14 Sep 2017 23:07:40 +0530 Subject: [PATCH 15/22] #631 - Partial Response : Add Readme. --- partial-response/README.md | 29 ++++++++++++++++++ partial-response/etc/partial-response.urm.png | Bin 0 -> 27781 bytes 2 files changed, 29 insertions(+) create mode 100644 partial-response/README.md create mode 100644 partial-response/etc/partial-response.urm.png diff --git a/partial-response/README.md b/partial-response/README.md new file mode 100644 index 000000000..5d03cb359 --- /dev/null +++ b/partial-response/README.md @@ -0,0 +1,29 @@ +--- +layout: pattern +title: Partial Response +folder: partial-response +permalink: /patterns/partial-response/ +categories: Architectural +tags: + - Java + - KISS + - YAGNI + - Difficulty-Beginner +--- + +## Intent +Send partial response from server to client on need basis. Client will specify the the fields +that it need to server, instead of serving all details for resource. + +![alt text](./etc/partial-response.urm.png "partial-response") + +## Applicability +Use the Partial Response pattern when + +* Client need only subset of data from resource. +* To avoid too much data transfer over wire + +## Credits + +* [Common Design Patterns](https://cloud.google.com/apis/design/design_patterns) +* [Partial Response in RESTful API Design](http://yaoganglian.com/2013/07/01/partial-response/) diff --git a/partial-response/etc/partial-response.urm.png b/partial-response/etc/partial-response.urm.png new file mode 100644 index 0000000000000000000000000000000000000000..17dbd5f1b60df743f40c23a87deb70bc8d952806 GIT binary patch literal 27781 zcmdqIg;$ho+cu8D20;W1kQ7jm2I*E(KtS4|kr)`dJ48Z6x}>{7V(1zHrMpW)I)?82 zT?2bR`+48*_x%IkEY@Py%suyg#TmzOoag2LPF4a3iwFx14Gl-~ji>?|8oCV{+6{Ni zo8S|wrIV?Fp)Hz(fw_UTuC0Oo(+^Hhjcjc#d6}6lO?Ay}?aWM> z^eoKov+$6hq1~i#R(fyy&*x}pj`2Qb7(JS+Wa zR{xb%>GY5PSXk)1slgs%Q@=%0FBt!B$^OPhU5!h9zb~!g;+Vf;(Gh|4{SPsRjw%<1 z-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e`qYYpbNBWNmHjGY<_Uq?@0I=Of7#aX6|93!lfVtb!A} z^-XU_bq4cgTR4|CajL^{{qlUB~K6hbZS0vW@ct??v2qw jzk`|ok%ip Date: Tue, 19 Sep 2017 19:00:19 +0530 Subject: [PATCH 16/22] #631 - Partial Response : Add class diagram --- partial-response/etc/partial-response.ucls | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 partial-response/etc/partial-response.ucls diff --git a/partial-response/etc/partial-response.ucls b/partial-response/etc/partial-response.ucls new file mode 100644 index 000000000..a0b029496 --- /dev/null +++ b/partial-response/etc/partial-response.ucls @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From a59e0fa961ea3beeb201ed75208ee2ad96db41af Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Fri, 22 Sep 2017 11:53:26 +0530 Subject: [PATCH 17/22] #631 - Partial Response : Update copyright header. --- .../main/java/com/iluwatar/partialresponse/FieldJsonMapper.java | 2 +- .../src/main/java/com/iluwatar/partialresponse/Video.java | 2 +- .../main/java/com/iluwatar/partialresponse/VideoClientApp.java | 2 +- .../main/java/com/iluwatar/partialresponse/VideoResource.java | 2 +- .../java/com/iluwatar/partialresponse/FieldJsonMapperTest.java | 2 +- .../java/com/iluwatar/partialresponse/VideoResourceTest.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java b/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java index 8a8ae087a..9283cfa69 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/FieldJsonMapper.java @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2017 Gopinath Langote + * Copyright (c) 2014-2017 Gopinath Langote * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java index d5d56f4fd..050db71b5 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2017 Gopinath Langote + * Copyright (c) 2014-2017 Gopinath Langote * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoClientApp.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoClientApp.java index af1d48029..0f2fb96e0 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoClientApp.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoClientApp.java @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2017 Gopinath Langote + * Copyright (c) 2014-2017 Gopinath Langote * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java index fefb7277c..2bf7a73c1 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/VideoResource.java @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2017 Gopinath Langote + * Copyright (c) 2014-2017 Gopinath Langote * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/FieldJsonMapperTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/FieldJsonMapperTest.java index d8ddd5881..9bc078b57 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/FieldJsonMapperTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/FieldJsonMapperTest.java @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2017 Gopinath Langote + * Copyright (c) 2014-2017 Gopinath Langote * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java index 1415e77b2..0453e8ffd 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/VideoResourceTest.java @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2017 Gopinath Langote + * Copyright (c) 2014-2017 Gopinath Langote * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal From 5d8d312733b9de93bc0ce3cc25d30174cce47cc4 Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Fri, 22 Sep 2017 11:55:21 +0530 Subject: [PATCH 18/22] #631 - Partial Response : Made final private variables in immutable class. --- .../java/com/iluwatar/partialresponse/Video.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java index 050db71b5..e242965e3 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/Video.java @@ -29,12 +29,12 @@ package com.iluwatar.partialresponse; *

*/ public class Video { - private Integer id; - private String title; - private Integer length; - private String description; - private String director; - private String language; + private final Integer id; + private final String title; + private final Integer length; + private final String description; + private final String director; + private final String language; /** * @param id video unique id From 7f9789ce1dba6fd756a2a5cc876d6cf7cb8d852a Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Fri, 22 Sep 2017 11:57:12 +0530 Subject: [PATCH 19/22] #631 - Partial Response : [Refactor] Made Main class name as App for consistancy. --- .../partialresponse/{VideoClientApp.java => App.java} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename partial-response/src/main/java/com/iluwatar/partialresponse/{VideoClientApp.java => App.java} (93%) diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoClientApp.java b/partial-response/src/main/java/com/iluwatar/partialresponse/App.java similarity index 93% rename from partial-response/src/main/java/com/iluwatar/partialresponse/VideoClientApp.java rename to partial-response/src/main/java/com/iluwatar/partialresponse/App.java index 0f2fb96e0..0fe50594c 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/VideoClientApp.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/App.java @@ -32,15 +32,15 @@ import java.util.Map; /** * The Partial response pattern is a design pattern in which client specifies fields to fetch to serve. - * Here {@link VideoClientApp} is playing as client for {@link VideoResource} server. + * Here {@link App} is playing as client for {@link VideoResource} server. * Client ask for specific fields information in video to server. *

*

* {@link VideoResource} act as server to serve video information. */ -public class VideoClientApp { - private static final Logger LOGGER = LoggerFactory.getLogger(VideoClientApp.class); +public class App { + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); /** * Method as act client and request to server for video details. From c63494cef20024fce97830711f3349aab703a07f Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Fri, 22 Sep 2017 12:01:38 +0530 Subject: [PATCH 20/22] #631 - Partial Response : Modify intendation. --- .../com/iluwatar/partialresponse/AppTest.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 partial-response/src/test/java/com/iluwatar/partialresponse/AppTest.java diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/AppTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/AppTest.java new file mode 100644 index 000000000..7e4f27b7d --- /dev/null +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/AppTest.java @@ -0,0 +1,38 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2014-2017 Gopinath Langote + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.iluwatar.partialresponse; + +import org.junit.Test; + +/** + * Application test + */ +public class AppTest { + @Test + public void test() throws Exception { + String[] args = {}; + App.main(args); + } +} \ No newline at end of file From 06b5c671f5897b98fa9e713cdaf652d022f1ded3 Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Fri, 22 Sep 2017 12:33:11 +0530 Subject: [PATCH 21/22] #631 - Partial Response : Modify AppTest. --- .../src/test/java/com/iluwatar/partialresponse/AppTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/partial-response/src/test/java/com/iluwatar/partialresponse/AppTest.java b/partial-response/src/test/java/com/iluwatar/partialresponse/AppTest.java index 7e4f27b7d..2ac34dd0d 100644 --- a/partial-response/src/test/java/com/iluwatar/partialresponse/AppTest.java +++ b/partial-response/src/test/java/com/iluwatar/partialresponse/AppTest.java @@ -30,9 +30,11 @@ import org.junit.Test; * Application test */ public class AppTest { + @Test - public void test() throws Exception { + public void main() throws Exception { String[] args = {}; App.main(args); } + } \ No newline at end of file From dba2d8aef7e8c7bd203c780dc3336f4bc8804071 Mon Sep 17 00:00:00 2001 From: Gopinath Langote Date: Sat, 23 Sep 2017 01:03:16 +0530 Subject: [PATCH 22/22] #631 - Partial Response : [Refactor] Inline object creation. --- .../src/main/java/com/iluwatar/partialresponse/App.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/partial-response/src/main/java/com/iluwatar/partialresponse/App.java b/partial-response/src/main/java/com/iluwatar/partialresponse/App.java index 0fe50594c..2977b50a7 100644 --- a/partial-response/src/main/java/com/iluwatar/partialresponse/App.java +++ b/partial-response/src/main/java/com/iluwatar/partialresponse/App.java @@ -52,8 +52,7 @@ public class App { videos.put(1, new Video(1, "Avatar", 178, "epic science fiction film", "James Cameron", "English")); videos.put(2, new Video(2, "Godzilla Resurgence", 120, "Action & drama movie|", "Hideaki Anno", "Japanese")); videos.put(3, new Video(3, "Interstellar", 169, "Adventure & Sci-Fi", "Christopher Nolan", "English")); - FieldJsonMapper fieldJsonMapper = new FieldJsonMapper(); - VideoResource videoResource = new VideoResource(fieldJsonMapper, videos); + VideoResource videoResource = new VideoResource(new FieldJsonMapper(), videos); LOGGER.info("Retrieving full response from server:-");