test code

This commit is contained in:
insanity 2018-04-24 19:49:21 +09:00
parent 7df5c1458a
commit 55f66f0337
49 changed files with 1703 additions and 1725 deletions

View File

@ -19,7 +19,6 @@ import com.loafle.overflow.service.central.domain.DomainMemberService;
import com.loafle.overflow.service.central.member.MemberService; import com.loafle.overflow.service.central.member.MemberService;
import com.loafle.overflow.service.central.probe.ProbeService; import com.loafle.overflow.service.central.probe.ProbeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@ -1,6 +1,5 @@
package com.loafle.overflow.central.module.apikey.service; package com.loafle.overflow.central.module.apikey.service;
import com.google.protobuf.Api;
import com.loafle.overflow.central.spring.AppConfigTest; import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.core.exception.OverflowException; import com.loafle.overflow.core.exception.OverflowException;

View File

@ -23,7 +23,7 @@ import java.util.Date;
public class EmailAuthServiceTest { public class EmailAuthServiceTest {
@Autowired @Autowired
CentralEmailAuthService emailAuthService; EmailAuthService emailAuthService;
@Test @Test
@Ignore @Ignore

View File

@ -1,12 +1,13 @@
package com.loafle.overflow.central.module.history.service; package com.loafle.overflow.central.module.history.service;
import com.loafle.overflow.central.commons.model.PageParams;
import com.loafle.overflow.central.module.domain.model.Domain;
import com.loafle.overflow.central.module.history.model.History;
import com.loafle.overflow.central.module.member.model.Member;
import com.loafle.overflow.central.module.meta.model.MetaHistoryType;
import com.loafle.overflow.central.module.probe.model.Probe;
import com.loafle.overflow.central.spring.AppConfigTest; import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.core.model.PageParams;
import com.loafle.overflow.model.domain.Domain;
import com.loafle.overflow.model.history.History;
import com.loafle.overflow.model.member.Member;
import com.loafle.overflow.model.meta.MetaHistoryType;
import com.loafle.overflow.model.probe.Probe;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
@ -26,7 +27,7 @@ import java.util.Random;
public class HistoryServiceTest { public class HistoryServiceTest {
@Autowired @Autowired
private HistoryService historyService; private CentralHistoryService historyService;
@Test @Test
@Ignore @Ignore

View File

@ -1,7 +1,8 @@
package com.loafle.overflow.central.module.infra.dao; package com.loafle.overflow.central.module.infra.dao;
import com.loafle.overflow.central.module.probe.model.Probe;
import com.loafle.overflow.central.spring.AppConfigTest; import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.model.probe.Probe;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,9 +1,12 @@
package com.loafle.overflow.central.module.infra.service; package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.model.InfraHost;
import com.loafle.overflow.central.module.infra.model.InfraOS;
import com.loafle.overflow.central.module.meta.model.MetaInfraType;
import com.loafle.overflow.central.spring.AppConfigTest; import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraHost;
import com.loafle.overflow.model.infra.InfraOS;
import com.loafle.overflow.model.meta.MetaInfraType;
import com.loafle.overflow.service.central.infra.InfraHostService;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -41,7 +44,6 @@ public class InfraHostServiceTest {
metaInfraType.setId(2); metaInfraType.setId(2);
this.infraHostService.regist(infraHost); this.infraHostService.regist(infraHost);
Assert.assertNotEquals(infraHost.getId(), 0 ); Assert.assertNotEquals(infraHost.getId(), 0 );
@ -63,9 +65,15 @@ public class InfraHostServiceTest {
@Test @Test
public void readByIp() { public void readByIp() {
InfraHost infraHost = this.infraHostService.readByIp(3232235980L); InfraHost infraHost;
try {
infraHost = this.infraHostService.readByIp(3232235980L);
Assert.assertNotEquals(infraHost, null);
} catch (OverflowException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Assert.assertNotEquals(infraHost, null);
} }

View File

@ -1,8 +1,10 @@
package com.loafle.overflow.central.module.infra.service; package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.model.InfraMachine;
import com.loafle.overflow.central.module.meta.model.MetaInfraType;
import com.loafle.overflow.central.spring.AppConfigTest; import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.model.infra.InfraMachine;
import com.loafle.overflow.model.meta.MetaInfraType;
import com.loafle.overflow.service.central.infra.InfraMachineService;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;

View File

@ -1,9 +1,11 @@
package com.loafle.overflow.central.module.infra.service; package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.model.InfraOS;
import com.loafle.overflow.central.module.infra.model.InfraOSApplication;
import com.loafle.overflow.central.module.meta.model.MetaInfraType;
import com.loafle.overflow.central.spring.AppConfigTest; import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.model.infra.InfraOS;
import com.loafle.overflow.model.infra.InfraOSApplication;
import com.loafle.overflow.model.meta.MetaInfraType;
import com.loafle.overflow.service.central.infra.InfraOSApplicationService;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;

View File

@ -1,9 +1,11 @@
package com.loafle.overflow.central.module.infra.service; package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.model.InfraOS;
import com.loafle.overflow.central.module.infra.model.InfraOSDaemon;
import com.loafle.overflow.central.module.meta.model.MetaInfraType;
import com.loafle.overflow.central.spring.AppConfigTest; import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.model.infra.InfraOS;
import com.loafle.overflow.model.infra.InfraOSDaemon;
import com.loafle.overflow.model.meta.MetaInfraType;
import com.loafle.overflow.service.central.infra.InfraOSDaemonService;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;

View File

@ -1,9 +1,12 @@
package com.loafle.overflow.central.module.infra.service; package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.model.InfraOS;
import com.loafle.overflow.central.module.infra.model.InfraOSPort;
import com.loafle.overflow.central.module.meta.model.MetaInfraType;
import com.loafle.overflow.central.spring.AppConfigTest; import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraOS;
import com.loafle.overflow.model.infra.InfraOSPort;
import com.loafle.overflow.model.meta.MetaInfraType;
import com.loafle.overflow.service.central.infra.InfraOSPortService;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -49,9 +52,15 @@ public class InfraOSPortServiceTest {
@Test @Test
public void readByPort() { public void readByPort() {
InfraOSPort infraOSPort = this.infraOSPortService.readByPort(1, 22, "TCP"); InfraOSPort infraOSPort;
try {
infraOSPort = this.infraOSPortService.readByPort(1, 22, "TCP");
Assert.assertNotEquals(infraOSPort, null);
} catch (OverflowException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Assert.assertNotEquals(infraOSPort, null);
} }

View File

@ -1,10 +1,12 @@
package com.loafle.overflow.central.module.infra.service; package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.model.InfraMachine;
import com.loafle.overflow.central.module.infra.model.InfraOS;
import com.loafle.overflow.central.module.meta.model.MetaInfraType;
import com.loafle.overflow.central.module.meta.model.MetaInfraVendor;
import com.loafle.overflow.central.spring.AppConfigTest; import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.model.infra.InfraMachine;
import com.loafle.overflow.model.infra.InfraOS;
import com.loafle.overflow.model.meta.MetaInfraType;
import com.loafle.overflow.model.meta.MetaInfraVendor;
import com.loafle.overflow.service.central.infra.InfraOSService;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

View File

@ -1,11 +1,12 @@
package com.loafle.overflow.central.module.infra.service; package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.model.InfraHost;
import com.loafle.overflow.central.module.infra.model.InfraService;
import com.loafle.overflow.central.module.meta.model.MetaInfraType;
import com.loafle.overflow.central.module.meta.model.MetaInfraVendor;
import com.loafle.overflow.central.spring.AppConfigTest; import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.model.infra.InfraHost;
import com.loafle.overflow.model.infra.InfraService;
import com.loafle.overflow.model.meta.MetaInfraType;
import com.loafle.overflow.model.meta.MetaInfraVendor;
import com.loafle.overflow.service.central.infra.InfraServiceService;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -17,52 +18,10 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* Created by snoop on 17. 7. 28. * Created by snoop on 17. 7. 28.
*/ */
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) @ContextConfiguration(classes = { AppConfigTest.class })
public class InfraServiceServiceTest { public class InfraServiceServiceTest {
@Autowired @Autowired
private InfraServiceService infraServiceService; 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(3);
infraService.setHost(infraHost);
infraService.setTlsType(false);
MetaInfraVendor metaInfraVendor = new MetaInfraVendor();
metaInfraVendor.setId(45);
infraService.setVendor(metaInfraVendor);
MetaInfraType metaInfraType = new MetaInfraType();
metaInfraType.setId(7);
this.infraServiceService.regist(infraService);
Assert.assertNotEquals(infraService.getId(), 0);
}
@Test
public void read() throws Exception {
}
@Test
public void readByService() {
InfraService infraService = this.infraServiceService.readByService(3, 80, "TCP");
Assert.assertNotEquals(infraService, null);
}
} }

View File

@ -1,125 +1,119 @@
package com.loafle.overflow.central.module.infra.service; // package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.commons.model.PageParams; // import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.central.module.domain.model.Domain; // import org.codehaus.jackson.map.ObjectMapper;
import com.loafle.overflow.central.module.infra.model.Infra; // import org.junit.Test;
import com.loafle.overflow.central.module.probe.model.Probe; // import org.junit.runner.RunWith;
import com.loafle.overflow.central.module.probe.service.ProbeService; // import org.springframework.beans.factory.annotation.Autowired;
import com.loafle.overflow.central.module.target.model.Target; // import org.springframework.data.domain.Page;
import com.loafle.overflow.central.spring.AppConfigTest; // import org.springframework.test.context.ContextConfiguration;
import org.codehaus.jackson.map.ObjectMapper; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.IOException; // import java.io.IOException;
import static org.junit.Assert.assertNotNull; // import static org.junit.Assert.assertNotNull;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class InfraServiceTest { // public class InfraServiceTest {
@Autowired // @Autowired
private InfraService infraService; // private InfraService infraService;
@Autowired // @Autowired
private ProbeService probeService; // private ProbeService probeService;
@Autowired // @Autowired
private InfraMachineService infraMachineService; // private InfraMachineService infraMachineService;
@Test // @Test
public void tttt() { // public void tttt() {
} // }
@Test // @Test
public void readAllByProbe() throws IOException { // public void readAllByProbe() throws IOException {
Probe probe = new Probe(); // Probe probe = new Probe();
probe.setId(1); // probe.setId(1);
PageParams pageParams = new PageParams(); // PageParams pageParams = new PageParams();
pageParams.setCountPerPage(100); // pageParams.setCountPerPage(100);
pageParams.setPageNo(0); // pageParams.setPageNo(0);
pageParams.setSortCol("id"); // pageParams.setSortCol("id");
pageParams.setSortDirection("descending"); // pageParams.setSortDirection("descending");
Page<Infra> list = this.infraService.readAllByProbe(probe, pageParams); // Page<Infra> list = this.infraService.readAllByProbe(probe, pageParams);
assertNotNull(list); // assertNotNull(list);
} // }
@Test // @Test
public void read() throws Exception { // public void read() throws Exception {
// registInfraMachine(); // // registInfraMachine();
Infra infra = this.infraService.read(1); // Infra infra = this.infraService.read(1);
ObjectMapper objectMapper = new ObjectMapper(); // ObjectMapper objectMapper = new ObjectMapper();
String json = objectMapper.writeValueAsString(infra); // String json = objectMapper.writeValueAsString(infra);
System.out.println(json); // System.out.println(json);
} // }
// @Test // // @Test
// public void readAllProbe() throws IOException { // // public void readAllProbe() throws IOException {
// // //
// Probe probe = new Probe(); // // Probe probe = new Probe();
// probe.setId(1); // // probe.setId(1);
// // //
// List<Infra> infraList = this.infraService.readAllByProbe(probe); // // List<Infra> infraList = this.infraService.readAllByProbe(probe);
// // //
// ObjectMapper objectMapper = new ObjectMapper(); // // ObjectMapper objectMapper = new ObjectMapper();
// String json = objectMapper.writeValueAsString(infraList); // // String json = objectMapper.writeValueAsString(infraList);
// // //
// System.out.println(json); // // System.out.println(json);
// // //
// } // // }
@Test // @Test
public void readAllTarget() { // public void readAllTarget() {
Domain domain = new Domain(); // Domain domain = new Domain();
domain.setId(1); // domain.setId(1);
// this.infraService.readAllTargetByProbeList() // // this.infraService.readAllTargetByProbeList()
} // }
@Test // @Test
public void readByTarget() throws IOException { // public void readByTarget() throws IOException {
Target target = new Target(); // Target target = new Target();
target.setId(1); // target.setId(1);
Infra infra = this.infraService.readByTarget(target); // Infra infra = this.infraService.readByTarget(target);
ObjectMapper objectMapper = new ObjectMapper(); // ObjectMapper objectMapper = new ObjectMapper();
String json = objectMapper.writeValueAsString(infra); // String json = objectMapper.writeValueAsString(infra);
System.out.println(json); // System.out.println(json);
} // }
// @Test // // @Test
// public void readAllByProbeList() throws IOException { // // public void readAllByProbeList() throws IOException {
// // //
// Domain domain = new Domain(); // // Domain domain = new Domain();
// domain.setId(1); // // domain.setId(1);
// // //
// // //
// List<Infra> fl = this.infraService.readAllByDomain(domain); // // List<Infra> fl = this.infraService.readAllByDomain(domain);
// // //
// System.out.println(fl.size()); // // System.out.println(fl.size());
// ObjectMapper objectMapper = new ObjectMapper(); // // ObjectMapper objectMapper = new ObjectMapper();
// String json = objectMapper.writeValueAsString(fl); // // String json = objectMapper.writeValueAsString(fl);
// // //
// System.out.println(json); // // System.out.println(json);
// // //
// } // // }
} // }

View File

@ -1,56 +1,56 @@
package com.loafle.overflow.central.module.member.dao; // package com.loafle.overflow.central.module.member.dao;
import com.loafle.overflow.central.module.member.model.Member; // import com.loafle.overflow.central.module.member.model.Member;
import com.loafle.overflow.central.module.meta.model.MetaMemberStatus; // import com.loafle.overflow.central.module.meta.model.MetaMemberStatus;
import com.loafle.overflow.central.spring.*; // import com.loafle.overflow.central.spring.*;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; // import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.test.context.ActiveProfiles; // import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/** // /**
* Created by geek on 17. 6. 28. // * Created by geek on 17. 6. 28.
*/ // */
@Ignore // @Ignore
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ActiveProfiles("test") // @ActiveProfiles("test")
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MemberDAOTest { // public class MemberDAOTest {
@Autowired // @Autowired
private MemberDAO repo; // private MemberDAO repo;
// @Ignore // // @Ignore
@Test // @Test
public void createMember() { // public void createMember() {
Member m = new Member(); // Member m = new Member();
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); // BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
m.setName("insanity2"); // m.setName("insanity2");
m.setCompanyName("loafle"); // m.setCompanyName("loafle");
m.setPw(passwordEncoder.encode("!@#$qwer1234")); // m.setPw(passwordEncoder.encode("!@#$qwer1234"));
// m.setPw("!@#$qwer1234"); // // m.setPw("!@#$qwer1234");
m.setPhone("000-000-0000"); // m.setPhone("000-000-0000");
m.setEmail("geekhot@hotmail.co.kr"); // m.setEmail("geekhot@hotmail.co.kr");
m.setStatus(new MetaMemberStatus((short)1)); // m.setStatus(new MetaMemberStatus((short)1));
repo.save(m); // repo.save(m);
Assert.assertNotEquals(m.getId(), 0); // Assert.assertNotEquals(m.getId(), 0);
} // }
@Test // @Test
public void findByEmail() throws Exception { // public void findByEmail() throws Exception {
Member member = new Member(1); // Member member = new Member(1);
member.setEmail("overflow@loafle.com"); // member.setEmail("overflow@loafle.com");
Member rr = repo.findByEmail("overflow@loafle.com"); // Member rr = repo.findByEmail("overflow@loafle.com");
Assert.assertNotNull(rr); // Assert.assertNotNull(rr);
// System.out.println("rr.getCompanyName() = " + rr.getCompanyName()); // // System.out.println("rr.getCompanyName() = " + rr.getCompanyName());
} // }
} // }

View File

@ -1,50 +1,50 @@
package com.loafle.overflow.central.module.member.dao; // package com.loafle.overflow.central.module.member.dao;
import com.loafle.overflow.central.module.member.model.Member; // import com.loafle.overflow.central.module.member.model.Member;
import com.loafle.overflow.central.module.member.model.MemberTotp; // import com.loafle.overflow.central.module.member.model.MemberTotp;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles; // import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by geek on 18. 3. 9. // * Created by geek on 18. 3. 9.
*/ // */
@Ignore // @Ignore
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ActiveProfiles("test") // @ActiveProfiles("test")
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MemberTotpDAOTest { // public class MemberTotpDAOTest {
@Autowired // @Autowired
private MemberTotpDAO dao; // private MemberTotpDAO dao;
@Test // @Test
public void insertTest() throws Exception { // public void insertTest() throws Exception {
MemberTotp totp = new MemberTotp(); // MemberTotp totp = new MemberTotp();
totp.setSecretCode("AI6EWOYSZWEBAI2D"); // totp.setSecretCode("AI6EWOYSZWEBAI2D");
totp.setMember(new Member(2)); // totp.setMember(new Member(2));
this.dao.save(totp); // this.dao.save(totp);
} // }
@Test // @Test
public void findBySecretCode() throws Exception { // public void findBySecretCode() throws Exception {
} // }
@Test // @Test
public void findByMember() throws Exception { // public void findByMember() throws Exception {
MemberTotp totp = new MemberTotp(); // MemberTotp totp = new MemberTotp();
totp.setSecretCode("EDPBZLDATGZP7NX2"); // totp.setSecretCode("EDPBZLDATGZP7NX2");
totp.setMember(new Member(2)); // totp.setMember(new Member(2));
this.dao.save(totp); // this.dao.save(totp);
MemberTotp totp1 = this.dao.findByMember(totp.getMember()); // MemberTotp totp1 = this.dao.findByMember(totp.getMember());
assertNotNull(totp1); // assertNotNull(totp1);
} // }
} // }

View File

@ -1,120 +1,120 @@
package com.loafle.overflow.central.module.member.service; // package com.loafle.overflow.central.module.member.service;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.model.member.Member; // import com.loafle.overflow.model.member.Member;
import com.loafle.overflow.service.central.member.MemberService; // import com.loafle.overflow.service.central.member.MemberService;
import com.loafle.overflow.service.central.member.MemberTotpService; // import com.loafle.overflow.service.central.member.MemberTotpService;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles; // import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date; // import java.util.Date;
import java.util.List; // import java.util.List;
import java.util.regex.Matcher; // import java.util.regex.Matcher;
import java.util.regex.Pattern; // import java.util.regex.Pattern;
/** // /**
* Created by insanity on 17. 6. 28. // * Created by insanity on 17. 6. 28.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ActiveProfiles("test") // @ActiveProfiles("test")
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MemberServiceTest { // public class MemberServiceTest {
@Autowired // @Autowired
MemberService memberService; // MemberService memberService;
@Autowired // @Autowired
MemberTotpService totpService; // MemberTotpService totpService;
@Test // @Test
public void regist() throws Exception { // public void regist() throws Exception {
Member m = new Member(); // Member m = new Member();
m.setPw("!@#$qwer1234"); // m.setPw("!@#$qwer1234");
m.setStatus(new MetaMemberStatus((short)1)); // m.setStatus(new MetaMemberStatus((short)1));
m.setCreateDate(new Date()); // m.setCreateDate(new Date());
m.setCompanyName("Loafle"); // m.setCompanyName("Loafle");
m.setEmail("geekhot@hotmail.co.kr"); // m.setEmail("geekhot@hotmail.co.kr");
m.setName("administrator"); // m.setName("administrator");
m.setPhone("00000000"); // m.setPhone("00000000");
Member res = this.memberService.signup(m,"!@#$qwer1234"); // Member res = this.memberService.signup(m,"!@#$qwer1234");
Assert.assertNotNull(res); // Assert.assertNotNull(res);
} // }
@Test // @Test
public void signin() throws Exception { // public void signin() throws Exception {
// Member m = this.memberService.signin("overflow@loafle.com", "!@#$qwer1234"); // // Member m = this.memberService.signin("overflow@loafle.com", "!@#$qwer1234");
// Assert.assertNotNull(m); // // Assert.assertNotNull(m);
} // }
@Test // @Test
public void readAllMemberByProbeKey() { // public void readAllMemberByProbeKey() {
List<Member> members = this.memberService.readAllByProbeKey("95d8bcdc739741dca74c4a0e489e0774"); // List<Member> members = this.memberService.readAllByProbeKey("95d8bcdc739741dca74c4a0e489e0774");
Assert.assertNotEquals(members.size(), 0); // Assert.assertNotEquals(members.size(), 0);
} // }
@Test // @Test
public void readAllMemberByApiKey() { // public void readAllMemberByApiKey() {
List<Member> members = this.memberService.readAllByApiKey("52abd6fd57e511e7ac52080027658d13"); // List<Member> members = this.memberService.readAllByApiKey("52abd6fd57e511e7ac52080027658d13");
Assert.assertNotEquals(members.size(), 0); // Assert.assertNotEquals(members.size(), 0);
} // }
@Test // @Test
public void readAllMemberByDomain() { // public void readAllMemberByDomain() {
Domain domain = new Domain(); // Domain domain = new Domain();
domain.setId(1); // domain.setId(1);
List<Member> members = this.memberService.readAllByDomain(domain); // List<Member> members = this.memberService.readAllByDomain(domain);
Assert.assertNotEquals(members.size(), 0); // Assert.assertNotEquals(members.size(), 0);
} // }
@Test // @Test
public void TestPasswordStrong() { // public void TestPasswordStrong() {
String arrpw[] = new String[]{"!@#$Qwer1234", "Zxasqw12!!","@Cosmos@5795"}; // String arrpw[] = new String[]{"!@#$Qwer1234", "Zxasqw12!!","@Cosmos@5795"};
// String pass = "!@#$Qwer1234"; // // String pass = "!@#$Qwer1234";
boolean check = false; // boolean check = false;
for (int i = 0; i < arrpw.length; i++) { // for (int i = 0; i < arrpw.length; i++) {
check = this.memberService.isPasswordStrong(arrpw[i]); // check = this.memberService.isPasswordStrong(arrpw[i]);
// System.out.println("check = " + check); // // System.out.println("check = " + check);
Assert.assertTrue(check); // Assert.assertTrue(check);
} // }
} // }
// // //
// String regex = "(" + // // String regex = "(" +
// "(?=.*[a-z])" + // // "(?=.*[a-z])" +
// "(?=.*\\d)" + // // "(?=.*\\d)" +
// "(?=.*[A-Z])" + // // "(?=.*[A-Z])" +
// "(?=.*[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?])" + // // "(?=.*[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?])" +
// "." + // // "." +
// "{6,40}" + // // "{6,40}" +
// ")"; // // ")";
// @Test // // @Test
// public void TestPassword() { // // public void TestPassword() {
// Pattern pattern = Pattern.compile(regex); // // Pattern pattern = Pattern.compile(regex);
// Matcher matcher = pattern.matcher("qwe1231@Q\\"); // // Matcher matcher = pattern.matcher("qwe1231@Q\\");
// System.out.println("Length"+"qwe1231@Q\\".length()); // // System.out.println("Length"+"qwe1231@Q\\".length());
// // //
// System.out.println("matcher.matches() = " + matcher.matches()); // // System.out.println("matcher.matches() = " + matcher.matches());
// } // // }
} // }

View File

@ -1,70 +1,70 @@
package com.loafle.overflow.central.module.member.service; // package com.loafle.overflow.central.module.member.service;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.model.member.Member; // import com.loafle.overflow.model.member.Member;
import com.loafle.overflow.model.member.MemberTotp; // import com.loafle.overflow.model.member.MemberTotp;
import com.loafle.overflow.service.central.member.MemberTotpService; // import com.loafle.overflow.service.central.member.MemberTotpService;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles; // import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Map; // import java.util.Map;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by geek on 18. 3. 9. // * Created by geek on 18. 3. 9.
*/ // */
@Ignore // @Ignore
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ActiveProfiles("test") // @ActiveProfiles("test")
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MemberTotpServiceTest { // public class MemberTotpServiceTest {
@Autowired // @Autowired
private MemberTotpService totpService; // private MemberTotpService totpService;
@Test // @Test
public void regist() throws Exception { // public void regist() throws Exception {
} // }
@Test // @Test
public void modify() throws Exception { // public void modify() throws Exception {
} // }
@Test // @Test
public void remove() throws Exception { // public void remove() throws Exception {
} // }
@Test // @Test
public void read() throws Exception { // public void read() throws Exception {
} // }
@Test // @Test
public void checkCode() throws Exception { // public void checkCode() throws Exception {
MemberTotp totp = new MemberTotp(); // MemberTotp totp = new MemberTotp();
totp.setSecretCode("PN44SRPS5QCGCJNS"); // totp.setSecretCode("PN44SRPS5QCGCJNS");
boolean isCheck = this.totpService.checkCode("PN44SRPS5QCGCJNS", "125073"); // boolean isCheck = this.totpService.checkCode("PN44SRPS5QCGCJNS", "125073");
System.out.println(isCheck); // System.out.println(isCheck);
} // }
@Test // @Test
public void createTotp() throws Exception { // public void createTotp() throws Exception {
Member m = new Member(2); // Member m = new Member(2);
m.setEmail("geekdev@naver.com"); // m.setEmail("geekdev@naver.com");
Map<String, String> totp = this.totpService.createTotp(m ); // Map<String, String> totp = this.totpService.createTotp(m );
System.out.println(totp.get("key")); // System.out.println(totp.get("key"));
System.out.println(totp.get("uri")); // System.out.println(totp.get("uri"));
} // }
} // }

View File

@ -1,39 +1,39 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaCrawler; // import com.loafle.overflow.central.module.meta.model.MetaCrawler;
import com.loafle.overflow.central.module.meta.model.MetaCrawlerInputItem; // import com.loafle.overflow.central.module.meta.model.MetaCrawlerInputItem;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaCrawlerInputItemServiceTest { // public class CentralMetaCrawlerInputItemServiceTest {
@Autowired // @Autowired
private MetaCrawlerInputItemService crawlerInputItemService; // private MetaCrawlerInputItemService crawlerInputItemService;
@Test // @Test
public void readAllByMetaCrawler() throws Exception { // public void readAllByMetaCrawler() throws Exception {
MetaCrawler metaCrawler = new MetaCrawler(); // MetaCrawler metaCrawler = new MetaCrawler();
metaCrawler.setId((short)1); // metaCrawler.setId((short)1);
List<MetaCrawlerInputItem> crawlerInputItems = this.crawlerInputItemService.readAllByMetaCrawler(metaCrawler); // List<MetaCrawlerInputItem> crawlerInputItems = this.crawlerInputItemService.readAllByMetaCrawler(metaCrawler);
Assert.assertNotEquals(crawlerInputItems.size(), 0); // Assert.assertNotEquals(crawlerInputItems.size(), 0);
} // }
} // }

View File

@ -1,36 +1,36 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaCrawler; // import com.loafle.overflow.central.module.meta.model.MetaCrawler;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaCrawlerServiceTest { // public class CentralMetaCrawlerServiceTest {
@Autowired // @Autowired
private MetaCrawlerService service; // private MetaCrawlerService service;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaCrawler> metaCrawlerServices = this.service.readAll(); // List<MetaCrawler> metaCrawlerServices = this.service.readAll();
Assert.assertNotEquals(metaCrawlerServices.size(), 0); // Assert.assertNotEquals(metaCrawlerServices.size(), 0);
System.out.println(metaCrawlerServices.size()); // System.out.println(metaCrawlerServices.size());
} // }
} // }

View File

@ -1,74 +1,74 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaHistoryType; // import com.loafle.overflow.central.module.meta.model.MetaHistoryType;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList; // import java.util.ArrayList;
import java.util.List; // import java.util.List;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
@Ignore // @Ignore
public class CentralMetaHistoryTypeServiceTest { // public class CentralMetaHistoryTypeServiceTest {
@Autowired // @Autowired
private MetaHistoryTypeService historyTypeService; // private MetaHistoryTypeService historyTypeService;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaHistoryType> historyTypes = this.historyTypeService.readAll(); // List<MetaHistoryType> historyTypes = this.historyTypeService.readAll();
Assert.assertNotNull(historyTypes); // Assert.assertNotNull(historyTypes);
} // }
@Test // @Test
public void save() throws Exception { // public void save() throws Exception {
List<MetaHistoryType> list = new ArrayList<>(); // List<MetaHistoryType> list = new ArrayList<>();
MetaHistoryType t1 = new MetaHistoryType(); // MetaHistoryType t1 = new MetaHistoryType();
t1.setId(1); // t1.setId(1);
t1.setName("Member"); // t1.setName("Member");
MetaHistoryType t2 = new MetaHistoryType(); // MetaHistoryType t2 = new MetaHistoryType();
t2.setId(2); // t2.setId(2);
t2.setName("Probe"); // t2.setName("Probe");
MetaHistoryType t3 = new MetaHistoryType(); // MetaHistoryType t3 = new MetaHistoryType();
t3.setId(3); // t3.setId(3);
t3.setName("Discovery"); // t3.setName("Discovery");
MetaHistoryType t4 = new MetaHistoryType(); // MetaHistoryType t4 = new MetaHistoryType();
t4.setId(4); // t4.setId(4);
t4.setName("Target"); // t4.setName("Target");
MetaHistoryType t5 = new MetaHistoryType(); // MetaHistoryType t5 = new MetaHistoryType();
t5.setId(5); // t5.setId(5);
t5.setName("Crawler"); // t5.setName("Crawler");
MetaHistoryType t6 = new MetaHistoryType(); // MetaHistoryType t6 = new MetaHistoryType();
t6.setId(6); // t6.setId(6);
t6.setName("Sensor"); // t6.setName("Sensor");
//todo: need more // //todo: need more
list.add(t1); // list.add(t1);
list.add(t2); // list.add(t2);
list.add(t3); // list.add(t3);
list.add(t4); // list.add(t4);
list.add(t5); // list.add(t5);
list.add(t6); // list.add(t6);
List<MetaHistoryType> result = this.historyTypeService.registAll(list); // List<MetaHistoryType> result = this.historyTypeService.registAll(list);
Assert.assertEquals(result.size(), list.size()); // Assert.assertEquals(result.size(), list.size());
} // }
} // }

View File

@ -1,35 +1,35 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaInfraType; // import com.loafle.overflow.central.module.meta.model.MetaInfraType;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
@Ignore // @Ignore
public class CentralMetaInfraTypeServiceTest { // public class CentralMetaInfraTypeServiceTest {
@Autowired // @Autowired
private CentralMetaInfraTypeService infraTypeService; // private CentralMetaInfraTypeService infraTypeService;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaInfraType> metaInfraTypes = this.infraTypeService.readAll(); // List<MetaInfraType> metaInfraTypes = this.infraTypeService.readAll();
Assert.assertNotEquals(metaInfraTypes.size(), 0); // Assert.assertNotEquals(metaInfraTypes.size(), 0);
} // }
} // }

