spring change

This commit is contained in:
geek
2017-06-22 17:56:56 +09:00
parent 37b9da0f66
commit 25f8293205
51 changed files with 1436 additions and 1239 deletions

View File

@@ -1,36 +1,36 @@
package com.loafle.overflow.agent.dao;
import com.loafle.overflow.module.agent.dao.JPAAgentDAO;
import com.loafle.overflow.module.agent.model.Agent;
import com.loafle.overflow.module.member.model.Member;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
/**
* Created by root on 17. 6. 4.
*/
@Ignore
public class JPAAgentDAOTest {
private JPAAgentDAO jpaAgentDAO = null;
@Before
public void before() {
this.jpaAgentDAO = new JPAAgentDAO();
}
@Test
public void createAgent() {
Member m = new Member();
m.setId(Long.valueOf(1));
Agent agent = new Agent();
agent.setDescription("test agent");
agent.setMember(m);
Agent savedAgent = jpaAgentDAO.create(agent);
System.out.println(savedAgent.getDescription());
}
}
//package com.loafle.overflow.agent.dao;
//
//import com.loafle.overflow.module.agent.dao.JPAAgentDAO;
//import com.loafle.overflow.module.agent.model.Agent;
//import com.loafle.overflow.module.member.model.Member;
//import org.junit.Before;
//import org.junit.Ignore;
//import org.junit.Test;
//
///**
// * Created by root on 17. 6. 4.
// */
//@Ignore
//public class JPAAgentDAOTest {
//
// private JPAAgentDAO jpaAgentDAO = null;
//
// @Before
// public void before() {
// this.jpaAgentDAO = new JPAAgentDAO();
// }
//
//
// @Test
// public void createAgent() {
// Member m = new Member();
// m.setId(Long.valueOf(1));
// Agent agent = new Agent();
// agent.setDescription("test agent");
// agent.setMember(m);
// Agent savedAgent = jpaAgentDAO.create(agent);
//
// System.out.println(savedAgent.getDescription());
// }
//
//}

View File

@@ -1,54 +1,54 @@
package com.loafle.overflow.apikey.dao;
import com.loafle.overflow.module.apikey.dao.JPAApiKeyDao;
import com.loafle.overflow.module.apikey.model.Apikey;
import com.loafle.overflow.module.member.model.Member;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.util.Date;
/**
* Created by root on 17. 6. 4.
*/
public class JPAApiKeyDaoTest {
private JPAApiKeyDao jpaApiKeyDao;
@Before
public void Before() {
this.jpaApiKeyDao = new JPAApiKeyDao();
}
@Ignore
@Test
public void findByApiKey() throws Exception {
Apikey apikey = new Apikey();
apikey.setApiKey("1111111");
Apikey a = this.jpaApiKeyDao.findByApiKey(apikey);
System.out.println(a.getId());
}
@Ignore
@Test
public void createApiKey() {
Apikey apikey = new Apikey();
apikey.setApiKey("1111111");
apikey.setCreateDate(new Date());
Member member = new Member();
member.setId((long)2);
apikey.setMember(member);
jpaApiKeyDao.create(apikey);
}
}
//package com.loafle.overflow.apikey.dao;
//
//import com.loafle.overflow.module.apikey.dao.JPAApiKeyDao;
//import com.loafle.overflow.module.apikey.model.Apikey;
//import com.loafle.overflow.module.member.model.Member;
//import org.junit.Before;
//import org.junit.Ignore;
//import org.junit.Test;
//
//import java.util.Date;
//
///**
// * Created by root on 17. 6. 4.
// */
//public class JPAApiKeyDaoTest {
//
// private JPAApiKeyDao jpaApiKeyDao;
//
// @Before
// public void Before() {
// this.jpaApiKeyDao = new JPAApiKeyDao();
// }
//
//
// @Ignore
// @Test
// public void findByApiKey() throws Exception {
//
// Apikey apikey = new Apikey();
//
// apikey.setApiKey("1111111");
//
// Apikey a = this.jpaApiKeyDao.findByApiKey(apikey);
//
// System.out.println(a.getId());
//
// }
//
// @Ignore
// @Test
// public void createApiKey() {
// Apikey apikey = new Apikey();
//
// apikey.setApiKey("1111111");
// apikey.setCreateDate(new Date());
// Member member = new Member();
// member.setId((long)2);
// apikey.setMember(member);
//
//
// jpaApiKeyDao.create(apikey);
// }
//
//}

View File

