Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ae64433
dependencies: update spring-boot-dependencies 2.0.9 to 2.7.5 (#2156)
robertvolkmann Oct 30, 2022
9dc91d8
docs: add robertvolkmann as a contributor for code (#2292)
allcontributors[bot] Oct 30, 2022
2b29479
Fix #1929: Suppress logging hibernate internals (#2158)
robertvolkmann Oct 30, 2022
4a6d652
docs: Updated documentation on comments on DefaultCircuitBreaker args…
bipin-k Oct 30, 2022
5afc32c
docs: add bipin-k as a contributor for doc (#2293)
allcontributors[bot] Oct 30, 2022
4cd8149
refactor: remove code smell java:S5786 (#2159)
robertvolkmann Oct 30, 2022
13cb2e8
docs: Data mapper1762 (#2165)
KyleSong30 Oct 30, 2022
cd736d7
docs: add KyleSong30 as a contributor for doc (#2294)
allcontributors[bot] Oct 30, 2022
adb0e25
refactor: Fix for maven warnings (#2157)
mohanaraosv Oct 30, 2022
badb828
docs: add robertvolkmann as a contributor for review (#2295)
allcontributors[bot] Oct 30, 2022
6660330
docs: Add Explanation for Data-Bus Design Pattern #590 (#2170)
DanielKim129 Oct 30, 2022
2dd1b55
docs: add u7281975 as a contributor for doc (#2296)
allcontributors[bot] Oct 30, 2022
12ce824
fix: Fix the CI build
iseppala Oct 30, 2022
e063bd1
translation: Closes iluwatar#2160 Translate template-method pattern r…
seongkyu-lim Oct 30, 2022
d9b4965
translation: Closes iluwatar#2161 Translate template-method pattern r…
seongkyu-lim Oct 30, 2022
cfeee23
translation: Closes iluwatar#2162 Translate template-method pattern r…
seongkyu-lim Oct 30, 2022
925996f
refactoring: Sonar issue fix for duplicate string (#2175)
harshalkhachane Nov 5, 2022
c8fa1a5
docs: add harshalkhachane as a contributor for code (#2312)
allcontributors[bot] Nov 5, 2022
6f21b10
refactoring: Sonar CRITICAL issue fixes (#2176)
harshalkhachane Nov 5, 2022
3605f8f
docs: Adding explanation for Producer-Consumer Design Pattern (#2179)
ManviGoel26 Nov 5, 2022
20ebbe0
docs: Replace profile url (#2183)
frascu Nov 5, 2022
3fde35a
refactoring: Adding lombok to MVC pattern (#2188)
burno1 Nov 5, 2022
cbb1eed
translation: remove unnecessary infor (#2192)
m-inh Nov 5, 2022
df52e1f
translation: Closes #2124 Translate the adapter readme to Spanish (#2…
aitorfi Nov 5, 2022
c9fc123
fix: Formatting of the main pom.xml
iseppala Nov 6, 2022
e955472
docs: add ec-026 as a contributor for translation (#2315)
allcontributors[bot] Nov 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 57 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,7 @@
"login": "frascu",
"name": "Francesco Scuccimarri",
"avatar_url": "https://avatars.githubusercontent.com/u/7107651?v=4",
"profile": "http://scuccimarri.it",
"profile": "https://github.com/frascu",
"contributions": [
"code"
]
Expand Down Expand Up @@ -2079,6 +2079,62 @@
"contributions": [
"translation"
]
},
{
"login": "robertvolkmann",
"name": "Robert Volkmann",
"avatar_url": "https://avatars.githubusercontent.com/u/20912167?v=4",
"profile": "https://github.com/robertvolkmann",
"contributions": [
"code",
"review"
]
},
{
"login": "bipin-k",
"name": "Bipin Kumar Chaurasia",
"avatar_url": "https://avatars.githubusercontent.com/u/21119358?v=4",
"profile": "https://github.com/bipin-k",
"contributions": [
"doc"
]
},
{
"login": "KyleSong30",
"name": "KyleSong30",
"avatar_url": "https://avatars.githubusercontent.com/u/100892032?v=4",
"profile": "https://github.com/KyleSong30",
"contributions": [
"doc"
]
},
{
"login": "u7281975",
"name": "u7281975",
"avatar_url": "https://avatars.githubusercontent.com/u/111095623?v=4",
"profile": "https://github.com/u7281975",
"contributions": [
"doc"
]
},
{
"login": "harshalkhachane",
"name": "harshalkhachane",
"avatar_url": "https://avatars.githubusercontent.com/u/92866584?v=4",
"profile": "https://github.com/harshalkhachane",
"contributions": [
"code"
]
},
{
"login": "ec-026",
"name": "Tejas Singh",
"avatar_url": "https://avatars.githubusercontent.com/u/95495584?v=4",
"profile": "https://github.com/ec-026",
"contributions": [
"doc",
"translation"
]
}
],
"contributorsPerLine": 7,
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=iluwatar_java-design-patterns&metric=coverage)](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
[![Join the chat at https://gitter.im/iluwatar/java-design-patterns](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-228-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-233-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

<br/>
Expand Down Expand Up @@ -368,6 +368,14 @@ This project is licensed under the terms of the MIT license.
<td align="center"><a href="https://github.com/steph88ss"><img src="https://avatars.githubusercontent.com/u/111041594?v=4?s=100" width="100px;" alt="steph88ss"/><br /><sub><b>steph88ss</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=steph88ss" title="Documentation">📖</a></td>
<td align="center"><a href="http://yujanranjitkar.com.np"><img src="https://avatars.githubusercontent.com/u/63731234?v=4?s=100" width="100px;" alt="Yujan Ranjitkar"/><br /><sub><b>Yujan Ranjitkar</b></sub></a><br /><a href="#translation-0xYujan" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/yusha-g"><img src="https://avatars.githubusercontent.com/u/110189579?v=4?s=100" width="100px;" alt="yusha-g"/><br /><sub><b>yusha-g</b></sub></a><br /><a href="#translation-yusha-g" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/robertvolkmann"><img src="https://avatars.githubusercontent.com/u/20912167?v=4?s=100" width="100px;" alt="Robert Volkmann"/><br /><sub><b>Robert Volkmann</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=robertvolkmann" title="Code">💻</a> <a href="https://github.com/iluwatar/java-design-patterns/pulls?q=is%3Apr+reviewed-by%3Arobertvolkmann" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://github.com/bipin-k"><img src="https://avatars.githubusercontent.com/u/21119358?v=4?s=100" width="100px;" alt="Bipin Kumar Chaurasia"/><br /><sub><b>Bipin Kumar Chaurasia</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=bipin-k" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/KyleSong30"><img src="https://avatars.githubusercontent.com/u/100892032?v=4?s=100" width="100px;" alt="KyleSong30"/><br /><sub><b>KyleSong30</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=KyleSong30" title="Documentation">📖</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/u7281975"><img src="https://avatars.githubusercontent.com/u/111095623?v=4?s=100" width="100px;" alt="u7281975"/><br /><sub><b>u7281975</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=u7281975" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/harshalkhachane"><img src="https://avatars.githubusercontent.com/u/92866584?v=4?s=100" width="100px;" alt="harshalkhachane"/><br /><sub><b>harshalkhachane</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=harshalkhachane" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/ec-026"><img src="https://avatars.githubusercontent.com/u/95495584?v=4?s=100" width="100px;" alt="Tejas Singh"/><br /><sub><b>Tejas Singh</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=ec-026" title="Documentation">📖</a> <a href="#translation-ec-026" title="Translation">🌍</a></td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void testVisitForHayes() {

@BeforeEach
@AfterEach
public void clearLoggers() {
void clearLoggers() {
TestLoggerFactory.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ConfigureForUnixVisitorTest {

@BeforeEach
@AfterEach
public void clearLoggers() {
void clearLoggers() {
TestLoggerFactory.clear();
}

Expand Down
4 changes: 2 additions & 2 deletions adapter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ Use the Adapter pattern when
Class and object adapters have different trade-offs. A class adapter

* Adapts Adaptee to Target by committing to a concrete Adaptee class. As a consequence, a class adapter won’t work when we want to adapt a class and all its subclasses.
* Let’s Adapter override some of Adaptee’s behavior since Adapter is a subclass of Adaptee.
* Lets Adapter override some of Adaptee’s behavior since Adapter is a subclass of Adaptee.
* Introduces only one object, and no additional pointer indirection is needed to get to the adaptee.

An object adapter

* Lets a single Adapter work with many Adapteesthat is, the Adaptee itself and all of its subclasses (if any). The Adapter can also add functionality to all Adaptees at once.
* Lets a single Adapter work with many Adaptees, that is, the Adaptee itself and all of its subclasses (if any). The Adapter can also add functionality to all Adaptees at once.
* Makes it harder to override Adaptee behavior. It will require subclassing Adaptee and making the Adapter refer to the subclass rather than the Adaptee itself.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AdapterPatternTest {
* This method runs before the test execution and sets the bean objects in the beans Map.
*/
@BeforeEach
public void setup() {
void setup() {
beans = new HashMap<>();

var fishingBoatAdapter = spy(new FishingBoatAdapter());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AggregatorTest {
private ProductInventoryClient inventoryClient;

@BeforeEach
public void setup() {
void setup() {
MockitoAnnotations.openMocks(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ApiGatewayTest {
private PriceClient priceClient;

@BeforeEach
public void setup() {
void setup() {
MockitoAnnotations.openMocks(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class BusinessDelegateTest {
* execution of every test.
*/
@BeforeEach
public void setup() {
void setup() {
netflixService = spy(new NetflixService());
youTubeService = spy(new YouTubeService());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CachingTest {
* Setup of application test includes: initializing DB connection and cache size/capacity.
*/
@BeforeEach
public void setUp() {
void setUp() {
// VirtualDB (instead of MongoDB) was used in running the JUnit tests
// to avoid Maven compilation errors. Set flag to true to run the
// tests with MongoDB (provided that MongoDB is installed and socket
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* <p>
* Could be done with mock objects as well where the call method call is verified.
*/
public class CallbackTest {
class CallbackTest {

private Integer callingCount = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public class DefaultCircuitBreaker implements CircuitBreaker {
* Constructor to create an instance of Circuit Breaker.
*
* @param timeout Timeout for the API request. Not necessary for this simple example
* @param failureThreshold Number of failures we receive from the depended service before changing
* state to 'OPEN'
* @param retryTimePeriod Time period after which a new request is made to remote service for
* status check.
* @param failureThreshold Number of failures we receive from the depended on service before
* changing state to 'OPEN'
* @param retryTimePeriod Time, in nanoseconds, period after which a new request is made to
* remote service for status check.
*/
DefaultCircuitBreaker(RemoteService serviceToCall, long timeout, int failureThreshold,
long retryTimePeriod) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/**
* App Test showing usage of circuit breaker.
*/
public class AppTest {
class AppTest {

private static final Logger LOGGER = LoggerFactory.getLogger(AppTest.class);

Expand All @@ -60,7 +60,7 @@ public class AppTest {
* and retry time period of 2 seconds.
*/
@BeforeEach
public void setupCircuitBreakers() {
void setupCircuitBreakers() {
var delayedService = new DelayedRemoteService(System.nanoTime(), STARTUP_DELAY);
//Set the circuit Breaker parameters
delayedServiceCircuitBreaker = new DefaultCircuitBreaker(delayedService, 3000,
Expand All @@ -78,7 +78,7 @@ public void setupCircuitBreakers() {
}

@Test
public void testFailure_OpenStateTransition() {
void testFailure_OpenStateTransition() {
//Calling delayed service, which will be unhealthy till 4 seconds
assertEquals("Delayed service is down", monitoringService.delayedServiceResponse());
//As failure threshold is "1", the circuit breaker is changed to OPEN
Expand All @@ -93,7 +93,7 @@ public void testFailure_OpenStateTransition() {
}

@Test
public void testFailure_HalfOpenStateTransition() {
void testFailure_HalfOpenStateTransition() {
//Calling delayed service, which will be unhealthy till 4 seconds
assertEquals("Delayed service is down", monitoringService.delayedServiceResponse());
//As failure threshold is "1", the circuit breaker is changed to OPEN
Expand All @@ -112,7 +112,7 @@ public void testFailure_HalfOpenStateTransition() {
}

@Test
public void testRecovery_ClosedStateTransition() {
void testRecovery_ClosedStateTransition() {
//Calling delayed service, which will be unhealthy till 4 seconds
assertEquals("Delayed service is down", monitoringService.delayedServiceResponse());
//As failure threshold is "1", the circuit breaker is changed to OPEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.rmi.Remote;
import org.junit.jupiter.api.Test;

/**
* Circuit Breaker test
*/
public class DefaultCircuitBreakerTest {
class DefaultCircuitBreakerTest {

//long timeout, int failureThreshold, long retryTimePeriod
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void testDefaultConstructor() throws RemoteServiceException {
* @throws RemoteServiceException
*/
@Test
public void testParameterizedConstructor() throws RemoteServiceException {
void testParameterizedConstructor() throws RemoteServiceException {
var obj = new DelayedRemoteService(System.nanoTime()-2000*1000*1000,1);
assertEquals("Delayed service is working",obj.call());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
* Unit test for Function class.
*/
@ExtendWith(MockitoExtension.class)
public class UsageCostProcessorFunctionTest {
class UsageCostProcessorFunctionTest {

@Mock
MessageHandlerUtility<UsageDetail> mockMessageHandlerUtilityForUsageADetail;
Expand All @@ -74,7 +74,7 @@ public class UsageCostProcessorFunctionTest {
UsageCostProcessorFunction usageCostProcessorFunction;

@BeforeEach
public void setUp() {
void setUp() {
var messageBodyUsageDetail = new MessageBody<UsageDetail>();
var usageDetailsList = new ArrayList<UsageDetail>();

Expand Down Expand Up @@ -122,7 +122,7 @@ public void setUp() {
* Unit test for HttpTriggerJava method.
*/
@Test
public void shouldTriggerHttpAzureFunctionJavaWithSubscriptionValidationEventType() throws Exception {
void shouldTriggerHttpAzureFunctionJavaWithSubscriptionValidationEventType() throws Exception {

// Setup
@SuppressWarnings("unchecked")
Expand All @@ -148,7 +148,7 @@ public HttpResponseMessage.Builder answer(InvocationOnMock invocation) {
}

@Test
public void shouldTriggerHttpAzureFunctionJavaWithUsageDetailEventType() throws Exception {
void shouldTriggerHttpAzureFunctionJavaWithUsageDetailEventType() throws Exception {
// Setup
@SuppressWarnings("unchecked")
final HttpRequestMessage<Optional<String>> req = mock(HttpRequestMessage.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* Unit test for Function class.
*/
@ExtendWith(MockitoExtension.class)
public class UsageDetailPublisherFunctionTest {
class UsageDetailPublisherFunctionTest {
@Mock
MessageHandlerUtility<UsageDetail> mockMessageHandlerUtility;
@Mock
Expand All @@ -65,7 +65,7 @@ public class UsageDetailPublisherFunctionTest {
* Unit test for HttpTriggerJava method.
*/
@Test
public void shouldTriggerHttpAzureFunctionJavaWithSubscriptionValidationEventType() throws Exception {
void shouldTriggerHttpAzureFunctionJavaWithSubscriptionValidationEventType() throws Exception {

// Setup
@SuppressWarnings("unchecked")
Expand All @@ -91,7 +91,7 @@ public HttpResponseMessage.Builder answer(InvocationOnMock invocation) {
}

@Test
public void shouldTriggerHttpAzureFunctionJavaWithUsageDetailEventType() throws Exception {
void shouldTriggerHttpAzureFunctionJavaWithUsageDetailEventType() throws Exception {

// Setup
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.mockito.junit.jupiter.MockitoExtension;

@ExtendWith(MockitoExtension.class)
public class EventHandlerUtilityTest {
class EventHandlerUtilityTest {

@Mock
EventGridPublisherClient<BinaryData> mockCustomEventClient;
Expand All @@ -49,7 +49,7 @@ public class EventHandlerUtilityTest {
EventHandlerUtility<Message<UsageDetail>> eventHandlerUtility;

@BeforeEach
public void setUp() {
void setUp() {

System.setProperty("EventGridURL", "https://www.dummyEndpoint.com/api/events");
System.setProperty("EventGridKey", "EventGridURL");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import static org.mockito.Mockito.*;

@ExtendWith(MockitoExtension.class)
public class MessageHandlerUtilityTest {
class MessageHandlerUtilityTest {
@Mock
private BlobClient mockBlobClient;

Expand All @@ -63,7 +63,7 @@ public class MessageHandlerUtilityTest {
private MessageReference messageReference;

@BeforeEach
public void setUp() {
void setUp() {
System.setProperty("BlobStorageConnectionString", "https://www.dummyEndpoint.com/api/blobs");

var messageBody = new MessageBody<UsageDetail>();
Expand Down
Loading