View File

@ -1,36 +1,36 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaInfraVendorServiceTest { // public class CentralMetaInfraVendorServiceTest {
@Autowired // @Autowired
private MetaInfraVendorService infraVendorService; // private MetaInfraVendorService infraVendorService;
@Test // @Test
public void readAllByMetaInfraType() throws Exception { // public void readAllByMetaInfraType() throws Exception {
MetaInfraType metaInfraType = new MetaInfraType(); // MetaInfraType metaInfraType = new MetaInfraType();
metaInfraType.setId(1); // metaInfraType.setId(1);
List<MetaInfraVendor> infraVendors = this.infraVendorService.readAllByMetaInfraType(metaInfraType); // List<MetaInfraVendor> infraVendors = this.infraVendorService.readAllByMetaInfraType(metaInfraType);
Assert.assertNotEquals(infraVendors.size(), 0); // Assert.assertNotEquals(infraVendors.size(), 0);
} // }
} // }

View File

@ -1,35 +1,35 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaInputType; // import com.loafle.overflow.central.module.meta.model.MetaInputType;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaInputTypeServiceTest { // public class CentralMetaInputTypeServiceTest {
@Autowired // @Autowired
private MetaInputTypeService inputTypeService; // private MetaInputTypeService inputTypeService;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaInputType> inputTypes = this.inputTypeService.readAll(); // List<MetaInputType> inputTypes = this.inputTypeService.readAll();
Assert.assertNotEquals(inputTypes.size(), 0); // Assert.assertNotEquals(inputTypes.size(), 0);
} // }
} // }