@@ -1,78 +1,78 @@
package com.loafle.overflow.crawler.dao;
import com.loafle.overflow.module.crawler.dao.JPACrawlerDAO;
import com.loafle.overflow.module.crawler.model.Crawler;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
/**
* Created by geek@loafle.com on 17. 6. 8.
*/
@Ignore
public class JPACrawlerDAOTest {
private JPACrawlerDAO jpaCrawlerDAO = null;
@Before
public void before() {
this.jpaCrawlerDAO = new JPACrawlerDAO();
}
// TODO Crawler Meta Data Insert
@Test
public void TestInsertList() {
List<Crawler> crawlers = new ArrayList<Crawler>();
Crawler crawler1 = new Crawler();
crawler1.setName("SNMP Crawler");
crawler1.setDescription("SNMP Crawler");
crawler1.setCrawlerType("SNMP");
Crawler crawler2 = new Crawler();
crawler2.setName("WMI Crawler");
crawler2.setDescription("WMI Crawler");
crawler2.setCrawlerType("WMI");
Crawler crawler3 = new Crawler();
crawler3.setName("HTTP Crawler");
crawler3.setDescription("HTTP Crawler");
crawler3.setCrawlerType("Network");
Crawler crawler4 = new Crawler();
crawler4.setName("FTP Crawler");
crawler4.setDescription("FTP Crawler");
crawler4.setCrawlerType("Network");
crawlers.add(crawler1);
crawlers.add(crawler2);
crawlers.add(crawler3);
crawlers.add(crawler4);
this.jpaCrawlerDAO.createAll(crawlers);
}
@Test
public void TestInsert() {
Crawler crawler = new Crawler();
crawler.setName("Mysql Crawler");
crawler.setDescription("Mysql Crawler");
crawler.setCrawlerType("MysqlCrawler");
this.jpaCrawlerDAO.create(crawler);
}
// TODO Crawler Select Test
@Test
public void TestListAll() {
List<Crawler> ls = this.jpaCrawlerDAO.findAll();
System.out.println(ls.size());
}
// TODO Crawler Update Test
// TODO Crawler Delete Test
}
//package com.loafle.overflow.crawler.dao;
//
//
//import com.loafle.overflow.module.crawler.dao.JPACrawlerDAO;
//import com.loafle.overflow.module.crawler.model.Crawler;
//import org.junit.Before;
//import org.junit.Ignore;
//import org.junit.Test;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by geek@loafle.com on 17. 6. 8.
// */
//@Ignore
//public class JPACrawlerDAOTest {
//
// private JPACrawlerDAO jpaCrawlerDAO = null;
//
// @Before
// public void before() {
// this.jpaCrawlerDAO = new JPACrawlerDAO();
//
// }
//
// // TODO Crawler Meta Data Insert
// @Test
// public void TestInsertList() {
// List<Crawler> crawlers = new ArrayList<Crawler>();
//
// Crawler crawler1 = new Crawler();
// crawler1.setName("SNMP Crawler");
// crawler1.setDescription("SNMP Crawler");
// crawler1.setCrawlerType("SNMP");
//
// Crawler crawler2 = new Crawler();
// crawler2.setName("WMI Crawler");
// crawler2.setDescription("WMI Crawler");
// crawler2.setCrawlerType("WMI");
//
// Crawler crawler3 = new Crawler();
// crawler3.setName("HTTP Crawler");
// crawler3.setDescription("HTTP Crawler");
// crawler3.setCrawlerType("Network");
//
// Crawler crawler4 = new Crawler();
// crawler4.setName("FTP Crawler");
// crawler4.setDescription("FTP Crawler");
// crawler4.setCrawlerType("Network");
//
// crawlers.add(crawler1);
// crawlers.add(crawler2);
// crawlers.add(crawler3);
// crawlers.add(crawler4);
//
// this.jpaCrawlerDAO.createAll(crawlers);
// }
//
// @Test
// public void TestInsert() {
// Crawler crawler = new Crawler();
// crawler.setName("Mysql Crawler");
// crawler.setDescription("Mysql Crawler");
// crawler.setCrawlerType("MysqlCrawler");
// this.jpaCrawlerDAO.create(crawler);
// }
// // TODO Crawler Select Test
//
// @Test
// public void TestListAll() {
// List<Crawler> ls = this.jpaCrawlerDAO.findAll();
// System.out.println(ls.size());
// }
// // TODO Crawler Update Test
//
// // TODO Crawler Delete Test
//}

View File

