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.probe.ProbeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

View File

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

View File

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

View File

@ -1,12 +1,13 @@
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.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.Ignore;
import org.junit.Test;
@ -26,7 +27,7 @@ import java.util.Random;
public class HistoryServiceTest {
@Autowired
private HistoryService historyService;
private CentralHistoryService historyService;
@Test
@Ignore

View File

@ -1,7 +1,8 @@
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.model.probe.Probe;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,9 +1,12 @@
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.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.junit.Assert;
import org.junit.Test;
@ -41,7 +44,6 @@ public class InfraHostServiceTest {
metaInfraType.setId(2);
this.infraHostService.regist(infraHost);
Assert.assertNotEquals(infraHost.getId(), 0 );
@ -63,9 +65,15 @@ public class InfraHostServiceTest {
@Test
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();
}
}

View File

@ -1,8 +1,10 @@
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.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.junit.Assert;
import org.junit.Test;

View File

@ -1,9 +1,11 @@
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.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.junit.Assert;
import org.junit.Test;

View File

@ -1,9 +1,11 @@
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.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.junit.Assert;
import org.junit.Test;

View File

@ -1,9 +1,12 @@
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.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.Test;
import org.junit.runner.RunWith;
@ -49,9 +52,15 @@ public class InfraOSPortServiceTest {
@Test
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();
}
}

View File

@ -1,10 +1,12 @@
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.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.junit.Test;
import org.junit.runner.RunWith;

View File

