fixed infra series

This commit is contained in:
snoop 2017-07-28 17:09:17 +09:00
parent 952706d358
commit d6db2beddc
9 changed files with 245 additions and 16 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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 {
}
}

View File

@ -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 {
}
}

View File

@ -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);