@@ -1,62 +1,62 @@
package com.loafle.overflow.crawler.dao;
import com.loafle.overflow.module.crawler.dao.JPACrawlerInputItemDAO;
import com.loafle.overflow.module.crawler.model.CrawlerInputItem;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
/**
* Created by geek@loafle.com on 17. 6. 8.
*/
@Ignore
public class JPACrawlerInputItemDAOTest {
private JPACrawlerInputItemDAO inputItemDAO = null;
@Before
public void before() {
this.inputItemDAO = new JPACrawlerInputItemDAO();
}
@Test
public void TestInsertList() {
List<CrawlerInputItem> cris = new ArrayList<CrawlerInputItem>();
CrawlerInputItem item1 = new CrawlerInputItem();
item1.setName("ID");
item1.setDataType("String");
item1.setDescription("Auth ID");
CrawlerInputItem item2 = new CrawlerInputItem();
item2.setName("PW");
item2.setDataType("String");
item2.setDescription("Auth PW");
CrawlerInputItem item3 = new CrawlerInputItem();
item3.setName("AuthType");
item3.setDataType("Select");
item3.setDescription("MD5||SHA");
CrawlerInputItem item4 = new CrawlerInputItem();
item4.setName("community");
item4.setDataType("String");
item4.setDescription("community");
CrawlerInputItem item5 = new CrawlerInputItem();
item5.setName("textfield");
item5.setDataType("String");
item5.setDescription("User ID");
cris.add(item1);
cris.add(item2);
cris.add(item3);
cris.add(item4);
cris.add(item5);
this.inputItemDAO.createAll(cris);
}
}
//package com.loafle.overflow.crawler.dao;
//
//import com.loafle.overflow.module.crawler.dao.JPACrawlerInputItemDAO;
//import com.loafle.overflow.module.crawler.model.CrawlerInputItem;
//import org.junit.Before;
//import org.junit.Ignore;
//import org.junit.Test;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by geek@loafle.com on 17. 6. 8.
// */
//@Ignore
//public class JPACrawlerInputItemDAOTest {
//
// private JPACrawlerInputItemDAO inputItemDAO = null;
//
// @Before
// public void before() {
// this.inputItemDAO = new JPACrawlerInputItemDAO();
// }
//
// @Test
// public void TestInsertList() {
// List<CrawlerInputItem> cris = new ArrayList<CrawlerInputItem>();
//
// CrawlerInputItem item1 = new CrawlerInputItem();
// item1.setName("ID");
// item1.setDataType("String");
// item1.setDescription("Auth ID");
//
// CrawlerInputItem item2 = new CrawlerInputItem();
// item2.setName("PW");
// item2.setDataType("String");
// item2.setDescription("Auth PW");
//
// CrawlerInputItem item3 = new CrawlerInputItem();
// item3.setName("AuthType");
// item3.setDataType("Select");
// item3.setDescription("MD5||SHA");
//
// CrawlerInputItem item4 = new CrawlerInputItem();
// item4.setName("community");
// item4.setDataType("String");
// item4.setDescription("community");
//
// CrawlerInputItem item5 = new CrawlerInputItem();
// item5.setName("textfield");
// item5.setDataType("String");
// item5.setDescription("User ID");
//
// cris.add(item1);
// cris.add(item2);
// cris.add(item3);
// cris.add(item4);
// cris.add(item5);
//
// this.inputItemDAO.createAll(cris);
// }
//}

View File