View File

@ -1,35 +1,35 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaMemberStatus; // import com.loafle.overflow.central.module.meta.model.MetaMemberStatus;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaMemberStatusServiceTest { // public class CentralMetaMemberStatusServiceTest {
@Autowired // @Autowired
private MetaMemberStatusService memberStatusService; // private MetaMemberStatusService memberStatusService;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaMemberStatus> memberStatuses = this.memberStatusService.readAll(); // List<MetaMemberStatus> memberStatuses = this.memberStatusService.readAll();
Assert.assertNotEquals(memberStatuses.size(), 0); // Assert.assertNotEquals(memberStatuses.size(), 0);
} // }
} // }

View File

@ -1,33 +1,33 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaNoAuthProbeStatus; // import com.loafle.overflow.central.module.meta.model.MetaNoAuthProbeStatus;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaNoAuthProbeStatusServiceTest { // public class CentralMetaNoAuthProbeStatusServiceTest {
@Autowired // @Autowired
private MetaNoAuthProbeStatusService noAuthProbeStatusService; // private MetaNoAuthProbeStatusService noAuthProbeStatusService;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaNoAuthProbeStatus> metaNoAuthProbeStatuses = this.noAuthProbeStatusService.readAll(); // List<MetaNoAuthProbeStatus> metaNoAuthProbeStatuses = this.noAuthProbeStatusService.readAll();
Assert.assertNotEquals(metaNoAuthProbeStatuses.size(), 0); // Assert.assertNotEquals(metaNoAuthProbeStatuses.size(), 0);
} // }
} // }

View File