@ -1,11 +1,12 @@
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.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.Test;
import org.junit.runner.RunWith;
@ -23,46 +24,4 @@ public class InfraServiceServiceTest {
@Autowired
private InfraServiceService infraServiceService;
// @Ignore
@Test
public void regist() throws Exception {
InfraService infraService = new InfraService();
infraService.setPort(80);
infraService.setPortType("TCP");
InfraHost infraHost = new InfraHost();
infraHost.setId(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.module.domain.model.Domain;
import com.loafle.overflow.central.module.infra.model.Infra;
import com.loafle.overflow.central.module.probe.model.Probe;
import com.loafle.overflow.central.module.probe.service.ProbeService;
import com.loafle.overflow.central.module.target.model.Target;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.codehaus.jackson.map.ObjectMapper;
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 com.loafle.overflow.central.spring.AppConfigTest;
// import org.codehaus.jackson.map.ObjectMapper;
// 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.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class InfraServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class InfraServiceTest {
@Autowired
private InfraService infraService;
// @Autowired
// private InfraService infraService;
@Autowired
private ProbeService probeService;
// @Autowired
// private ProbeService probeService;
@Autowired
private InfraMachineService infraMachineService;
// @Autowired
// private InfraMachineService infraMachineService;
@Test
public void tttt() {
}
@Test
public void readAllByProbe() throws IOException {
Probe probe = new Probe();
probe.setId(1);
PageParams pageParams = new PageParams();
pageParams.setCountPerPage(100);
pageParams.setPageNo(0);
pageParams.setSortCol("id");
pageParams.setSortDirection("descending");
Page<Infra> list = this.infraService.readAllByProbe(probe, pageParams);
assertNotNull(list);
}
@Test
public void read() throws Exception {
// registInfraMachine();
Infra infra = this.infraService.read(1);
ObjectMapper objectMapper = new ObjectMapper();
String json = objectMapper.writeValueAsString(infra);
System.out.println(json);
}
// @Test
// public void readAllProbe() throws IOException {
//
// public void tttt() {
// }
// @Test
// public void readAllByProbe() throws IOException {
// Probe probe = new Probe();
// probe.setId(1);
//
// List<Infra> infraList = this.infraService.readAllByProbe(probe);
//
// ObjectMapper objectMapper = new ObjectMapper();
// String json = objectMapper.writeValueAsString(infraList);
//
// System.out.println(json);
//
// PageParams pageParams = new PageParams();
// pageParams.setCountPerPage(100);
// pageParams.setPageNo(0);
// pageParams.setSortCol("id");
// pageParams.setSortDirection("descending");
// Page<Infra> list = this.infraService.readAllByProbe(probe, pageParams);
// assertNotNull(list);
// }
@Test
public void readAllTarget() {
Domain domain = new Domain();
domain.setId(1);
// this.infraService.readAllTargetByProbeList()
}
@Test
public void readByTarget() throws IOException {
Target target = new Target();
target.setId(1);
Infra infra = this.infraService.readByTarget(target);
ObjectMapper objectMapper = new ObjectMapper();
String json = objectMapper.writeValueAsString(infra);
System.out.println(json);
}
// @Test
// public void readAllByProbeList() throws IOException {
//
// Domain domain = new Domain();
// domain.setId(1);
//
//
// List<Infra> fl = this.infraService.readAllByDomain(domain);
//
// System.out.println(fl.size());
// public void read() throws Exception {
// // registInfraMachine();
// Infra infra = this.infraService.read(1);
// ObjectMapper objectMapper = new ObjectMapper();
// String json = objectMapper.writeValueAsString(fl);
//
// String json = objectMapper.writeValueAsString(infra);
// System.out.println(json);
//
// }
}
// // @Test
// // public void readAllProbe() throws IOException {
// //
// // Probe probe = new Probe();
// // probe.setId(1);
// //
// // List<Infra> infraList = this.infraService.readAllByProbe(probe);
// //
// // ObjectMapper objectMapper = new ObjectMapper();
// // String json = objectMapper.writeValueAsString(infraList);
// //
// // System.out.println(json);
// //
// // }
// @Test
// public void readAllTarget() {
// Domain domain = new Domain();
// domain.setId(1);
// // this.infraService.readAllTargetByProbeList()
// }
// @Test
// public void readByTarget() throws IOException {
// Target target = new Target();
// target.setId(1);
// Infra infra = this.infraService.readByTarget(target);
// ObjectMapper objectMapper = new ObjectMapper();
// String json = objectMapper.writeValueAsString(infra);
// System.out.println(json);
// }
// // @Test
// // public void readAllByProbeList() throws IOException {
// //
// // Domain domain = new Domain();
// // domain.setId(1);
// //
// //
// // List<Infra> fl = this.infraService.readAllByDomain(domain);
// //
// // System.out.println(fl.size());
// // ObjectMapper objectMapper = new ObjectMapper();
// // String json = objectMapper.writeValueAsString(fl);
// //
// // 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.meta.model.MetaMemberStatus;
import com.loafle.overflow.central.spring.*;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.member.model.Member;
// import com.loafle.overflow.central.module.meta.model.MetaMemberStatus;
// import com.loafle.overflow.central.spring.*;
// import org.junit.Assert;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
// import org.springframework.test.context.ActiveProfiles;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Created by geek on 17. 6. 28.
*/
@Ignore
@RunWith(SpringJUnit4ClassRunner.class)
@ActiveProfiles("test")
@ContextConfiguration(classes = {AppConfigTest.class})
public class MemberDAOTest {
@Autowired
private MemberDAO repo;
// /**
// * Created by geek on 17. 6. 28.
// */
// @Ignore
@Test
public void createMember() {
Member m = new Member();
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
m.setName("insanity2");
m.setCompanyName("loafle");
m.setPw(passwordEncoder.encode("!@#$qwer1234"));
// m.setPw("!@#$qwer1234");
m.setPhone("000-000-0000");
m.setEmail("geekhot@hotmail.co.kr");
m.setStatus(new MetaMemberStatus((short)1));
// @RunWith(SpringJUnit4ClassRunner.class)
// @ActiveProfiles("test")
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MemberDAOTest {
repo.save(m);
Assert.assertNotEquals(m.getId(), 0);
}
// @Autowired
// private MemberDAO repo;
@Test
public void findByEmail() throws Exception {
Member member = new Member(1);
member.setEmail("overflow@loafle.com");
// // @Ignore
// @Test
// public void createMember() {
// Member m = new Member();
// BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
// m.setName("insanity2");
// m.setCompanyName("loafle");
// m.setPw(passwordEncoder.encode("!@#$qwer1234"));
// // m.setPw("!@#$qwer1234");
// m.setPhone("000-000-0000");
// m.setEmail("geekhot@hotmail.co.kr");
// m.setStatus(new MetaMemberStatus((short)1));
Member rr = repo.findByEmail("overflow@loafle.com");
Assert.assertNotNull(rr);
// System.out.println("rr.getCompanyName() = " + rr.getCompanyName());
}
// repo.save(m);
// Assert.assertNotEquals(m.getId(), 0);
// }
}
// @Test
// public void findByEmail() throws Exception {
// Member member = new Member(1);
// member.setEmail("overflow@loafle.com");
// Member rr = repo.findByEmail("overflow@loafle.com");
// Assert.assertNotNull(rr);
// // 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.MemberTotp;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.member.model.Member;
// import com.loafle.overflow.central.module.member.model.MemberTotp;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ActiveProfiles;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by geek on 18. 3. 9.
*/
@Ignore
@RunWith(SpringJUnit4ClassRunner.class)
@ActiveProfiles("test")
@ContextConfiguration(classes = {AppConfigTest.class})
public class MemberTotpDAOTest {
// /**
// * Created by geek on 18. 3. 9.
// */
// @Ignore
// @RunWith(SpringJUnit4ClassRunner.class)
// @ActiveProfiles("test")
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MemberTotpDAOTest {
@Autowired
private MemberTotpDAO dao;
// @Autowired
// private MemberTotpDAO dao;
@Test
public void insertTest() throws Exception {
MemberTotp totp = new MemberTotp();
totp.setSecretCode("AI6EWOYSZWEBAI2D");
totp.setMember(new Member(2));
this.dao.save(totp);
}
@Test
public void findBySecretCode() throws Exception {
}
// @Test
// public void insertTest() throws Exception {
// MemberTotp totp = new MemberTotp();
// totp.setSecretCode("AI6EWOYSZWEBAI2D");
// totp.setMember(new Member(2));
// this.dao.save(totp);
// }
// @Test
// public void findBySecretCode() throws Exception {
// }
@Test
public void findByMember() throws Exception {
MemberTotp totp = new MemberTotp();
totp.setSecretCode("EDPBZLDATGZP7NX2");
totp.setMember(new Member(2));
this.dao.save(totp);
// @Test
// public void findByMember() throws Exception {
// MemberTotp totp = new MemberTotp();
// totp.setSecretCode("EDPBZLDATGZP7NX2");
// totp.setMember(new Member(2));
// 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.model.member.Member;
import com.loafle.overflow.service.central.member.MemberService;
import com.loafle.overflow.service.central.member.MemberTotpService;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import com.loafle.overflow.model.member.Member;
// import com.loafle.overflow.service.central.member.MemberService;
// import com.loafle.overflow.service.central.member.MemberTotpService;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import org.junit.Assert;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ActiveProfiles;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
// import java.util.Date;
// import java.util.List;
// import java.util.regex.Matcher;
// import java.util.regex.Pattern;
/**
* Created by insanity on 17. 6. 28.
*/
// /**
// * Created by insanity on 17. 6. 28.
// */
@RunWith(SpringJUnit4ClassRunner.class)
@ActiveProfiles("test")
@ContextConfiguration(classes = {AppConfigTest.class})
public class MemberServiceTest {
@Autowired
MemberService memberService;
// @RunWith(SpringJUnit4ClassRunner.class)
// @ActiveProfiles("test")
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MemberServiceTest {
// @Autowired
// MemberService memberService;
@Autowired
MemberTotpService totpService;
// @Autowired
// MemberTotpService totpService;
@Test
public void regist() throws Exception {
Member m = new Member();
m.setPw("!@#$qwer1234");
m.setStatus(new MetaMemberStatus((short)1));
m.setCreateDate(new Date());
m.setCompanyName("Loafle");
m.setEmail("geekhot@hotmail.co.kr");
m.setName("administrator");
m.setPhone("00000000");
Member res = this.memberService.signup(m,"!@#$qwer1234");
Assert.assertNotNull(res);
}
@Test
public void signin() throws Exception {
// Member m = this.memberService.signin("overflow@loafle.com", "!@#$qwer1234");
// Assert.assertNotNull(m);
}
@Test
public void readAllMemberByProbeKey() {
List<Member> members = this.memberService.readAllByProbeKey("95d8bcdc739741dca74c4a0e489e0774");
Assert.assertNotEquals(members.size(), 0);
}
@Test
public void readAllMemberByApiKey() {
List<Member> members = this.memberService.readAllByApiKey("52abd6fd57e511e7ac52080027658d13");
Assert.assertNotEquals(members.size(), 0);
}
@Test
public void readAllMemberByDomain() {
Domain domain = new Domain();
domain.setId(1);
List<Member> members = this.memberService.readAllByDomain(domain);
Assert.assertNotEquals(members.size(), 0);
}
@Test
public void TestPasswordStrong() {
String arrpw[] = new String[]{"!@#$Qwer1234", "Zxasqw12!!","@Cosmos@5795"};
// String pass = "!@#$Qwer1234";
boolean check = false;
for (int i = 0; i < arrpw.length; i++) {
check = this.memberService.isPasswordStrong(arrpw[i]);
// System.out.println("check = " + check);
Assert.assertTrue(check);
}
}
//
// String regex = "(" +
// "(?=.*[a-z])" +
// "(?=.*\\d)" +
// "(?=.*[A-Z])" +
// "(?=.*[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?])" +
// "." +
// "{6,40}" +
// ")";
// @Test
// public void TestPassword() {
// Pattern pattern = Pattern.compile(regex);
// Matcher matcher = pattern.matcher("qwe1231@Q\\");
// System.out.println("Length"+"qwe1231@Q\\".length());
//
// System.out.println("matcher.matches() = " + matcher.matches());
// public void regist() throws Exception {
// Member m = new Member();
// m.setPw("!@#$qwer1234");
// m.setStatus(new MetaMemberStatus((short)1));
// m.setCreateDate(new Date());
// m.setCompanyName("Loafle");
// m.setEmail("geekhot@hotmail.co.kr");
// m.setName("administrator");
// m.setPhone("00000000");
// Member res = this.memberService.signup(m,"!@#$qwer1234");
// Assert.assertNotNull(res);
// }
// @Test
// public void signin() throws Exception {
// // Member m = this.memberService.signin("overflow@loafle.com", "!@#$qwer1234");
// // Assert.assertNotNull(m);
// }
// @Test
// public void readAllMemberByProbeKey() {
// List<Member> members = this.memberService.readAllByProbeKey("95d8bcdc739741dca74c4a0e489e0774");
// Assert.assertNotEquals(members.size(), 0);
// }
// @Test
// public void readAllMemberByApiKey() {
// List<Member> members = this.memberService.readAllByApiKey("52abd6fd57e511e7ac52080027658d13");
// Assert.assertNotEquals(members.size(), 0);
// }
// @Test
// public void readAllMemberByDomain() {
// Domain domain = new Domain();
// domain.setId(1);
// List<Member> members = this.memberService.readAllByDomain(domain);
// Assert.assertNotEquals(members.size(), 0);
// }
// @Test
// public void TestPasswordStrong() {
// String arrpw[] = new String[]{"!@#$Qwer1234", "Zxasqw12!!","@Cosmos@5795"};
// // String pass = "!@#$Qwer1234";
// boolean check = false;
// for (int i = 0; i < arrpw.length; i++) {
// check = this.memberService.isPasswordStrong(arrpw[i]);
// // System.out.println("check = " + check);
// Assert.assertTrue(check);
// }
// }
// //
// // String regex = "(" +
// // "(?=.*[a-z])" +
// // "(?=.*\\d)" +
// // "(?=.*[A-Z])" +
// // "(?=.*[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?])" +
// // "." +
// // "{6,40}" +
// // ")";
// // @Test
// // public void TestPassword() {
// // Pattern pattern = Pattern.compile(regex);
// // Matcher matcher = pattern.matcher("qwe1231@Q\\");
// // System.out.println("Length"+"qwe1231@Q\\".length());
// //
// // 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.model.member.Member;
import com.loafle.overflow.model.member.MemberTotp;
import com.loafle.overflow.service.central.member.MemberTotpService;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import com.loafle.overflow.model.member.Member;
// import com.loafle.overflow.model.member.MemberTotp;
// import com.loafle.overflow.service.central.member.MemberTotpService;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ActiveProfiles;
// import org.springframework.test.context.ContextConfiguration;
// 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.
*/
@Ignore
@RunWith(SpringJUnit4ClassRunner.class)
@ActiveProfiles("test")
@ContextConfiguration(classes = {AppConfigTest.class})
public class MemberTotpServiceTest {
// /**
// * Created by geek on 18. 3. 9.
// */
// @Ignore
// @RunWith(SpringJUnit4ClassRunner.class)
// @ActiveProfiles("test")
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MemberTotpServiceTest {
@Autowired
private MemberTotpService totpService;
// @Autowired
// private MemberTotpService totpService;
@Test
public void regist() throws Exception {
}
// @Test
// public void regist() throws Exception {
// }
@Test
public void modify() throws Exception {
}
// @Test
// public void modify() throws Exception {
// }
@Test
public void remove() throws Exception {
}
// @Test
// public void remove() throws Exception {
// }
@Test
public void read() throws Exception {
}
// @Test
// public void read() throws Exception {
// }
@Test
public void checkCode() throws Exception {
MemberTotp totp = new MemberTotp();
totp.setSecretCode("PN44SRPS5QCGCJNS");
// @Test
// public void checkCode() throws Exception {
// MemberTotp totp = new MemberTotp();
// 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
public void createTotp() throws Exception {
// @Test
// public void createTotp() throws Exception {
Member m = new Member(2);
m.setEmail("geekdev@naver.com");
Map<String, String> totp = this.totpService.createTotp(m );
// Member m = new Member(2);
// m.setEmail("geekdev@naver.com");
// Map<String, String> totp = this.totpService.createTotp(m );
System.out.println(totp.get("key"));
System.out.println(totp.get("uri"));
}
// System.out.println(totp.get("key"));
// 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.MetaCrawlerInputItem;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaCrawler;
// import com.loafle.overflow.central.module.meta.model.MetaCrawlerInputItem;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaCrawlerInputItemServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class CentralMetaCrawlerInputItemServiceTest {
@Autowired
private MetaCrawlerInputItemService crawlerInputItemService;
// @Autowired
// private MetaCrawlerInputItemService crawlerInputItemService;
@Test
public void readAllByMetaCrawler() throws Exception {
// @Test
// public void readAllByMetaCrawler() throws Exception {
MetaCrawler metaCrawler = new MetaCrawler();
metaCrawler.setId((short)1);
// MetaCrawler metaCrawler = new MetaCrawler();
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaCrawler;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaCrawlerServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class CentralMetaCrawlerServiceTest {
@Autowired
private MetaCrawlerService service;
// @Autowired
// private MetaCrawlerService service;
@Test
public void readAll() throws Exception {
List<MetaCrawler> metaCrawlerServices = this.service.readAll();
// @Test
// public void readAll() throws Exception {
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaHistoryType;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.List;
// import java.util.ArrayList;
// import java.util.List;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
@Ignore
public class CentralMetaHistoryTypeServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// @Ignore
// public class CentralMetaHistoryTypeServiceTest {
@Autowired
private MetaHistoryTypeService historyTypeService;
// @Autowired
// private MetaHistoryTypeService historyTypeService;
@Test
public void readAll() throws Exception {
List<MetaHistoryType> historyTypes = this.historyTypeService.readAll();
Assert.assertNotNull(historyTypes);
}
// @Test
// public void readAll() throws Exception {
// List<MetaHistoryType> historyTypes = this.historyTypeService.readAll();
// Assert.assertNotNull(historyTypes);
// }
@Test
public void save() throws Exception {
List<MetaHistoryType> list = new ArrayList<>();
// @Test
// public void save() throws Exception {
// List<MetaHistoryType> list = new ArrayList<>();
MetaHistoryType t1 = new MetaHistoryType();
t1.setId(1);
t1.setName("Member");
// MetaHistoryType t1 = new MetaHistoryType();
// t1.setId(1);
// t1.setName("Member");
MetaHistoryType t2 = new MetaHistoryType();
t2.setId(2);
t2.setName("Probe");
// MetaHistoryType t2 = new MetaHistoryType();
// t2.setId(2);
// t2.setName("Probe");
MetaHistoryType t3 = new MetaHistoryType();
t3.setId(3);
t3.setName("Discovery");
// MetaHistoryType t3 = new MetaHistoryType();
// t3.setId(3);
// t3.setName("Discovery");
MetaHistoryType t4 = new MetaHistoryType();
t4.setId(4);
t4.setName("Target");
// MetaHistoryType t4 = new MetaHistoryType();
// t4.setId(4);
// t4.setName("Target");
MetaHistoryType t5 = new MetaHistoryType();
t5.setId(5);
t5.setName("Crawler");
// MetaHistoryType t5 = new MetaHistoryType();
// t5.setId(5);
// t5.setName("Crawler");
MetaHistoryType t6 = new MetaHistoryType();
t6.setId(6);
t6.setName("Sensor");
// MetaHistoryType t6 = new MetaHistoryType();
// t6.setId(6);
// t6.setName("Sensor");
//todo: need more
// //todo: need more
list.add(t1);
list.add(t2);
list.add(t3);
list.add(t4);
list.add(t5);
list.add(t6);
// list.add(t1);
// list.add(t2);
// list.add(t3);
// list.add(t4);
// list.add(t5);
// list.add(t6);
List<MetaHistoryType> result = this.historyTypeService.registAll(list);
Assert.assertEquals(result.size(), list.size());
}
// List<MetaHistoryType> result = this.historyTypeService.registAll(list);
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaInfraType;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
@Ignore
public class CentralMetaInfraTypeServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// @Ignore
// public class CentralMetaInfraTypeServiceTest {
@Autowired
private CentralMetaInfraTypeService infraTypeService;
// @Autowired
// private CentralMetaInfraTypeService infraTypeService;
@Test
public void readAll() throws Exception {
// @Test
// 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 org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaInfraVendorServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class CentralMetaInfraVendorServiceTest {
@Autowired
private MetaInfraVendorService infraVendorService;
// @Autowired
// private MetaInfraVendorService infraVendorService;
@Test
public void readAllByMetaInfraType() throws Exception {
// @Test
// public void readAllByMetaInfraType() throws Exception {
MetaInfraType metaInfraType = new MetaInfraType();
metaInfraType.setId(1);
// MetaInfraType metaInfraType = new MetaInfraType();
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaInputType;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaInputTypeServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class CentralMetaInputTypeServiceTest {
@Autowired
private MetaInputTypeService inputTypeService;
// @Autowired
// private MetaInputTypeService inputTypeService;
@Test
public void readAll() throws Exception {
// @Test
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaMemberStatus;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaMemberStatusServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class CentralMetaMemberStatusServiceTest {
@Autowired
private MetaMemberStatusService memberStatusService;
// @Autowired
// private MetaMemberStatusService memberStatusService;
@Test
public void readAll() throws Exception {
// @Test
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaNoAuthProbeStatus;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaNoAuthProbeStatusServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class CentralMetaNoAuthProbeStatusServiceTest {
@Autowired
private MetaNoAuthProbeStatusService noAuthProbeStatusService;
// @Autowired
// private MetaNoAuthProbeStatusService noAuthProbeStatusService;
@Test
public void readAll() throws Exception {
List<MetaNoAuthProbeStatus> metaNoAuthProbeStatuses = this.noAuthProbeStatusService.readAll();
// @Test
// public void readAll() throws Exception {
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaProbeArchitecture;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaProbeArchitectureServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class CentralMetaProbeArchitectureServiceTest {
@Autowired
private MetaProbeArchitectureService probeArchitectureService;
// @Autowired
// private MetaProbeArchitectureService probeArchitectureService;
@Test
public void readAll() throws Exception {
// @Test
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaProbeOs;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class CentralMetaProbeOsServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class CentralMetaProbeOsServiceTest {
@Autowired
private MetaProbeOsService probeOsService;
// @Autowired
// private MetaProbeOsService probeOsService;
@Test
public void readAll() throws Exception {
// @Test
// 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.MetaProbePackage;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaProbeOs;
// import com.loafle.overflow.central.module.meta.model.MetaProbePackage;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class MetaProbePackageServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MetaProbePackageServiceTest {
@Autowired
private MetaProbePackageService probePackageService;
// @Autowired
// private MetaProbePackageService probePackageService;
@Test
public void readAllByOs() throws Exception {
// @Test
// public void readAllByOs() throws Exception {
MetaProbeOs metaProbeOs = new MetaProbeOs();
metaProbeOs.setId((short)1);
// MetaProbeOs metaProbeOs = new MetaProbeOs();
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaProbeStatus;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class MetaProbeStatusServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MetaProbeStatusServiceTest {
@Autowired
private MetaProbeStatusService probeStatusService;
// @Autowired
// private MetaProbeStatusService probeStatusService;
@Test
public void readAll() throws Exception {
// @Test
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaProbeTaskType;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class MetaProbeTaskTypeServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MetaProbeTaskTypeServiceTest {
@Autowired
private MetaProbeTaskTypeService probeTaskTypeService;
// @Autowired
// private MetaProbeTaskTypeService probeTaskTypeService;
@Test
public void readAll() throws Exception {
// @Test
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaProbeVersion;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class MetaProbeVersionServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MetaProbeVersionServiceTest {
@Autowired
private MetaProbeVersionService probeVersionService;
// @Autowired
// private MetaProbeVersionService probeVersionService;
@Test
public void readAll() throws Exception {
// @Test
// 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.MetaSensorDisplayItem;
import com.loafle.overflow.central.module.meta.model.MetaSensorItemUnit;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import 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.MetaSensorItemUnit;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
// import java.util.Date;
/**
* Created by insanity on 17. 11. 7.
*/
// /**
// * Created by insanity on 17. 11. 7.
// */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorDisplayItemServiceTest {
@Autowired
MetaSensorDisplayItemService service;
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MetaSensorDisplayItemServiceTest {
// @Autowired
// MetaSensorDisplayItemService service;
@Test
@Ignore
public void regist() throws Exception {
MetaSensorDisplayItem cpuTotal = new MetaSensorDisplayItem();
cpuTotal.setId(120);
cpuTotal.setCrawler(new MetaCrawler((short)21));
cpuTotal.setCreateDate(new Date());
cpuTotal.setKey("CPU_TOTAL");
cpuTotal.setDisplayName("CPU Total Usage (%)");
cpuTotal.setDescription("");
cpuTotal.setUnit(new MetaSensorItemUnit((short)1));
service.regist(cpuTotal);
}
}
// @Test
// @Ignore
// public void regist() throws Exception {
// MetaSensorDisplayItem cpuTotal = new MetaSensorDisplayItem();
// cpuTotal.setId(120);
// cpuTotal.setCrawler(new MetaCrawler((short)21));
// cpuTotal.setCreateDate(new Date());
// cpuTotal.setKey("CPU_TOTAL");
// cpuTotal.setDisplayName("CPU Total Usage (%)");
// cpuTotal.setDescription("");
// cpuTotal.setUnit(new MetaSensorItemUnit((short)1));
// 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.MetaSensorItemKey;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaSensorDisplayItem;
// import com.loafle.overflow.central.module.meta.model.MetaSensorItemKey;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
/**
* Created by insanity on 17. 11. 7.
*/
// /**
// * Created by insanity on 17. 11. 7.
// */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorDisplayMappingServiceTest {
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MetaSensorDisplayMappingServiceTest {
@Autowired
MetaSensorDisplayMappingService service;
// @Autowired
// MetaSensorDisplayMappingService service;
@Test
public void read() {
List<MetaSensorItemKey> list = this.service.findAllByDisplayItem(new MetaSensorDisplayItem(1));
Assert.assertNotNull(list);
}
}
// @Test
// public void read() {
// List<MetaSensorItemKey> list = this.service.findAllByDisplayItem(new MetaSensorDisplayItem(1));
// 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.MetaSensorItemKey;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaCrawler;
// import com.loafle.overflow.central.module.meta.model.MetaSensorItemKey;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Map;
// import java.util.Map;
/**
* Created by snoop on 17. 8. 29.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorItemKeyServiceTest {
// /**
// * Created by snoop on 17. 8. 29.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MetaSensorItemKeyServiceTest {
@Autowired
private MetaSensorItemKeyService metaSensorItemKeyService;
// @Autowired
// private MetaSensorItemKeyService metaSensorItemKeyService;
@Test
public void readAllByCrawler() {
MetaCrawler metaCrawler = new MetaCrawler();
metaCrawler.setId((short)11);
// @Test
// public void readAllByCrawler() {
// MetaCrawler metaCrawler = new MetaCrawler();
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaSensorItem;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorItemServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MetaSensorItemServiceTest {
@Autowired
private MetaSensorItemService metaSensorItemService;
// @Autowired
// private MetaSensorItemService metaSensorItemService;
@Test
public void readAll() throws Exception {
// @Test
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaSensorItemType;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorItemTypeServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MetaSensorItemTypeServiceTest {
@Autowired
private MetaSensorItemTypeService sensorItemTypeService;
// @Autowired
// private MetaSensorItemTypeService sensorItemTypeService;
@Test
@Ignore
public void readAll() throws Exception {
List<MetaSensorItemType> metaSensorItemTypes = this.sensorItemTypeService.readAll();
// @Test
// @Ignore
// public void readAll() throws Exception {
// 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.spring.AppConfigTest;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaSensorItemUnit;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorItemUnitServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MetaSensorItemUnitServiceTest {
@Autowired
private MetaSensorItemUnitService service;
// @Autowired
// private MetaSensorItemUnitService service;
@Test
@Ignore
public void regist() throws Exception {
// @Test
// @Ignore
// public void regist() throws Exception {
MetaSensorItemUnit defaultValue = new MetaSensorItemUnit();
defaultValue.setId((short)0);
defaultValue.setUnit("");
defaultValue.setMark("");
this.service.regist(defaultValue);
// MetaSensorItemUnit defaultValue = new MetaSensorItemUnit();
// defaultValue.setId((short)0);
// defaultValue.setUnit("");
// defaultValue.setMark("");
// this.service.regist(defaultValue);
MetaSensorItemUnit unit1 = new MetaSensorItemUnit();
unit1.setId((short)1);
unit1.setUnit("Percentage");
unit1.setMark("%");
this.service.regist(unit1);
// MetaSensorItemUnit unit1 = new MetaSensorItemUnit();
// unit1.setId((short)1);
// unit1.setUnit("Percentage");
// unit1.setMark("%");
// this.service.regist(unit1);
MetaSensorItemUnit unit2 = new MetaSensorItemUnit();
unit2.setId((short)2);
unit2.setUnit("Byte");
unit2.setMark("Bytes");
this.service.regist(unit2);
// MetaSensorItemUnit unit2 = new MetaSensorItemUnit();
// unit2.setId((short)2);
// unit2.setUnit("Byte");
// unit2.setMark("Bytes");
// this.service.regist(unit2);
MetaSensorItemUnit unit3 = new MetaSensorItemUnit();
unit3.setId((short)3);
unit3.setUnit("KByte");
unit3.setMark("KB");
this.service.regist(unit3);
// MetaSensorItemUnit unit3 = new MetaSensorItemUnit();
// unit3.setId((short)3);
// unit3.setUnit("KByte");
// unit3.setMark("KB");
// this.service.regist(unit3);
MetaSensorItemUnit unit4 = new MetaSensorItemUnit();
unit4.setId((short)4);
unit4.setUnit("MByte");
unit4.setMark("MB");
this.service.regist(unit4);
// MetaSensorItemUnit unit4 = new MetaSensorItemUnit();
// unit4.setId((short)4);
// unit4.setUnit("MByte");
// unit4.setMark("MB");
// this.service.regist(unit4);
MetaSensorItemUnit unit5 = new MetaSensorItemUnit();
unit5.setId((short)5);
unit5.setUnit("GByte");
unit5.setMark("GB");
this.service.regist(unit5);
// MetaSensorItemUnit unit5 = new MetaSensorItemUnit();
// unit5.setId((short)5);
// unit5.setUnit("GByte");
// unit5.setMark("GB");
// this.service.regist(unit5);
MetaSensorItemUnit unit6 = new MetaSensorItemUnit();
unit6.setId((short)6);
unit6.setUnit("Count");
unit6.setMark("");
this.service.regist(unit6);
// MetaSensorItemUnit unit6 = new MetaSensorItemUnit();
// unit6.setId((short)6);
// unit6.setUnit("Count");
// unit6.setMark("");
// this.service.regist(unit6);
MetaSensorItemUnit unit7 = new MetaSensorItemUnit();
unit7.setId((short)7);
unit7.setUnit("Jiffy");
unit7.setMark("Jiffies");
this.service.regist(unit7);
// MetaSensorItemUnit unit7 = new MetaSensorItemUnit();
// unit7.setId((short)7);
// unit7.setUnit("Jiffy");
// unit7.setMark("Jiffies");
// this.service.regist(unit7);
MetaSensorItemUnit unit8 = new MetaSensorItemUnit();
unit8.setId((short)8);
unit8.setUnit("Byte Per Second");
unit8.setMark("BPS");
this.service.regist(unit8);
// MetaSensorItemUnit unit8 = new MetaSensorItemUnit();
// unit8.setId((short)8);
// unit8.setUnit("Byte Per Second");
// unit8.setMark("BPS");
// this.service.regist(unit8);
MetaSensorItemUnit unit9 = new MetaSensorItemUnit();
unit9.setId((short)9);
unit9.setUnit("Packet Per Second");
unit9.setMark("PPS");
this.service.regist(unit9);
}
// MetaSensorItemUnit unit9 = new MetaSensorItemUnit();
// unit9.setId((short)9);
// unit9.setUnit("Packet Per Second");
// unit9.setMark("PPS");
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaSensorStatus;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class MetaSensorStatusServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MetaSensorStatusServiceTest {
@Autowired
private MetaSensorStatusService sensorStatusService;
// @Autowired
// private MetaSensorStatusService sensorStatusService;
@Test
public void readAll() throws Exception {
// @Test
// 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.MetaInfraVendor;
import com.loafle.overflow.central.module.meta.model.MetaVendorCrawler;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import 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.MetaVendorCrawler;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
/**
* Created by snoop on 17. 7. 27.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class MetaVendorCrawlerServiceTest {
// /**
// * Created by snoop on 17. 7. 27.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class MetaVendorCrawlerServiceTest {
@Autowired
private MetaVendorCrawlerService service;
// @Autowired
// private MetaVendorCrawlerService service;
@Test
public void readAllByInfraVendor() throws Exception {
MetaInfraVendor metaInfraVendor = new MetaInfraVendor();
// @Test
// public void readAllByInfraVendor() throws Exception {
// 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
@Test
public void regist() throws Exception {
MetaVendorCrawler metaVendorCrawler = new MetaVendorCrawler();
// @Ignore
// @Test
// public void regist() throws Exception {
// MetaVendorCrawler metaVendorCrawler = new MetaVendorCrawler();
MetaCrawler metaCrawler = new MetaCrawler();
metaCrawler.setId((short)23);
// MetaCrawler metaCrawler = new MetaCrawler();
// metaCrawler.setId((short)23);
MetaInfraVendor metaInfraVendor = new MetaInfraVendor();
metaInfraVendor.setId(42);
// MetaInfraVendor metaInfraVendor = new MetaInfraVendor();
// metaInfraVendor.setId(42);
metaVendorCrawler.setCrawler(metaCrawler);
metaVendorCrawler.setInfraVendor(metaInfraVendor);
// metaVendorCrawler.setCrawler(metaCrawler);
// metaVendorCrawler.setInfraVendor(metaInfraVendor);
metaVendorCrawler.setId(1);
this.service.regist(metaVendorCrawler);
// metaVendorCrawler.setId(1);
// 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.module.domain.model.Domain;
import com.loafle.overflow.central.module.meta.model.MetaNoAuthProbeStatus;
import com.loafle.overflow.central.module.noauthprobe.model.NoAuthProbe;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.commons.service.MessagePublisher;
// import com.loafle.overflow.central.module.domain.model.Domain;
// import com.loafle.overflow.central.module.meta.model.MetaNoAuthProbeStatus;
// import com.loafle.overflow.central.module.noauthprobe.model.NoAuthProbe;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
// import java.io.IOException;
// import java.util.ArrayList;
// import java.util.List;
/**
* Created by snoop on 17. 6. 28.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class NoAuthProbeServiceTest {
// /**
// * Created by snoop on 17. 6. 28.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class NoAuthProbeServiceTest {
@Autowired
private NoAuthProbeService noAuthProbeService;
// @Autowired
// private NoAuthProbeService noAuthProbeService;
@Autowired
private MessagePublisher messagePublisher;
@Ignore
@Test
public void regist() throws Exception {
NoAuthProbe noAuthProbe = new NoAuthProbe();
// noAuthProbe.setHostName("snoop");
// noAuthProbe.setIpAddress(3232235980L);
// 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.setApiKey("52abd6fd57e511e7ac52080027658d13");
MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus();
metaNoAuthProbeStatus.setId((short)3);
noAuthProbe.setStatus(metaNoAuthProbeStatus);
noAuthProbe.setTempProbeKey("ac7f252b5bc811e784ad080027658d13");
Domain d = new Domain();
d.setId(1);
noAuthProbe.setDomain(d);
this.noAuthProbeService.regist(noAuthProbe);
Assert.assertNotEquals(noAuthProbe.getId(), 0);
}
@Ignore
@Test
public void registForNoAuthProbes() throws Exception {
NoAuthProbe noAuthProbe = new NoAuthProbe();
// noAuthProbe.setHostName("geek");
// noAuthProbe.setIpAddress(3232235980L);
// 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.setApiKey("521abd6fd57e511e7ac52080027658d13");
MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus();
metaNoAuthProbeStatus.setId((short)3);
noAuthProbe.setStatus(metaNoAuthProbeStatus);
noAuthProbe.setTempProbeKey("a1c7f252b5bc811e784ad080027658d13");
Domain d = new Domain();
d.setId(1);
noAuthProbe.setDomain(d);
List<NoAuthProbe> noAuthProbes = new ArrayList<NoAuthProbe>();
noAuthProbes.add(noAuthProbe);
// List<NoAuthProbe> dd = this.noAuthProbeService.registForNoAuthProbes(noAuthProbes);
// System.out.println(dd.get(0).getId());
Assert.assertNotEquals(noAuthProbes.size(), 2);
}
@Ignore
@Test
public void readAllByDomain() throws Exception {
Domain domain = new Domain();
domain.setId(1);
List<NoAuthProbe> probes = this.noAuthProbeService.readAllByDomain(domain);
Assert.assertNotEquals(probes.size(), 0);
}
// @Autowired
// private MessagePublisher messagePublisher;
// @Ignore
@Test
public void read() throws Exception {
// @Test
// public void regist() throws Exception {
NoAuthProbe noAuthProbe = this.noAuthProbeService.read(1);
Assert.assertNotEquals(noAuthProbe, null);
}
// NoAuthProbe noAuthProbe = new NoAuthProbe();
@Test
public void acceptProbe() throws IOException {
// // noAuthProbe.setHostName("snoop");
// // noAuthProbe.setIpAddress(3232235980L);
// // 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 noAuthProbe = this.noAuthProbeService.read(1);
// noAuthProbe.setApiKey("52abd6fd57e511e7ac52080027658d13");
this.noAuthProbeService.acceptNoAuthProbe(noAuthProbe);
// MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus();
// metaNoAuthProbeStatus.setId((short)3);
}
// noAuthProbe.setStatus(metaNoAuthProbeStatus);
// noAuthProbe.setTempProbeKey("ac7f252b5bc811e784ad080027658d13");
@Test
public void ssss() {
String ss = "192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64";
// Domain d = new Domain();
// d.setId(1);
// noAuthProbe.setDomain(d);
String[] sss = ss.split("\\|");
// this.noAuthProbeService.regist(noAuthProbe);
System.out.println(sss[0]);
}
// Assert.assertNotEquals(noAuthProbe.getId(), 0);
@Test
public void readByTempKey() {
// }
NoAuthProbe noAuthProbe = this.noAuthProbeService.readByTempKey("1cf2555c57d511e79714080027658d15");
// @Ignore
// @Test
// public void registForNoAuthProbes() throws Exception {
Assert.assertNotEquals(noAuthProbe, null);
// NoAuthProbe noAuthProbe = new NoAuthProbe();
}
// // noAuthProbe.setHostName("geek");
// // noAuthProbe.setIpAddress(3232235980L);
// // 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.setApiKey("521abd6fd57e511e7ac52080027658d13");
@Test
public void sendWeb() {
// MetaNoAuthProbeStatus metaNoAuthProbeStatus = new MetaNoAuthProbeStatus();
// metaNoAuthProbeStatus.setId((short)3);
Domain domain = new Domain();
domain.setId(1);
// noAuthProbe.setStatus(metaNoAuthProbeStatus);
// noAuthProbe.setTempProbeKey("a1c7f252b5bc811e784ad080027658d13");
List<NoAuthProbe> probes = this.noAuthProbeService.readAllByDomain(domain);
// Domain d = new Domain();
// d.setId(1);
// noAuthProbe.setDomain(d);
messagePublisher.publishToDomainMembers(domain.getId(), "NoAuthProbeService.regist", probes);
// List<NoAuthProbe> noAuthProbes = new ArrayList<NoAuthProbe>();
}
// noAuthProbes.add(noAuthProbe);
// // List<NoAuthProbe> dd = this.noAuthProbeService.registForNoAuthProbes(noAuthProbes);
// // System.out.println(dd.get(0).getId());
// Assert.assertNotEquals(noAuthProbes.size(), 2);
// }
// @Ignore
// @Test
// public void readAllByDomain() throws Exception {
// Domain domain = new Domain();
// domain.setId(1);
// List<NoAuthProbe> probes = this.noAuthProbeService.readAllByDomain(domain);
// Assert.assertNotEquals(probes.size(), 0);
// }
// // @Ignore
// @Test
// public void read() throws Exception {
// NoAuthProbe noAuthProbe = this.noAuthProbeService.read(1);
// Assert.assertNotEquals(noAuthProbe, null);
// }
}
// @Test
// public void acceptProbe() throws IOException {
// NoAuthProbe noAuthProbe = this.noAuthProbeService.read(1);
// this.noAuthProbeService.acceptNoAuthProbe(noAuthProbe);
// }
// @Test
// public void ssss() {
// String ss = "192.168.1.106/24|fe80::36c0:6c3e:6006:dd23/64";
// String[] sss = ss.split("\\|");
// System.out.println(sss[0]);
// }
// @Test
// public void readByTempKey() {
// NoAuthProbe noAuthProbe = this.noAuthProbeService.readByTempKey("1cf2555c57d511e79714080027658d15");
// Assert.assertNotEquals(noAuthProbe, null);
// }
// @Test
// public void sendWeb() {
// Domain domain = new Domain();
// domain.setId(1);
// List<NoAuthProbe> probes = this.noAuthProbeService.readAllByDomain(domain);
// 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.notification.model.Notification;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.member.model.Member;
// import com.loafle.overflow.central.module.notification.model.Notification;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
// import java.util.Date;
/**
* Created by insanity on 17. 8. 25.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class NotificationServiceTest {
@Autowired
private NotificationService notificationService;
@Test
public void testRegist() {
for (int i=0; i<30; i++) {
Notification n = new Notification();
n.setMember(new Member(1));
n.setTitle("Title"+i);
n.setMessage("Message"+i);
if(i<20) {
n.setConfirmDate(new Date());
}
this.notificationService.regist(n);
}
}
// /**
// * Created by insanity on 17. 8. 25.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class NotificationServiceTest {
// @Autowired
// private NotificationService notificationService;
// @Test
// @Ignore
// public void testReadAll() {
// this.testRegist();
// Page<Notification> notis = this.notificationService.readAllByMember(new Member(1), 0, 10);
// Assert.assertEquals(30, notis.getTotalElements());
// public void testRegist() {
// for (int i=0; i<30; i++) {
// Notification n = new Notification();
// n.setMember(new Member(1));
// n.setTitle("Title"+i);
// n.setMessage("Message"+i);
// if(i<20) {
// n.setConfirmDate(new Date());
// }
//
// @Test
// @Ignore
// public void testReadAllUnread() {
// this.testRegist();
// Page<Notification> notis = this.notificationService.readAllUnconfirmedByMember(new Member(1), 0, 10);
// Assert.assertEquals(15, notis.getTotalElements());
// this.notificationService.regist(n);
// }
// }
// // @Test
// // @Ignore
// // public void testReadAll() {
// // this.testRegist();
// // Page<Notification> notis = this.notificationService.readAllByMember(new Member(1), 0, 10);
// // Assert.assertEquals(30, notis.getTotalElements());
// // }
// //
// // @Test
// // @Ignore
// // public void testReadAllUnread() {
// // this.testRegist();
// // Page<Notification> notis = this.notificationService.readAllUnconfirmedByMember(new Member(1), 0, 10);
// // 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.probe.model.Probe;
import com.loafle.overflow.central.module.probe.model.ProbeHost;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import 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.ProbeHost;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.*;
// import static org.junit.Assert.*;
/**
* Created by snoop on 17. 8. 21.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class ProbeHostServiceTest {
// /**
// * Created by snoop on 17. 8. 21.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class ProbeHostServiceTest {
@Autowired
private ProbeHostService probeHostService;
// @Autowired
// private ProbeHostService probeHostService;
@Test
public void regist() {
ProbeHost probeHost = new ProbeHost();
// @Test
// public void regist() {
// ProbeHost probeHost = new ProbeHost();
Probe probe = new Probe();
probe.setId(1);
// Probe probe = new Probe();
// probe.setId(1);
InfraHost infraHost = new InfraHost();
infraHost.setId(3);
// InfraHost infraHost = new InfraHost();
// 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
public void readByProbe() throws Exception {
// @Test
// public void readByProbe() throws Exception {
Probe probe = new Probe();
probe.setId(1);
// Probe probe = new Probe();
// 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.member.model.Member;
import com.loafle.overflow.central.module.meta.model.MetaProbeStatus;
import com.loafle.overflow.central.module.probe.model.Probe;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.domain.model.Domain;
// import com.loafle.overflow.central.module.member.model.Member;
// import com.loafle.overflow.central.module.meta.model.MetaProbeStatus;
// import com.loafle.overflow.central.module.probe.model.Probe;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
import java.util.UUID;
// import java.util.List;
// import java.util.UUID;
/**
* Created by snoop on 17. 6. 28.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class ProbeServiceTest {
// /**
// * Created by snoop on 17. 6. 28.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class ProbeServiceTest {
@Autowired
private ProbeService probeService;
// @Autowired
// private ProbeService probeService;
// // @Ignore
// @Test
// public void regist() throws Exception {
// Probe probe = new Probe();
// probe.setDescription("snoop probe");
// Domain domain = new Domain();
// domain.setId(1);
// probe.setDomain(domain);
// probe.setEncryptionKey(getUUID());
// probe.setProbeKey(getUUID());
// MetaProbeStatus status = new MetaProbeStatus();
// status.setId((short)1);
// probe.setStatus(status);
// probe.setDisplayName("test probe 22222");
// probe.setCidr("192.168.1.0/24");
// // probe.setAuthorizedDate(new Date());
// Member member = new Member();
// member.setId(1l);
// probe.setAuthorizeMember(member);
// // InfraHost infraHost = new InfraHost();
// // infraHost.setId(1);
// //
// // probe.setHost(infraHost);
// this.probeService.regist(probe);
// Assert.assertNotEquals(probe.getId(), 0);
// }
// public String getUUID() {
// return UUID.randomUUID().toString().replaceAll("-", "");
// }
// @Test
// public void tttt() {
// String uuid = UUID.randomUUID().toString();
// String uuid2 = uuid.replaceAll("-", "");
// System.out.println(uuid2);
// }
// @Test
// public void readAllByDomain() throws Exception {
// Domain domain = new Domain();
// domain.setId(1);
// List<Probe> probes = this.probeService.readAllByDomain(domain);
// Assert.assertEquals(probes.size(), 1);
// }
// @Ignore
@Test
public void regist() throws Exception {
// @Test
// public void readByProbeKey() throws Exception {
Probe probe = new Probe();
// regist();
// Probe probe = this.probeService.readByProbeKey("899fdd145bcc11e7b611080027658d13");
probe.setDescription("snoop probe");
// Assert.assertNotEquals(probe, null);
Domain domain = new Domain();
domain.setId(1);
// }
probe.setDomain(domain);
probe.setEncryptionKey(getUUID());
probe.setProbeKey(getUUID());
MetaProbeStatus status = new MetaProbeStatus();
status.setId((short)1);
probe.setStatus(status);
probe.setDisplayName("test probe 22222");
probe.setCidr("192.168.1.0/24");
// probe.setAuthorizedDate(new Date());
Member member = new Member();
member.setId(1l);
probe.setAuthorizeMember(member);
// InfraHost infraHost = new InfraHost();
// infraHost.setId(1);
//
// probe.setHost(infraHost);
this.probeService.regist(probe);
Assert.assertNotEquals(probe.getId(), 0);
}
public String getUUID() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
@Test
public void tttt() {
String uuid = UUID.randomUUID().toString();
String uuid2 = uuid.replaceAll("-", "");
System.out.println(uuid2);
}
@Test
public void readAllByDomain() throws Exception {
Domain domain = new Domain();
domain.setId(1);
List<Probe> probes = this.probeService.readAllByDomain(domain);
Assert.assertEquals(probes.size(), 1);
}
@Ignore
@Test
public void readByProbeKey() throws Exception {
regist();
Probe probe = this.probeService.readByProbeKey("899fdd145bcc11e7b611080027658d13");
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.probe.model.Probe;
import com.loafle.overflow.central.module.probe.model.ProbeTask;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import 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.ProbeTask;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
/**
* Created by snoop on 17. 6. 28.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class ProbeTaskServiceTest {
// /**
// * Created by snoop on 17. 6. 28.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class ProbeTaskServiceTest {
@Autowired
private ProbeTaskService probeTaskService;
// @Autowired
// private ProbeTaskService probeTaskService;
@Ignore
@Test
public void regist() throws Exception {
// @Ignore
// @Test
// public void regist() throws Exception {
ProbeTask probeTask = new ProbeTask();
// ProbeTask probeTask = new ProbeTask();
MetaProbeTaskType typeDiscovery = new MetaProbeTaskType();
typeDiscovery.setId((short)1);
// MetaProbeTaskType typeDiscovery = new MetaProbeTaskType();
// typeDiscovery.setId((short)1);
probeTask.setTaskType(typeDiscovery);
probeTask.setData("");
// probeTask.setTaskType(typeDiscovery);
// probeTask.setData("");
Probe probe = new Probe();
probe.setId(1);
// Probe probe = new Probe();
// 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
@Test
public void readAllByProbe() throws Exception {
// @Ignore
// @Test
// public void readAllByProbe() throws Exception {
regist();
// regist();
Probe probe = new Probe();
probe.setId(1);
// Probe probe = new Probe();
// 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.sensor.model.Sensor;
import com.loafle.overflow.central.module.sensor.model.SensorItem;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import 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.SensorItem;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
// import java.util.Date;
/**
* Created by insanity on 17. 6. 28.
*/
@Ignore
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class SensorItemServiceTest {
@Autowired
SensorItemService sensorItemService;
@Ignore
@Test
public void regist() throws Exception {
SensorItem sensorItem = new SensorItem();
sensorItem.setCreateDate(new Date());
MetaSensorDisplayItem item = new MetaSensorDisplayItem();
item.setId(1);
Sensor sensor = new Sensor();
sensor.setId(1);
sensorItem.setItem(item);
sensorItem.setSensor(sensor);
SensorItem res = this.sensorItemService.regist(sensorItem);
Assert.assertNotNull(res);
}
@Test
public void read() throws Exception {
SensorItem res = this.sensorItemService.read("1");
Assert.assertNotNull(res);
}
// /**
// * Created by insanity on 17. 6. 28.
// */
// @Ignore
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class SensorItemServiceTest {
// @Autowired
// SensorItemService sensorItemService;
// @Ignore
// @Test
// public void readAllBySensor() throws IOException {
// public void regist() throws Exception {
// SensorItem sensorItem = new SensorItem();
// sensorItem.setCreateDate(new Date());
// MetaSensorDisplayItem item = new MetaSensorDisplayItem();
// item.setId(1);
// Sensor sensor = new Sensor();
// sensor.setId(1);
// List<SensorItem> sensorItems = this.sensorItemService.readAllBySensor(sensor);
//
// ObjectMapper objectMapper = new ObjectMapper();
// String json = objectMapper.writeValueAsString(sensorItems);
// System.out.println(json);
// sensorItem.setItem(item);
// sensorItem.setSensor(sensor);
// SensorItem res = this.sensorItemService.regist(sensorItem);
// Assert.assertNotNull(res);
// }
// @Test
// public void read() throws Exception {
// SensorItem res = this.sensorItemService.read("1");
// Assert.assertNotNull(res);
// }
// // @Test
// // public void readAllBySensor() throws IOException {
// // Sensor sensor = new Sensor();
// // sensor.setId(1);
// // List<SensorItem> sensorItems = this.sensorItemService.readAllBySensor(sensor);
// //
// // ObjectMapper objectMapper = new ObjectMapper();
// // String json = objectMapper.writeValueAsString(sensorItems);
// // 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.MetaSensorStatus;
import com.loafle.overflow.central.module.sensor.model.Sensor;
import com.loafle.overflow.central.module.target.model.Target;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.meta.model.MetaCrawler;
// import com.loafle.overflow.central.module.meta.model.MetaSensorStatus;
// import com.loafle.overflow.central.module.sensor.model.Sensor;
// import com.loafle.overflow.central.module.target.model.Target;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.codehaus.jackson.map.ObjectMapper;
// import org.junit.Assert;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import java.io.IOException;
// import java.util.Date;
// import java.util.HashMap;
// import java.util.Map;
// /**
// * Created by insanity on 17. 6. 28.
// */
// //@Ignore
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class SensorServiceTest {
// @Autowired
// SensorService sensorService;
// @Autowired
// ObjectMapper objectMapper;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* Created by insanity on 17. 6. 28.
*/
// @Ignore
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class SensorServiceTest {
@Autowired
SensorService sensorService;
@Autowired
ObjectMapper objectMapper;
@Ignore
@Test
public void regist() throws Exception {
Sensor sensor = new Sensor();
MetaSensorStatus status = new MetaSensorStatus((short)1);
sensor.setStatus(status);
MetaCrawler crawler = new MetaCrawler();
crawler.setId((short)1);
sensor.setCrawler(crawler);
Target target = new Target();
target.setId(1);
sensor.setTarget(target);
sensor.setCreateDate(new Date());
Sensor res = this.sensorService.regist(sensor);
Assert.assertNotNull(res);
}
@Test
public void read() throws Exception {
Sensor res = this.sensorService.read("1");
Assert.assertNotNull(res);
ObjectMapper objectMapper = new ObjectMapper();
// String json = objectMapper.writeValueAsString(res);
String json = this.objectMapper.writeValueAsString(res);
System.out.println(json);
}
@Test
public void generateSensorConfig() throws IOException {
Sensor sensor = new Sensor();
sensor.setId(5);
String result = this.sensorService.generateSensorConfig(sensor);
System.out.println(result);
}
@Test
public void testJsonToMap() throws IOException {
String json = "{\"interval\":5}";
ObjectMapper objectMapper = new ObjectMapper();
Map<String, Object> mm = new HashMap<>();
mm = objectMapper.readValue(json, HashMap.class);
System.out.println(mm.get("interval"));
}
@Test
public void stringbbb() {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("222222222222222222222222222");
System.out.println(stringBuffer.toString());
stringBuffer.setLength(0);
System.out.println(stringBuffer.toString());
stringBuffer.append("3333333333");
System.out.println(stringBuffer.toString());
}
// @Test
// public void readAllByTarget() throws Exception {
// public void regist() throws Exception {
// Sensor sensor = new Sensor();
// MetaSensorStatus status = new MetaSensorStatus((short)1);
// sensor.setStatus(status);
// MetaCrawler crawler = new MetaCrawler();
// crawler.setId((short)1);
// sensor.setCrawler(crawler);
// Target target = new Target();
// target.setId(1);
// List<Sensor> sensors = this.sensorService.readAllByTarget(target);
//
// sensor.setTarget(target);
// sensor.setCreateDate(new Date());
// Sensor res = this.sensorService.regist(sensor);
// Assert.assertNotNull(res);
// }
// @Test
// public void read() throws Exception {
// Sensor res = this.sensorService.read("1");
// Assert.assertNotNull(res);
// ObjectMapper objectMapper = new ObjectMapper();
//
// String json = objectMapper.writeValueAsString(sensors);
//
// // String json = objectMapper.writeValueAsString(res);
// String json = this.objectMapper.writeValueAsString(res);
// System.out.println(json);
// }
// @Test
// public void readAllByTargetList() {
//
// Domain domain = new Domain();
// domain.setId(1);
//
// List<Sensor> sl = this.sensorService.readAllByDomain(domain);
//
// Assert.assertNotEquals(sl.size(), 0);
//
// public void generateSensorConfig() throws IOException {
// Sensor sensor = new Sensor();
// sensor.setId(5);
// String result = this.sensorService.generateSensorConfig(sensor);
// System.out.println(result);
// }
// @Test
// public void readAllByInfra() {
//
// Infra infra = new InfraMachine();
// infra.setId(1);
//
// List<Sensor> sl = this.sensorService.readAllByInfra(1);
//
// Assert.assertNotEquals(sl.size(), 0);
//
// public void testJsonToMap() throws IOException {
// String json = "{\"interval\":5}";
// ObjectMapper objectMapper = new ObjectMapper();
// Map<String, Object> mm = new HashMap<>();
// mm = objectMapper.readValue(json, HashMap.class);
// System.out.println(mm.get("interval"));
// }
// @Test
// public void stringbbb() {
// StringBuffer stringBuffer = new StringBuffer();
// stringBuffer.append("222222222222222222222222222");
// System.out.println(stringBuffer.toString());
// stringBuffer.setLength(0);
// System.out.println(stringBuffer.toString());
// stringBuffer.append("3333333333");
// System.out.println(stringBuffer.toString());
// }
// // @Test
// // public void readAllByTarget() throws Exception {
// // Target target = new Target();
// // target.setId(1);
// // List<Sensor> sensors = this.sensorService.readAllByTarget(target);
// //
// // ObjectMapper objectMapper = new ObjectMapper();
// //
// // String json = objectMapper.writeValueAsString(sensors);
// //
// // System.out.println(json);
// // }
// // @Test
// // public void readAllByTargetList() {
// //
// // Domain domain = new Domain();
// // domain.setId(1);
// //
// // List<Sensor> sl = this.sensorService.readAllByDomain(domain);
// //
// // Assert.assertNotEquals(sl.size(), 0);
// //
// // }
// // @Test
// // public void readAllByInfra() {
// //
// // Infra infra = new InfraMachine();
// // infra.setId(1);
// //
// // List<Sensor> sl = this.sensorService.readAllByInfra(1);
// //
// // 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.infra.model.Infra;
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.service.ProbeService;
import com.loafle.overflow.central.module.target.model.Target;
import com.loafle.overflow.central.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.domain.model.Domain;
// import com.loafle.overflow.central.module.infra.model.Infra;
// 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.service.ProbeService;
// import com.loafle.overflow.central.module.target.model.Target;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List;
// import java.util.List;
/**
* Created by insanity on 17. 6. 28.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class TargetDAOTest {
// /**
// * Created by insanity on 17. 6. 28.
// */
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class TargetDAOTest {
@Autowired
private TargetDAO targetDAO;
// @Autowired
// private TargetDAO targetDAO;
@Autowired
private ProbeService probeService;
// @Autowired
// private ProbeService probeService;
@Autowired
private InfraService infraService;
// @Autowired
// 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.spring.AppConfigTest;
import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ResourceLoader;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.probe.model.Probe;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.codehaus.jackson.map.DeserializationConfig;
// import org.codehaus.jackson.map.ObjectMapper;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.aop.support.AopUtils;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.core.io.ResourceLoader;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;
// import java.io.BufferedReader;
// import java.io.FileReader;
// import java.io.IOException;
// import java.lang.reflect.Method;
// import java.lang.reflect.ParameterizedType;
// import java.lang.reflect.Type;
// import java.util.List;
/**
* Created by snoop on 17. 6. 28.
*/
// /**
// * Created by snoop on 17. 6. 28.
// */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class TargetDiscoveryServiceTest {
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class TargetDiscoveryServiceTest {
@Autowired
private ResourceLoader resourceLoader;
// @Autowired
// private ResourceLoader resourceLoader;
@Autowired
private TargetDiscoveryService targetDiscoveryService;
// @Autowired
// private TargetDiscoveryService targetDiscoveryService;
@Ignore
@Test
public void saveAllTarget() throws Exception {
// @Ignore
// @Test
// 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.setId(1);
// Probe probe = new Probe();
// probe.setId(1);
// this.targetDiscoveryService.saveAllTarget(hosts, probe);
}
// // this.targetDiscoveryService.saveAllTarget(hosts, probe);
// }
private String readFileAsString(String filePath) throws IOException {
StringBuffer fileData = new StringBuffer();
BufferedReader reader = new BufferedReader(
new FileReader(filePath));
char[] buf = new char[1024];
int numRead=0;
while((numRead=reader.read(buf)) != -1){
String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData);
}
reader.close();
return fileData.toString();
}
// private String readFileAsString(String filePath) throws IOException {
// StringBuffer fileData = new StringBuffer();
// BufferedReader reader = new BufferedReader(
// new FileReader(filePath));
// char[] buf = new char[1024];
// int numRead=0;
// while((numRead=reader.read(buf)) != -1){
// String readData = String.valueOf(buf, 0, numRead);
// fileData.append(readData);
// }
// reader.close();
// return fileData.toString();
// }
@Ignore
@Test
public void testParam() throws NoSuchMethodException {
// @Ignore
// @Test
// public void testParam() throws NoSuchMethodException {
Method m = this.targetDiscoveryService.getClass().getMethod("saveAllTarget", List.class, Probe.class);
// Method m = TargetDiscoveryService.class.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);
Class<?> clazz = AopUtils.getTargetClass(this.targetDiscoveryService);
Method[] ms = clazz.getMethods();
// Class<?> clazz = AopUtils.getTargetClass(this.targetDiscoveryService);
// Method[] ms = clazz.getMethods();
Method sm = null;
for(Method mm : ms){
if ("saveAllTarget".equals(mm.getName())) {
sm = mm;
break;
}
}
// Method sm = null;
// for(Method mm : ms){
// if ("saveAllTarget".equals(mm.getName())) {
// sm = mm;
// break;
// }
// }
if (sm != null) {
Type[] ts = sm.getGenericParameterTypes();
for(Type t : ts){
if (t instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType)t;
System.out.println(pt.getActualTypeArguments()[0].getTypeName());
}
System.out.println(t.getTypeName());
// if (sm != null) {
// Type[] ts = sm.getGenericParameterTypes();
// for(Type t : ts){
// if (t instanceof ParameterizedType) {
// ParameterizedType pt = (ParameterizedType)t;
// System.out.println(pt.getActualTypeArguments()[0].getTypeName());
// }
// System.out.println(t.getTypeName());
}
}
// }
// }
System.out.println(m.getName());
Type[] genericParameterTypes = m.getGenericParameterTypes();
// System.out.println(m.getName());
// Type[] genericParameterTypes = m.getGenericParameterTypes();
for(Type genericParameterType : genericParameterTypes){
if(genericParameterType instanceof ParameterizedType){
ParameterizedType aType = (ParameterizedType) genericParameterType;
Type[] parameterArgTypes = aType.getActualTypeArguments();
for(Type parameterArgType : parameterArgTypes){
Class parameterArgClass = (Class) parameterArgType;
System.out.println("parameterArgClass = " + parameterArgClass);
}
}
}
}
// for(Type genericParameterType : genericParameterTypes){
// if(genericParameterType instanceof ParameterizedType){
// ParameterizedType aType = (ParameterizedType) genericParameterType;
// Type[] parameterArgTypes = aType.getActualTypeArguments();
// for(Type parameterArgType : parameterArgTypes){
// Class parameterArgClass = (Class) parameterArgType;
// System.out.println("parameterArgClass = " + parameterArgClass);
// }
// }
// }
// }
@Ignore
@Test
public void testName() throws ClassNotFoundException {
// @Ignore
// @Test
// public void testName() throws ClassNotFoundException {
Object o = this.targetDiscoveryService;
// Object o = this.targetDiscoveryService;
String nnn = o.getClass().getSimpleName();
System.out.println(nnn);
// String nnn = o.getClass().getSimpleName();
// 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.spring.AppConfigTest;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
// import com.loafle.overflow.central.module.target.model.Target;
// import com.loafle.overflow.central.spring.AppConfigTest;
// import org.junit.Assert;
// import org.junit.Ignore;
// import org.junit.Test;
// import org.junit.runner.RunWith;
// import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.test.context.ContextConfiguration;
// import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
// import java.util.Date;
/**
* Created by insanity on 17. 6. 28.
*/
// /**
// * Created by insanity on 17. 6. 28.
// */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfigTest.class})
public class TargetServiceTest {
@Autowired
TargetService targetService;
// @RunWith(SpringJUnit4ClassRunner.class)
// @ContextConfiguration(classes = {AppConfigTest.class})
// public class TargetServiceTest {
// @Autowired
// TargetService targetService;
@Ignore
@Test
public void regist() throws Exception {
Target t = new Target();
t.setCreateDate(new Date());
// Infra infra = new Infra();
// infra.setId(1);
// Probe probe = new Probe();
// probe.setId(1);
// t.setProbe(probe);
// t.setInfra(infra);
t.setDescription("i am target");
t.setDisplayName("ghost target");
// @Ignore
// @Test
// public void regist() throws Exception {
// Target t = new Target();
// t.setCreateDate(new Date());
// // Infra infra = new Infra();
// // infra.setId(1);
// // Probe probe = new Probe();
// // probe.setId(1);
// // t.setProbe(probe);
// // t.setInfra(infra);
// t.setDescription("i am target");
// t.setDisplayName("ghost target");
Target res = this.targetService.regist(t);
Assert.assertNotNull(res);
}
// Target res = this.targetService.regist(t);
// Assert.assertNotNull(res);
// }
@Test
public void read() throws Exception {
Target res = this.targetService.read("1");
Assert.assertNotNull(res);
}
}
// @Test
// public void read() throws Exception {
// Target res = this.targetService.read("1");
// Assert.assertNotNull(res);
// }
// }