@@ -1,89 +1,89 @@
package com.loafle.overflow.crawler.dao;
import com.loafle.overflow.module.crawler.dao.JPACrawlerInputItemMappingDAO;
import com.loafle.overflow.module.crawler.model.Crawler;
import com.loafle.overflow.module.crawler.model.CrawlerInputItem;
import com.loafle.overflow.module.crawler.model.CrawlerInputItemMapping;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
/**
* Created by geek@loafle.com on 17. 6. 8.
*/
@Ignore
public class JPACrawlerInputItemMappingDAOTest {
private JPACrawlerInputItemMappingDAO mappingDAO = null;
@Before
public void before() {
this.mappingDAO = new JPACrawlerInputItemMappingDAO();
}
@Test
public void TestInsert() {
CrawlerInputItemMapping itemMapping = new CrawlerInputItemMapping();
itemMapping.setCrawler(new Crawler((long)5));
itemMapping.setCrawlerInputItem(new CrawlerInputItem((long)1));
itemMapping.setPriority((short) 1);
itemMapping.setRequiredType(true);
CrawlerInputItemMapping itemMapping1 = new CrawlerInputItemMapping();
itemMapping1.setCrawler(new Crawler((long)5));
itemMapping1.setCrawlerInputItem(new CrawlerInputItem((long)2));
itemMapping1.setPriority((short) 2);
itemMapping1.setRequiredType(true);
CrawlerInputItemMapping itemMapping2 = new CrawlerInputItemMapping();
itemMapping2.setCrawler(new Crawler((long)1));
itemMapping2.setCrawlerInputItem(new CrawlerInputItem((long)1));
itemMapping2.setPriority((short) 1);
itemMapping2.setRequiredType(true);
CrawlerInputItemMapping itemMapping3 = new CrawlerInputItemMapping();
itemMapping3.setCrawler(new Crawler((long)1));
itemMapping3.setCrawlerInputItem(new CrawlerInputItem((long)2));
itemMapping3.setPriority((short) 2);
itemMapping3.setRequiredType(true);
CrawlerInputItemMapping itemMapping4 = new CrawlerInputItemMapping();
itemMapping4.setCrawler(new Crawler((long)1));
itemMapping4.setCrawlerInputItem(new CrawlerInputItem((long)3));
itemMapping4.setPriority((short) 3);
itemMapping4.setRequiredType(true);
CrawlerInputItemMapping itemMapping5 = new CrawlerInputItemMapping();
itemMapping5.setCrawler(new Crawler((long)2));
itemMapping5.setCrawlerInputItem(new CrawlerInputItem((long)1));
itemMapping5.setPriority((short) 1);
itemMapping5.setRequiredType(true);
CrawlerInputItemMapping itemMapping6 = new CrawlerInputItemMapping();
itemMapping6.setCrawler(new Crawler((long)2));
itemMapping6.setCrawlerInputItem(new CrawlerInputItem((long)2));
itemMapping6.setPriority((short) 2);
itemMapping6.setRequiredType(true);
List<CrawlerInputItemMapping> crs = new ArrayList<CrawlerInputItemMapping>();
crs.add(itemMapping);
crs.add(itemMapping1);
crs.add(itemMapping2);
crs.add(itemMapping3);
crs.add(itemMapping4);
crs.add(itemMapping5);
crs.add(itemMapping6);
this.mappingDAO.createAll(crs);
}
@Test
public void TestFindByCrawlerId() {
List<CrawlerInputItemMapping> ls = this.mappingDAO.findByCrawlerId(new Crawler((long)5));
System.out.println(ls.size());
}
}
//package com.loafle.overflow.crawler.dao;
//
//import com.loafle.overflow.module.crawler.dao.JPACrawlerInputItemMappingDAO;
//import com.loafle.overflow.module.crawler.model.Crawler;
//import com.loafle.overflow.module.crawler.model.CrawlerInputItem;
//import com.loafle.overflow.module.crawler.model.CrawlerInputItemMapping;
//import org.junit.Before;
//import org.junit.Ignore;
//import org.junit.Test;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by geek@loafle.com on 17. 6. 8.
// */
//@Ignore
//public class JPACrawlerInputItemMappingDAOTest {
//
// private JPACrawlerInputItemMappingDAO mappingDAO = null;
//
// @Before
// public void before() {
// this.mappingDAO = new JPACrawlerInputItemMappingDAO();
// }
//
// @Test
// public void TestInsert() {
// CrawlerInputItemMapping itemMapping = new CrawlerInputItemMapping();
// itemMapping.setCrawler(new Crawler((long)5));
// itemMapping.setCrawlerInputItem(new CrawlerInputItem((long)1));
// itemMapping.setPriority((short) 1);
// itemMapping.setRequiredType(true);
//
// CrawlerInputItemMapping itemMapping1 = new CrawlerInputItemMapping();
// itemMapping1.setCrawler(new Crawler((long)5));
// itemMapping1.setCrawlerInputItem(new CrawlerInputItem((long)2));
// itemMapping1.setPriority((short) 2);
// itemMapping1.setRequiredType(true);
//
// CrawlerInputItemMapping itemMapping2 = new CrawlerInputItemMapping();
// itemMapping2.setCrawler(new Crawler((long)1));
// itemMapping2.setCrawlerInputItem(new CrawlerInputItem((long)1));
// itemMapping2.setPriority((short) 1);
// itemMapping2.setRequiredType(true);
//
// CrawlerInputItemMapping itemMapping3 = new CrawlerInputItemMapping();
// itemMapping3.setCrawler(new Crawler((long)1));
// itemMapping3.setCrawlerInputItem(new CrawlerInputItem((long)2));
// itemMapping3.setPriority((short) 2);
// itemMapping3.setRequiredType(true);
//
// CrawlerInputItemMapping itemMapping4 = new CrawlerInputItemMapping();
// itemMapping4.setCrawler(new Crawler((long)1));
// itemMapping4.setCrawlerInputItem(new CrawlerInputItem((long)3));
// itemMapping4.setPriority((short) 3);
// itemMapping4.setRequiredType(true);
//
// CrawlerInputItemMapping itemMapping5 = new CrawlerInputItemMapping();
// itemMapping5.setCrawler(new Crawler((long)2));
// itemMapping5.setCrawlerInputItem(new CrawlerInputItem((long)1));
// itemMapping5.setPriority((short) 1);
// itemMapping5.setRequiredType(true);
//
// CrawlerInputItemMapping itemMapping6 = new CrawlerInputItemMapping();
// itemMapping6.setCrawler(new Crawler((long)2));
// itemMapping6.setCrawlerInputItem(new CrawlerInputItem((long)2));
// itemMapping6.setPriority((short) 2);
// itemMapping6.setRequiredType(true);
//
// List<CrawlerInputItemMapping> crs = new ArrayList<CrawlerInputItemMapping>();
// crs.add(itemMapping);
// crs.add(itemMapping1);
// crs.add(itemMapping2);
// crs.add(itemMapping3);
// crs.add(itemMapping4);
// crs.add(itemMapping5);
// crs.add(itemMapping6);
//
// this.mappingDAO.createAll(crs);
// }
//
// @Test
// public void TestFindByCrawlerId() {
// List<CrawlerInputItemMapping> ls = this.mappingDAO.findByCrawlerId(new Crawler((long)5));
// System.out.println(ls.size());
// }
//
//}

View File