@ -1,34 +1,34 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaProbeArchitecture; // import com.loafle.overflow.central.module.meta.model.MetaProbeArchitecture;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaProbeArchitectureServiceTest { // public class CentralMetaProbeArchitectureServiceTest {
@Autowired // @Autowired
private MetaProbeArchitectureService probeArchitectureService; // private MetaProbeArchitectureService probeArchitectureService;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaProbeArchitecture> probeArchitectures = this.probeArchitectureService.readAll(); // List<MetaProbeArchitecture> probeArchitectures = this.probeArchitectureService.readAll();
Assert.assertNotEquals(probeArchitectures.size(), 0); // Assert.assertNotEquals(probeArchitectures.size(), 0);
} // }
} // }

View File

@ -1,35 +1,35 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaProbeOs; // import com.loafle.overflow.central.module.meta.model.MetaProbeOs;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaProbeOsServiceTest { // public class CentralMetaProbeOsServiceTest {
@Autowired // @Autowired
private MetaProbeOsService probeOsService; // private MetaProbeOsService probeOsService;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaProbeOs> metaProbeOs = this.probeOsService.readAll(); // List<MetaProbeOs> metaProbeOs = this.probeOsService.readAll();
Assert.assertNotEquals(metaProbeOs.size(), 0); // Assert.assertNotEquals(metaProbeOs.size(), 0);
} // }
} // }

View File

@ -1,39 +1,39 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaProbeOs; // import com.loafle.overflow.central.module.meta.model.MetaProbeOs;
import com.loafle.overflow.central.module.meta.model.MetaProbePackage; // import com.loafle.overflow.central.module.meta.model.MetaProbePackage;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MetaProbePackageServiceTest { // public class MetaProbePackageServiceTest {
@Autowired // @Autowired
private MetaProbePackageService probePackageService; // private MetaProbePackageService probePackageService;
@Test // @Test
public void readAllByOs() throws Exception { // public void readAllByOs() throws Exception {
MetaProbeOs metaProbeOs = new MetaProbeOs(); // MetaProbeOs metaProbeOs = new MetaProbeOs();
metaProbeOs.setId((short)1); // metaProbeOs.setId((short)1);
List<MetaProbePackage> metaProbePackages = this.probePackageService.readAllByOs(metaProbeOs); // List<MetaProbePackage> metaProbePackages = this.probePackageService.readAllByOs(metaProbeOs);
Assert.assertNotEquals(metaProbePackages.size(), 0); // Assert.assertNotEquals(metaProbePackages.size(), 0);
} // }
} // }

View File

@ -1,34 +1,34 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaProbeStatus; // import com.loafle.overflow.central.module.meta.model.MetaProbeStatus;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MetaProbeStatusServiceTest { // public class MetaProbeStatusServiceTest {
@Autowired // @Autowired
private MetaProbeStatusService probeStatusService; // private MetaProbeStatusService probeStatusService;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaProbeStatus> metaProbeStatuses = this.probeStatusService.readAll(); // List<MetaProbeStatus> metaProbeStatuses = this.probeStatusService.readAll();
Assert.assertNotEquals(metaProbeStatuses.size(), 0); // Assert.assertNotEquals(metaProbeStatuses.size(), 0);
} // }
} // }

View File

@ -1,35 +1,35 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaProbeTaskType; // import com.loafle.overflow.central.module.meta.model.MetaProbeTaskType;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MetaProbeTaskTypeServiceTest { // public class MetaProbeTaskTypeServiceTest {
@Autowired // @Autowired
private MetaProbeTaskTypeService probeTaskTypeService; // private MetaProbeTaskTypeService probeTaskTypeService;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaProbeTaskType> probeTaskTypes = this.probeTaskTypeService.readAll(); // List<MetaProbeTaskType> probeTaskTypes = this.probeTaskTypeService.readAll();
Assert.assertNotEquals(probeTaskTypes.size(), 0 ); // Assert.assertNotEquals(probeTaskTypes.size(), 0 );
} // }
} // }

View File

@ -1,36 +1,36 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaProbeVersion; // import com.loafle.overflow.central.module.meta.model.MetaProbeVersion;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MetaProbeVersionServiceTest { // public class MetaProbeVersionServiceTest {
@Autowired // @Autowired
private MetaProbeVersionService probeVersionService; // private MetaProbeVersionService probeVersionService;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaProbeVersion> probeVersionList = this.probeVersionService.readAll(); // List<MetaProbeVersion> probeVersionList = this.probeVersionService.readAll();
Assert.assertNotEquals(probeVersionList.size(), 0); // Assert.assertNotEquals(probeVersionList.size(), 0);
} // }
} // }

View File

