package 이동 반영
This commit is contained in:
@@ -2,7 +2,7 @@ package com.eactive.httpmockserver.client.controller;
|
||||
|
||||
import com.eactive.httpmockserver.client.dto.ApiRequestDTO;
|
||||
import com.eactive.httpmockserver.client.dto.ApiResponse;
|
||||
import com.eactive.httpmockserver.client.entity.Server;
|
||||
import com.eactive.httpmockserver.server.entity.Server;
|
||||
import com.eactive.httpmockserver.client.repository.ServerRepository;
|
||||
import com.eactive.httpmockserver.client.service.NettyApiClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -41,7 +41,7 @@ public class ApiClientController {
|
||||
List<Server> servers = serverRepository.findAll();
|
||||
model.addAttribute("servers", servers);
|
||||
|
||||
return "page/apiTester";
|
||||
return "page/tester/apiTester";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.eactive.httpmockserver.client.entity;
|
||||
|
||||
import com.eactive.httpmockserver.server.entity.Server;
|
||||
import com.eactive.httpmockserver.user.entity.StaffUser;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.eactive.httpmockserver.client.mapper;
|
||||
|
||||
|
||||
import com.eactive.httpmockserver.client.entity.Server;
|
||||
import com.eactive.httpmockserver.client.repository.ServerRepository;
|
||||
import com.eactive.httpmockserver.common.exception.NotFoundException;
|
||||
import com.eactive.httpmockserver.server.dto.ServerDTO;
|
||||
import com.eactive.httpmockserver.server.entity.Server;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -17,14 +18,43 @@ public class ServerMapper {
|
||||
@Autowired
|
||||
ServerRepository serverRepository;
|
||||
|
||||
Server map(Long id) {
|
||||
if (id == null) return null;
|
||||
Server mapById(Long id) {
|
||||
if (id == null || id == 0) return null;
|
||||
return serverRepository.findById(id).orElseThrow(() -> new NotFoundException("Server[" + id + "] not found"));
|
||||
}
|
||||
|
||||
Long map(Server server) {
|
||||
Long mapById(Server server) {
|
||||
if (server == null) return null;
|
||||
return server.getId();
|
||||
}
|
||||
|
||||
public ServerDTO map(Server server) {
|
||||
if (server == null) return null;
|
||||
ServerDTO dto = new ServerDTO();
|
||||
|
||||
dto.setId(server.getId());
|
||||
dto.setName(server.getName());
|
||||
dto.setHostname(server.getHostname());
|
||||
dto.setPort(server.getPort());
|
||||
dto.setScheme(server.getScheme());
|
||||
dto.setBasePath(server.getBasePath());
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
public Server map(ServerDTO dto) {
|
||||
if (dto == null) return null;
|
||||
|
||||
Server server = new Server();
|
||||
|
||||
server.setId(dto.getId());
|
||||
server.setName(dto.getName());
|
||||
server.setHostname(dto.getHostname());
|
||||
server.setPort(dto.getPort());
|
||||
server.setScheme(dto.getScheme());
|
||||
server.setBasePath(dto.getBasePath());
|
||||
|
||||
return server;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.eactive.httpmockserver.client.repository;
|
||||
|
||||
import com.eactive.httpmockserver.client.entity.Server;
|
||||
import com.eactive.httpmockserver.server.entity.Server;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.eactive.httpmockserver.client.service;
|
||||
import com.eactive.httpmockserver.client.dto.ApiRequestKeyValueDTO;
|
||||
import com.eactive.httpmockserver.client.dto.ApiRequestDTO;
|
||||
import com.eactive.httpmockserver.client.dto.ApiResponse;
|
||||
import com.eactive.httpmockserver.client.entity.Server;
|
||||
import com.eactive.httpmockserver.server.entity.Server;
|
||||
import com.eactive.httpmockserver.client.repository.ServerRepository;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
Reference in New Issue
Block a user