added Meta Vendor Crawler
This commit is contained in:
parent
9d94078110
commit
6020c1e853
|
@ -1,13 +1,17 @@
|
|||
package com.loafle.overflow.module.meta.dao;
|
||||
|
||||
import com.loafle.overflow.module.meta.model.MetaInfraVendor;
|
||||
import com.loafle.overflow.module.meta.model.MetaVendorCrawler;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 6. 23.
|
||||
*/
|
||||
@Repository
|
||||
public interface MetaVendorCrawlerDAO extends JpaRepository<MetaVendorCrawler, Integer>{
|
||||
|
||||
List<MetaVendorCrawler> findAllByMetaInfraVendor(MetaInfraVendor infraVendor);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class MetaVendorCrawler {
|
|||
// }
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "CREATE_DATE", nullable = false)
|
||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.loafle.overflow.module.meta.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 7. 27.
|
||||
*/
|
||||
@Service("MetaVendorCrawlerSensorItemService")
|
||||
public class MetaVendorCrawlerSensorItemService {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.loafle.overflow.module.meta.service;
|
||||
|
||||
import com.loafle.overflow.module.meta.dao.MetaVendorCrawlerDAO;
|
||||
import com.loafle.overflow.module.meta.model.MetaInfraVendor;
|
||||
import com.loafle.overflow.module.meta.model.MetaVendorCrawler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 7. 27.
|
||||
*/
|
||||
@Service("MetaVendorCrawlerService")
|
||||
public class MetaVendorCrawlerService {
|
||||
|
||||
@Autowired
|
||||
private MetaVendorCrawlerDAO crawlerDAO;
|
||||
|
||||
public List<MetaVendorCrawler> readAllByInfraVendor(MetaInfraVendor infraVendor) {
|
||||
|
||||
return this.crawlerDAO.findAllByMetaInfraVendor(infraVendor);
|
||||
}
|
||||
|
||||
public MetaVendorCrawler regist(MetaVendorCrawler metaVendorCrawler) {
|
||||
return this.crawlerDAO.save(metaVendorCrawler);
|
||||
}
|
||||
}
|
|
@ -360,4 +360,67 @@ NULL,'2017-06-26 20:19:07.074','My sensor',1,1,1);
|
|||
INSERT INTO public.sensor_item (create_date,item_id,sensor_id) VALUES (
|
||||
'2017-06-26 20:21:16.626',1,1);
|
||||
INSERT INTO public.sensor_item (create_date,item_id,sensor_id) VALUES (
|
||||
'2017-06-26 20:21:50.988',2,2);
|
||||
'2017-06-26 20:21:50.988',2,2);
|
||||
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
1,'2017-07-27 15:29:48.634',23,26);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
2,'2017-07-27 15:29:48.634',20,26);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
3,'2017-07-27 15:29:48.634',20,28);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
4,'2017-07-27 15:29:48.634',20,29);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
5,'2017-07-27 15:29:48.634',20,30);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
6,'2017-07-27 15:29:48.634',20,31);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
7,'2017-07-27 15:29:48.634',20,32);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
8,'2017-07-27 15:29:48.634',1,40);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
9,'2017-07-27 15:29:48.634',2,41);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
10,'2017-07-27 15:29:48.634',3,42);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
11,'2017-07-27 15:29:48.634',4,43);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
12,'2017-07-27 15:29:48.634',5,44);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
13,'2017-07-27 15:29:48.634',6,45);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
14,'2017-07-27 15:29:48.634',7,46);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
15,'2017-07-27 15:29:48.634',8,47);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
16,'2017-07-27 15:29:48.634',9,48);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
17,'2017-07-27 15:29:48.634',10,49);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
18,'2017-07-27 15:29:48.634',11,50);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
19,'2017-07-27 15:29:48.634',12,51);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
20,'2017-07-27 15:29:48.634',13,52);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
21,'2017-07-27 15:29:48.634',14,53);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
22,'2017-07-27 15:29:48.634',15,54);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
23,'2017-07-27 15:29:48.634',16,55);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
24,'2017-07-27 15:29:48.634',17,56);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
25,'2017-07-27 15:29:48.634',18,57);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
26,'2017-07-27 15:29:48.634',19,58);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
27,'2017-07-27 15:29:48.634',20,59);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
28,'2017-07-27 15:29:48.634',21,60);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
29,'2017-07-27 15:29:48.634',22,61);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
30,'2017-07-27 15:29:48.634',23,62);
|
||||
INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES (
|
||||
31,'2017-07-27 15:29:48.634',24,63);
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package com.loafle.overflow.module.meta.service;
|
||||
|
||||
import com.loafle.overflow.module.meta.model.MetaCrawler;
|
||||
import com.loafle.overflow.module.meta.model.MetaInfraVendor;
|
||||
import com.loafle.overflow.module.meta.model.MetaVendorCrawler;
|
||||
import com.loafle.overflow.spring.AppConfig;
|
||||
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||
import com.loafle.overflow.spring.MailConfiguration;
|
||||
import org.junit.Assert;
|
||||
import org.junit.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 static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 7. 27.
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class})
|
||||
public class MetaVendorCrawlerServiceTest {
|
||||
|
||||
@Autowired
|
||||
private MetaVendorCrawlerService service;
|
||||
|
||||
@Test
|
||||
public void readAllByInfraVendor() throws Exception {
|
||||
MetaInfraVendor metaInfraVendor = new MetaInfraVendor();
|
||||
|
||||
metaInfraVendor.setId(26);
|
||||
|
||||
List<MetaVendorCrawler> metaVendorCrawlers = this.service.readAllByInfraVendor(metaInfraVendor);
|
||||
|
||||
Assert.assertNotEquals(metaVendorCrawlers.size(), 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void regist() throws Exception {
|
||||
MetaVendorCrawler metaVendorCrawler = new MetaVendorCrawler();
|
||||
|
||||
MetaCrawler metaCrawler = new MetaCrawler();
|
||||
metaCrawler.setId((short)23);
|
||||
|
||||
MetaInfraVendor metaInfraVendor = new MetaInfraVendor();
|
||||
metaInfraVendor.setId(42);
|
||||
|
||||
metaVendorCrawler.setMetaCrawler(metaCrawler);
|
||||
metaVendorCrawler.setMetaInfraVendor(metaInfraVendor);
|
||||
|
||||
metaVendorCrawler.setId(1);
|
||||
this.service.regist(metaVendorCrawler);
|
||||
|
||||
Assert.assertNotEquals(metaVendorCrawler.getId(), 0);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user