@@ -1,77 +1,77 @@
package com.loafle.overflow.email.dao;
import com.loafle.overflow.module.email.dao.JPAEmailAuthDAO;
import com.loafle.overflow.module.email.model.EmailAuth;
import com.loafle.overflow.module.member.model.Member;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.util.Date;
import java.util.List;
/**
* Created by geek@loafle.com on 17. 6. 6.
*/
@Ignore
public class JPAEmailAuthDAOTest {
private JPAEmailAuthDAO emailAuthDAO = null;
@Before
public void before() {
this.emailAuthDAO = new JPAEmailAuthDAO();
}
@Test
@Ignore
public void createEmailAuth() {
EmailAuth auth = new EmailAuth();
auth.setAuthToken("0F2003A6-83B0-40F5-B56A-0485F458CA911");
auth.setMember(new Member(Long.valueOf(1)));
auth.setIsInvalid(false);
//package com.loafle.overflow.email.dao;
//
//import com.loafle.overflow.module.email.dao.JPAEmailAuthDAO;
//import com.loafle.overflow.module.email.model.EmailAuth;
//import com.loafle.overflow.module.member.model.Member;
//import org.junit.Assert;
//import org.junit.Before;
//import org.junit.Ignore;
//import org.junit.Test;
//
//import java.util.Date;
//import java.util.List;
//
///**
// * Created by geek@loafle.com on 17. 6. 6.
// */
//@Ignore
//public class JPAEmailAuthDAOTest {
//
// private JPAEmailAuthDAO emailAuthDAO = null;
//
// @Before
// public void before() {
//
// this.emailAuthDAO = new JPAEmailAuthDAO();
// }
//
// @Test
// @Ignore
// public void createEmailAuth() {
// EmailAuth auth = new EmailAuth();
//
// auth.setAuthToken("0F2003A6-83B0-40F5-B56A-0485F458CA911");
// auth.setMember(new Member(Long.valueOf(1)));
// auth.setIsInvalid(false);
//// auth.setUpdateDate(new Date());
// auth.setIsConfirm(false);
// EmailAuth ret = emailAuthDAO.create(auth);
// System.out.println(ret.getId());
// }
//
// @Test
// @Ignore
// public void updateEmailAuth() {
// EmailAuth auth = this.emailAuthDAO.find("1");
//
// auth.setIsInvalid(true);
// auth.setUpdateDate(new Date());
auth.setIsConfirm(false);
EmailAuth ret = emailAuthDAO.create(auth);
System.out.println(ret.getId());
}
@Test
@Ignore
public void updateEmailAuth() {
EmailAuth auth = this.emailAuthDAO.find("1");
auth.setIsInvalid(true);
auth.setUpdateDate(new Date());
auth.setConfirmDate(new Date());
this.emailAuthDAO.update(auth);
System.out.println(auth.getConfirmDate());
}
@Test
@Ignore
public void TestFindByAuthToken() {
EmailAuth auth = new EmailAuth();
auth.setAuthToken("3C03F8AB-1D4D-4C8A-8C36-EE2D644988B5");
EmailAuth temp = this.emailAuthDAO.findByAuthToken(auth);
System.out.println(temp.getId());
Assert.assertNotNull(temp);
}
@Test
@Ignore
public void TestFindByMemberId() {
EmailAuth auth = new EmailAuth();
auth.setMember(new Member((long)4));
List<EmailAuth> ems = this.emailAuthDAO.findByMemberId(auth);
System.out.println(ems.get(0).getMember().getEmail());
Assert.assertEquals((long)1, (long)ems.size());
}
}
// auth.setConfirmDate(new Date());
//
// this.emailAuthDAO.update(auth);
// System.out.println(auth.getConfirmDate());
// }
//
// @Test
// @Ignore
// public void TestFindByAuthToken() {
// EmailAuth auth = new EmailAuth();
// auth.setAuthToken("3C03F8AB-1D4D-4C8A-8C36-EE2D644988B5");
//
// EmailAuth temp = this.emailAuthDAO.findByAuthToken(auth);
//
// System.out.println(temp.getId());
// Assert.assertNotNull(temp);
// }
//
// @Test
// @Ignore
// public void TestFindByMemberId() {
// EmailAuth auth = new EmailAuth();
// auth.setMember(new Member((long)4));
// List<EmailAuth> ems = this.emailAuthDAO.findByMemberId(auth);
//
// System.out.println(ems.get(0).getMember().getEmail());
// Assert.assertEquals((long)1, (long)ems.size());
// }
//}

View File

