diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraHostService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraHostService.java index c81239d..02a134f 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraHostService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraHostService.java @@ -19,7 +19,7 @@ public class InfraHostService { return this.infraHostDAO.save(infraHost); } - public InfraHost read(String id) { - return this.infraHostDAO.findOne(Long.valueOf(id)); + public InfraHost read(long id) { + return this.infraHostDAO.findOne(id); } } diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraService.java index 3fc6182..f154a99 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraService.java @@ -19,8 +19,8 @@ public class InfraService { return this.infraDAO.save(infra); } - public Infra read(String id) { - return this.infraDAO.findOne(Long.valueOf(id)); + public Infra read(long id) { + return this.infraDAO.findOne(id); } } diff --git a/src/test/java/com/loafle/overflow/module/infra/service/InfraHostServiceTest.java b/src/test/java/com/loafle/overflow/module/infra/service/InfraHostServiceTest.java index 0e09695..9471d1b 100644 --- a/src/test/java/com/loafle/overflow/module/infra/service/InfraHostServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/infra/service/InfraHostServiceTest.java @@ -5,6 +5,7 @@ import com.loafle.overflow.module.infra.model.InfraOS; import com.loafle.overflow.spring.AppConfig; import com.loafle.overflow.spring.JdbcConfiguration; import com.loafle.overflow.spring.MailConfiguration; +import org.codehaus.jackson.map.ObjectMapper; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -45,6 +46,14 @@ public class InfraHostServiceTest { @Test public void read() throws Exception { + + InfraHost infraHost = this.infraHostService.read(1); + + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(infraHost); + + System.out.println(json); + } } \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/module/infra/service/InfraServiceTest.java b/src/test/java/com/loafle/overflow/module/infra/service/InfraServiceTest.java index fa2d1b7..95813a1 100644 --- a/src/test/java/com/loafle/overflow/module/infra/service/InfraServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/infra/service/InfraServiceTest.java @@ -8,6 +8,7 @@ import com.loafle.overflow.module.target.model.Target; import com.loafle.overflow.spring.AppConfig; import com.loafle.overflow.spring.JdbcConfiguration; import com.loafle.overflow.spring.MailConfiguration; +import org.codehaus.jackson.map.ObjectMapper; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -69,6 +70,13 @@ public class InfraServiceTest { @Test public void read() throws Exception { + + Infra infra = this.infraService.read(3); + + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(infra); + + System.out.println(json); } } \ No newline at end of file