@ -1,39 +1,39 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaCrawler; // import com.loafle.overflow.central.module.meta.model.MetaCrawler;
import com.loafle.overflow.central.module.meta.model.MetaSensorDisplayItem; // import com.loafle.overflow.central.module.meta.model.MetaSensorDisplayItem;
import com.loafle.overflow.central.module.meta.model.MetaSensorItemUnit; // import com.loafle.overflow.central.module.meta.model.MetaSensorItemUnit;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date; // import java.util.Date;
/** // /**
* Created by insanity on 17. 11. 7. // * Created by insanity on 17. 11. 7.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorDisplayItemServiceTest { // public class MetaSensorDisplayItemServiceTest {
@Autowired // @Autowired
MetaSensorDisplayItemService service; // MetaSensorDisplayItemService service;
@Test // @Test
@Ignore // @Ignore
public void regist() throws Exception { // public void regist() throws Exception {
MetaSensorDisplayItem cpuTotal = new MetaSensorDisplayItem(); // MetaSensorDisplayItem cpuTotal = new MetaSensorDisplayItem();
cpuTotal.setId(120); // cpuTotal.setId(120);
cpuTotal.setCrawler(new MetaCrawler((short)21)); // cpuTotal.setCrawler(new MetaCrawler((short)21));
cpuTotal.setCreateDate(new Date()); // cpuTotal.setCreateDate(new Date());
cpuTotal.setKey("CPU_TOTAL"); // cpuTotal.setKey("CPU_TOTAL");
cpuTotal.setDisplayName("CPU Total Usage (%)"); // cpuTotal.setDisplayName("CPU Total Usage (%)");
cpuTotal.setDescription(""); // cpuTotal.setDescription("");
cpuTotal.setUnit(new MetaSensorItemUnit((short)1)); // cpuTotal.setUnit(new MetaSensorItemUnit((short)1));
service.regist(cpuTotal); // service.regist(cpuTotal);
} // }
} // }

View File

@ -1,32 +1,32 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaSensorDisplayItem; // import com.loafle.overflow.central.module.meta.model.MetaSensorDisplayItem;
import com.loafle.overflow.central.module.meta.model.MetaSensorItemKey; // import com.loafle.overflow.central.module.meta.model.MetaSensorItemKey;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
/** // /**
* Created by insanity on 17. 11. 7. // * Created by insanity on 17. 11. 7.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorDisplayMappingServiceTest { // public class MetaSensorDisplayMappingServiceTest {
@Autowired // @Autowired
MetaSensorDisplayMappingService service; // MetaSensorDisplayMappingService service;
@Test // @Test
public void read() { // public void read() {
List<MetaSensorItemKey> list = this.service.findAllByDisplayItem(new MetaSensorDisplayItem(1)); // List<MetaSensorItemKey> list = this.service.findAllByDisplayItem(new MetaSensorDisplayItem(1));
Assert.assertNotNull(list); // Assert.assertNotNull(list);
} // }
} // }

View File

@ -1,37 +1,37 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaCrawler; // import com.loafle.overflow.central.module.meta.model.MetaCrawler;
import com.loafle.overflow.central.module.meta.model.MetaSensorItemKey; // import com.loafle.overflow.central.module.meta.model.MetaSensorItemKey;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Map; // import java.util.Map;
/** // /**
* Created by snoop on 17. 8. 29. // * Created by snoop on 17. 8. 29.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorItemKeyServiceTest { // public class MetaSensorItemKeyServiceTest {
@Autowired // @Autowired
private MetaSensorItemKeyService metaSensorItemKeyService; // private MetaSensorItemKeyService metaSensorItemKeyService;
@Test // @Test
public void readAllByCrawler() { // public void readAllByCrawler() {
MetaCrawler metaCrawler = new MetaCrawler(); // MetaCrawler metaCrawler = new MetaCrawler();
metaCrawler.setId((short)11); // metaCrawler.setId((short)11);
Map<Integer, MetaSensorItemKey> resultMap = this.metaSensorItemKeyService.readAllMapByCrawler(metaCrawler); // Map<Integer, MetaSensorItemKey> resultMap = this.metaSensorItemKeyService.readAllMapByCrawler(metaCrawler);
Assert.assertNotEquals(resultMap.size(), 0); // Assert.assertNotEquals(resultMap.size(), 0);
} // }
} // }

View File

@ -1,34 +1,34 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaSensorItem; // import com.loafle.overflow.central.module.meta.model.MetaSensorItem;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorItemServiceTest { // public class MetaSensorItemServiceTest {
@Autowired // @Autowired
private MetaSensorItemService metaSensorItemService; // private MetaSensorItemService metaSensorItemService;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaSensorItem> metaSensorItems = this.metaSensorItemService.readAll(); // List<MetaSensorItem> metaSensorItems = this.metaSensorItemService.readAll();
Assert.assertNotEquals(metaSensorItems.size(), 0); // Assert.assertNotEquals(metaSensorItems.size(), 0);
} // }
} // }

View File

@ -1,33 +1,33 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaSensorItemType; // import com.loafle.overflow.central.module.meta.model.MetaSensorItemType;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorItemTypeServiceTest { // public class MetaSensorItemTypeServiceTest {
@Autowired // @Autowired
private MetaSensorItemTypeService sensorItemTypeService; // private MetaSensorItemTypeService sensorItemTypeService;
@Test // @Test
@Ignore // @Ignore
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaSensorItemType> metaSensorItemTypes = this.sensorItemTypeService.readAll(); // List<MetaSensorItemType> metaSensorItemTypes = this.sensorItemTypeService.readAll();
Assert.assertNotEquals(metaSensorItemTypes.size(), 0); // Assert.assertNotEquals(metaSensorItemTypes.size(), 0);
} // }
} // }

View File

@ -1,88 +1,88 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaSensorItemUnit; // import com.loafle.overflow.central.module.meta.model.MetaSensorItemUnit;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorItemUnitServiceTest { // public class MetaSensorItemUnitServiceTest {
@Autowired // @Autowired
private MetaSensorItemUnitService service; // private MetaSensorItemUnitService service;
@Test // @Test
@Ignore // @Ignore
public void regist() throws Exception { // public void regist() throws Exception {
MetaSensorItemUnit defaultValue = new MetaSensorItemUnit(); // MetaSensorItemUnit defaultValue = new MetaSensorItemUnit();
defaultValue.setId((short)0); // defaultValue.setId((short)0);
defaultValue.setUnit(""); // defaultValue.setUnit("");
defaultValue.setMark(""); // defaultValue.setMark("");
this.service.regist(defaultValue); // this.service.regist(defaultValue);
MetaSensorItemUnit unit1 = new MetaSensorItemUnit(); // MetaSensorItemUnit unit1 = new MetaSensorItemUnit();
unit1.setId((short)1); // unit1.setId((short)1);
unit1.setUnit("Percentage"); // unit1.setUnit("Percentage");
unit1.setMark("%"); // unit1.setMark("%");
this.service.regist(unit1); // this.service.regist(unit1);
MetaSensorItemUnit unit2 = new MetaSensorItemUnit(); // MetaSensorItemUnit unit2 = new MetaSensorItemUnit();
unit2.setId((short)2); // unit2.setId((short)2);
unit2.setUnit("Byte"); // unit2.setUnit("Byte");
unit2.setMark("Bytes"); // unit2.setMark("Bytes");
this.service.regist(unit2); // this.service.regist(unit2);
MetaSensorItemUnit unit3 = new MetaSensorItemUnit(); // MetaSensorItemUnit unit3 = new MetaSensorItemUnit();
unit3.setId((short)3); // unit3.setId((short)3);
unit3.setUnit("KByte"); // unit3.setUnit("KByte");
unit3.setMark("KB"); // unit3.setMark("KB");
this.service.regist(unit3); // this.service.regist(unit3);
MetaSensorItemUnit unit4 = new MetaSensorItemUnit(); // MetaSensorItemUnit unit4 = new MetaSensorItemUnit();
unit4.setId((short)4); // unit4.setId((short)4);
unit4.setUnit("MByte"); // unit4.setUnit("MByte");
unit4.setMark("MB"); // unit4.setMark("MB");
this.service.regist(unit4); // this.service.regist(unit4);
MetaSensorItemUnit unit5 = new MetaSensorItemUnit(); // MetaSensorItemUnit unit5 = new MetaSensorItemUnit();
unit5.setId((short)5); // unit5.setId((short)5);
unit5.setUnit("GByte"); // unit5.setUnit("GByte");
unit5.setMark("GB"); // unit5.setMark("GB");
this.service.regist(unit5); // this.service.regist(unit5);
MetaSensorItemUnit unit6 = new MetaSensorItemUnit(); // MetaSensorItemUnit unit6 = new MetaSensorItemUnit();
unit6.setId((short)6); // unit6.setId((short)6);
unit6.setUnit("Count"); // unit6.setUnit("Count");
unit6.setMark(""); // unit6.setMark("");
this.service.regist(unit6); // this.service.regist(unit6);
MetaSensorItemUnit unit7 = new MetaSensorItemUnit(); // MetaSensorItemUnit unit7 = new MetaSensorItemUnit();
unit7.setId((short)7); // unit7.setId((short)7);
unit7.setUnit("Jiffy"); // unit7.setUnit("Jiffy");
unit7.setMark("Jiffies"); // unit7.setMark("Jiffies");
this.service.regist(unit7); // this.service.regist(unit7);
MetaSensorItemUnit unit8 = new MetaSensorItemUnit(); // MetaSensorItemUnit unit8 = new MetaSensorItemUnit();
unit8.setId((short)8); // unit8.setId((short)8);
unit8.setUnit("Byte Per Second"); // unit8.setUnit("Byte Per Second");
unit8.setMark("BPS"); // unit8.setMark("BPS");
this.service.regist(unit8); // this.service.regist(unit8);
MetaSensorItemUnit unit9 = new MetaSensorItemUnit(); // MetaSensorItemUnit unit9 = new MetaSensorItemUnit();
unit9.setId((short)9); // unit9.setId((short)9);
unit9.setUnit("Packet Per Second"); // unit9.setUnit("Packet Per Second");
unit9.setMark("PPS"); // unit9.setMark("PPS");
this.service.regist(unit9); // this.service.regist(unit9);
} // }
} // }

View File

@ -1,35 +1,35 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaSensorStatus; // import com.loafle.overflow.central.module.meta.model.MetaSensorStatus;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorStatusServiceTest { // public class MetaSensorStatusServiceTest {
@Autowired // @Autowired
private MetaSensorStatusService sensorStatusService; // private MetaSensorStatusService sensorStatusService;
@Test // @Test
public void readAll() throws Exception { // public void readAll() throws Exception {
List<MetaSensorStatus> sensorStatuses = this.sensorStatusService.readAll(); // List<MetaSensorStatus> sensorStatuses = this.sensorStatusService.readAll();
Assert.assertNotEquals(sensorStatuses.size(), 0); // Assert.assertNotEquals(sensorStatuses.size(), 0);
} // }
} // }

View File

@ -1,60 +1,60 @@
package com.loafle.overflow.central.module.meta.service; // package com.loafle.overflow.central.module.meta.service;
import com.loafle.overflow.central.module.meta.model.MetaCrawler; // import com.loafle.overflow.central.module.meta.model.MetaCrawler;
import com.loafle.overflow.central.module.meta.model.MetaInfraVendor; // import com.loafle.overflow.central.module.meta.model.MetaInfraVendor;
import com.loafle.overflow.central.module.meta.model.MetaVendorCrawler; // import com.loafle.overflow.central.module.meta.model.MetaVendorCrawler;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
/** // /**
* Created by snoop on 17. 7. 27. // * Created by snoop on 17. 7. 27.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class MetaVendorCrawlerServiceTest { // public class MetaVendorCrawlerServiceTest {
@Autowired // @Autowired
private MetaVendorCrawlerService service; // private MetaVendorCrawlerService service;
@Test // @Test
public void readAllByInfraVendor() throws Exception { // public void readAllByInfraVendor() throws Exception {
MetaInfraVendor metaInfraVendor = new MetaInfraVendor(); // MetaInfraVendor metaInfraVendor = new MetaInfraVendor();
metaInfraVendor.setId(26); // metaInfraVendor.setId(26);
List<MetaVendorCrawler> metaVendorCrawlers = this.service.readAllByInfraVendor(metaInfraVendor); // List<MetaVendorCrawler> metaVendorCrawlers = this.service.readAllByInfraVendor(metaInfraVendor);
Assert.assertNotEquals(metaVendorCrawlers.size(), 0); // Assert.assertNotEquals(metaVendorCrawlers.size(), 0);
} // }
@Ignore // @Ignore
@Test // @Test
public void regist() throws Exception { // public void regist() throws Exception {
MetaVendorCrawler metaVendorCrawler = new MetaVendorCrawler(); // MetaVendorCrawler metaVendorCrawler = new MetaVendorCrawler();
MetaCrawler metaCrawler = new MetaCrawler(); // MetaCrawler metaCrawler = new MetaCrawler();
metaCrawler.setId((short)23); // metaCrawler.setId((short)23);
MetaInfraVendor metaInfraVendor = new MetaInfraVendor(); // MetaInfraVendor metaInfraVendor = new MetaInfraVendor();
metaInfraVendor.setId(42); // metaInfraVendor.setId(42);
metaVendorCrawler.setCrawler(metaCrawler); // metaVendorCrawler.setCrawler(metaCrawler);
metaVendorCrawler.setInfraVendor(metaInfraVendor); // metaVendorCrawler.setInfraVendor(metaInfraVendor);
metaVendorCrawler.setId(1); // metaVendorCrawler.setId(1);
this.service.regist(metaVendorCrawler); // this.service.regist(metaVendorCrawler);
Assert.assertNotEquals(metaVendorCrawler.getId(), 0); // Assert.assertNotEquals(metaVendorCrawler.getId(), 0);
} // }
} // }

View File

@ -1,159 +1,159 @@
package com.loafle.overflow.central.module.noauthprobe.service; // package com.loafle.overflow.central.module.noauthprobe.service;
import com.loafle.overflow.central.commons.service.MessagePublisher; // import com.loafle.overflow.central.commons.service.MessagePublisher;
import com.loafle.overflow.central.module.domain.model.Domain; // import com.loafle.overflow.central.module.domain.model.Domain;
import com.loafle.overflow.central.module.meta.model.MetaNoAuthProbeStatus; // import com.loafle.overflow.central.module.meta.model.MetaNoAuthProbeStatus;
import com.loafle.overflow.central.module.noauthprobe.model.NoAuthProbe; // import com.loafle.overflow.central.module.noauthprobe.model.NoAuthProbe;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.IOException; // import java.io.IOException;
import java.util.ArrayList; // import java.util.ArrayList;
import java.util.List; // import java.util.List;
/** // /**
* Created by snoop on 17. 6. 28. // * Created by snoop on 17. 6. 28.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class NoAuthProbeServiceTest { // public class NoAuthProbeServiceTest {
@Autowired // @Autowired
private NoAuthProbeService noAuthProbeService; // private NoAuthProbeService noAuthProbeService;
@Autowired // @Autowired
private MessagePublisher messagePublisher; // private MessagePublisher messagePublisher;
@Ignore // @Ignore
@Test // @Test
public void regist() throws Exception { // public void regist() throws Exception {
NoAuthProbe noAuthProbe = new NoAuthProbe(); // NoAuthProbe noAuthProbe = new NoAuthProbe();
// noAuthProbe.setHostName("snoop"); // // noAuthProbe.setHostName("snoop");
// noAuthProbe.setIpAddress(3232235980L); // // noAuthProbe.setIpAddress(3232235980L);
// noAuthProbe.setMacAddress(8796753988883L); // // noAuthProbe.setMacAddress(8796753988883L);
noAuthProbe.setDescription("{\"host\":{\"name\":\"snoop-ubuntu\",\"os\":\"linux\",\"paltform\":\"ubuntu\",\"platformFamily\":\"debian\",\"platformVersion\":\"\",\"kernelVersion\":\"4.4.0-93-generic\",\"hostID\":\"DE60E4C3-347A-4D38-AEAB-1760471665EA\"},\"network\":{\"name\":\"enp3s0\",\"address\":\"192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64\",\"gateway\":\"192.168.1.254\",\"macAddress\":\"44:8a:5b:f1:f1:f3\"}}"); // noAuthProbe.setDescription("{\"host\":{\"name\":\"snoop-ubuntu\",\"os\":\"linux\",\"paltform\":\"ubuntu\",\"platformFamily\":\"debian\",\"platformVersion\":\"\",\"kernelVersion\":\"4.4.0-93-generic\",\"hostID\":\"DE60E4C3-347A-4D38-AEAB-1760471665EA\"},\"network\":{\"name\":\"enp3s0\",\"address\":\"192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64\",\"gateway\":\"192.168.1.254\",\"macAddress\":\"44:8a:5b:f1:f1:f3\"}}");
noAuthProbe.setApiKey("52abd6fd57e511e7ac52080027658d13"); // noAuthProbe.setApiKey("52abd6fd57e511e7ac52080027658d13");
MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus(); // MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus();
metaNoAuthProbeStatus.setId((short)3); // metaNoAuthProbeStatus.setId((short)3);
noAuthProbe.setStatus(metaNoAuthProbeStatus); // noAuthProbe.setStatus(metaNoAuthProbeStatus);
noAuthProbe.setTempProbeKey("ac7f252b5bc811e784ad080027658d13"); // noAuthProbe.setTempProbeKey("ac7f252b5bc811e784ad080027658d13");
Domain d = new Domain(); // Domain d = new Domain();
d.setId(1); // d.setId(1);
noAuthProbe.setDomain(d); // noAuthProbe.setDomain(d);
this.noAuthProbeService.regist(noAuthProbe); // this.noAuthProbeService.regist(noAuthProbe);
Assert.assertNotEquals(noAuthProbe.getId(), 0); // Assert.assertNotEquals(noAuthProbe.getId(), 0);
} // }
@Ignore // @Ignore
@Test // @Test
public void registForNoAuthProbes() throws Exception { // public void registForNoAuthProbes() throws Exception {
NoAuthProbe noAuthProbe = new NoAuthProbe(); // NoAuthProbe noAuthProbe = new NoAuthProbe();
// noAuthProbe.setHostName("geek"); // // noAuthProbe.setHostName("geek");
// noAuthProbe.setIpAddress(3232235980L); // // noAuthProbe.setIpAddress(3232235980L);
// noAuthProbe.setMacAddress(8796753988883L); // // noAuthProbe.setMacAddress(8796753988883L);
noAuthProbe.setDescription("{\"host\":{\"name\":\"geek-ubuntu\",\"os\":\"linux\",\"paltform\":\"ubuntu\",\"platformFamily\":\"debian\",\"platformVersion\":\"\",\"kernelVersion\":\"4.4.0-93-generic\",\"hostID\":\"03000200-0400-0500-0006-000700080009\"},\"network\":{\"name\":\"enp3s0\",\"address\":\"192.168.1.103/24|fe80::36c0:6c3e:6006:dd23/64\",\"gateway\":\"192.168.1.254\",\"macAddress\":\"44:8a:5b:f1:f1:f3\"}}"); // noAuthProbe.setDescription("{\"host\":{\"name\":\"geek-ubuntu\",\"os\":\"linux\",\"paltform\":\"ubuntu\",\"platformFamily\":\"debian\",\"platformVersion\":\"\",\"kernelVersion\":\"4.4.0-93-generic\",\"hostID\":\"03000200-0400-0500-0006-000700080009\"},\"network\":{\"name\":\"enp3s0\",\"address\":\"192.168.1.103/24|fe80::36c0:6c3e:6006:dd23/64\",\"gateway\":\"192.168.1.254\",\"macAddress\":\"44:8a:5b:f1:f1:f3\"}}");
noAuthProbe.setApiKey("521abd6fd57e511e7ac52080027658d13"); // noAuthProbe.setApiKey("521abd6fd57e511e7ac52080027658d13");
MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus(); // MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus();
metaNoAuthProbeStatus.setId((short)3); // metaNoAuthProbeStatus.setId((short)3);
noAuthProbe.setStatus(metaNoAuthProbeStatus); // noAuthProbe.setStatus(metaNoAuthProbeStatus);
noAuthProbe.setTempProbeKey("a1c7f252b5bc811e784ad080027658d13"); // noAuthProbe.setTempProbeKey("a1c7f252b5bc811e784ad080027658d13");
Domain d = new Domain(); // Domain d = new Domain();
d.setId(1); // d.setId(1);
noAuthProbe.setDomain(d); // noAuthProbe.setDomain(d);
List<NoAuthProbe> noAuthProbes = new ArrayList<NoAuthProbe>(); // List<NoAuthProbe> noAuthProbes = new ArrayList<NoAuthProbe>();
noAuthProbes.add(noAuthProbe); // noAuthProbes.add(noAuthProbe);
// List<NoAuthProbe> dd = this.noAuthProbeService.registForNoAuthProbes(noAuthProbes); // // List<NoAuthProbe> dd = this.noAuthProbeService.registForNoAuthProbes(noAuthProbes);
// System.out.println(dd.get(0).getId()); // // System.out.println(dd.get(0).getId());
Assert.assertNotEquals(noAuthProbes.size(), 2); // Assert.assertNotEquals(noAuthProbes.size(), 2);
} // }
@Ignore // @Ignore
@Test // @Test
public void readAllByDomain() throws Exception { // public void readAllByDomain() throws Exception {
Domain domain = new Domain(); // Domain domain = new Domain();
domain.setId(1); // domain.setId(1);
List<NoAuthProbe> probes = this.noAuthProbeService.readAllByDomain(domain); // List<NoAuthProbe> probes = this.noAuthProbeService.readAllByDomain(domain);
Assert.assertNotEquals(probes.size(), 0); // Assert.assertNotEquals(probes.size(), 0);
} // }
// @Ignore // // @Ignore
@Test // @Test
public void read() throws Exception { // public void read() throws Exception {
NoAuthProbe noAuthProbe = this.noAuthProbeService.read(1); // NoAuthProbe noAuthProbe = this.noAuthProbeService.read(1);
Assert.assertNotEquals(noAuthProbe, null); // Assert.assertNotEquals(noAuthProbe, null);
} // }
@Test // @Test
public void acceptProbe() throws IOException { // public void acceptProbe() throws IOException {
NoAuthProbe noAuthProbe = this.noAuthProbeService.read(1); // NoAuthProbe noAuthProbe = this.noAuthProbeService.read(1);
this.noAuthProbeService.acceptNoAuthProbe(noAuthProbe); // this.noAuthProbeService.acceptNoAuthProbe(noAuthProbe);
} // }
@Test // @Test
public void ssss() { // public void ssss() {
String ss = "192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64"; // String ss = "192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64";
String[] sss = ss.split("\\|"); // String[] sss = ss.split("\\|");
System.out.println(sss[0]); // System.out.println(sss[0]);
} // }
@Test // @Test
public void readByTempKey() { // public void readByTempKey() {
NoAuthProbe noAuthProbe = this.noAuthProbeService.readByTempKey("1cf2555c57d511e79714080027658d15"); // NoAuthProbe noAuthProbe = this.noAuthProbeService.readByTempKey("1cf2555c57d511e79714080027658d15");
Assert.assertNotEquals(noAuthProbe, null); // Assert.assertNotEquals(noAuthProbe, null);
} // }
@Test // @Test
public void sendWeb() { // public void sendWeb() {
Domain domain = new Domain(); // Domain domain = new Domain();
domain.setId(1); // domain.setId(1);
List<NoAuthProbe> probes = this.noAuthProbeService.readAllByDomain(domain); // List<NoAuthProbe> probes = this.noAuthProbeService.readAllByDomain(domain);
messagePublisher.publishToDomainMembers(domain.getId(), "NoAuthProbeService.regist", probes); // messagePublisher.publishToDomainMembers(domain.getId(), "NoAuthProbeService.regist", probes);
} // }
} // }

View File

@ -1,52 +1,52 @@
package com.loafle.overflow.central.module.notification.service; // package com.loafle.overflow.central.module.notification.service;
import com.loafle.overflow.central.module.member.model.Member; // import com.loafle.overflow.central.module.member.model.Member;
import com.loafle.overflow.central.module.notification.model.Notification; // import com.loafle.overflow.central.module.notification.model.Notification;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date; // import java.util.Date;
/** // /**
* Created by insanity on 17. 8. 25. // * Created by insanity on 17. 8. 25.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class NotificationServiceTest { // public class NotificationServiceTest {
@Autowired // @Autowired
private NotificationService notificationService; // private NotificationService notificationService;
@Test // @Test
public void testRegist() { // public void testRegist() {
for (int i=0; i<30; i++) { // for (int i=0; i<30; i++) {
Notification n = new Notification(); // Notification n = new Notification();
n.setMember(new Member(1)); // n.setMember(new Member(1));
n.setTitle("Title"+i); // n.setTitle("Title"+i);
n.setMessage("Message"+i); // n.setMessage("Message"+i);
if(i<20) { // if(i<20) {
n.setConfirmDate(new Date()); // n.setConfirmDate(new Date());
} // }
this.notificationService.regist(n); // this.notificationService.regist(n);
} // }
} // }
// @Test // // @Test
// @Ignore // // @Ignore
// public void testReadAll() { // // public void testReadAll() {
// this.testRegist(); // // this.testRegist();
// Page<Notification> notis = this.notificationService.readAllByMember(new Member(1), 0, 10); // // Page<Notification> notis = this.notificationService.readAllByMember(new Member(1), 0, 10);
// Assert.assertEquals(30, notis.getTotalElements()); // // Assert.assertEquals(30, notis.getTotalElements());
// } // // }
// // //
// @Test // // @Test
// @Ignore // // @Ignore
// public void testReadAllUnread() { // // public void testReadAllUnread() {
// this.testRegist(); // // this.testRegist();
// Page<Notification> notis = this.notificationService.readAllUnconfirmedByMember(new Member(1), 0, 10); // // Page<Notification> notis = this.notificationService.readAllUnconfirmedByMember(new Member(1), 0, 10);
// Assert.assertEquals(15, notis.getTotalElements()); // // Assert.assertEquals(15, notis.getTotalElements());
// } // // }
} // }

View File

@ -1,57 +1,57 @@
package com.loafle.overflow.central.module.probe.service; // package com.loafle.overflow.central.module.probe.service;
import com.loafle.overflow.central.module.infra.model.InfraHost; // import com.loafle.overflow.central.module.infra.model.InfraHost;
import com.loafle.overflow.central.module.probe.model.Probe; // import com.loafle.overflow.central.module.probe.model.Probe;
import com.loafle.overflow.central.module.probe.model.ProbeHost; // import com.loafle.overflow.central.module.probe.model.ProbeHost;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.*; // import static org.junit.Assert.*;
/** // /**
* Created by snoop on 17. 8. 21. // * Created by snoop on 17. 8. 21.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class ProbeHostServiceTest { // public class ProbeHostServiceTest {
@Autowired // @Autowired
private ProbeHostService probeHostService; // private ProbeHostService probeHostService;
@Test // @Test
public void regist() { // public void regist() {
ProbeHost probeHost = new ProbeHost(); // ProbeHost probeHost = new ProbeHost();
Probe probe = new Probe(); // Probe probe = new Probe();
probe.setId(1); // probe.setId(1);
InfraHost infraHost = new InfraHost(); // InfraHost infraHost = new InfraHost();
infraHost.setId(3); // infraHost.setId(3);
probeHost.setProbe(probe); // probeHost.setProbe(probe);
probeHost.setHost(infraHost); // probeHost.setHost(infraHost);
this.probeHostService.regist(probeHost); // this.probeHostService.regist(probeHost);
Assert.assertNotEquals(probeHost.getId(), 0); // Assert.assertNotEquals(probeHost.getId(), 0);
} // }
@Test // @Test
public void readByProbe() throws Exception { // public void readByProbe() throws Exception {
Probe probe = new Probe(); // Probe probe = new Probe();
probe.setId(1); // probe.setId(1);
ProbeHost probeHost = this.probeHostService.readByProbe(probe); // ProbeHost probeHost = this.probeHostService.readByProbe(probe);
Assert.assertNotEquals(probeHost, null); // Assert.assertNotEquals(probeHost, null);
} // }
} // }

View File

@ -1,105 +1,105 @@
package com.loafle.overflow.central.module.probe.service; // package com.loafle.overflow.central.module.probe.service;
import com.loafle.overflow.central.module.domain.model.Domain; // import com.loafle.overflow.central.module.domain.model.Domain;
import com.loafle.overflow.central.module.member.model.Member; // import com.loafle.overflow.central.module.member.model.Member;
import com.loafle.overflow.central.module.meta.model.MetaProbeStatus; // import com.loafle.overflow.central.module.meta.model.MetaProbeStatus;
import com.loafle.overflow.central.module.probe.model.Probe; // import com.loafle.overflow.central.module.probe.model.Probe;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
import java.util.UUID; // import java.util.UUID;
/** // /**
* Created by snoop on 17. 6. 28. // * Created by snoop on 17. 6. 28.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class ProbeServiceTest { // public class ProbeServiceTest {
@Autowired // @Autowired
private ProbeService probeService; // private ProbeService probeService;
// @Ignore // // @Ignore
@Test // @Test
public void regist() throws Exception { // public void regist() throws Exception {
Probe probe = new Probe(); // Probe probe = new Probe();
probe.setDescription("snoop probe"); // probe.setDescription("snoop probe");
Domain domain = new Domain(); // Domain domain = new Domain();
domain.setId(1); // domain.setId(1);
probe.setDomain(domain); // probe.setDomain(domain);
probe.setEncryptionKey(getUUID()); // probe.setEncryptionKey(getUUID());
probe.setProbeKey(getUUID()); // probe.setProbeKey(getUUID());
MetaProbeStatus status = new MetaProbeStatus(); // MetaProbeStatus status = new MetaProbeStatus();
status.setId((short)1); // status.setId((short)1);
probe.setStatus(status); // probe.setStatus(status);
probe.setDisplayName("test probe 22222"); // probe.setDisplayName("test probe 22222");
probe.setCidr("192.168.1.0/24"); // probe.setCidr("192.168.1.0/24");
// probe.setAuthorizedDate(new Date()); // // probe.setAuthorizedDate(new Date());
Member member = new Member(); // Member member = new Member();
member.setId(1l); // member.setId(1l);
probe.setAuthorizeMember(member); // probe.setAuthorizeMember(member);
// InfraHost infraHost = new InfraHost(); // // InfraHost infraHost = new InfraHost();
// infraHost.setId(1); // // infraHost.setId(1);
// // //
// probe.setHost(infraHost); // // probe.setHost(infraHost);
this.probeService.regist(probe); // this.probeService.regist(probe);
Assert.assertNotEquals(probe.getId(), 0); // Assert.assertNotEquals(probe.getId(), 0);
} // }
public String getUUID() { // public String getUUID() {
return UUID.randomUUID().toString().replaceAll("-", ""); // return UUID.randomUUID().toString().replaceAll("-", "");
} // }
@Test // @Test
public void tttt() { // public void tttt() {
String uuid = UUID.randomUUID().toString(); // String uuid = UUID.randomUUID().toString();
String uuid2 = uuid.replaceAll("-", ""); // String uuid2 = uuid.replaceAll("-", "");
System.out.println(uuid2); // System.out.println(uuid2);
} // }
@Test // @Test
public void readAllByDomain() throws Exception { // public void readAllByDomain() throws Exception {
Domain domain = new Domain(); // Domain domain = new Domain();
domain.setId(1); // domain.setId(1);
List<Probe> probes = this.probeService.readAllByDomain(domain); // List<Probe> probes = this.probeService.readAllByDomain(domain);
Assert.assertEquals(probes.size(), 1); // Assert.assertEquals(probes.size(), 1);
} // }
@Ignore // @Ignore
@Test // @Test
public void readByProbeKey() throws Exception { // public void readByProbeKey() throws Exception {
regist(); // regist();
Probe probe = this.probeService.readByProbeKey("899fdd145bcc11e7b611080027658d13"); // Probe probe = this.probeService.readByProbeKey("899fdd145bcc11e7b611080027658d13");
Assert.assertNotEquals(probe, null); // Assert.assertNotEquals(probe, null);
} // }
} // }

View File

@ -1,63 +1,63 @@
package com.loafle.overflow.central.module.probe.service; // package com.loafle.overflow.central.module.probe.service;
import com.loafle.overflow.central.module.meta.model.MetaProbeTaskType; // import com.loafle.overflow.central.module.meta.model.MetaProbeTaskType;
import com.loafle.overflow.central.module.probe.model.Probe; // import com.loafle.overflow.central.module.probe.model.Probe;
import com.loafle.overflow.central.module.probe.model.ProbeTask; // import com.loafle.overflow.central.module.probe.model.ProbeTask;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
/** // /**
* Created by snoop on 17. 6. 28. // * Created by snoop on 17. 6. 28.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class ProbeTaskServiceTest { // public class ProbeTaskServiceTest {
@Autowired // @Autowired
private ProbeTaskService probeTaskService; // private ProbeTaskService probeTaskService;
@Ignore // @Ignore
@Test // @Test
public void regist() throws Exception { // public void regist() throws Exception {
ProbeTask probeTask = new ProbeTask(); // ProbeTask probeTask = new ProbeTask();
MetaProbeTaskType typeDiscovery = new MetaProbeTaskType(); // MetaProbeTaskType typeDiscovery = new MetaProbeTaskType();
typeDiscovery.setId((short)1); // typeDiscovery.setId((short)1);
probeTask.setTaskType(typeDiscovery); // probeTask.setTaskType(typeDiscovery);
probeTask.setData(""); // probeTask.setData("");
Probe probe = new Probe(); // Probe probe = new Probe();
probe.setId(1); // probe.setId(1);
probeTask.setProbe(probe); // probeTask.setProbe(probe);
this.probeTaskService.regist(probeTask); // this.probeTaskService.regist(probeTask);
Assert.assertNotEquals(probeTask.getId(), 0); // Assert.assertNotEquals(probeTask.getId(), 0);
} // }
@Ignore // @Ignore
@Test // @Test
public void readAllByProbe() throws Exception { // public void readAllByProbe() throws Exception {
regist(); // regist();
Probe probe = new Probe(); // Probe probe = new Probe();
probe.setId(1); // probe.setId(1);
List<ProbeTask> probeTasks = this.probeTaskService.readAllByProbe(probe); // List<ProbeTask> probeTasks = this.probeTaskService.readAllByProbe(probe);
Assert.assertNotEquals(probeTasks.size(), 0 ); // Assert.assertNotEquals(probeTasks.size(), 0 );
} // }
} // }

View File

@ -1,59 +1,59 @@
package com.loafle.overflow.central.module.sensor.service; // package com.loafle.overflow.central.module.sensor.service;
import com.loafle.overflow.central.module.meta.model.MetaSensorDisplayItem; // import com.loafle.overflow.central.module.meta.model.MetaSensorDisplayItem;
import com.loafle.overflow.central.module.sensor.model.Sensor; // import com.loafle.overflow.central.module.sensor.model.Sensor;
import com.loafle.overflow.central.module.sensor.model.SensorItem; // import com.loafle.overflow.central.module.sensor.model.SensorItem;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date; // import java.util.Date;
/** // /**
* Created by insanity on 17. 6. 28. // * Created by insanity on 17. 6. 28.
*/ // */
@Ignore // @Ignore
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class SensorItemServiceTest { // public class SensorItemServiceTest {
@Autowired // @Autowired
SensorItemService sensorItemService; // SensorItemService sensorItemService;
@Ignore // @Ignore
@Test // @Test
public void regist() throws Exception { // public void regist() throws Exception {
SensorItem sensorItem = new SensorItem(); // SensorItem sensorItem = new SensorItem();
sensorItem.setCreateDate(new Date()); // sensorItem.setCreateDate(new Date());
MetaSensorDisplayItem item = new MetaSensorDisplayItem(); // MetaSensorDisplayItem item = new MetaSensorDisplayItem();
item.setId(1); // item.setId(1);
Sensor sensor = new Sensor(); // Sensor sensor = new Sensor();
sensor.setId(1); // sensor.setId(1);
sensorItem.setItem(item); // sensorItem.setItem(item);
sensorItem.setSensor(sensor); // sensorItem.setSensor(sensor);
SensorItem res = this.sensorItemService.regist(sensorItem); // SensorItem res = this.sensorItemService.regist(sensorItem);
Assert.assertNotNull(res); // Assert.assertNotNull(res);
} // }
@Test // @Test
public void read() throws Exception { // public void read() throws Exception {
SensorItem res = this.sensorItemService.read("1"); // SensorItem res = this.sensorItemService.read("1");
Assert.assertNotNull(res); // Assert.assertNotNull(res);
} // }
// @Test // // @Test
// public void readAllBySensor() throws IOException { // // public void readAllBySensor() throws IOException {
// Sensor sensor = new Sensor(); // // Sensor sensor = new Sensor();
// sensor.setId(1); // // sensor.setId(1);
// List<SensorItem> sensorItems = this.sensorItemService.readAllBySensor(sensor); // // List<SensorItem> sensorItems = this.sensorItemService.readAllBySensor(sensor);
// // //
// ObjectMapper objectMapper = new ObjectMapper(); // // ObjectMapper objectMapper = new ObjectMapper();
// String json = objectMapper.writeValueAsString(sensorItems); // // String json = objectMapper.writeValueAsString(sensorItems);
// System.out.println(json); // // System.out.println(json);
// } // // }
} // }