@@ -1,42 +1,42 @@
package com.loafle.overflow.member.dao;
import com.loafle.overflow.module.member.dao.JPAMemberDAO;
import com.loafle.overflow.module.member.model.Member;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
/**
* Created by root on 17. 6. 4.
*/
@Ignore
public class JPAMemberDAOTest {
private JPAMemberDAO jpaMemberDAO = null;
@Before
public void before() {
this.jpaMemberDAO = new JPAMemberDAO();
}
@Test
public void findByEmail() throws Exception {
}
// @Ignore
@Test
public void createMember() {
Member m = new Member();
m.setName("geek");
m.setCompany("loafle");
m.setDigest("bbbbbbbbb");
m.setPwSalt("salktttt");
m.setPhone("000-000-0000");
m.setEmail("geek@loafle.com");
this.jpaMemberDAO.create(m);
}
}
//package com.loafle.overflow.member.dao;
//
//import com.loafle.overflow.module.member.dao.JPAMemberDAO;
//import com.loafle.overflow.module.member.model.Member;
//import org.junit.Before;
//import org.junit.Ignore;
//import org.junit.Test;
//
///**
// * Created by root on 17. 6. 4.
// */
//@Ignore
//public class JPAMemberDAOTest {
//
// private JPAMemberDAO jpaMemberDAO = null;
//
// @Before
// public void before() {
//
// this.jpaMemberDAO = new JPAMemberDAO();
// }
//
// @Test
// public void findByEmail() throws Exception {
// }
//
//// @Ignore
// @Test
// public void createMember() {
// Member m = new Member();
//
// m.setName("geek");
// m.setCompany("loafle");
// m.setDigest("bbbbbbbbb");
// m.setPwSalt("salktttt");
// m.setPhone("000-000-0000");
// m.setEmail("geek@loafle.com");
//
// this.jpaMemberDAO.create(m);
// }
//
//}

View File

@@ -0,0 +1,38 @@
package com.loafle.overflow.module.member.dao;
import com.loafle.overflow.AppConfig;
import com.loafle.overflow.JdbcConfiguration;
import com.loafle.overflow.module.member.model.Member;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.*;
/**
* Created by root on 17. 6. 22.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
public class MemberDAOTest {
@Autowired
private MemberDAO repo;
@Test
public void createMember() {
Member m = new Member();
m.setName("insanity2");
m.setCompany("loafle");
m.setDigest("bbbbbbbbb");
m.setPwSalt("salktttt");
m.setPhone("000-000-0000");
m.setEmail("insanity1@loafle.com");
repo.save(m);
}
}

View File

@@ -1,58 +1,58 @@
package com.loafle.overflow.noauthagent.dao;
import com.loafle.overflow.module.noauthagent.dao.JPANoAuthAgentDAO;
import com.loafle.overflow.module.noauthagent.model.NoAuthAgent;
import com.loafle.overflow.module.noauthagent.type.AuthType;
import org.junit.Before;
import org.junit.Test;
import java.util.Date;
/**
* Created by root on 17. 6. 4.
*/
public class JPANoAuthAgentDAOTest {
private JPANoAuthAgentDAO jpaNoAuthAgentDAO = null;
@Before
public void Before() {
this.jpaNoAuthAgentDAO = new JPANoAuthAgentDAO();
}
@Test
public void findByTempKey() throws Exception {
NoAuthAgent noAuthAgent = new NoAuthAgent();
noAuthAgent.setTempKey("3398473-90847903874");
NoAuthAgent aa = this.jpaNoAuthAgentDAO.findByTempKey(noAuthAgent);
System.out.println(aa.getAuthStatus());
}
@Test
public void findAllByNoAuth() throws Exception {
}
@Test
public void createNoAuthAgent() {
NoAuthAgent noAuthAgent = new NoAuthAgent();
noAuthAgent.setApiKey("aaaaaaa");
noAuthAgent.setDate(new Date());
noAuthAgent.setHostName("Snoop pc");
noAuthAgent.setLocalIP(4123);
noAuthAgent.setTempKey("3398473-90847903874");
noAuthAgent.setAuthStatus(AuthType.WAIT);
this.jpaNoAuthAgentDAO.create(noAuthAgent);
}
}
//package com.loafle.overflow.noauthagent.dao;
//
//import com.loafle.overflow.module.noauthagent.dao.JPANoAuthAgentDAO;
//import com.loafle.overflow.module.noauthagent.model.NoAuthAgent;
//import com.loafle.overflow.module.noauthagent.type.AuthType;
//import org.junit.Before;
//import org.junit.Test;
//
//import java.util.Date;
//
///**
// * Created by root on 17. 6. 4.
// */
//public class JPANoAuthAgentDAOTest {
//
// private JPANoAuthAgentDAO jpaNoAuthAgentDAO = null;
//
// @Before
// public void Before() {
// this.jpaNoAuthAgentDAO = new JPANoAuthAgentDAO();
// }
//
// @Test
// public void findByTempKey() throws Exception {
//
// NoAuthAgent noAuthAgent = new NoAuthAgent();
// noAuthAgent.setTempKey("3398473-90847903874");
//
// NoAuthAgent aa = this.jpaNoAuthAgentDAO.findByTempKey(noAuthAgent);
//
// System.out.println(aa.getAuthStatus());
//
// }
//
// @Test
// public void findAllByNoAuth() throws Exception {
// }
//
//
// @Test
// public void createNoAuthAgent() {
// NoAuthAgent noAuthAgent = new NoAuthAgent();
//
//
// noAuthAgent.setApiKey("aaaaaaa");
// noAuthAgent.setDate(new Date());
// noAuthAgent.setHostName("Snoop pc");
// noAuthAgent.setLocalIP(4123);
// noAuthAgent.setTempKey("3398473-90847903874");
// noAuthAgent.setAuthStatus(AuthType.WAIT);
//
// this.jpaNoAuthAgentDAO.create(noAuthAgent);
// }
//
//
//
//
//}

