diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSApplicationService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSApplicationService.java index bd235ae..3adfbe8 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSApplicationService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSApplicationService.java @@ -19,7 +19,7 @@ public class InfraOSApplicationService { return this.infraOSApplicationDAO.save(infraOSApplication); } - public InfraOSApplication read(String id) { - return this.infraOSApplicationDAO.findOne(Long.valueOf(id)); + public InfraOSApplication read(long id) { + return this.infraOSApplicationDAO.findOne(id); } } diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSDaemonService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSDaemonService.java index 66698e4..7cf4685 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSDaemonService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSDaemonService.java @@ -19,7 +19,7 @@ public class InfraOSDaemonService { return this.infraOSDaemonDAO.save(infraOSDaemon); } - public InfraOSDaemon read(String id) { - return this.infraOSDaemonDAO.findOne(Long.valueOf(id)); + public InfraOSDaemon read(long id) { + return this.infraOSDaemonDAO.findOne(id); } } diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSPortService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSPortService.java index d2014ee..8c99823 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraOSPortService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraOSPortService.java @@ -19,7 +19,7 @@ public class InfraOSPortService { return this.infraOSPortDAO.save(infraOSPort); } - public InfraOSPort read(String id) { - return this.infraOSPortDAO.findOne(Long.valueOf(id)); + public InfraOSPort read(long id) { + return this.infraOSPortDAO.findOne(id); } } diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraServiceService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraServiceService.java index 550030d..78a5a04 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraServiceService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraServiceService.java @@ -16,7 +16,7 @@ public class InfraServiceService { return this.infraServiceDAO.save(infraService); } - public com.loafle.overflow.module.infra.model.InfraService read(String id) { - return this.infraServiceDAO.findOne(Long.valueOf(id)); + public com.loafle.overflow.module.infra.model.InfraService read(long id) { + return this.infraServiceDAO.findOne(id); } } diff --git a/src/test/java/com/loafle/overflow/module/infra/service/InfraOSApplicationServiceTest.java b/src/test/java/com/loafle/overflow/module/infra/service/InfraOSApplicationServiceTest.java new file mode 100644 index 0000000..aee4b1b --- /dev/null +++ b/src/test/java/com/loafle/overflow/module/infra/service/InfraOSApplicationServiceTest.java @@ -0,0 +1,62 @@ +package com.loafle.overflow.module.infra.service; + +import com.loafle.overflow.module.infra.model.InfraOS; +import com.loafle.overflow.module.infra.model.InfraOSApplication; +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; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import static org.junit.Assert.*; + +/** + * Created by snoop on 17. 7. 28. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class}) +public class InfraOSApplicationServiceTest { + + @Autowired + private InfraOSApplicationService infraOSApplicationService; + + @Ignore + @Test + public void regist() throws Exception { + InfraOSApplication infraOSApplication = new InfraOSApplication(); + + infraOSApplication.setName("Apache"); + + InfraOS infraOS = new InfraOS(); + infraOS.setId(1); + + infraOSApplication.setOs(infraOS); + + this.infraOSApplicationService.regist(infraOSApplication); + + + Assert.assertNotEquals(infraOSApplication.getId(), 0); + + } + + @Test + public void read() throws Exception { + + InfraOSApplication infraOSApplication = this.infraOSApplicationService.read(1); + + Assert.assertNotNull(infraOSApplication); + + ObjectMapper objectMapper = new ObjectMapper(); + + String json = objectMapper.writeValueAsString(infraOSApplication); + System.out.println(json); + + } + +} \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/module/infra/service/InfraOSDaemonServiceTest.java b/src/test/java/com/loafle/overflow/module/infra/service/InfraOSDaemonServiceTest.java new file mode 100644 index 0000000..45bb44c --- /dev/null +++ b/src/test/java/com/loafle/overflow/module/infra/service/InfraOSDaemonServiceTest.java @@ -0,0 +1,59 @@ +package com.loafle.overflow.module.infra.service; + +import com.loafle.overflow.module.infra.model.InfraOS; +import com.loafle.overflow.module.infra.model.InfraOSDaemon; +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; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import static org.junit.Assert.*; + +/** + * Created by snoop on 17. 7. 28. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class}) +public class InfraOSDaemonServiceTest { + + @Autowired + private InfraOSDaemonService infraOSDaemonService; + + @Ignore + @Test + public void regist() throws Exception { + + InfraOSDaemon infraOSDaemon = new InfraOSDaemon(); + infraOSDaemon.setName("Apache"); + + InfraOS infraOS = new InfraOS(); + infraOS.setId(1); + + infraOSDaemon.setOs(infraOS); + + this.infraOSDaemonService.regist(infraOSDaemon); + + Assert.assertNotEquals(infraOSDaemon.getId(), 0); + + } + + @Test + public void read() throws Exception { + + InfraOSDaemon infraOSDaemon = this.infraOSDaemonService.read(1); + Assert.assertNotNull(infraOSDaemon); + + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(infraOSDaemon); + System.out.println(json); + + } + +} \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/module/infra/service/InfraOSPortServiceTest.java b/src/test/java/com/loafle/overflow/module/infra/service/InfraOSPortServiceTest.java new file mode 100644 index 0000000..efe25e5 --- /dev/null +++ b/src/test/java/com/loafle/overflow/module/infra/service/InfraOSPortServiceTest.java @@ -0,0 +1,48 @@ +package com.loafle.overflow.module.infra.service; + +import com.loafle.overflow.module.infra.model.InfraOS; +import com.loafle.overflow.module.infra.model.InfraOSPort; +import com.loafle.overflow.spring.AppConfig; +import com.loafle.overflow.spring.JdbcConfiguration; +import com.loafle.overflow.spring.MailConfiguration; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import static org.junit.Assert.*; + +/** + * Created by snoop on 17. 7. 28. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class}) +public class InfraOSPortServiceTest { + + @Autowired + private InfraOSPortService infraOSPortService; + + @Ignore + @Test + public void regist() throws Exception { + + InfraOSPort infraOSPort = new InfraOSPort(); + infraOSPort.setTlsType(false); + infraOSPort.setPortType("TCP"); + + InfraOS infraOS = new InfraOS(); + infraOS.setId(1); + + infraOSPort.setOs(infraOS); + + // FIXME::vendor??? + + } + + @Test + public void read() throws Exception { + } + +} \ No newline at end of file diff --git a/src/test/java/com/loafle/overflow/module/infra/service/InfraServiceServiceTest.java b/src/test/java/com/loafle/overflow/module/infra/service/InfraServiceServiceTest.java new file mode 100644 index 0000000..e8a5ab7 --- /dev/null +++ b/src/test/java/com/loafle/overflow/module/infra/service/InfraServiceServiceTest.java @@ -0,0 +1,60 @@ +package com.loafle.overflow.module.infra.service; + + +import com.loafle.overflow.module.infra.model.InfraHost; +import com.loafle.overflow.module.infra.model.InfraService; +import com.loafle.overflow.module.meta.model.MetaInfraType; +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.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import static org.junit.Assert.*; + +/** + * Created by snoop on 17. 7. 28. + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class}) +public class InfraServiceServiceTest { + + @Autowired + private InfraServiceService infraServiceService; + + @Ignore + @Test + public void regist() throws Exception { + + InfraService infraService = new InfraService(); + + infraService.setPort(80); + infraService.setPortType("TCP"); + + InfraHost infraHost = new InfraHost(); + infraHost.setId(1); + + infraService.setHost(infraHost); + infraService.setTlsType(false); + + MetaInfraVendor metaInfraVendor = new MetaInfraVendor(); + metaInfraVendor.setId(45); + + infraService.setVendor(metaInfraVendor); + + this.infraServiceService.regist(infraService); + + Assert.assertNotEquals(infraService.getId(), 0); + } + + @Test + public void read() throws Exception { + } + +} \ 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 519cf78..3c018a2 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 @@ -26,24 +26,24 @@ public class InfraServiceTest { @Autowired private InfraService infraService; - @Test @Ignore + @Test public void regist() throws Exception { - long id =registInfra(1,1); + long id =registInfra(7,1); Assert.assertNotEquals(id, 0); - id =registInfra(3,1); - Assert.assertNotEquals(id, 0); - - id =registInfra(2,1); - Assert.assertNotEquals(id, 0); +// id =registInfra(3,1); +// Assert.assertNotEquals(id, 0); +// +// id =registInfra(2,1); +// Assert.assertNotEquals(id, 0); } - @Ignore +// @Ignore public long registInfra(int type, int childId) { MetaInfraType metaInfraType = new MetaInfraType(); metaInfraType.setId(type);