Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit 90e451b

Browse files
authored
Refacto Twitch module (#93)
* WIP: Refacto Twitch module * WIP: Refacto Twitch module * WIP: Refacto Twitch module * WIP: Refacto Twitch module * Removed useless files * Fix tests
1 parent a6deb7e commit 90e451b

File tree

73 files changed

+675
-721
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+675
-721
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM openjdk:21-slim
1+
FROM amazoncorretto:21-alpine
22

33
ARG service_name
44
ARG service_base_dir

modules/accounting/service/src/test/java/com/funixproductions/api/accounting/service/services/AccountingServiceTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.junit.jupiter.api.Test;
1414
import org.springframework.beans.factory.annotation.Autowired;
1515
import org.springframework.boot.test.context.SpringBootTest;
16-
import org.springframework.boot.test.mock.mockito.MockBean;
16+
import org.springframework.test.context.bean.override.mockito.MockitoBean;
1717

1818
import java.util.List;
1919
import java.util.Random;
@@ -30,16 +30,16 @@ class AccountingServiceTest {
3030
@Autowired
3131
private AccountingService accountingService;
3232

33-
@MockBean
33+
@MockitoBean
3434
private IncomeRepository incomeRepository;
3535

36-
@MockBean
36+
@MockitoBean
3737
private ProductRepository productRepository;
3838

39-
@MockBean
39+
@MockitoBean
4040
private GoogleGmailClient gmailClient;
4141

42-
@MockBean
42+
@MockitoBean
4343
private BillingFeignInternalClient billingClient;
4444

4545
@Test

modules/core/src/main/java/com/funixproductions/api/core/enums/FrontOrigins.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
import lombok.Getter;
55
import lombok.RequiredArgsConstructor;
66

7+
import javax.annotation.Nullable;
8+
79
@Getter
810
@RequiredArgsConstructor
911
public enum FrontOrigins {
1012
FUNIX_PRODUCTIONS_DASHBOARD(
1113
"funixproductions-dashboard",
1214
"Dashboard Funix Productions",
1315
"https://dashboard.funixproductions.com",
14-
"http://localhost:4200"
16+
"https://dev.dashboard.funixproductions.com"
1517
),
1618
PACIFISTA_PUBLIC_WEB(
1719
"pacifista-public-web",
@@ -25,7 +27,8 @@ public enum FrontOrigins {
2527
private final String domainProd;
2628
private final String domainDev;
2729

28-
public static FrontOrigins getRedirectAuthOrigin(String origin) {
30+
@Nullable
31+
public static FrontOrigins getRedirectAuthOrigin(@Nullable String origin) {
2932
if (Strings.isNullOrEmpty(origin)) {
3033
return null;
3134
}

modules/google/reCaptcha/service/src/test/java/com/funixproductions/api/google/recaptcha/service/ressources/GoogleCaptchaResourceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.springframework.beans.factory.annotation.Autowired;
1010
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
1111
import org.springframework.boot.test.context.SpringBootTest;
12-
import org.springframework.boot.test.mock.mockito.MockBean;
12+
import org.springframework.test.context.bean.override.mockito.MockitoBean;
1313
import org.springframework.test.web.servlet.MockMvc;
1414

1515
import static org.mockito.ArgumentMatchers.anyString;
@@ -25,7 +25,7 @@ class GoogleCaptchaResourceTest {
2525
@Autowired
2626
private MockMvc mockMvc;
2727

28-
@MockBean
28+
@MockitoBean
2929
private GoogleRecaptchaClient googleRecaptchaClient;
3030

3131
@Test

modules/payment/billing/service/src/test/java/com/funixproductions/api/payment/billing/service/resources/BillingResourceTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import com.funixproductions.core.crud.dtos.PageDTO;
1212
import com.funixproductions.core.tools.pdf.tools.VATInformation;
1313
import org.junit.jupiter.api.BeforeEach;
14-
import org.springframework.boot.test.mock.mockito.MockBean;
1514
import org.springframework.core.io.ByteArrayResource;
15+
import org.springframework.test.context.bean.override.mockito.MockitoBean;
1616

1717
import java.util.Date;
1818
import java.util.List;
@@ -24,10 +24,10 @@
2424

2525
public abstract class BillingResourceTest {
2626

27-
@MockBean
27+
@MockitoBean
2828
protected UserAuthClient userAuthClient;
2929

30-
@MockBean
30+
@MockitoBean
3131
protected BillingCrudService billingCrudService;
3232

3333
protected final BillingDTO billingDTO = new BillingDTO();

modules/payment/billing/service/src/test/java/com/funixproductions/api/payment/billing/service/services/BillingCrudServiceTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import org.junit.jupiter.api.Test;
2020
import org.springframework.beans.factory.annotation.Autowired;
2121
import org.springframework.boot.test.context.SpringBootTest;
22-
import org.springframework.boot.test.mock.mockito.MockBean;
22+
import org.springframework.test.context.bean.override.mockito.MockitoBean;
2323

2424
import java.io.File;
2525
import java.time.LocalDate;
@@ -41,10 +41,10 @@ class BillingCrudServiceTest {
4141
@Autowired
4242
private BillingRepository billingRepository;
4343

44-
@MockBean
44+
@MockitoBean
4545
private CurrentSession currentSession;
4646

47-
@MockBean
47+
@MockitoBean
4848
private GoogleGmailClient googleGmailClient;
4949

5050
@BeforeEach

modules/payment/paypal/service/src/test/java/com/funixproductions/api/payment/paypal/service/auth/services/PaypalAccessTokenServiceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.springframework.beans.factory.annotation.Autowired;
1313
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
1414
import org.springframework.boot.test.context.SpringBootTest;
15-
import org.springframework.boot.test.mock.mockito.MockBean;
15+
import org.springframework.test.context.bean.override.mockito.MockitoBean;
1616

1717
import java.lang.reflect.Field;
1818
import java.nio.charset.StandardCharsets;
@@ -28,7 +28,7 @@
2828
@AutoConfigureMockMvc
2929
class PaypalAccessTokenServiceTest {
3030

31-
@MockBean
31+
@MockitoBean
3232
private PaypalAuthClient paypalAuthClient;
3333

3434
@Autowired

modules/payment/paypal/service/src/test/java/com/funixproductions/api/payment/paypal/service/orders/resources/PaypalOrderResourceTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import org.springframework.beans.factory.annotation.Autowired;
1818
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
1919
import org.springframework.boot.test.context.SpringBootTest;
20-
import org.springframework.boot.test.mock.mockito.MockBean;
2120
import org.springframework.http.MediaType;
21+
import org.springframework.test.context.bean.override.mockito.MockitoBean;
2222
import org.springframework.test.web.servlet.MockMvc;
2323
import org.springframework.test.web.servlet.MvcResult;
2424

@@ -40,13 +40,13 @@ class PaypalOrderResourceTest {
4040
@Autowired
4141
private MockMvc mockMvc;
4242

43-
@MockBean
43+
@MockitoBean
4444
private PaypalOrderService service;
4545

4646
@Autowired
4747
private JsonHelper jsonHelper;
4848

49-
@MockBean
49+
@MockitoBean
5050
private BillingFeignInternalClient billingClient;
5151

5252
@BeforeEach

modules/payment/paypal/service/src/test/java/com/funixproductions/api/payment/paypal/service/orders/services/PaypalOrderServiceTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.springframework.beans.factory.annotation.Autowired;
1414
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
1515
import org.springframework.boot.test.context.SpringBootTest;
16-
import org.springframework.boot.test.mock.mockito.MockBean;
16+
import org.springframework.test.context.bean.override.mockito.MockitoBean;
1717

1818
import java.nio.charset.StandardCharsets;
1919
import java.util.HashMap;
@@ -26,10 +26,10 @@
2626
@AutoConfigureMockMvc
2727
class PaypalOrderServiceTest {
2828

29-
@MockBean
29+
@MockitoBean
3030
private PaypalFeignOrderClient orderClient;
3131

32-
@MockBean
32+
@MockitoBean
3333
private PaypalAccessTokenService tokenService;
3434

3535
@Autowired
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package com.funixproductions.api.twitch.auth.client.clients;
22

33
import com.funixproductions.api.twitch.auth.client.dtos.TwitchClientTokenDTO;
4+
import lombok.NonNull;
45
import org.springframework.cloud.openfeign.FeignClient;
56
import org.springframework.web.bind.annotation.GetMapping;
67
import org.springframework.web.bind.annotation.RequestParam;
78

9+
import javax.annotation.Nullable;
10+
811
@FeignClient(
912
name = "TwitchAuthClient",
1013
url = "${funixproductions.api.twitch.auth.app-domain-url}",
@@ -13,9 +16,14 @@
1316
public interface TwitchAuthClient {
1417

1518
@GetMapping("clientAuthUrl")
16-
String getAuthClientUrl(@RequestParam(defaultValue = "VIEWER") String tokenType);
19+
String getAuthClientUrl(
20+
@RequestParam(defaultValue = "VIEWER") @NonNull String tokenType,
21+
@RequestParam(required = false) @Nullable String origin
22+
);
1723

1824
@GetMapping("accessToken")
19-
TwitchClientTokenDTO getAccessToken();
25+
TwitchClientTokenDTO getAccessToken(
26+
@RequestParam(defaultValue = "VIEWER") @NonNull String tokenType
27+
);
2028

2129
}

0 commit comments

Comments
 (0)