View File

@@ -1,55 +1,55 @@
package com.loafle.overflow.sensor.dao;
import com.loafle.overflow.module.crawler.model.Crawler;
import com.loafle.overflow.module.sensor.dao.JPASensorDao;
import com.loafle.overflow.module.sensor.dao.SensorDao;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
/**
* Created by root on 17. 6. 9.
*/
public class JPASensorDaoTest {
private SensorDao sensorDao = null;
@Before
public void before() {
this.sensorDao = new JPASensorDao();
}
@Test
public void findAllByAgentID() throws Exception {
}
@Ignore
@Test
public void create() {
Sensor sensor = new Sensor();
Crawler crawler = new Crawler();
crawler.setId(1L);
Target target = new Target();
target.setId(1L);
sensor.setCrawler(crawler);
sensor.setInterval(1);
sensor.setNotification("nothing");
sensor.setTarget(target);
this.sensorDao.create(sensor);
}
@Test
public void list() {
// this.sensorDao.findAllByAgentID()
}
}
//package com.loafle.overflow.sensor.dao;
//
//import com.loafle.overflow.module.crawler.model.Crawler;
//import com.loafle.overflow.module.sensor.dao.JPASensorDao;
//import com.loafle.overflow.module.sensor.dao.SensorDao;
//import org.junit.Before;
//import org.junit.Ignore;
//import org.junit.Test;
//
///**
// * Created by root on 17. 6. 9.
// */
//public class JPASensorDaoTest {
//
// private SensorDao sensorDao = null;
//
// @Before
// public void before() {
// this.sensorDao = new JPASensorDao();
// }
//
// @Test
// public void findAllByAgentID() throws Exception {
// }
//
//
// @Ignore
// @Test
// public void create() {
//
//
// Sensor sensor = new Sensor();
//
// Crawler crawler = new Crawler();
// crawler.setId(1L);
//
// Target target = new Target();
// target.setId(1L);
//
// sensor.setCrawler(crawler);
// sensor.setInterval(1);
// sensor.setNotification("nothing");
// sensor.setTarget(target);
//
// this.sensorDao.create(sensor);
//
// }
//
// @Test
// public void list() {
//
//// this.sensorDao.findAllByAgentID()
// }
//
//}

View File

@@ -1,36 +1,36 @@
package com.loafle.overflow.sensor.dao;
import com.loafle.overflow.module.sensor.dao.JPASensorItemCategoryDao;
import com.loafle.overflow.module.sensor.dao.SensorItemCategoryDao;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
/**
* Created by root on 17. 6. 9.
*/
public class JPASensorItemCategoryDaoTest {
private SensorItemCategoryDao sensorItemCategoryDao = null;
@Before
public void before() {
this.sensorItemCategoryDao = new JPASensorItemCategoryDao();
}
@Ignore
@Test
public void create() {
SensorItemCategory sensorItemCategory = new SensorItemCategory();
sensorItemCategory.setName("count");
sensorItemCategory.setDescription("count !!!!");
this.sensorItemCategoryDao.create(sensorItemCategory);
}
}
//package com.loafle.overflow.sensor.dao;
//
//import com.loafle.overflow.module.sensor.dao.JPASensorItemCategoryDao;
//import com.loafle.overflow.module.sensor.dao.SensorItemCategoryDao;
//import org.junit.Before;
//import org.junit.Ignore;
//import org.junit.Test;
//
///**
// * Created by root on 17. 6. 9.
// */
//public class JPASensorItemCategoryDaoTest {
//
// private SensorItemCategoryDao sensorItemCategoryDao = null;
//
// @Before
// public void before() {
//
// this.sensorItemCategoryDao = new JPASensorItemCategoryDao();
// }
//
//
// @Ignore
// @Test
// public void create() {
//
// SensorItemCategory sensorItemCategory = new SensorItemCategory();
//
// sensorItemCategory.setName("count");
// sensorItemCategory.setDescription("count !!!!");
//
// this.sensorItemCategoryDao.create(sensorItemCategory);
//
// }
//
//}

View File

