Skip to content

Commit

Permalink
fix compile
Browse files Browse the repository at this point in the history
  • Loading branch information
허원철/NSC서버팀/NE committed Dec 21, 2024
1 parent eb8db66 commit 2046ec7
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.example.java.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurerSupport;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

@Configuration
@EnableAsync
public class AsyncConfig extends AsyncConfigurerSupport {
public class AsyncConfig implements AsyncConfigurer {

@Override
public Executor getAsyncExecutor() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package com.example.kotlin.config

import org.springframework.context.annotation.Configuration
import org.springframework.scheduling.annotation.AsyncConfigurerSupport
import org.springframework.scheduling.annotation.AsyncConfigurer
import org.springframework.scheduling.annotation.EnableAsync

import java.util.concurrent.Executor
import java.util.concurrent.Executors

@Configuration
@EnableAsync
class AsyncConfig : AsyncConfigurerSupport() {
class AsyncConfig : AsyncConfigurer {

override fun getAsyncExecutor(): Executor {
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.*;
import org.springframework.boot.jackson.JsonComponent;
import org.springframework.util.Base64Utils;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Iterator;

@JsonComponent
Expand All @@ -33,7 +34,8 @@ public Model deserialize(JsonParser p, DeserializationContext ctxt)
System.out.println(field + ":" + node.get(field));
}

String name = new String(Base64Utils.decodeFromString(node.get("name").asText()));
String name = new String(Base64.getDecoder().decode(node.get("name").asText()),
StandardCharsets.UTF_8);
int type = node.get("type").asInt();
System.out.println("---------------------------------------------------");
return new Model(name, type);
Expand All @@ -52,7 +54,7 @@ public void serialize(Model value, JsonGenerator json,
SerializerProvider provider) throws IOException {
json.writeStartObject();
json.writeFieldName("name");
json.writeString(Base64Utils.encodeToString(value.getName().getBytes()));
json.writeString(Base64.getEncoder().encodeToString(value.getName().getBytes()));
json.writeFieldName("type");
json.writeNumber(value.getType());
json.writeEndObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.*
import org.springframework.boot.jackson.JsonComponent
import org.springframework.util.Base64Utils
import java.io.IOException
import java.util.Base64

@JsonComponent
class EncodedJsonComponent {
Expand All @@ -28,7 +28,7 @@ class EncodedJsonComponent {
println(field + ":" + node.get(field))
}

val name = String(Base64Utils.decodeFromString(node.get("name").asText()))
val name = String(Base64.getDecoder().decode(node.get("name").asText()))
val type = node.get("type").asInt()
println("---------------------------------------------------")
return Model(name, type)
Expand All @@ -46,7 +46,7 @@ class EncodedJsonComponent {
provider: SerializerProvider) {
json.writeStartObject()
json.writeFieldName("name")
json.writeString(Base64Utils.encodeToString(value.name.toByteArray()))
json.writeString(Base64.getEncoder().encodeToString(value.name.toByteArray()))
json.writeFieldName("type")
json.writeNumber(value.type)
json.writeEndObject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;

import static com.heowc.event.PasswordChangedEventListener.MESSAGE_FORMAT;
import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -22,7 +22,7 @@ class PasswordChangingServiceTest {
@Autowired
private MemberRepository repository;

@MockBean
@MockitoBean
private SendService sendService;

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.http.HttpStatus;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -29,7 +28,7 @@ public class UserControllerTest {
@Autowired
private ObjectMapper objectMapper;

@MockBean
@MockitoBean
private UserRepository repository;

@Test
Expand Down
4 changes: 2 additions & 2 deletions SpringBootTest/src/test/java/com/example/MockMvcTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;

import static org.mockito.BDDMockito.given;
Expand All @@ -22,7 +22,7 @@ public class MockMvcTest {
@Autowired
private MockMvc mvc;

@MockBean
@MockitoBean
private BasicService service;

@Autowired
Expand Down
4 changes: 2 additions & 2 deletions SpringBootTest/src/test/java/com/example/MockTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.test.context.bean.override.mockito.MockitoBean;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
Expand All @@ -17,7 +17,7 @@ public class MockTest {
@Autowired
TestRestTemplate restTemplate;

@MockBean
@MockitoBean
BasicService service;

@Test
Expand Down

0 comments on commit 2046ec7

Please sign in to comment.