From 952706d3584243383ac5d3287d5e17876a216471 Mon Sep 17 00:00:00 2001 From: snoop Date: Fri, 28 Jul 2017 16:29:50 +0900 Subject: [PATCH] fixed infra service, test --- .../module/infra/service/InfraMachineService.java | 4 ++-- .../overflow/module/infra/service/InfraOSService.java | 4 ++-- .../module/infra/service/InfraMachineServiceTest.java | 9 ++++++++- .../module/infra/service/InfraOSServiceTest.java | 6 ++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraMachineService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraMachineService.java index 06b4cec..2b53889 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraMachineService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraMachineService.java @@ -17,8 +17,8 @@ public class InfraMachineService { return this.infraMachineDAO.save(infraMachine); } - public InfraMachine read(String id) { - return this.infraMachineDAO.findOne(Long.valueOf(id)); + public InfraMachine read(long id) { + return this.infraMachineDAO.findOne(id); } } diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSService.java index 0d2a88a..e26ab0c 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSService.java @@ -19,7 +19,7 @@ public class InfraOSService { return this.infraOSDAO.save(infraOS); } - public InfraOS read(String id) { - return this.infraOSDAO.findOne(Long.valueOf(id)); + public InfraOS read(long id) { + return this.infraOSDAO.findOne(id); } } diff --git a/src/test/java/com/loafle/overflow/module/infra/service/InfraMachineServiceTest.java b/src/test/java/com/loafle/overflow/module/infra/service/InfraMachineServiceTest.java index d988f21..2f9fcd3 100644 --- a/src/test/java/com/loafle/overflow/module/infra/service/InfraMachineServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/infra/service/InfraMachineServiceTest.java @@ -4,6 +4,7 @@ import com.loafle.overflow.module.infra.model.InfraMachine; 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.Ignore; import org.junit.Test; @@ -22,8 +23,8 @@ public class InfraMachineServiceTest { @Autowired private InfraMachineService infraMachineService; - @Test @Ignore + @Test public void regist() throws Exception { InfraMachine infraMachine = new InfraMachine(); @@ -38,6 +39,12 @@ public class InfraMachineServiceTest { @Test public void read() throws Exception { + + InfraMachine infraMachine = this.infraMachineService.read(1); + + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(infraMachine); + System.out.println(json); } } \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/module/infra/service/InfraOSServiceTest.java b/src/test/java/com/loafle/overflow/module/infra/service/InfraOSServiceTest.java index 05e2257..5a2e584 100644 --- a/src/test/java/com/loafle/overflow/module/infra/service/InfraOSServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/infra/service/InfraOSServiceTest.java @@ -6,6 +6,7 @@ import com.loafle.overflow.module.meta.model.MetaInfraVendor; 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.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -45,6 +46,11 @@ public class InfraOSServiceTest { @Test public void read() throws Exception { + + InfraOS infraOS = this.infraOSService.read(1); + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(infraOS); + System.out.println(json); } } \ No newline at end of file