View File

@ -1,142 +1,142 @@
package com.loafle.overflow.central.module.sensor.service; // package com.loafle.overflow.central.module.sensor.service;
import com.loafle.overflow.central.module.meta.model.MetaCrawler; // import com.loafle.overflow.central.module.meta.model.MetaCrawler;
import com.loafle.overflow.central.module.meta.model.MetaSensorStatus; // import com.loafle.overflow.central.module.meta.model.MetaSensorStatus;
import com.loafle.overflow.central.module.sensor.model.Sensor; // import com.loafle.overflow.central.module.sensor.model.Sensor;
import com.loafle.overflow.central.module.target.model.Target; // import com.loafle.overflow.central.module.target.model.Target;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.codehaus.jackson.map.ObjectMapper; // import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.IOException; // import java.io.IOException;
import java.util.Date; // import java.util.Date;
import java.util.HashMap; // import java.util.HashMap;
import java.util.Map; // import java.util.Map;
/** // /**
* Created by insanity on 17. 6. 28. // * Created by insanity on 17. 6. 28.
*/ // */
//@Ignore // //@Ignore
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class SensorServiceTest { // public class SensorServiceTest {
@Autowired // @Autowired
SensorService sensorService; // SensorService sensorService;
@Autowired // @Autowired
ObjectMapper objectMapper; // ObjectMapper objectMapper;
@Ignore // @Ignore
@Test // @Test
public void regist() throws Exception { // public void regist() throws Exception {
Sensor sensor = new Sensor(); // Sensor sensor = new Sensor();
MetaSensorStatus status = new MetaSensorStatus((short)1); // MetaSensorStatus status = new MetaSensorStatus((short)1);
sensor.setStatus(status); // sensor.setStatus(status);
MetaCrawler crawler = new MetaCrawler(); // MetaCrawler crawler = new MetaCrawler();
crawler.setId((short)1); // crawler.setId((short)1);
sensor.setCrawler(crawler); // sensor.setCrawler(crawler);
Target target = new Target(); // Target target = new Target();
target.setId(1); // target.setId(1);
sensor.setTarget(target); // sensor.setTarget(target);
sensor.setCreateDate(new Date()); // sensor.setCreateDate(new Date());
Sensor res = this.sensorService.regist(sensor); // Sensor res = this.sensorService.regist(sensor);
Assert.assertNotNull(res); // Assert.assertNotNull(res);
} // }
@Test // @Test
public void read() throws Exception { // public void read() throws Exception {
Sensor res = this.sensorService.read("1"); // Sensor res = this.sensorService.read("1");
Assert.assertNotNull(res); // Assert.assertNotNull(res);
ObjectMapper objectMapper = new ObjectMapper(); // ObjectMapper objectMapper = new ObjectMapper();
// String json = objectMapper.writeValueAsString(res); // // String json = objectMapper.writeValueAsString(res);
String json = this.objectMapper.writeValueAsString(res); // String json = this.objectMapper.writeValueAsString(res);
System.out.println(json); // System.out.println(json);
} // }
@Test // @Test
public void generateSensorConfig() throws IOException { // public void generateSensorConfig() throws IOException {
Sensor sensor = new Sensor(); // Sensor sensor = new Sensor();
sensor.setId(5); // sensor.setId(5);
String result = this.sensorService.generateSensorConfig(sensor); // String result = this.sensorService.generateSensorConfig(sensor);
System.out.println(result); // System.out.println(result);
} // }
@Test // @Test
public void testJsonToMap() throws IOException { // public void testJsonToMap() throws IOException {
String json = "{\"interval\":5}"; // String json = "{\"interval\":5}";
ObjectMapper objectMapper = new ObjectMapper(); // ObjectMapper objectMapper = new ObjectMapper();
Map<String, Object> mm = new HashMap<>(); // Map<String, Object> mm = new HashMap<>();
mm = objectMapper.readValue(json, HashMap.class); // mm = objectMapper.readValue(json, HashMap.class);
System.out.println(mm.get("interval")); // System.out.println(mm.get("interval"));
} // }
@Test // @Test
public void stringbbb() { // public void stringbbb() {
StringBuffer stringBuffer = new StringBuffer(); // StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("222222222222222222222222222"); // stringBuffer.append("222222222222222222222222222");
System.out.println(stringBuffer.toString()); // System.out.println(stringBuffer.toString());
stringBuffer.setLength(0); // stringBuffer.setLength(0);
System.out.println(stringBuffer.toString()); // System.out.println(stringBuffer.toString());
stringBuffer.append("3333333333"); // stringBuffer.append("3333333333");
System.out.println(stringBuffer.toString()); // System.out.println(stringBuffer.toString());
} // }
// @Test // // @Test
// public void readAllByTarget() throws Exception { // // public void readAllByTarget() throws Exception {
// Target target = new Target(); // // Target target = new Target();
// target.setId(1); // // target.setId(1);
// List<Sensor> sensors = this.sensorService.readAllByTarget(target); // // List<Sensor> sensors = this.sensorService.readAllByTarget(target);
// // //
// ObjectMapper objectMapper = new ObjectMapper(); // // ObjectMapper objectMapper = new ObjectMapper();
// // //
// String json = objectMapper.writeValueAsString(sensors); // // String json = objectMapper.writeValueAsString(sensors);
// // //
// System.out.println(json); // // System.out.println(json);
// } // // }
// @Test // // @Test
// public void readAllByTargetList() { // // public void readAllByTargetList() {
// // //
// Domain domain = new Domain(); // // Domain domain = new Domain();
// domain.setId(1); // // domain.setId(1);
// // //
// List<Sensor> sl = this.sensorService.readAllByDomain(domain); // // List<Sensor> sl = this.sensorService.readAllByDomain(domain);
// // //
// Assert.assertNotEquals(sl.size(), 0); // // Assert.assertNotEquals(sl.size(), 0);
// // //
// } // // }
// @Test // // @Test
// public void readAllByInfra() { // // public void readAllByInfra() {
// // //
// Infra infra = new InfraMachine(); // // Infra infra = new InfraMachine();
// infra.setId(1); // // infra.setId(1);
// // //
// List<Sensor> sl = this.sensorService.readAllByInfra(1); // // List<Sensor> sl = this.sensorService.readAllByInfra(1);
// // //
// Assert.assertNotEquals(sl.size(), 0); // // Assert.assertNotEquals(sl.size(), 0);
// // //
// } // // }
} // }

