Compare commits
29 Commits
feature/te
...
feature/se
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98f67f1bbc | ||
|
|
ae136bea44 | ||
|
|
485894cdb1 | ||
|
|
ef2c61d3f2 | ||
|
|
a446c62643 | ||
|
|
bda4384795 | ||
|
|
08522a2ff2 | ||
|
|
a67e446f43 | ||
|
|
435484cc13 | ||
|
|
57c58ea5cc | ||
|
|
477ff38a0a | ||
|
|
0dd0c18c6e | ||
|
|
1866b88bc5 | ||
|
|
09d2a5b68c | ||
|
|
ed0f7b4b24 | ||
|
|
e608cc0a6b | ||
|
|
1b43ebd628 | ||
|
|
eed262f54a | ||
|
|
9fea91e887 | ||
|
|
c7bcca4836 | ||
|
|
eeaaafe991 | ||
|
|
e3bd2f2671 | ||
|
|
d1d7f13c60 | ||
|
|
b804c2bf25 | ||
|
|
90b2abc988 | ||
|
|
34bbe0ec7f | ||
|
|
6259218422 | ||
|
|
07aa667326 | ||
|
|
3c9545fe82 |
5
.idea/workspace.xml
generated
5
.idea/workspace.xml
generated
@@ -1,7 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="2a93e153-a90c-44db-b1da-6c4424693422" name="Changes" comment="" />
|
<list default="true" id="2a93e153-a90c-44db-b1da-6c4424693422" name="Changes" comment="">
|
||||||
|
<change afterPath="$PROJECT_DIR$/server/src/main/java/com/ticketing/server/global/config/SwaggerConfig.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/server/build.gradle.kts" beforeDir="false" afterPath="$PROJECT_DIR$/server/build.gradle.kts" afterDir="false" />
|
||||||
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ dependencies {
|
|||||||
implementation("com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.4")
|
implementation("com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.4")
|
||||||
implementation("com.lmax:disruptor:3.4.2")
|
implementation("com.lmax:disruptor:3.4.2")
|
||||||
implementation("io.jsonwebtoken:jjwt-api:0.11.2")
|
implementation("io.jsonwebtoken:jjwt-api:0.11.2")
|
||||||
implementation("com.googlecode.json-simple:json-simple:1.1.1")
|
|
||||||
|
|
||||||
modules {
|
modules {
|
||||||
module("org.springframework.boot:spring-boot-starter-logging") {
|
module("org.springframework.boot:spring-boot-starter-logging") {
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.ticketing.server.global.config;
|
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.time.Duration;
|
|
||||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.http.client.BufferingClientHttpRequestFactory;
|
|
||||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
|
||||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class RestTemplateConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
|
|
||||||
return restTemplateBuilder
|
|
||||||
.requestFactory(() -> new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory()))
|
|
||||||
.setConnectTimeout(Duration.ofMillis(5000)) // connection-timeout
|
|
||||||
.setReadTimeout(Duration.ofMillis(5000)) // read-timeout
|
|
||||||
.additionalMessageConverters(new StringHttpMessageConverter(Charset.forName("UTF-8")))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package com.ticketing.server.movie.service;
|
|
||||||
|
|
||||||
import com.ticketing.server.movie.service.interfaces.TMDBService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class TMBDServiceImpl implements TMDBService {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package com.ticketing.server.movie.service.interfaces;
|
|
||||||
|
|
||||||
public interface TMDBService {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
package com.ticketing.server.movie.service;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.junit.jupiter.api.DisplayName;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.http.HttpEntity;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpMethod;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
@SpringBootTest
|
|
||||||
public class TMDBServiceImplTest {
|
|
||||||
|
|
||||||
@Value("${tmdb.api-key}")
|
|
||||||
private String apiKey;
|
|
||||||
|
|
||||||
@Value("${tmdb.read-access-token}")
|
|
||||||
private String readAccessToken;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
RestTemplate restTemplate;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@DisplayName("TMDB Service Test - Get [Now Playing] movies")
|
|
||||||
void shouldAbleToGetMovieList() throws Exception {
|
|
||||||
// given
|
|
||||||
assertNotNull(apiKey);
|
|
||||||
assertNotNull(readAccessToken);
|
|
||||||
|
|
||||||
ArrayList<Charset> acceptCharset = new ArrayList<>();
|
|
||||||
acceptCharset.add(StandardCharsets.UTF_8);
|
|
||||||
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
|
||||||
headers.setAcceptCharset(acceptCharset);
|
|
||||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
|
||||||
headers.setBearerAuth(readAccessToken);
|
|
||||||
|
|
||||||
Map<String, String> params = new HashMap<>();
|
|
||||||
params.put("api_key", apiKey);
|
|
||||||
params.put("language", "ko");
|
|
||||||
|
|
||||||
HttpEntity<?> request = new HttpEntity<>(headers);
|
|
||||||
|
|
||||||
// when
|
|
||||||
ResponseEntity<?> response = restTemplate.exchange(
|
|
||||||
"https://api.themoviedb.org/3/movie/now_playing?" + mapToUrlParam(params),
|
|
||||||
HttpMethod.GET,
|
|
||||||
request,
|
|
||||||
String.class
|
|
||||||
);
|
|
||||||
|
|
||||||
// JSONParser parser = new JSONParser();
|
|
||||||
// Object obj = parser.parse(String.valueOf(response));
|
|
||||||
// Object results = ((JSONObject) obj).get("results");
|
|
||||||
//
|
|
||||||
// ArrayList<String> movieList = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// ArrayList<JSONObject> jsonMovieList = new ArrayList<>();
|
|
||||||
|
|
||||||
// then
|
|
||||||
assertTrue(response.getStatusCode().is2xxSuccessful());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String mapToUrlParam(Map<String, String> params) {
|
|
||||||
StringBuffer paramData = new StringBuffer();
|
|
||||||
|
|
||||||
for (Map.Entry<String, String> param : params.entrySet()) {
|
|
||||||
if (paramData.length() != 0) {
|
|
||||||
paramData.append('&');
|
|
||||||
}
|
|
||||||
|
|
||||||
paramData.append(param.getKey());
|
|
||||||
paramData.append('=');
|
|
||||||
paramData.append(param.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
return paramData.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -22,8 +22,3 @@ jwt:
|
|||||||
prefix: Bearer
|
prefix: Bearer
|
||||||
secret-key: Zi1sYWItdGlja2V0aW5nLXByb2plY3Qtc3ByaW5nLWJvb3Qtc2VjdXJpdHktand0LXNlY3JldC1rZXktZi1sYWItdGlja2V0aW5nLXByb2plY3Qtc3ByaW5nLWJvb3Qtc2VjdXJpdHktand0LXNlY3JldC1rZXkK
|
secret-key: Zi1sYWItdGlja2V0aW5nLXByb2plY3Qtc3ByaW5nLWJvb3Qtc2VjdXJpdHktand0LXNlY3JldC1rZXktZi1sYWItdGlja2V0aW5nLXByb2plY3Qtc3ByaW5nLWJvb3Qtc2VjdXJpdHktand0LXNlY3JldC1rZXkK
|
||||||
token-validity-in-seconds: 86400
|
token-validity-in-seconds: 86400
|
||||||
|
|
||||||
tmdb:
|
|
||||||
api-key: 0d1503b6dcbfe1c514299b5564c649b8
|
|
||||||
read-access-token: eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIwZDE1MDNiNmRjYmZlMWM1MTQyOTliNTU2NGM2NDliOCIsInN1YiI6IjYyOWYwODRlNzI2ZmIxMTA2NDA4MjI2NCIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.rs8KZea8QLyashILiggWFx2s46lgUtzo-xSWoDgE58A
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user