@@ -1,61 +1,61 @@
package com.loafle.overflow.sensor.dao;
import com.loafle.overflow.module.crawler.model.Crawler;
import com.loafle.overflow.module.sensor.dao.JPASensorItemDao;
import com.loafle.overflow.module.sensor.dao.SensorItemDao;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.util.List;
/**
* Created by root on 17. 6. 9.
*/
public class JPASensorItemDaoTest {
private SensorItemDao sensorItemDao = null;
@Before
public void before() {
this.sensorItemDao = new JPASensorItemDao();
}
@Ignore
@Test
public void create() {
SensorItem sensorItem = new SensorItem();
Crawler crawler = new Crawler();
crawler.setId(1L);
SensorItemCategory category = new SensorItemCategory();
category.setId(1L);
sensorItem.setCrawler(crawler);
sensorItem.setDataType("int");
sensorItem.setDescription("count getget");
sensorItem.setName("net.mysql.connection_count");
sensorItem.setSensorItemCategory(category);
this.sensorItemDao.create(sensorItem);
}
@Ignore
@Test
public void list() {
Crawler crawler = new Crawler();
crawler.setId(1L);
List<SensorItem> is = this.sensorItemDao.findAllByCrawlerId(crawler);
System.out.println(is.size());
}
}
//package com.loafle.overflow.sensor.dao;
//
//import com.loafle.overflow.module.crawler.model.Crawler;
//import com.loafle.overflow.module.sensor.dao.JPASensorItemDao;
//import com.loafle.overflow.module.sensor.dao.SensorItemDao;
//import org.junit.Before;
//import org.junit.Ignore;
//import org.junit.Test;
//
//import java.util.List;
//
///**
// * Created by root on 17. 6. 9.
// */
//public class JPASensorItemDaoTest {
//
// private SensorItemDao sensorItemDao = null;
//
// @Before
// public void before() {
// this.sensorItemDao = new JPASensorItemDao();
// }
//
// @Ignore
// @Test
// public void create() {
//
//
// SensorItem sensorItem = new SensorItem();
//
// Crawler crawler = new Crawler();
// crawler.setId(1L);
//
// SensorItemCategory category = new SensorItemCategory();
// category.setId(1L);
//
// sensorItem.setCrawler(crawler);
// sensorItem.setDataType("int");
// sensorItem.setDescription("count getget");
// sensorItem.setName("net.mysql.connection_count");
// sensorItem.setSensorItemCategory(category);
//
// this.sensorItemDao.create(sensorItem);
//
// }
//
// @Ignore
// @Test
// public void list() {
//
// Crawler crawler = new Crawler();
// crawler.setId(1L);
//
// List<SensorItem> is = this.sensorItemDao.findAllByCrawlerId(crawler);
//
//
// System.out.println(is.size());
//
// }
//
//}

View File

@@ -1,59 +1,59 @@
package com.loafle.overflow.sensor.dao;
import com.loafle.overflow.module.sensor.dao.JPASensorItemMappingDao;
import com.loafle.overflow.module.sensor.dao.SensorItemMappingDao;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.util.List;
/**
* Created by root on 17. 6. 9.
*/
public class JPASensorItemMappingDaoTest {
private SensorItemMappingDao sensorItemMappingDao = null;
@Before
public void before() {
this.sensorItemMappingDao = new JPASensorItemMappingDao();
}
@Ignore
@Test
public void create() {
SensorItemMapping mapping = new SensorItemMapping();
Sensor sensor = new Sensor();
sensor.setId(1L);
SensorItem sensorItem = new SensorItem();
sensorItem.setId(1L);
mapping.setSensor(sensor);
mapping.setSensorItem(sensorItem);
this.sensorItemMappingDao.create(mapping);
}
@Test
public void list() {
Sensor sensor = new Sensor();
sensor.setId(1L);
List<SensorItemMapping> ml = this.sensorItemMappingDao.findAllBySensorId(sensor);
System.out.println(ml.size());
}
}
//package com.loafle.overflow.sensor.dao;
//
//import com.loafle.overflow.module.sensor.dao.JPASensorItemMappingDao;
//import com.loafle.overflow.module.sensor.dao.SensorItemMappingDao;
//import org.junit.Before;
//import org.junit.Ignore;
//import org.junit.Test;
//
//import java.util.List;
//
///**
// * Created by root on 17. 6. 9.
// */
//public class JPASensorItemMappingDaoTest {
//
// private SensorItemMappingDao sensorItemMappingDao = null;
//
// @Before
// public void before() {
// this.sensorItemMappingDao = new JPASensorItemMappingDao();
// }
//
//
// @Ignore
// @Test
// public void create() {
//
// SensorItemMapping mapping = new SensorItemMapping();
//
// Sensor sensor = new Sensor();
//
// sensor.setId(1L);
//
// SensorItem sensorItem = new SensorItem();
//
// sensorItem.setId(1L);
//
// mapping.setSensor(sensor);
//
// mapping.setSensorItem(sensorItem);
//
// this.sensorItemMappingDao.create(mapping);
//
// }
//
// @Test
// public void list() {
//
// Sensor sensor = new Sensor();
//
// sensor.setId(1L);
//
// List<SensorItemMapping> ml = this.sensorItemMappingDao.findAllBySensorId(sensor);
//
// System.out.println(ml.size());
//
// }
//
//}