View File

@ -1,36 +1,36 @@
package com.loafle.overflow.central.module.target.dao; // package com.loafle.overflow.central.module.target.dao;
import com.loafle.overflow.central.module.domain.model.Domain; // import com.loafle.overflow.central.module.domain.model.Domain;
import com.loafle.overflow.central.module.infra.model.Infra; // import com.loafle.overflow.central.module.infra.model.Infra;
import com.loafle.overflow.central.module.infra.service.InfraService; // import com.loafle.overflow.central.module.infra.service.InfraService;
import com.loafle.overflow.central.module.probe.model.Probe; // import com.loafle.overflow.central.module.probe.model.Probe;
import com.loafle.overflow.central.module.probe.service.ProbeService; // import com.loafle.overflow.central.module.probe.service.ProbeService;
import com.loafle.overflow.central.module.target.model.Target; // import com.loafle.overflow.central.module.target.model.Target;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; // import java.util.List;
/** // /**
* Created by insanity on 17. 6. 28. // * Created by insanity on 17. 6. 28.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class TargetDAOTest { // public class TargetDAOTest {
@Autowired // @Autowired
private TargetDAO targetDAO; // private TargetDAO targetDAO;
@Autowired // @Autowired
private ProbeService probeService; // private ProbeService probeService;
@Autowired // @Autowired
private InfraService infraService; // private InfraService infraService;
} // }

View File

@ -1,134 +1,134 @@
package com.loafle.overflow.central.module.target.service; // package com.loafle.overflow.central.module.target.service;
import com.loafle.overflow.central.module.probe.model.Probe; // import com.loafle.overflow.central.module.probe.model.Probe;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.codehaus.jackson.map.DeserializationConfig; // import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper; // import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.aop.support.AopUtils; // import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ResourceLoader; // import org.springframework.core.io.ResourceLoader;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.BufferedReader; // import java.io.BufferedReader;
import java.io.FileReader; // import java.io.FileReader;
import java.io.IOException; // import java.io.IOException;
import java.lang.reflect.Method; // import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType; // import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type; // import java.lang.reflect.Type;
import java.util.List; // import java.util.List;
/** // /**
* Created by snoop on 17. 6. 28. // * Created by snoop on 17. 6. 28.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class TargetDiscoveryServiceTest { // public class TargetDiscoveryServiceTest {
@Autowired // @Autowired
private ResourceLoader resourceLoader; // private ResourceLoader resourceLoader;
@Autowired // @Autowired
private TargetDiscoveryService targetDiscoveryService; // private TargetDiscoveryService targetDiscoveryService;
@Ignore // @Ignore
@Test // @Test
public void saveAllTarget() throws Exception { // public void saveAllTarget() throws Exception {
String json = readFileAsString(resourceLoader.getResource("classpath:dh.json").getURI().getPath()); // String json = readFileAsString(resourceLoader.getResource("classpath:dh.json").getURI().getPath());
ObjectMapper mapper = new ObjectMapper(); // ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); // mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
List<Host> hosts = mapper.readValue(json, mapper.getTypeFactory().constructCollectionType(List.class, Host.class)); // List<Host> hosts = mapper.readValue(json, mapper.getTypeFactory().constructCollectionType(List.class, Host.class));
Probe probe = new Probe(); // Probe probe = new Probe();
probe.setId(1); // probe.setId(1);
// this.targetDiscoveryService.saveAllTarget(hosts, probe); // // this.targetDiscoveryService.saveAllTarget(hosts, probe);
} // }
private String readFileAsString(String filePath) throws IOException { // private String readFileAsString(String filePath) throws IOException {
StringBuffer fileData = new StringBuffer(); // StringBuffer fileData = new StringBuffer();
BufferedReader reader = new BufferedReader( // BufferedReader reader = new BufferedReader(
new FileReader(filePath)); // new FileReader(filePath));
char[] buf = new char[1024]; // char[] buf = new char[1024];
int numRead=0; // int numRead=0;
while((numRead=reader.read(buf)) != -1){ // while((numRead=reader.read(buf)) != -1){
String readData = String.valueOf(buf, 0, numRead); // String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData); // fileData.append(readData);
} // }
reader.close(); // reader.close();
return fileData.toString(); // return fileData.toString();
} // }
@Ignore // @Ignore
@Test // @Test
public void testParam() throws NoSuchMethodException { // public void testParam() throws NoSuchMethodException {
Method m = this.targetDiscoveryService.getClass().getMethod("saveAllTarget", List.class, Probe.class); // Method m = this.targetDiscoveryService.getClass().getMethod("saveAllTarget", List.class, Probe.class);
// Method m = TargetDiscoveryService.class.getMethod("saveAllTarget", List.class, Probe.class); // // Method m = TargetDiscoveryService.class.getMethod("saveAllTarget", List.class, Probe.class);
Class<?> clazz = AopUtils.getTargetClass(this.targetDiscoveryService); // Class<?> clazz = AopUtils.getTargetClass(this.targetDiscoveryService);
Method[] ms = clazz.getMethods(); // Method[] ms = clazz.getMethods();
Method sm = null; // Method sm = null;
for(Method mm : ms){ // for(Method mm : ms){
if ("saveAllTarget".equals(mm.getName())) { // if ("saveAllTarget".equals(mm.getName())) {
sm = mm; // sm = mm;
break; // break;
} // }
} // }
if (sm != null) { // if (sm != null) {
Type[] ts = sm.getGenericParameterTypes(); // Type[] ts = sm.getGenericParameterTypes();
for(Type t : ts){ // for(Type t : ts){
if (t instanceof ParameterizedType) { // if (t instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType)t; // ParameterizedType pt = (ParameterizedType)t;
System.out.println(pt.getActualTypeArguments()[0].getTypeName()); // System.out.println(pt.getActualTypeArguments()[0].getTypeName());
} // }
System.out.println(t.getTypeName()); // System.out.println(t.getTypeName());
} // }
} // }
System.out.println(m.getName()); // System.out.println(m.getName());
Type[] genericParameterTypes = m.getGenericParameterTypes(); // Type[] genericParameterTypes = m.getGenericParameterTypes();
for(Type genericParameterType : genericParameterTypes){ // for(Type genericParameterType : genericParameterTypes){
if(genericParameterType instanceof ParameterizedType){ // if(genericParameterType instanceof ParameterizedType){
ParameterizedType aType = (ParameterizedType) genericParameterType; // ParameterizedType aType = (ParameterizedType) genericParameterType;
Type[] parameterArgTypes = aType.getActualTypeArguments(); // Type[] parameterArgTypes = aType.getActualTypeArguments();
for(Type parameterArgType : parameterArgTypes){ // for(Type parameterArgType : parameterArgTypes){
Class parameterArgClass = (Class) parameterArgType; // Class parameterArgClass = (Class) parameterArgType;
System.out.println("parameterArgClass = " + parameterArgClass); // System.out.println("parameterArgClass = " + parameterArgClass);
} // }
} // }
} // }
} // }
@Ignore // @Ignore
@Test // @Test
public void testName() throws ClassNotFoundException { // public void testName() throws ClassNotFoundException {
Object o = this.targetDiscoveryService; // Object o = this.targetDiscoveryService;
String nnn = o.getClass().getSimpleName(); // String nnn = o.getClass().getSimpleName();
System.out.println(nnn); // System.out.println(nnn);
} // }
} // }

View File

@ -1,48 +1,48 @@
package com.loafle.overflow.central.module.target.service; // package com.loafle.overflow.central.module.target.service;
import com.loafle.overflow.central.module.target.model.Target; // import com.loafle.overflow.central.module.target.model.Target;
import com.loafle.overflow.central.spring.AppConfigTest; // import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert; // import org.junit.Assert;
import org.junit.Ignore; // import org.junit.Ignore;
import org.junit.Test; // import org.junit.Test;
import org.junit.runner.RunWith; // import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; // import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; // import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date; // import java.util.Date;
/** // /**
* Created by insanity on 17. 6. 28. // * Created by insanity on 17. 6. 28.
*/ // */
@RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class}) // @ContextConfiguration(classes = {AppConfigTest.class})
public class TargetServiceTest { // public class TargetServiceTest {
@Autowired // @Autowired
TargetService targetService; // TargetService targetService;
@Ignore // @Ignore
@Test // @Test
public void regist() throws Exception { // public void regist() throws Exception {
Target t = new Target(); // Target t = new Target();
t.setCreateDate(new Date()); // t.setCreateDate(new Date());
// Infra infra = new Infra(); // // Infra infra = new Infra();
// infra.setId(1); // // infra.setId(1);
// Probe probe = new Probe(); // // Probe probe = new Probe();
// probe.setId(1); // // probe.setId(1);
// t.setProbe(probe); // // t.setProbe(probe);
// t.setInfra(infra); // // t.setInfra(infra);
t.setDescription("i am target"); // t.setDescription("i am target");
t.setDisplayName("ghost target"); // t.setDisplayName("ghost target");
Target res = this.targetService.regist(t); // Target res = this.targetService.regist(t);
Assert.assertNotNull(res); // Assert.assertNotNull(res);
} // }
@Test // @Test
public void read() throws Exception { // public void read() throws Exception {
Target res = this.targetService.read("1"); // Target res = this.targetService.read("1");
Assert.assertNotNull(res); // Assert.assertNotNull(res);
} // }
} // }