spring change
This commit is contained in:
parent
37b9da0f66
commit
25f8293205
32
pom.xml
32
pom.xml
|
@ -17,7 +17,9 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<grpc.version>1.2.0</grpc.version>
|
<grpc.version>1.2.0</grpc.version>
|
||||||
|
<spring-test-version>4.3.9.RELEASE</spring-test-version>
|
||||||
<hibernate.version>4.3.10.Final</hibernate.version>
|
<hibernate.version>4.3.10.Final</hibernate.version>
|
||||||
|
<spring-data-jpa>1.11.4.RELEASE</spring-data-jpa>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -43,11 +45,19 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager -->
|
<!-- Spring Dependency-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hibernate</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>hibernate-entitymanager</artifactId>
|
<artifactId>spring-data-jpa</artifactId>
|
||||||
<version>5.2.10.Final</version>
|
<version>${spring-data-jpa}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-test</artifactId>
|
||||||
|
<version>${spring-test-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
|
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
|
||||||
|
@ -63,10 +73,18 @@
|
||||||
<version>1.9.13</version>
|
<version>1.9.13</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.loafle</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>overflow_jpa_base_dao</artifactId>
|
<artifactId>hibernate-entitymanager</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>5.2.10.Final</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<artifactId>hibernate-core</artifactId>
|
||||||
|
<version>5.2.10.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--<dependency>-->
|
<!--<dependency>-->
|
||||||
|
|
25
src/main/java/com/loafle/overflow/AppConfig.java
Normal file
25
src/main/java/com/loafle/overflow/AppConfig.java
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package com.loafle.overflow;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by insanity on 17. 6. 13.
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ComponentScan(basePackages = {"com.loafle.overflow"}, excludeFilters = @ComponentScan.Filter({Configuration.class}))
|
||||||
|
@PropertySource({"classpath:database.properties"})
|
||||||
|
public class AppConfig {
|
||||||
|
@Bean
|
||||||
|
public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
|
||||||
|
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
|
||||||
|
ppc.setLocation(new ClassPathResource("database.properties"));
|
||||||
|
ppc.setIgnoreUnresolvablePlaceholders(true);
|
||||||
|
|
||||||
|
return ppc;
|
||||||
|
}
|
||||||
|
}
|
79
src/main/java/com/loafle/overflow/JdbcConfiguration.java
Normal file
79
src/main/java/com/loafle/overflow/JdbcConfiguration.java
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
package com.loafle.overflow;
|
||||||
|
|
||||||
|
import org.hibernate.cfg.Environment;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||||
|
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
||||||
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||||
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
|
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||||
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
import org.springframework.transaction.annotation.TransactionManagementConfigurer;
|
||||||
|
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by root on 17. 6. 13.
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableTransactionManagement
|
||||||
|
@EnableJpaRepositories(basePackages = {"com.loafle.overflow"})
|
||||||
|
public class JdbcConfiguration implements TransactionManagementConfigurer {
|
||||||
|
@Value("${spring.datasource.driver-class-name}")
|
||||||
|
private String driver;
|
||||||
|
@Value("${spring.datasource.url}")
|
||||||
|
private String url;
|
||||||
|
@Value("${spring.datasource.username}")
|
||||||
|
private String username;
|
||||||
|
@Value("${spring.datasource.password}")
|
||||||
|
private String password;
|
||||||
|
@Value("${spring.jpa.hibernate.dialect}")
|
||||||
|
private String dialect;
|
||||||
|
@Value("${spring.jpa.hibernate.ddl-auto}")
|
||||||
|
private String hbm2ddlAuto;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public DataSource configureDataSource() {
|
||||||
|
DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
||||||
|
dataSource.setDriverClassName(driver);
|
||||||
|
dataSource.setUrl(url);
|
||||||
|
dataSource.setUsername(username);
|
||||||
|
dataSource.setPassword(password);
|
||||||
|
return dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
||||||
|
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
|
||||||
|
entityManagerFactoryBean.setDataSource(configureDataSource());
|
||||||
|
entityManagerFactoryBean.setPackagesToScan("com.loafle.overflow");
|
||||||
|
entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
|
||||||
|
|
||||||
|
Properties jpaProperties = new Properties();
|
||||||
|
jpaProperties.put(Environment.DIALECT, dialect);
|
||||||
|
jpaProperties.put(Environment.HBM2DDL_AUTO, hbm2ddlAuto);
|
||||||
|
jpaProperties.put(Environment.SHOW_SQL, true);
|
||||||
|
|
||||||
|
entityManagerFactoryBean.setJpaProperties(jpaProperties);
|
||||||
|
|
||||||
|
return entityManagerFactoryBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@Qualifier(value = "transactionManager")
|
||||||
|
public PlatformTransactionManager annotationDrivenTransactionManager() {
|
||||||
|
return new JpaTransactionManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public EntityManager entityManager() {
|
||||||
|
return entityManagerFactory().getObject().createEntityManager();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,15 @@
|
||||||
package com.loafle.overflow.module.agent.dao;
|
package com.loafle.overflow.module.agent.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.module.agent.model.Agent;
|
import com.loafle.overflow.module.agent.model.Agent;
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import com.loafle.overflow.module.member.model.Member;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by insanity on 17. 5. 29.
|
* Created by insanity on 17. 5. 29.
|
||||||
*/
|
*/
|
||||||
public interface AgentDAO extends BaseDAO<Agent> {
|
@Repository
|
||||||
public List<Agent> findAgentListByMemberId(Member member);
|
public interface AgentDAO extends JpaRepository<Agent, Long> {
|
||||||
|
// public List<Agent> findAgentListByMemberId(Member member);
|
||||||
}
|
}
|
|
@ -1,32 +1,32 @@
|
||||||
package com.loafle.overflow.module.agent.dao;
|
//package com.loafle.overflow.module.agent.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.agent.model.Agent;
|
//import com.loafle.overflow.module.agent.model.Agent;
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
import com.loafle.overflow.module.member.model.Member;
|
//import com.loafle.overflow.module.member.model.Member;
|
||||||
|
//
|
||||||
import javax.persistence.Query;
|
//import javax.persistence.Query;
|
||||||
import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by insanity on 17. 5. 29.
|
// * Created by insanity on 17. 5. 29.
|
||||||
*/
|
// */
|
||||||
public class JPAAgentDAO extends JPABaseDAO<Agent> implements AgentDAO {
|
//public class JPAAgentDAO extends JPABaseDAO<Agent> implements AgentDAO {
|
||||||
|
//
|
||||||
public List<Agent> findAgentListByMemberId(Member member) {
|
// public List<Agent> findAgentListByMemberId(Member member) {
|
||||||
Query query = getEntityManager()
|
// Query query = getEntityManager()
|
||||||
.createNativeQuery("SELECT agt.* FROM AGENT agt WHERE agt.MEMBER_ID = :member", Agent.class);
|
// .createNativeQuery("SELECT agt.* FROM AGENT agt WHERE agt.MEMBER_ID = :member", Agent.class);
|
||||||
query.setParameter("member", member.getId());
|
// query.setParameter("member", member.getId());
|
||||||
|
//
|
||||||
List<Agent> list = new ArrayList<>();
|
// List<Agent> list = new ArrayList<>();
|
||||||
try {
|
// try {
|
||||||
list = query.getResultList();
|
// list = query.getResultList();
|
||||||
}catch(Exception e) {
|
// }catch(Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}finally {
|
// }finally {
|
||||||
return list;
|
// return list;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
package com.loafle.overflow.module.apikey.dao;
|
package com.loafle.overflow.module.apikey.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.module.apikey.model.Apikey;
|
import com.loafle.overflow.module.apikey.model.Apikey;
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 1.
|
* Created by root on 17. 6. 1.
|
||||||
*/
|
*/
|
||||||
public interface ApiKeyDao extends BaseDAO<Apikey> {
|
@Repository
|
||||||
Apikey findByApiKey(Apikey apikey);
|
public interface ApiKeyDao extends JpaRepository<Apikey, Long> {
|
||||||
|
// Apikey findByApiKey(Apikey apikey);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
package com.loafle.overflow.module.apikey.dao;
|
//package com.loafle.overflow.module.apikey.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.apikey.model.Apikey;
|
//import com.loafle.overflow.module.apikey.model.Apikey;
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
|
//
|
||||||
|
//
|
||||||
import javax.persistence.Query;
|
//import javax.persistence.Query;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 1.
|
// * Created by root on 17. 6. 1.
|
||||||
*/
|
// */
|
||||||
public class JPAApiKeyDao extends JPABaseDAO<Apikey> implements ApiKeyDao {
|
//public class JPAApiKeyDao extends JPABaseDAO<Apikey> implements ApiKeyDao {
|
||||||
public Apikey findByApiKey(Apikey apikey) {
|
// public Apikey findByApiKey(Apikey apikey) {
|
||||||
|
//
|
||||||
Query query = getEntityManager().createNativeQuery("SELECT ak.* FROM API_KEY ak WHERE ak.API_KEY = :apikey", Apikey.class);
|
// Query query = getEntityManager().createNativeQuery("SELECT ak.* FROM API_KEY ak WHERE ak.API_KEY = :apikey", Apikey.class);
|
||||||
query.setParameter("apikey", apikey.getApiKey());
|
// query.setParameter("apikey", apikey.getApiKey());
|
||||||
|
//
|
||||||
Apikey ak = null;
|
// Apikey ak = null;
|
||||||
try {
|
// try {
|
||||||
ak = (Apikey)query.getSingleResult();
|
// ak = (Apikey)query.getSingleResult();
|
||||||
}catch(Exception e) {
|
// }catch(Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}finally {
|
// }finally {
|
||||||
return ak;
|
// return ak;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
package com.loafle.overflow.module.crawler.dao;
|
package com.loafle.overflow.module.crawler.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
|
||||||
import com.loafle.overflow.module.crawler.model.Crawler;
|
import com.loafle.overflow.module.crawler.model.Crawler;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geek@loafle.com on 17. 6. 8.
|
* Created by geek@loafle.com on 17. 6. 8.
|
||||||
*/
|
*/
|
||||||
public interface CrawlerDAO extends BaseDAO<Crawler> {
|
@Repository
|
||||||
public List<Crawler> findAll();
|
public interface CrawlerDAO extends JpaRepository<Crawler, Long> {
|
||||||
|
// public List<Crawler> findAll();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package com.loafle.overflow.module.crawler.dao;
|
package com.loafle.overflow.module.crawler.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
|
||||||
import com.loafle.overflow.module.crawler.model.CrawlerInputItem;
|
import com.loafle.overflow.module.crawler.model.CrawlerInputItem;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geek@loafle.com on 17. 6. 8.
|
* Created by geek@loafle.com on 17. 6. 8.
|
||||||
*/
|
*/
|
||||||
public interface CrawlerInputItemDAO extends BaseDAO<CrawlerInputItem> {
|
@Repository
|
||||||
|
public interface CrawlerInputItemDAO extends JpaRepository<CrawlerInputItem, Long> {
|
||||||
}
|
}
|
|
@ -1,14 +1,15 @@
|
||||||
package com.loafle.overflow.module.crawler.dao;
|
package com.loafle.overflow.module.crawler.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
|
||||||
import com.loafle.overflow.module.crawler.model.Crawler;
|
|
||||||
import com.loafle.overflow.module.crawler.model.CrawlerInputItemMapping;
|
import com.loafle.overflow.module.crawler.model.CrawlerInputItemMapping;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geek@loafle.com on 17. 6. 8.
|
* Created by geek@loafle.com on 17. 6. 8.
|
||||||
*/
|
*/
|
||||||
public interface CrawlerInputItemMappingDAO extends BaseDAO<CrawlerInputItemMapping> {
|
@Repository
|
||||||
public List<CrawlerInputItemMapping> findByCrawlerId(Crawler crawler);
|
public interface CrawlerInputItemMappingDAO extends JpaRepository<CrawlerInputItemMapping, Long> {
|
||||||
|
// public List<CrawlerInputItemMapping> findByCrawlerId(Crawler crawler);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
package com.loafle.overflow.module.crawler.dao;
|
//package com.loafle.overflow.module.crawler.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
import com.loafle.overflow.module.crawler.model.Crawler;
|
//import com.loafle.overflow.module.crawler.model.Crawler;
|
||||||
|
//
|
||||||
import javax.persistence.Query;
|
//import javax.persistence.Query;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by geek@loafle.com on 17. 6. 8.
|
// * Created by geek@loafle.com on 17. 6. 8.
|
||||||
*/
|
// */
|
||||||
public class JPACrawlerDAO extends JPABaseDAO<Crawler> implements CrawlerDAO {
|
//public class JPACrawlerDAO extends JPABaseDAO<Crawler> implements CrawlerDAO {
|
||||||
@Override
|
// @Override
|
||||||
public List<Crawler> findAll() {
|
// public List<Crawler> findAll() {
|
||||||
Query query = getEntityManager().createNativeQuery("SELECT c.* FROM CRAWLER c ", Crawler.class);
|
// Query query = getEntityManager().createNativeQuery("SELECT c.* FROM CRAWLER c ", Crawler.class);
|
||||||
|
//
|
||||||
List<Crawler> crs = null;
|
// List<Crawler> crs = null;
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
crs = (List<Crawler>)query.getResultList();
|
// crs = (List<Crawler>)query.getResultList();
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
} finally {
|
// } finally {
|
||||||
return crs;
|
// return crs;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.loafle.overflow.module.crawler.dao;
|
//package com.loafle.overflow.module.crawler.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
import com.loafle.overflow.module.crawler.model.CrawlerInputItem;
|
//import com.loafle.overflow.module.crawler.model.CrawlerInputItem;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by geek@loafle.com on 17. 6. 8.
|
// * Created by geek@loafle.com on 17. 6. 8.
|
||||||
*/
|
// */
|
||||||
public class JPACrawlerInputItemDAO extends JPABaseDAO<CrawlerInputItem> implements CrawlerInputItemDAO {
|
//public class JPACrawlerInputItemDAO extends JPABaseDAO<CrawlerInputItem> implements CrawlerInputItemDAO {
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
package com.loafle.overflow.module.crawler.dao;
|
//package com.loafle.overflow.module.crawler.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
import com.loafle.overflow.module.crawler.model.Crawler;
|
//import com.loafle.overflow.module.crawler.model.Crawler;
|
||||||
import com.loafle.overflow.module.crawler.model.CrawlerInputItemMapping;
|
//import com.loafle.overflow.module.crawler.model.CrawlerInputItemMapping;
|
||||||
|
//
|
||||||
import javax.persistence.Query;
|
//import javax.persistence.Query;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by geek@loafle.com on 17. 6. 8.
|
// * Created by geek@loafle.com on 17. 6. 8.
|
||||||
*/
|
// */
|
||||||
public class JPACrawlerInputItemMappingDAO extends JPABaseDAO<CrawlerInputItemMapping> implements CrawlerInputItemMappingDAO {
|
//public class JPACrawlerInputItemMappingDAO extends JPABaseDAO<CrawlerInputItemMapping> implements CrawlerInputItemMappingDAO {
|
||||||
@Override
|
// @Override
|
||||||
public List<CrawlerInputItemMapping> findByCrawlerId(Crawler crawler) {
|
// public List<CrawlerInputItemMapping> findByCrawlerId(Crawler crawler) {
|
||||||
Query query = getEntityManager().createNativeQuery("SELECT m.* FROM CRAWLER_INPUT_ITEM_MAPPING m WHERE m.crawler_id = :crawler_id", CrawlerInputItemMapping.class);
|
// Query query = getEntityManager().createNativeQuery("SELECT m.* FROM CRAWLER_INPUT_ITEM_MAPPING m WHERE m.crawler_id = :crawler_id", CrawlerInputItemMapping.class);
|
||||||
query.setParameter("crawler_id", crawler.getId());
|
// query.setParameter("crawler_id", crawler.getId());
|
||||||
|
//
|
||||||
List<CrawlerInputItemMapping> crs = null;
|
// List<CrawlerInputItemMapping> crs = null;
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
crs = (List<CrawlerInputItemMapping>)query.getResultList();
|
// crs = (List<CrawlerInputItemMapping>)query.getResultList();
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
} finally {
|
// } finally {
|
||||||
return crs;
|
// return crs;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package com.loafle.overflow.module.discovery.dao;
|
package com.loafle.overflow.module.discovery.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
|
||||||
import com.loafle.overflow.module.discovery.model.Host;
|
import com.loafle.overflow.module.discovery.model.Host;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 4.
|
* Created by root on 17. 6. 4.
|
||||||
*/
|
*/
|
||||||
public interface HostDao extends BaseDAO<Host> {
|
@Repository
|
||||||
|
public interface HostDao extends JpaRepository<Host, Long> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.loafle.overflow.module.discovery.dao;
|
//package com.loafle.overflow.module.discovery.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
import com.loafle.overflow.module.discovery.model.Host;
|
//import com.loafle.overflow.module.discovery.model.Host;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 4.
|
// * Created by root on 17. 6. 4.
|
||||||
*/
|
// */
|
||||||
public class JPAHostDao extends JPABaseDAO<Host> implements HostDao {
|
//public class JPAHostDao extends JPABaseDAO<Host> implements HostDao {
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.loafle.overflow.module.discovery.dao;
|
//package com.loafle.overflow.module.discovery.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
import com.loafle.overflow.module.discovery.model.Port;
|
//import com.loafle.overflow.module.discovery.model.Port;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 4.
|
// * Created by root on 17. 6. 4.
|
||||||
*/
|
// */
|
||||||
public class JPAPortDao extends JPABaseDAO<Port> implements PortDao {
|
//public class JPAPortDao extends JPABaseDAO<Port> implements PortDao {
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.loafle.overflow.module.discovery.dao;
|
//package com.loafle.overflow.module.discovery.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
import com.loafle.overflow.module.discovery.model.Service;
|
//import com.loafle.overflow.module.discovery.model.Service;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 4.
|
// * Created by root on 17. 6. 4.
|
||||||
*/
|
// */
|
||||||
public class JPAServiceDao extends JPABaseDAO<Service> implements ServiceDao {
|
//public class JPAServiceDao extends JPABaseDAO<Service> implements ServiceDao {
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package com.loafle.overflow.module.discovery.dao;
|
//package com.loafle.overflow.module.discovery.dao;
|
||||||
|
//
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
import com.loafle.overflow.module.discovery.model.Zone;
|
//import com.loafle.overflow.module.discovery.model.Zone;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 4.
|
// * Created by root on 17. 6. 4.
|
||||||
*/
|
// */
|
||||||
public class JPAZoneDao extends JPABaseDAO<Zone> implements ZoneDao {
|
//public class JPAZoneDao extends JPABaseDAO<Zone> implements ZoneDao {
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package com.loafle.overflow.module.discovery.dao;
|
package com.loafle.overflow.module.discovery.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
|
||||||
import com.loafle.overflow.module.discovery.model.Port;
|
import com.loafle.overflow.module.discovery.model.Port;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 4.
|
* Created by root on 17. 6. 4.
|
||||||
*/
|
*/
|
||||||
public interface PortDao extends BaseDAO<Port> {
|
|
||||||
|
@Repository
|
||||||
|
public interface PortDao extends JpaRepository<Port, Long> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package com.loafle.overflow.module.discovery.dao;
|
package com.loafle.overflow.module.discovery.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
|
||||||
import com.loafle.overflow.module.discovery.model.Service;
|
import com.loafle.overflow.module.discovery.model.Service;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 4.
|
* Created by root on 17. 6. 4.
|
||||||
*/
|
*/
|
||||||
public interface ServiceDao extends BaseDAO<Service> {
|
@Repository
|
||||||
|
public interface ServiceDao extends JpaRepository<Service, Long> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package com.loafle.overflow.module.discovery.dao;
|
package com.loafle.overflow.module.discovery.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
|
||||||
import com.loafle.overflow.module.discovery.model.Zone;
|
import com.loafle.overflow.module.discovery.model.Zone;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 4.
|
* Created by root on 17. 6. 4.
|
||||||
*/
|
*/
|
||||||
public interface ZoneDao extends BaseDAO<Zone> {
|
@Repository
|
||||||
|
public interface ZoneDao extends JpaRepository<Zone, Long> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
package com.loafle.overflow.module.email.dao;
|
package com.loafle.overflow.module.email.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
|
||||||
import com.loafle.overflow.module.email.model.EmailAuth;
|
import com.loafle.overflow.module.email.model.EmailAuth;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geek@loafle.com on 17. 6. 6.
|
* Created by geek@loafle.com on 17. 6. 6.
|
||||||
*/
|
*/
|
||||||
public interface EmailAuthDAO extends BaseDAO<EmailAuth> {
|
@Repository
|
||||||
public EmailAuth findByAuthToken(EmailAuth emailAuth);
|
public interface EmailAuthDAO extends JpaRepository<EmailAuth, Long> {
|
||||||
|
// public EmailAuth findByAuthToken(EmailAuth emailAuth);
|
||||||
|
|
||||||
public List<EmailAuth> findByMemberId(EmailAuth emailAuth);
|
// public List<EmailAuth> findByMemberId(EmailAuth emailAuth);
|
||||||
|
|
||||||
// public EmailAuth updateEmailAuth(EmailAuth emailAuth);
|
// public EmailAuth updateEmailAuth(EmailAuth emailAuth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,63 +1,63 @@
|
||||||
package com.loafle.overflow.module.email.dao;
|
//package com.loafle.overflow.module.email.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
import com.loafle.overflow.module.email.model.EmailAuth;
|
//import com.loafle.overflow.module.email.model.EmailAuth;
|
||||||
|
//
|
||||||
import javax.persistence.Query;
|
//import javax.persistence.Query;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by geek@loafle.com on 17. 6. 6.
|
// * Created by geek@loafle.com on 17. 6. 6.
|
||||||
*/
|
// */
|
||||||
public class JPAEmailAuthDAO extends JPABaseDAO<EmailAuth> implements EmailAuthDAO {
|
//public class JPAEmailAuthDAO extends JPABaseDAO<EmailAuth> implements EmailAuthDAO {
|
||||||
|
//
|
||||||
public EmailAuth findByAuthToken(EmailAuth emailAuth) {
|
// public EmailAuth findByAuthToken(EmailAuth emailAuth) {
|
||||||
Query query = getEntityManager().createNativeQuery("SELECT e.* FROM EMAIL_AUTH e WHERE e.auth_token = :auth_token", EmailAuth.class);
|
// Query query = getEntityManager().createNativeQuery("SELECT e.* FROM EMAIL_AUTH e WHERE e.auth_token = :auth_token", EmailAuth.class);
|
||||||
query.setParameter("auth_token", emailAuth.getAuthToken());
|
// query.setParameter("auth_token", emailAuth.getAuthToken());
|
||||||
|
//
|
||||||
EmailAuth auth = null;
|
// EmailAuth auth = null;
|
||||||
|
|
||||||
try {
|
|
||||||
auth = (EmailAuth)query.getSingleResult();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
return auth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EmailAuth> findByMemberId(EmailAuth emailAuth) {
|
|
||||||
Query query = getEntityManager().createNativeQuery("SELECT e.* FROM EMAIL_AUTH e WHERE e.member_id = :member_id", EmailAuth.class);
|
|
||||||
query.setParameter("member_id", emailAuth.getMember().getId());
|
|
||||||
|
|
||||||
List<EmailAuth> auths = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
auths = (List<EmailAuth>)query.getResultList();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
return auths;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public EmailAuth updateEmailAuth(EmailAuth emailAuth) {
|
|
||||||
// EntityTransaction tx = this.getEntityManager().getTransaction();
|
|
||||||
// if (!tx.isActive()) {
|
|
||||||
// tx.begin();
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// try {
|
// try {
|
||||||
// emailAuth.setUpdateDate(new Date());
|
// auth = (EmailAuth)query.getSingleResult();
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// } finally {
|
||||||
|
// return auth;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
//
|
//
|
||||||
// EmailAuth result = this.getEntityManager().merge(emailAuth);
|
// @Override
|
||||||
// tx.commit();
|
// public List<EmailAuth> findByMemberId(EmailAuth emailAuth) {
|
||||||
// return result;
|
// Query query = getEntityManager().createNativeQuery("SELECT e.* FROM EMAIL_AUTH e WHERE e.member_id = :member_id", EmailAuth.class);
|
||||||
// }catch (Exception e) {
|
// query.setParameter("member_id", emailAuth.getMember().getId());
|
||||||
// tx.rollback();
|
//
|
||||||
// return null;
|
// List<EmailAuth> auths = null;
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// auths = (List<EmailAuth>)query.getResultList();
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// } finally {
|
||||||
|
// return auths;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
//
|
||||||
|
//// @Override
|
||||||
|
//// public EmailAuth updateEmailAuth(EmailAuth emailAuth) {
|
||||||
|
//// EntityTransaction tx = this.getEntityManager().getTransaction();
|
||||||
|
//// if (!tx.isActive()) {
|
||||||
|
//// tx.begin();
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// try {
|
||||||
|
//// emailAuth.setUpdateDate(new Date());
|
||||||
|
////
|
||||||
|
//// EmailAuth result = this.getEntityManager().merge(emailAuth);
|
||||||
|
//// tx.commit();
|
||||||
|
//// return result;
|
||||||
|
//// }catch (Exception e) {
|
||||||
|
//// tx.rollback();
|
||||||
|
//// return null;
|
||||||
|
//// }
|
||||||
|
//// }
|
||||||
|
//}
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
package com.loafle.overflow.module.member.dao;
|
//package com.loafle.overflow.module.member.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
import com.loafle.overflow.module.member.model.Member;
|
//import com.loafle.overflow.module.member.model.Member;
|
||||||
|
//
|
||||||
import javax.persistence.Query;
|
//import javax.persistence.Query;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by insanity on 17. 5. 25.
|
// * Created by insanity on 17. 5. 25.
|
||||||
*/
|
// */
|
||||||
public class JPAMemberDAO extends JPABaseDAO<Member> implements MemberDAO{
|
//public class JPAMemberDAO extends JPABaseDAO<Member> implements MemberDAO{
|
||||||
public Member findByEmail(Member member) {
|
// public Member findByEmail(Member member) {
|
||||||
|
//
|
||||||
Query query = getEntityManager().createNativeQuery("SELECT m.* FROM MEMBER m WHERE m.email = :email", Member.class);
|
// Query query = getEntityManager().createNativeQuery("SELECT m.* FROM MEMBER m WHERE m.email = :email", Member.class);
|
||||||
query.setParameter("email", member.getEmail());
|
// query.setParameter("email", member.getEmail());
|
||||||
|
//
|
||||||
Member retMember = null;
|
// Member retMember = null;
|
||||||
try {
|
// try {
|
||||||
retMember = (Member)query.getSingleResult();
|
// retMember = (Member)query.getSingleResult();
|
||||||
}catch(Exception e) {
|
// }catch(Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}finally {
|
// }finally {
|
||||||
return retMember;
|
// return retMember;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package com.loafle.overflow.module.member.dao;
|
package com.loafle.overflow.module.member.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
|
||||||
import com.loafle.overflow.module.member.model.Member;
|
import com.loafle.overflow.module.member.model.Member;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by insanity on 17. 5. 25.
|
* Created by insanity on 17. 5. 25.
|
||||||
*/
|
*/
|
||||||
public interface MemberDAO extends BaseDAO<Member> {
|
@Repository
|
||||||
public Member findByEmail(Member member);
|
public interface MemberDAO extends JpaRepository<Member, Long> {
|
||||||
|
// public Member findByEmail(Member member);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +1,42 @@
|
||||||
package com.loafle.overflow.module.noauthagent.dao;
|
//package com.loafle.overflow.module.noauthagent.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
import com.loafle.overflow.module.noauthagent.model.NoAuthAgent;
|
//import com.loafle.overflow.module.noauthagent.model.NoAuthAgent;
|
||||||
|
//
|
||||||
import javax.persistence.Query;
|
//import javax.persistence.Query;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 5. 30.
|
// * Created by root on 17. 5. 30.
|
||||||
*/
|
// */
|
||||||
public class JPANoAuthAgentDAO extends JPABaseDAO<NoAuthAgent> implements NoAuthAgentDao {
|
//public class JPANoAuthAgentDAO extends JPABaseDAO<NoAuthAgent> implements NoAuthAgentDao {
|
||||||
public NoAuthAgent findByTempKey(NoAuthAgent noAuthAgent) {
|
// public NoAuthAgent findByTempKey(NoAuthAgent noAuthAgent) {
|
||||||
Query query = getEntityManager().createNativeQuery("SELECT na.* FROM NOAUTH_AGENT na WHERE na.TEMP_KEY = :tempkey", NoAuthAgent.class);
|
// Query query = getEntityManager().createNativeQuery("SELECT na.* FROM NOAUTH_AGENT na WHERE na.TEMP_KEY = :tempkey", NoAuthAgent.class);
|
||||||
query.setParameter("tempkey", noAuthAgent.getTempKey());
|
// query.setParameter("tempkey", noAuthAgent.getTempKey());
|
||||||
|
//
|
||||||
NoAuthAgent authAgent = null;
|
// NoAuthAgent authAgent = null;
|
||||||
try {
|
// try {
|
||||||
authAgent = (NoAuthAgent)query.getSingleResult();
|
// authAgent = (NoAuthAgent)query.getSingleResult();
|
||||||
}catch(Exception e) {
|
// }catch(Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}finally {
|
// }finally {
|
||||||
return authAgent;
|
// return authAgent;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public List<NoAuthAgent> findAllByNoAuth(NoAuthAgent noAuthAgent) {
|
// public List<NoAuthAgent> findAllByNoAuth(NoAuthAgent noAuthAgent) {
|
||||||
|
//
|
||||||
Query query = getEntityManager().createNativeQuery("SELECT na.* FROM NOAUTH_AGENT na WHERE na.AUTH_STATUS != :authStatus", NoAuthAgent.class);
|
// Query query = getEntityManager().createNativeQuery("SELECT na.* FROM NOAUTH_AGENT na WHERE na.AUTH_STATUS != :authStatus", NoAuthAgent.class);
|
||||||
query.setParameter("authStatus", noAuthAgent.getAuthStatus().toString());
|
// query.setParameter("authStatus", noAuthAgent.getAuthStatus().toString());
|
||||||
|
//
|
||||||
List<NoAuthAgent> authAgentList = null;
|
// List<NoAuthAgent> authAgentList = null;
|
||||||
try {
|
// try {
|
||||||
authAgentList = (List<NoAuthAgent>)query.getResultList();
|
// authAgentList = (List<NoAuthAgent>)query.getResultList();
|
||||||
}catch(Exception e) {
|
// }catch(Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}finally {
|
// }finally {
|
||||||
return authAgentList;
|
// return authAgentList;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
package com.loafle.overflow.module.noauthagent.dao;
|
package com.loafle.overflow.module.noauthagent.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
|
||||||
import com.loafle.overflow.module.noauthagent.model.NoAuthAgent;
|
import com.loafle.overflow.module.noauthagent.model.NoAuthAgent;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 5. 30.
|
* Created by root on 17. 5. 30.
|
||||||
*/
|
*/
|
||||||
public interface NoAuthAgentDao extends BaseDAO<NoAuthAgent> {
|
@Repository
|
||||||
NoAuthAgent findByTempKey(NoAuthAgent noAuthAgent);
|
public interface NoAuthAgentDao extends JpaRepository<NoAuthAgent, Long> {
|
||||||
List<NoAuthAgent> findAllByNoAuth(NoAuthAgent noAuthAgent);
|
// NoAuthAgent findByTempKey(NoAuthAgent noAuthAgent);
|
||||||
|
// List<NoAuthAgent> findAllByNoAuth(NoAuthAgent noAuthAgent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
package com.loafle.overflow.module.sensor.dao;
|
//package com.loafle.overflow.module.sensor.dao;
|
||||||
|
//
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
|
//
|
||||||
import javax.persistence.Query;
|
//import javax.persistence.Query;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 9.
|
// * Created by root on 17. 6. 9.
|
||||||
*/
|
// */
|
||||||
public class JPASensorDao extends JPABaseDAO<Sensor> implements SensorDao {
|
//public class JPASensorDao extends JPABaseDAO<Sensor> implements SensorDao {
|
||||||
|
//
|
||||||
public List<Sensor> findAllByTargetId(Target target) {
|
// public List<Sensor> findAllByTargetId(Target target) {
|
||||||
Query query = getEntityManager().createNativeQuery("SELECT s.* FROM Sensor s WHERE s.TARGET_ID = :targetId", Sensor.class);
|
// Query query = getEntityManager().createNativeQuery("SELECT s.* FROM Sensor s WHERE s.TARGET_ID = :targetId", Sensor.class);
|
||||||
query.setParameter("targetId", target.getId());
|
// query.setParameter("targetId", target.getId());
|
||||||
|
//
|
||||||
List<Sensor> sensors = null;
|
// List<Sensor> sensors = null;
|
||||||
try {
|
// try {
|
||||||
sensors = (List<Sensor>)query.getResultList();
|
// sensors = (List<Sensor>)query.getResultList();
|
||||||
}catch(Exception e) {
|
// }catch(Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}finally {
|
// }finally {
|
||||||
return sensors;
|
// return sensors;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.loafle.overflow.module.sensor.dao;
|
//package com.loafle.overflow.module.sensor.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 9.
|
// * Created by root on 17. 6. 9.
|
||||||
*/
|
// */
|
||||||
public class JPASensorItemCategoryDao extends JPABaseDAO<SensorItemCategory> implements SensorItemCategoryDao {
|
//public class JPASensorItemCategoryDao extends JPABaseDAO<SensorItemCategory> implements SensorItemCategoryDao {
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
package com.loafle.overflow.module.sensor.dao;
|
//package com.loafle.overflow.module.sensor.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
import com.loafle.overflow.module.crawler.model.Crawler;
|
//import com.loafle.overflow.module.crawler.model.Crawler;
|
||||||
|
//
|
||||||
|
//
|
||||||
import javax.persistence.Query;
|
//import javax.persistence.Query;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 9.
|
// * Created by root on 17. 6. 9.
|
||||||
*/
|
// */
|
||||||
public class JPASensorItemDao extends JPABaseDAO<SensorItem> implements SensorItemDao {
|
//public class JPASensorItemDao extends JPABaseDAO<SensorItem> implements SensorItemDao {
|
||||||
|
//
|
||||||
public List<SensorItem> findAllByCrawlerId(Crawler crawler) {
|
// public List<SensorItem> findAllByCrawlerId(Crawler crawler) {
|
||||||
|
//
|
||||||
Query query = getEntityManager().createNativeQuery("SELECT si.* FROM SensorItem si WHERE si.CRAWLER_ID = :crawlerId", SensorItem.class);
|
// Query query = getEntityManager().createNativeQuery("SELECT si.* FROM SensorItem si WHERE si.CRAWLER_ID = :crawlerId", SensorItem.class);
|
||||||
query.setParameter("crawlerId", crawler.getId());
|
// query.setParameter("crawlerId", crawler.getId());
|
||||||
|
//
|
||||||
List<SensorItem> sensorItems = null;
|
// List<SensorItem> sensorItems = null;
|
||||||
try {
|
// try {
|
||||||
sensorItems = (List<SensorItem>)query.getResultList();
|
// sensorItems = (List<SensorItem>)query.getResultList();
|
||||||
}catch(Exception e) {
|
// }catch(Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}finally {
|
// }finally {
|
||||||
return sensorItems;
|
// return sensorItems;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
package com.loafle.overflow.module.sensor.dao;
|
//package com.loafle.overflow.module.sensor.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
//import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||||
|
//
|
||||||
import javax.persistence.Query;
|
//import javax.persistence.Query;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 9.
|
// * Created by root on 17. 6. 9.
|
||||||
*/
|
// */
|
||||||
public class JPASensorItemMappingDao extends JPABaseDAO<SensorItemMapping> implements SensorItemMappingDao {
|
//public class JPASensorItemMappingDao extends JPABaseDAO<SensorItemMapping> implements SensorItemMappingDao {
|
||||||
|
//
|
||||||
public List<SensorItemMapping> findAllBySensorId(Sensor sensor) {
|
// public List<SensorItemMapping> findAllBySensorId(Sensor sensor) {
|
||||||
|
//
|
||||||
Query query = getEntityManager().createNativeQuery("SELECT sim.* FROM SensorItemMapping sim WHERE sim.SENSOR_ID = :sensorId", SensorItemMapping.class);
|
// Query query = getEntityManager().createNativeQuery("SELECT sim.* FROM SensorItemMapping sim WHERE sim.SENSOR_ID = :sensorId", SensorItemMapping.class);
|
||||||
query.setParameter("sensorId", sensor.getId());
|
// query.setParameter("sensorId", sensor.getId());
|
||||||
|
//
|
||||||
List<SensorItemMapping> sensorItemMappings = null;
|
// List<SensorItemMapping> sensorItemMappings = null;
|
||||||
try {
|
// try {
|
||||||
sensorItemMappings = (List<SensorItemMapping>)query.getResultList();
|
// sensorItemMappings = (List<SensorItemMapping>)query.getResultList();
|
||||||
}catch(Exception e) {
|
// }catch(Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}finally {
|
// }finally {
|
||||||
return sensorItemMappings;
|
// return sensorItemMappings;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
package com.loafle.overflow.module.sensor.dao;
|
package com.loafle.overflow.module.sensor.dao;
|
||||||
|
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
import com.loafle.overflow.module.sensor.model.Sensor;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 9.
|
* Created by root on 17. 6. 9.
|
||||||
*/
|
*/
|
||||||
public interface SensorDao extends BaseDAO<Sensor> {
|
@Repository
|
||||||
|
public interface SensorDao extends JpaRepository<Sensor, Long> {
|
||||||
|
|
||||||
List<Sensor> findAllByTargetId(Target target);
|
// List<Sensor> findAllByTargetId(Target target);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package com.loafle.overflow.module.sensor.dao;
|
package com.loafle.overflow.module.sensor.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 9.
|
* Created by root on 17. 6. 9.
|
||||||
*/
|
*/
|
||||||
public interface SensorItemCategoryDao extends BaseDAO<SensorItemCategory> {
|
//@Repository
|
||||||
}
|
//public interface SensorItemCategoryDao extends JpaRepository<SensorItemCategory, Long> {
|
||||||
|
//}
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
package com.loafle.overflow.module.sensor.dao;
|
package com.loafle.overflow.module.sensor.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
import com.loafle.overflow.module.sensor.model.SensorItem;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import com.loafle.overflow.module.crawler.model.Crawler;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 9.
|
* Created by root on 17. 6. 9.
|
||||||
*/
|
*/
|
||||||
public interface SensorItemDao extends BaseDAO<SensorItem>{
|
@Repository
|
||||||
|
public interface SensorItemDao extends JpaRepository<SensorItem, Long> {
|
||||||
|
|
||||||
List<SensorItem> findAllByCrawlerId(Crawler crawler);
|
// List<SensorItem> findAllByCrawlerId(Crawler crawler);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
package com.loafle.overflow.module.sensor.dao;
|
package com.loafle.overflow.module.sensor.dao;
|
||||||
|
|
||||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 9.
|
* Created by root on 17. 6. 9.
|
||||||
*/
|
*/
|
||||||
public interface SensorItemMappingDao extends BaseDAO<SensorItemMapping> {
|
//@Repository
|
||||||
|
//public interface SensorItemMappingDao extends JpaRepository<SensorItemMapping> {
|
||||||
List<SensorItemMapping> findAllBySensorId(Sensor sensor);
|
//
|
||||||
|
//// List<SensorItemMapping> findAllBySensorId(Sensor sensor);
|
||||||
}
|
//
|
||||||
|
//}
|
||||||
|
|
|
@ -1,28 +1,22 @@
|
||||||
package com.loafle.overflow.proxy.db;
|
package com.loafle.overflow.proxy.db;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.loafle.overflow.dao.agent.dao.JPAAgentDAO;
|
|
||||||
import com.loafle.overflow.dao.apikey.dao.JPAApiKeyDao;
|
|
||||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
|
||||||
import com.loafle.overflow.dao.crawler.dao.JPACrawlerDAO;
|
|
||||||
import com.loafle.overflow.dao.crawler.dao.JPACrawlerInputItemDAO;
|
|
||||||
import com.loafle.overflow.dao.crawler.dao.JPACrawlerInputItemMappingDAO;
|
|
||||||
import com.loafle.overflow.db.api.DBGrpc;
|
import com.loafle.overflow.db.api.DBGrpc;
|
||||||
|
|
||||||
import com.loafle.overflow.db.api.DBInput;
|
import com.loafle.overflow.db.api.DBInput;
|
||||||
import com.loafle.overflow.db.api.DBOutput;
|
import com.loafle.overflow.db.api.DBOutput;
|
||||||
import com.loafle.overflow.dao.email.dao.JPAEmailAuthDAO;
|
import com.loafle.overflow.module.agent.dao.AgentDAO;
|
||||||
import com.loafle.overflow.dao.member.dao.JPAMemberDAO;
|
import com.loafle.overflow.module.apikey.dao.ApiKeyDao;
|
||||||
import com.loafle.overflow.dao.noauthagent.dao.JPANoAuthAgentDAO;
|
import com.loafle.overflow.module.crawler.dao.CrawlerDAO;
|
||||||
import com.loafle.overflow.dao.sensor.dao.JPASensorDao;
|
import com.loafle.overflow.module.crawler.dao.CrawlerInputItemDAO;
|
||||||
import com.loafle.overflow.dao.sensor.dao.JPASensorItemCategoryDao;
|
import com.loafle.overflow.module.crawler.dao.CrawlerInputItemMappingDAO;
|
||||||
import com.loafle.overflow.dao.sensor.dao.JPASensorItemDao;
|
import com.loafle.overflow.module.email.dao.EmailAuthDAO;
|
||||||
import com.loafle.overflow.dao.sensor.dao.JPASensorItemMappingDao;
|
import com.loafle.overflow.module.member.dao.MemberDAO;
|
||||||
import com.loafle.overflow.dao.target.dao.JPATargetDao;
|
import com.loafle.overflow.module.noauthagent.dao.NoAuthAgentDao;
|
||||||
|
import com.loafle.overflow.module.sensor.dao.SensorDao;
|
||||||
|
import com.loafle.overflow.module.sensor.dao.SensorItemDao;
|
||||||
import io.grpc.ServerBuilder;
|
import io.grpc.ServerBuilder;
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
@ -42,30 +36,64 @@ public class DBProxy {
|
||||||
private static final Logger logger = Logger.getLogger(DBProxy.class.getName());
|
private static final Logger logger = Logger.getLogger(DBProxy.class.getName());
|
||||||
private io.grpc.Server server;
|
private io.grpc.Server server;
|
||||||
|
|
||||||
private static Map<String, JPABaseDAO> daoMap = null;
|
private static Map<String, JpaRepository> daoMap = null;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MemberDAO memberDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AgentDAO agentDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NoAuthAgentDao noAuthAgentDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiKeyDao apiKeyDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmailAuthDAO emailAuthDAO;
|
||||||
|
|
||||||
|
// @Autowired
|
||||||
|
// private TargetDao targetDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CrawlerDAO crawlerDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CrawlerInputItemDAO crawlerInputItemDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CrawlerInputItemMappingDAO crawlerInputItemMappingDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SensorDao sensorDao;
|
||||||
|
|
||||||
|
// @Autowired
|
||||||
|
// private SensorItemCategoryDao sensorItemCategoryDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SensorItemDao sensorItemDao;
|
||||||
|
|
||||||
|
// @Autowired
|
||||||
|
// private SensorItemMappingDao sensorItemMappingDao;
|
||||||
|
|
||||||
public DBProxy() {
|
public DBProxy() {
|
||||||
daoMap = new ConcurrentHashMap();
|
daoMap = new ConcurrentHashMap();
|
||||||
JPAMemberDAO memberDao = new JPAMemberDAO();
|
|
||||||
JPAAgentDAO agentDao = new JPAAgentDAO();
|
|
||||||
JPANoAuthAgentDAO jpaNoAuthAgentDAO = new JPANoAuthAgentDAO();
|
|
||||||
JPAApiKeyDao jpaApiKeyDao = new JPAApiKeyDao();
|
|
||||||
JPAEmailAuthDAO emailAuthDAO = new JPAEmailAuthDAO();
|
|
||||||
|
|
||||||
daoMap.put("member", memberDao);
|
daoMap.put("member", memberDAO);
|
||||||
daoMap.put("agent", agentDao);
|
daoMap.put("agent", agentDAO);
|
||||||
daoMap.put("noauthAgent", jpaNoAuthAgentDAO);
|
daoMap.put("noauthAgent", noAuthAgentDAO);
|
||||||
daoMap.put("apiKey", jpaApiKeyDao);
|
daoMap.put("apiKey", apiKeyDao);
|
||||||
daoMap.put("emailAuth", emailAuthDAO);
|
daoMap.put("emailAuth", emailAuthDAO);
|
||||||
daoMap.put("target", new JPATargetDao());
|
// daoMap.put("target", targetDao);
|
||||||
daoMap.put("crawler", new JPACrawlerDAO());
|
daoMap.put("crawler", crawlerDAO);
|
||||||
daoMap.put("crawlerInputItem", new JPACrawlerInputItemDAO());
|
daoMap.put("crawlerInputItem", crawlerInputItemDAO);
|
||||||
daoMap.put("crawlerInputItemMapping", new JPACrawlerInputItemMappingDAO());
|
daoMap.put("crawlerInputItemMapping", crawlerInputItemMappingDAO);
|
||||||
|
|
||||||
daoMap.put("sensor", new JPASensorDao());
|
daoMap.put("sensor", sensorDao);
|
||||||
daoMap.put("sensorItemCategory", new JPASensorItemCategoryDao());
|
// daoMap.put("sensorItemCategory", sensorItemCategoryDao);
|
||||||
daoMap.put("sensorItem", new JPASensorItemDao());
|
daoMap.put("sensorItem", sensorItemDao);
|
||||||
daoMap.put("sensorItemMapping", new JPASensorItemMappingDao());
|
// daoMap.put("sensorItemMapping", sensorItemMappingDao);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start(int port) throws IOException {
|
public void start(int port) throws IOException {
|
||||||
|
@ -97,7 +125,7 @@ public class DBProxy {
|
||||||
io.grpc.stub.StreamObserver<com.loafle.overflow.db.api.DBOutput> responseObserver) {
|
io.grpc.stub.StreamObserver<com.loafle.overflow.db.api.DBOutput> responseObserver) {
|
||||||
String targetDAO = request.getTargetDao();
|
String targetDAO = request.getTargetDao();
|
||||||
|
|
||||||
JPABaseDAO dao = daoMap.get(targetDAO);
|
JpaRepository dao = daoMap.get(targetDAO);
|
||||||
|
|
||||||
if(dao != null) {
|
if(dao != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -119,7 +147,7 @@ public class DBProxy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String doQuery(DBInput request, JPABaseDAO dao) throws Exception {
|
private String doQuery(DBInput request, JpaRepository dao) throws Exception {
|
||||||
|
|
||||||
String methodName = request.getMethod();
|
String methodName = request.getMethod();
|
||||||
Map<String, String> params = request.getParamsMap();
|
Map<String, String> params = request.getParamsMap();
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
|
|
||||||
|
|
||||||
<persistence-unit name="overflow">
|
|
||||||
<class>com.loafle.overflow.member.model.Member</class>
|
|
||||||
<class>com.loafle.overflow.noauthagent.model.NoAuthAgent</class>
|
|
||||||
<class>com.loafle.overflow.apikey.model.Apikey</class>
|
|
||||||
<class>com.loafle.overflow.agent.model.Agent</class>
|
|
||||||
<class>com.loafle.overflow.email.model.EmailAuth</class>
|
|
||||||
<class>com.loafle.overflow.target.model.Target</class>
|
|
||||||
<class>com.loafle.overflow.crawler.model.Crawler</class>
|
|
||||||
<class>com.loafle.overflow.crawler.model.CrawlerInputItem</class>
|
|
||||||
<class>com.loafle.overflow.crawler.model.CrawlerInputItemMapping</class>
|
|
||||||
|
|
||||||
<class>com.loafle.overflow.sensor.model.Sensor</class>
|
|
||||||
<class>com.loafle.overflow.sensor.model.SensorItem</class>
|
|
||||||
<class>com.loafle.overflow.sensor.model.SensorItemMapping</class>
|
|
||||||
<class>com.loafle.overflow.sensor.model.SensorItemCategory</class>
|
|
||||||
<properties>
|
|
||||||
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://192.168.1.106:5432/postgres" />
|
|
||||||
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
|
|
||||||
<property name="javax.persistence.jdbc.user" value="vertx" />
|
|
||||||
<property name="javax.persistence.jdbc.password" value="qwe123" />
|
|
||||||
<!--<property name="hibernate.hbm2ddl.auto" value="create"/>-->
|
|
||||||
<property name="hibernate.show_sql" value="true" />
|
|
||||||
</properties>
|
|
||||||
</persistence-unit>
|
|
||||||
|
|
||||||
</persistence>
|
|
11
src/main/resources/database.properties
Normal file
11
src/main/resources/database.properties
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
spring.datasource.url=jdbc:postgresql://192.168.1.106:5432/postgres
|
||||||
|
spring.datasource.username=vertx
|
||||||
|
spring.datasource.password=qwe123
|
||||||
|
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||||
|
|
||||||
|
spring.jpa.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
||||||
|
spring.jpa.database=postgresql
|
||||||
|
spring.jpa.hibernate.ddl-auto=create
|
||||||
|
#spring.jpa.hibernate.ddl-auto=update
|
||||||
|
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
|
||||||
|
spring.jpa.show-sql=true
|
|
@ -1,36 +1,36 @@
|
||||||
package com.loafle.overflow.agent.dao;
|
//package com.loafle.overflow.agent.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.agent.dao.JPAAgentDAO;
|
//import com.loafle.overflow.module.agent.dao.JPAAgentDAO;
|
||||||
import com.loafle.overflow.module.agent.model.Agent;
|
//import com.loafle.overflow.module.agent.model.Agent;
|
||||||
import com.loafle.overflow.module.member.model.Member;
|
//import com.loafle.overflow.module.member.model.Member;
|
||||||
import org.junit.Before;
|
//import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
//import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
//import org.junit.Test;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 4.
|
// * Created by root on 17. 6. 4.
|
||||||
*/
|
// */
|
||||||
@Ignore
|
//@Ignore
|
||||||
public class JPAAgentDAOTest {
|
//public class JPAAgentDAOTest {
|
||||||
|
//
|
||||||
private JPAAgentDAO jpaAgentDAO = null;
|
// private JPAAgentDAO jpaAgentDAO = null;
|
||||||
|
//
|
||||||
@Before
|
// @Before
|
||||||
public void before() {
|
// public void before() {
|
||||||
this.jpaAgentDAO = new JPAAgentDAO();
|
// this.jpaAgentDAO = new JPAAgentDAO();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void createAgent() {
|
// public void createAgent() {
|
||||||
Member m = new Member();
|
// Member m = new Member();
|
||||||
m.setId(Long.valueOf(1));
|
// m.setId(Long.valueOf(1));
|
||||||
Agent agent = new Agent();
|
// Agent agent = new Agent();
|
||||||
agent.setDescription("test agent");
|
// agent.setDescription("test agent");
|
||||||
agent.setMember(m);
|
// agent.setMember(m);
|
||||||
Agent savedAgent = jpaAgentDAO.create(agent);
|
// Agent savedAgent = jpaAgentDAO.create(agent);
|
||||||
|
//
|
||||||
System.out.println(savedAgent.getDescription());
|
// System.out.println(savedAgent.getDescription());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
|
@ -1,54 +1,54 @@
|
||||||
package com.loafle.overflow.apikey.dao;
|
//package com.loafle.overflow.apikey.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.apikey.dao.JPAApiKeyDao;
|
//import com.loafle.overflow.module.apikey.dao.JPAApiKeyDao;
|
||||||
import com.loafle.overflow.module.apikey.model.Apikey;
|
//import com.loafle.overflow.module.apikey.model.Apikey;
|
||||||
import com.loafle.overflow.module.member.model.Member;
|
//import com.loafle.overflow.module.member.model.Member;
|
||||||
import org.junit.Before;
|
//import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
//import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
//import org.junit.Test;
|
||||||
|
//
|
||||||
import java.util.Date;
|
//import java.util.Date;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 4.
|
// * Created by root on 17. 6. 4.
|
||||||
*/
|
// */
|
||||||
public class JPAApiKeyDaoTest {
|
//public class JPAApiKeyDaoTest {
|
||||||
|
//
|
||||||
private JPAApiKeyDao jpaApiKeyDao;
|
// private JPAApiKeyDao jpaApiKeyDao;
|
||||||
|
//
|
||||||
@Before
|
// @Before
|
||||||
public void Before() {
|
// public void Before() {
|
||||||
this.jpaApiKeyDao = new JPAApiKeyDao();
|
// this.jpaApiKeyDao = new JPAApiKeyDao();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
@Ignore
|
// @Ignore
|
||||||
@Test
|
// @Test
|
||||||
public void findByApiKey() throws Exception {
|
// public void findByApiKey() throws Exception {
|
||||||
|
//
|
||||||
Apikey apikey = new Apikey();
|
// Apikey apikey = new Apikey();
|
||||||
|
//
|
||||||
apikey.setApiKey("1111111");
|
// apikey.setApiKey("1111111");
|
||||||
|
//
|
||||||
Apikey a = this.jpaApiKeyDao.findByApiKey(apikey);
|
// Apikey a = this.jpaApiKeyDao.findByApiKey(apikey);
|
||||||
|
//
|
||||||
System.out.println(a.getId());
|
// System.out.println(a.getId());
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Ignore
|
// @Ignore
|
||||||
@Test
|
// @Test
|
||||||
public void createApiKey() {
|
// public void createApiKey() {
|
||||||
Apikey apikey = new Apikey();
|
// Apikey apikey = new Apikey();
|
||||||
|
//
|
||||||
apikey.setApiKey("1111111");
|
// apikey.setApiKey("1111111");
|
||||||
apikey.setCreateDate(new Date());
|
// apikey.setCreateDate(new Date());
|
||||||
Member member = new Member();
|
// Member member = new Member();
|
||||||
member.setId((long)2);
|
// member.setId((long)2);
|
||||||
apikey.setMember(member);
|
// apikey.setMember(member);
|
||||||
|
//
|
||||||
|
//
|
||||||
jpaApiKeyDao.create(apikey);
|
// jpaApiKeyDao.create(apikey);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
|
@ -1,78 +1,78 @@
|
||||||
package com.loafle.overflow.crawler.dao;
|
//package com.loafle.overflow.crawler.dao;
|
||||||
|
//
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.crawler.dao.JPACrawlerDAO;
|
//import com.loafle.overflow.module.crawler.dao.JPACrawlerDAO;
|
||||||
import com.loafle.overflow.module.crawler.model.Crawler;
|
//import com.loafle.overflow.module.crawler.model.Crawler;
|
||||||
import org.junit.Before;
|
//import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
//import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
//import org.junit.Test;
|
||||||
|
//
|
||||||
import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by geek@loafle.com on 17. 6. 8.
|
// * Created by geek@loafle.com on 17. 6. 8.
|
||||||
*/
|
// */
|
||||||
@Ignore
|
//@Ignore
|
||||||
public class JPACrawlerDAOTest {
|
//public class JPACrawlerDAOTest {
|
||||||
|
//
|
||||||
private JPACrawlerDAO jpaCrawlerDAO = null;
|
// private JPACrawlerDAO jpaCrawlerDAO = null;
|
||||||
|
//
|
||||||
@Before
|
// @Before
|
||||||
public void before() {
|
// public void before() {
|
||||||
this.jpaCrawlerDAO = new JPACrawlerDAO();
|
// this.jpaCrawlerDAO = new JPACrawlerDAO();
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// TODO Crawler Meta Data Insert
|
// // TODO Crawler Meta Data Insert
|
||||||
@Test
|
// @Test
|
||||||
public void TestInsertList() {
|
// public void TestInsertList() {
|
||||||
List<Crawler> crawlers = new ArrayList<Crawler>();
|
// List<Crawler> crawlers = new ArrayList<Crawler>();
|
||||||
|
//
|
||||||
Crawler crawler1 = new Crawler();
|
// Crawler crawler1 = new Crawler();
|
||||||
crawler1.setName("SNMP Crawler");
|
// crawler1.setName("SNMP Crawler");
|
||||||
crawler1.setDescription("SNMP Crawler");
|
// crawler1.setDescription("SNMP Crawler");
|
||||||
crawler1.setCrawlerType("SNMP");
|
// crawler1.setCrawlerType("SNMP");
|
||||||
|
//
|
||||||
Crawler crawler2 = new Crawler();
|
// Crawler crawler2 = new Crawler();
|
||||||
crawler2.setName("WMI Crawler");
|
// crawler2.setName("WMI Crawler");
|
||||||
crawler2.setDescription("WMI Crawler");
|
// crawler2.setDescription("WMI Crawler");
|
||||||
crawler2.setCrawlerType("WMI");
|
// crawler2.setCrawlerType("WMI");
|
||||||
|
//
|
||||||
Crawler crawler3 = new Crawler();
|
// Crawler crawler3 = new Crawler();
|
||||||
crawler3.setName("HTTP Crawler");
|
// crawler3.setName("HTTP Crawler");
|
||||||
crawler3.setDescription("HTTP Crawler");
|
// crawler3.setDescription("HTTP Crawler");
|
||||||
crawler3.setCrawlerType("Network");
|
// crawler3.setCrawlerType("Network");
|
||||||
|
//
|
||||||
Crawler crawler4 = new Crawler();
|
// Crawler crawler4 = new Crawler();
|
||||||
crawler4.setName("FTP Crawler");
|
// crawler4.setName("FTP Crawler");
|
||||||
crawler4.setDescription("FTP Crawler");
|
// crawler4.setDescription("FTP Crawler");
|
||||||
crawler4.setCrawlerType("Network");
|
// crawler4.setCrawlerType("Network");
|
||||||
|
//
|
||||||
crawlers.add(crawler1);
|
// crawlers.add(crawler1);
|
||||||
crawlers.add(crawler2);
|
// crawlers.add(crawler2);
|
||||||
crawlers.add(crawler3);
|
// crawlers.add(crawler3);
|
||||||
crawlers.add(crawler4);
|
// crawlers.add(crawler4);
|
||||||
|
//
|
||||||
this.jpaCrawlerDAO.createAll(crawlers);
|
// this.jpaCrawlerDAO.createAll(crawlers);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void TestInsert() {
|
// public void TestInsert() {
|
||||||
Crawler crawler = new Crawler();
|
// Crawler crawler = new Crawler();
|
||||||
crawler.setName("Mysql Crawler");
|
// crawler.setName("Mysql Crawler");
|
||||||
crawler.setDescription("Mysql Crawler");
|
// crawler.setDescription("Mysql Crawler");
|
||||||
crawler.setCrawlerType("MysqlCrawler");
|
// crawler.setCrawlerType("MysqlCrawler");
|
||||||
this.jpaCrawlerDAO.create(crawler);
|
// this.jpaCrawlerDAO.create(crawler);
|
||||||
}
|
// }
|
||||||
// TODO Crawler Select Test
|
// // TODO Crawler Select Test
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void TestListAll() {
|
// public void TestListAll() {
|
||||||
List<Crawler> ls = this.jpaCrawlerDAO.findAll();
|
// List<Crawler> ls = this.jpaCrawlerDAO.findAll();
|
||||||
System.out.println(ls.size());
|
// System.out.println(ls.size());
|
||||||
}
|
// }
|
||||||
// TODO Crawler Update Test
|
// // TODO Crawler Update Test
|
||||||
|
//
|
||||||
// TODO Crawler Delete Test
|
// // TODO Crawler Delete Test
|
||||||
}
|
//}
|
|
@ -1,62 +1,62 @@
|
||||||
package com.loafle.overflow.crawler.dao;
|
//package com.loafle.overflow.crawler.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.crawler.dao.JPACrawlerInputItemDAO;
|
//import com.loafle.overflow.module.crawler.dao.JPACrawlerInputItemDAO;
|
||||||
import com.loafle.overflow.module.crawler.model.CrawlerInputItem;
|
//import com.loafle.overflow.module.crawler.model.CrawlerInputItem;
|
||||||
import org.junit.Before;
|
//import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
//import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
//import org.junit.Test;
|
||||||
|
//
|
||||||
import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by geek@loafle.com on 17. 6. 8.
|
// * Created by geek@loafle.com on 17. 6. 8.
|
||||||
*/
|
// */
|
||||||
@Ignore
|
//@Ignore
|
||||||
public class JPACrawlerInputItemDAOTest {
|
//public class JPACrawlerInputItemDAOTest {
|
||||||
|
//
|
||||||
private JPACrawlerInputItemDAO inputItemDAO = null;
|
// private JPACrawlerInputItemDAO inputItemDAO = null;
|
||||||
|
//
|
||||||
@Before
|
// @Before
|
||||||
public void before() {
|
// public void before() {
|
||||||
this.inputItemDAO = new JPACrawlerInputItemDAO();
|
// this.inputItemDAO = new JPACrawlerInputItemDAO();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void TestInsertList() {
|
// public void TestInsertList() {
|
||||||
List<CrawlerInputItem> cris = new ArrayList<CrawlerInputItem>();
|
// List<CrawlerInputItem> cris = new ArrayList<CrawlerInputItem>();
|
||||||
|
//
|
||||||
CrawlerInputItem item1 = new CrawlerInputItem();
|
// CrawlerInputItem item1 = new CrawlerInputItem();
|
||||||
item1.setName("ID");
|
// item1.setName("ID");
|
||||||
item1.setDataType("String");
|
// item1.setDataType("String");
|
||||||
item1.setDescription("Auth ID");
|
// item1.setDescription("Auth ID");
|
||||||
|
//
|
||||||
CrawlerInputItem item2 = new CrawlerInputItem();
|
// CrawlerInputItem item2 = new CrawlerInputItem();
|
||||||
item2.setName("PW");
|
// item2.setName("PW");
|
||||||
item2.setDataType("String");
|
// item2.setDataType("String");
|
||||||
item2.setDescription("Auth PW");
|
// item2.setDescription("Auth PW");
|
||||||
|
//
|
||||||
CrawlerInputItem item3 = new CrawlerInputItem();
|
// CrawlerInputItem item3 = new CrawlerInputItem();
|
||||||
item3.setName("AuthType");
|
// item3.setName("AuthType");
|
||||||
item3.setDataType("Select");
|
// item3.setDataType("Select");
|
||||||
item3.setDescription("MD5||SHA");
|
// item3.setDescription("MD5||SHA");
|
||||||
|
//
|
||||||
CrawlerInputItem item4 = new CrawlerInputItem();
|
// CrawlerInputItem item4 = new CrawlerInputItem();
|
||||||
item4.setName("community");
|
// item4.setName("community");
|
||||||
item4.setDataType("String");
|
// item4.setDataType("String");
|
||||||
item4.setDescription("community");
|
// item4.setDescription("community");
|
||||||
|
//
|
||||||
CrawlerInputItem item5 = new CrawlerInputItem();
|
// CrawlerInputItem item5 = new CrawlerInputItem();
|
||||||
item5.setName("textfield");
|
// item5.setName("textfield");
|
||||||
item5.setDataType("String");
|
// item5.setDataType("String");
|
||||||
item5.setDescription("User ID");
|
// item5.setDescription("User ID");
|
||||||
|
//
|
||||||
cris.add(item1);
|
// cris.add(item1);
|
||||||
cris.add(item2);
|
// cris.add(item2);
|
||||||
cris.add(item3);
|
// cris.add(item3);
|
||||||
cris.add(item4);
|
// cris.add(item4);
|
||||||
cris.add(item5);
|
// cris.add(item5);
|
||||||
|
//
|
||||||
this.inputItemDAO.createAll(cris);
|
// this.inputItemDAO.createAll(cris);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
|
@ -1,89 +1,89 @@
|
||||||
package com.loafle.overflow.crawler.dao;
|
//package com.loafle.overflow.crawler.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.crawler.dao.JPACrawlerInputItemMappingDAO;
|
//import com.loafle.overflow.module.crawler.dao.JPACrawlerInputItemMappingDAO;
|
||||||
import com.loafle.overflow.module.crawler.model.Crawler;
|
//import com.loafle.overflow.module.crawler.model.Crawler;
|
||||||
import com.loafle.overflow.module.crawler.model.CrawlerInputItem;
|
//import com.loafle.overflow.module.crawler.model.CrawlerInputItem;
|
||||||
import com.loafle.overflow.module.crawler.model.CrawlerInputItemMapping;
|
//import com.loafle.overflow.module.crawler.model.CrawlerInputItemMapping;
|
||||||
import org.junit.Before;
|
//import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
//import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
//import org.junit.Test;
|
||||||
|
//
|
||||||
import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by geek@loafle.com on 17. 6. 8.
|
// * Created by geek@loafle.com on 17. 6. 8.
|
||||||
*/
|
// */
|
||||||
@Ignore
|
//@Ignore
|
||||||
public class JPACrawlerInputItemMappingDAOTest {
|
//public class JPACrawlerInputItemMappingDAOTest {
|
||||||
|
//
|
||||||
private JPACrawlerInputItemMappingDAO mappingDAO = null;
|
// private JPACrawlerInputItemMappingDAO mappingDAO = null;
|
||||||
|
//
|
||||||
@Before
|
// @Before
|
||||||
public void before() {
|
// public void before() {
|
||||||
this.mappingDAO = new JPACrawlerInputItemMappingDAO();
|
// this.mappingDAO = new JPACrawlerInputItemMappingDAO();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void TestInsert() {
|
// public void TestInsert() {
|
||||||
CrawlerInputItemMapping itemMapping = new CrawlerInputItemMapping();
|
// CrawlerInputItemMapping itemMapping = new CrawlerInputItemMapping();
|
||||||
itemMapping.setCrawler(new Crawler((long)5));
|
// itemMapping.setCrawler(new Crawler((long)5));
|
||||||
itemMapping.setCrawlerInputItem(new CrawlerInputItem((long)1));
|
// itemMapping.setCrawlerInputItem(new CrawlerInputItem((long)1));
|
||||||
itemMapping.setPriority((short) 1);
|
// itemMapping.setPriority((short) 1);
|
||||||
itemMapping.setRequiredType(true);
|
// itemMapping.setRequiredType(true);
|
||||||
|
//
|
||||||
CrawlerInputItemMapping itemMapping1 = new CrawlerInputItemMapping();
|
// CrawlerInputItemMapping itemMapping1 = new CrawlerInputItemMapping();
|
||||||
itemMapping1.setCrawler(new Crawler((long)5));
|
// itemMapping1.setCrawler(new Crawler((long)5));
|
||||||
itemMapping1.setCrawlerInputItem(new CrawlerInputItem((long)2));
|
// itemMapping1.setCrawlerInputItem(new CrawlerInputItem((long)2));
|
||||||
itemMapping1.setPriority((short) 2);
|
// itemMapping1.setPriority((short) 2);
|
||||||
itemMapping1.setRequiredType(true);
|
// itemMapping1.setRequiredType(true);
|
||||||
|
//
|
||||||
CrawlerInputItemMapping itemMapping2 = new CrawlerInputItemMapping();
|
// CrawlerInputItemMapping itemMapping2 = new CrawlerInputItemMapping();
|
||||||
itemMapping2.setCrawler(new Crawler((long)1));
|
// itemMapping2.setCrawler(new Crawler((long)1));
|
||||||
itemMapping2.setCrawlerInputItem(new CrawlerInputItem((long)1));
|
// itemMapping2.setCrawlerInputItem(new CrawlerInputItem((long)1));
|
||||||
itemMapping2.setPriority((short) 1);
|
// itemMapping2.setPriority((short) 1);
|
||||||
itemMapping2.setRequiredType(true);
|
// itemMapping2.setRequiredType(true);
|
||||||
|
//
|
||||||
CrawlerInputItemMapping itemMapping3 = new CrawlerInputItemMapping();
|
// CrawlerInputItemMapping itemMapping3 = new CrawlerInputItemMapping();
|
||||||
itemMapping3.setCrawler(new Crawler((long)1));
|
// itemMapping3.setCrawler(new Crawler((long)1));
|
||||||
itemMapping3.setCrawlerInputItem(new CrawlerInputItem((long)2));
|
// itemMapping3.setCrawlerInputItem(new CrawlerInputItem((long)2));
|
||||||
itemMapping3.setPriority((short) 2);
|
// itemMapping3.setPriority((short) 2);
|
||||||
itemMapping3.setRequiredType(true);
|
// itemMapping3.setRequiredType(true);
|
||||||
|
//
|
||||||
CrawlerInputItemMapping itemMapping4 = new CrawlerInputItemMapping();
|
// CrawlerInputItemMapping itemMapping4 = new CrawlerInputItemMapping();
|
||||||
itemMapping4.setCrawler(new Crawler((long)1));
|
// itemMapping4.setCrawler(new Crawler((long)1));
|
||||||
itemMapping4.setCrawlerInputItem(new CrawlerInputItem((long)3));
|
// itemMapping4.setCrawlerInputItem(new CrawlerInputItem((long)3));
|
||||||
itemMapping4.setPriority((short) 3);
|
// itemMapping4.setPriority((short) 3);
|
||||||
itemMapping4.setRequiredType(true);
|
// itemMapping4.setRequiredType(true);
|
||||||
|
//
|
||||||
CrawlerInputItemMapping itemMapping5 = new CrawlerInputItemMapping();
|
// CrawlerInputItemMapping itemMapping5 = new CrawlerInputItemMapping();
|
||||||
itemMapping5.setCrawler(new Crawler((long)2));
|
// itemMapping5.setCrawler(new Crawler((long)2));
|
||||||
itemMapping5.setCrawlerInputItem(new CrawlerInputItem((long)1));
|
// itemMapping5.setCrawlerInputItem(new CrawlerInputItem((long)1));
|
||||||
itemMapping5.setPriority((short) 1);
|
// itemMapping5.setPriority((short) 1);
|
||||||
itemMapping5.setRequiredType(true);
|
// itemMapping5.setRequiredType(true);
|
||||||
|
//
|
||||||
CrawlerInputItemMapping itemMapping6 = new CrawlerInputItemMapping();
|
// CrawlerInputItemMapping itemMapping6 = new CrawlerInputItemMapping();
|
||||||
itemMapping6.setCrawler(new Crawler((long)2));
|
// itemMapping6.setCrawler(new Crawler((long)2));
|
||||||
itemMapping6.setCrawlerInputItem(new CrawlerInputItem((long)2));
|
// itemMapping6.setCrawlerInputItem(new CrawlerInputItem((long)2));
|
||||||
itemMapping6.setPriority((short) 2);
|
// itemMapping6.setPriority((short) 2);
|
||||||
itemMapping6.setRequiredType(true);
|
// itemMapping6.setRequiredType(true);
|
||||||
|
//
|
||||||
List<CrawlerInputItemMapping> crs = new ArrayList<CrawlerInputItemMapping>();
|
// List<CrawlerInputItemMapping> crs = new ArrayList<CrawlerInputItemMapping>();
|
||||||
crs.add(itemMapping);
|
// crs.add(itemMapping);
|
||||||
crs.add(itemMapping1);
|
// crs.add(itemMapping1);
|
||||||
crs.add(itemMapping2);
|
// crs.add(itemMapping2);
|
||||||
crs.add(itemMapping3);
|
// crs.add(itemMapping3);
|
||||||
crs.add(itemMapping4);
|
// crs.add(itemMapping4);
|
||||||
crs.add(itemMapping5);
|
// crs.add(itemMapping5);
|
||||||
crs.add(itemMapping6);
|
// crs.add(itemMapping6);
|
||||||
|
//
|
||||||
this.mappingDAO.createAll(crs);
|
// this.mappingDAO.createAll(crs);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void TestFindByCrawlerId() {
|
// public void TestFindByCrawlerId() {
|
||||||
List<CrawlerInputItemMapping> ls = this.mappingDAO.findByCrawlerId(new Crawler((long)5));
|
// List<CrawlerInputItemMapping> ls = this.mappingDAO.findByCrawlerId(new Crawler((long)5));
|
||||||
System.out.println(ls.size());
|
// System.out.println(ls.size());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
|
@ -1,77 +1,77 @@
|
||||||
package com.loafle.overflow.email.dao;
|
//package com.loafle.overflow.email.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.email.dao.JPAEmailAuthDAO;
|
//import com.loafle.overflow.module.email.dao.JPAEmailAuthDAO;
|
||||||
import com.loafle.overflow.module.email.model.EmailAuth;
|
//import com.loafle.overflow.module.email.model.EmailAuth;
|
||||||
import com.loafle.overflow.module.member.model.Member;
|
//import com.loafle.overflow.module.member.model.Member;
|
||||||
import org.junit.Assert;
|
//import org.junit.Assert;
|
||||||
import org.junit.Before;
|
//import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
//import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
//import org.junit.Test;
|
||||||
|
//
|
||||||
import java.util.Date;
|
//import java.util.Date;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by geek@loafle.com on 17. 6. 6.
|
// * Created by geek@loafle.com on 17. 6. 6.
|
||||||
*/
|
// */
|
||||||
@Ignore
|
//@Ignore
|
||||||
public class JPAEmailAuthDAOTest {
|
//public class JPAEmailAuthDAOTest {
|
||||||
|
//
|
||||||
private JPAEmailAuthDAO emailAuthDAO = null;
|
// private JPAEmailAuthDAO emailAuthDAO = null;
|
||||||
|
//
|
||||||
@Before
|
// @Before
|
||||||
public void before() {
|
// public void before() {
|
||||||
|
//
|
||||||
this.emailAuthDAO = new JPAEmailAuthDAO();
|
// this.emailAuthDAO = new JPAEmailAuthDAO();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
@Ignore
|
// @Ignore
|
||||||
public void createEmailAuth() {
|
// public void createEmailAuth() {
|
||||||
EmailAuth auth = new EmailAuth();
|
// EmailAuth auth = new EmailAuth();
|
||||||
|
//
|
||||||
auth.setAuthToken("0F2003A6-83B0-40F5-B56A-0485F458CA911");
|
// auth.setAuthToken("0F2003A6-83B0-40F5-B56A-0485F458CA911");
|
||||||
auth.setMember(new Member(Long.valueOf(1)));
|
// auth.setMember(new Member(Long.valueOf(1)));
|
||||||
auth.setIsInvalid(false);
|
// 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.setUpdateDate(new Date());
|
||||||
auth.setIsConfirm(false);
|
// auth.setConfirmDate(new Date());
|
||||||
EmailAuth ret = emailAuthDAO.create(auth);
|
//
|
||||||
System.out.println(ret.getId());
|
// this.emailAuthDAO.update(auth);
|
||||||
}
|
// System.out.println(auth.getConfirmDate());
|
||||||
|
// }
|
||||||
@Test
|
//
|
||||||
@Ignore
|
// @Test
|
||||||
public void updateEmailAuth() {
|
// @Ignore
|
||||||
EmailAuth auth = this.emailAuthDAO.find("1");
|
// public void TestFindByAuthToken() {
|
||||||
|
// EmailAuth auth = new EmailAuth();
|
||||||
auth.setIsInvalid(true);
|
// auth.setAuthToken("3C03F8AB-1D4D-4C8A-8C36-EE2D644988B5");
|
||||||
auth.setUpdateDate(new Date());
|
//
|
||||||
auth.setConfirmDate(new Date());
|
// EmailAuth temp = this.emailAuthDAO.findByAuthToken(auth);
|
||||||
|
//
|
||||||
this.emailAuthDAO.update(auth);
|
// System.out.println(temp.getId());
|
||||||
System.out.println(auth.getConfirmDate());
|
// Assert.assertNotNull(temp);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
@Ignore
|
// @Ignore
|
||||||
public void TestFindByAuthToken() {
|
// public void TestFindByMemberId() {
|
||||||
EmailAuth auth = new EmailAuth();
|
// EmailAuth auth = new EmailAuth();
|
||||||
auth.setAuthToken("3C03F8AB-1D4D-4C8A-8C36-EE2D644988B5");
|
// auth.setMember(new Member((long)4));
|
||||||
|
// List<EmailAuth> ems = this.emailAuthDAO.findByMemberId(auth);
|
||||||
EmailAuth temp = this.emailAuthDAO.findByAuthToken(auth);
|
//
|
||||||
|
// System.out.println(ems.get(0).getMember().getEmail());
|
||||||
System.out.println(temp.getId());
|
// Assert.assertEquals((long)1, (long)ems.size());
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,42 +1,42 @@
|
||||||
package com.loafle.overflow.member.dao;
|
//package com.loafle.overflow.member.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.member.dao.JPAMemberDAO;
|
//import com.loafle.overflow.module.member.dao.JPAMemberDAO;
|
||||||
import com.loafle.overflow.module.member.model.Member;
|
//import com.loafle.overflow.module.member.model.Member;
|
||||||
import org.junit.Before;
|
//import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
//import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
//import org.junit.Test;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 4.
|
// * Created by root on 17. 6. 4.
|
||||||
*/
|
// */
|
||||||
@Ignore
|
//@Ignore
|
||||||
public class JPAMemberDAOTest {
|
//public class JPAMemberDAOTest {
|
||||||
|
//
|
||||||
private JPAMemberDAO jpaMemberDAO = null;
|
// private JPAMemberDAO jpaMemberDAO = null;
|
||||||
|
//
|
||||||
@Before
|
// @Before
|
||||||
public void before() {
|
// public void before() {
|
||||||
|
//
|
||||||
this.jpaMemberDAO = new JPAMemberDAO();
|
// this.jpaMemberDAO = new JPAMemberDAO();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void findByEmail() throws Exception {
|
// public void findByEmail() throws Exception {
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// @Ignore
|
//// @Ignore
|
||||||
@Test
|
// @Test
|
||||||
public void createMember() {
|
// public void createMember() {
|
||||||
Member m = new Member();
|
// Member m = new Member();
|
||||||
|
//
|
||||||
m.setName("geek");
|
// m.setName("geek");
|
||||||
m.setCompany("loafle");
|
// m.setCompany("loafle");
|
||||||
m.setDigest("bbbbbbbbb");
|
// m.setDigest("bbbbbbbbb");
|
||||||
m.setPwSalt("salktttt");
|
// m.setPwSalt("salktttt");
|
||||||
m.setPhone("000-000-0000");
|
// m.setPhone("000-000-0000");
|
||||||
m.setEmail("geek@loafle.com");
|
// m.setEmail("geek@loafle.com");
|
||||||
|
//
|
||||||
this.jpaMemberDAO.create(m);
|
// this.jpaMemberDAO.create(m);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,58 +1,58 @@
|
||||||
package com.loafle.overflow.noauthagent.dao;
|
//package com.loafle.overflow.noauthagent.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.noauthagent.dao.JPANoAuthAgentDAO;
|
//import com.loafle.overflow.module.noauthagent.dao.JPANoAuthAgentDAO;
|
||||||
import com.loafle.overflow.module.noauthagent.model.NoAuthAgent;
|
//import com.loafle.overflow.module.noauthagent.model.NoAuthAgent;
|
||||||
import com.loafle.overflow.module.noauthagent.type.AuthType;
|
//import com.loafle.overflow.module.noauthagent.type.AuthType;
|
||||||
import org.junit.Before;
|
//import org.junit.Before;
|
||||||
import org.junit.Test;
|
//import org.junit.Test;
|
||||||
|
//
|
||||||
import java.util.Date;
|
//import java.util.Date;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 4.
|
// * Created by root on 17. 6. 4.
|
||||||
*/
|
// */
|
||||||
public class JPANoAuthAgentDAOTest {
|
//public class JPANoAuthAgentDAOTest {
|
||||||
|
//
|
||||||
private JPANoAuthAgentDAO jpaNoAuthAgentDAO = null;
|
// private JPANoAuthAgentDAO jpaNoAuthAgentDAO = null;
|
||||||
|
//
|
||||||
@Before
|
// @Before
|
||||||
public void Before() {
|
// public void Before() {
|
||||||
this.jpaNoAuthAgentDAO = new JPANoAuthAgentDAO();
|
// this.jpaNoAuthAgentDAO = new JPANoAuthAgentDAO();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void findByTempKey() throws Exception {
|
// public void findByTempKey() throws Exception {
|
||||||
|
//
|
||||||
NoAuthAgent noAuthAgent = new NoAuthAgent();
|
// NoAuthAgent noAuthAgent = new NoAuthAgent();
|
||||||
noAuthAgent.setTempKey("3398473-90847903874");
|
// noAuthAgent.setTempKey("3398473-90847903874");
|
||||||
|
//
|
||||||
NoAuthAgent aa = this.jpaNoAuthAgentDAO.findByTempKey(noAuthAgent);
|
// NoAuthAgent aa = this.jpaNoAuthAgentDAO.findByTempKey(noAuthAgent);
|
||||||
|
//
|
||||||
System.out.println(aa.getAuthStatus());
|
// System.out.println(aa.getAuthStatus());
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void findAllByNoAuth() throws Exception {
|
// public void findAllByNoAuth() throws Exception {
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void createNoAuthAgent() {
|
// public void createNoAuthAgent() {
|
||||||
NoAuthAgent noAuthAgent = new NoAuthAgent();
|
// NoAuthAgent noAuthAgent = new NoAuthAgent();
|
||||||
|
//
|
||||||
|
//
|
||||||
noAuthAgent.setApiKey("aaaaaaa");
|
// noAuthAgent.setApiKey("aaaaaaa");
|
||||||
noAuthAgent.setDate(new Date());
|
// noAuthAgent.setDate(new Date());
|
||||||
noAuthAgent.setHostName("Snoop pc");
|
// noAuthAgent.setHostName("Snoop pc");
|
||||||
noAuthAgent.setLocalIP(4123);
|
// noAuthAgent.setLocalIP(4123);
|
||||||
noAuthAgent.setTempKey("3398473-90847903874");
|
// noAuthAgent.setTempKey("3398473-90847903874");
|
||||||
noAuthAgent.setAuthStatus(AuthType.WAIT);
|
// noAuthAgent.setAuthStatus(AuthType.WAIT);
|
||||||
|
//
|
||||||
this.jpaNoAuthAgentDAO.create(noAuthAgent);
|
// this.jpaNoAuthAgentDAO.create(noAuthAgent);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
//}
|
|
@ -1,55 +1,55 @@
|
||||||
package com.loafle.overflow.sensor.dao;
|
//package com.loafle.overflow.sensor.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.crawler.model.Crawler;
|
//import com.loafle.overflow.module.crawler.model.Crawler;
|
||||||
import com.loafle.overflow.module.sensor.dao.JPASensorDao;
|
//import com.loafle.overflow.module.sensor.dao.JPASensorDao;
|
||||||
import com.loafle.overflow.module.sensor.dao.SensorDao;
|
//import com.loafle.overflow.module.sensor.dao.SensorDao;
|
||||||
import org.junit.Before;
|
//import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
//import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
//import org.junit.Test;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 9.
|
// * Created by root on 17. 6. 9.
|
||||||
*/
|
// */
|
||||||
public class JPASensorDaoTest {
|
//public class JPASensorDaoTest {
|
||||||
|
//
|
||||||
private SensorDao sensorDao = null;
|
// private SensorDao sensorDao = null;
|
||||||
|
//
|
||||||
@Before
|
// @Before
|
||||||
public void before() {
|
// public void before() {
|
||||||
this.sensorDao = new JPASensorDao();
|
// this.sensorDao = new JPASensorDao();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void findAllByAgentID() throws Exception {
|
// public void findAllByAgentID() throws Exception {
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
@Ignore
|
// @Ignore
|
||||||
@Test
|
// @Test
|
||||||
public void create() {
|
// public void create() {
|
||||||
|
//
|
||||||
|
//
|
||||||
Sensor sensor = new Sensor();
|
// Sensor sensor = new Sensor();
|
||||||
|
//
|
||||||
Crawler crawler = new Crawler();
|
// Crawler crawler = new Crawler();
|
||||||
crawler.setId(1L);
|
// crawler.setId(1L);
|
||||||
|
//
|
||||||
Target target = new Target();
|
// Target target = new Target();
|
||||||
target.setId(1L);
|
// target.setId(1L);
|
||||||
|
//
|
||||||
sensor.setCrawler(crawler);
|
// sensor.setCrawler(crawler);
|
||||||
sensor.setInterval(1);
|
// sensor.setInterval(1);
|
||||||
sensor.setNotification("nothing");
|
// sensor.setNotification("nothing");
|
||||||
sensor.setTarget(target);
|
// sensor.setTarget(target);
|
||||||
|
//
|
||||||
this.sensorDao.create(sensor);
|
// this.sensorDao.create(sensor);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void list() {
|
// public void list() {
|
||||||
|
//
|
||||||
// this.sensorDao.findAllByAgentID()
|
//// this.sensorDao.findAllByAgentID()
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
|
@ -1,36 +1,36 @@
|
||||||
package com.loafle.overflow.sensor.dao;
|
//package com.loafle.overflow.sensor.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.sensor.dao.JPASensorItemCategoryDao;
|
//import com.loafle.overflow.module.sensor.dao.JPASensorItemCategoryDao;
|
||||||
import com.loafle.overflow.module.sensor.dao.SensorItemCategoryDao;
|
//import com.loafle.overflow.module.sensor.dao.SensorItemCategoryDao;
|
||||||
import org.junit.Before;
|
//import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
//import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
//import org.junit.Test;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 9.
|
// * Created by root on 17. 6. 9.
|
||||||
*/
|
// */
|
||||||
public class JPASensorItemCategoryDaoTest {
|
//public class JPASensorItemCategoryDaoTest {
|
||||||
|
//
|
||||||
private SensorItemCategoryDao sensorItemCategoryDao = null;
|
// private SensorItemCategoryDao sensorItemCategoryDao = null;
|
||||||
|
//
|
||||||
@Before
|
// @Before
|
||||||
public void before() {
|
// public void before() {
|
||||||
|
//
|
||||||
this.sensorItemCategoryDao = new JPASensorItemCategoryDao();
|
// this.sensorItemCategoryDao = new JPASensorItemCategoryDao();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
@Ignore
|
// @Ignore
|
||||||
@Test
|
// @Test
|
||||||
public void create() {
|
// public void create() {
|
||||||
|
//
|
||||||
SensorItemCategory sensorItemCategory = new SensorItemCategory();
|
// SensorItemCategory sensorItemCategory = new SensorItemCategory();
|
||||||
|
//
|
||||||
sensorItemCategory.setName("count");
|
// sensorItemCategory.setName("count");
|
||||||
sensorItemCategory.setDescription("count !!!!");
|
// sensorItemCategory.setDescription("count !!!!");
|
||||||
|
//
|
||||||
this.sensorItemCategoryDao.create(sensorItemCategory);
|
// this.sensorItemCategoryDao.create(sensorItemCategory);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
|
@ -1,61 +1,61 @@
|
||||||
package com.loafle.overflow.sensor.dao;
|
//package com.loafle.overflow.sensor.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.crawler.model.Crawler;
|
//import com.loafle.overflow.module.crawler.model.Crawler;
|
||||||
import com.loafle.overflow.module.sensor.dao.JPASensorItemDao;
|
//import com.loafle.overflow.module.sensor.dao.JPASensorItemDao;
|
||||||
import com.loafle.overflow.module.sensor.dao.SensorItemDao;
|
//import com.loafle.overflow.module.sensor.dao.SensorItemDao;
|
||||||
import org.junit.Before;
|
//import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
//import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
//import org.junit.Test;
|
||||||
|
//
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 9.
|
// * Created by root on 17. 6. 9.
|
||||||
*/
|
// */
|
||||||
public class JPASensorItemDaoTest {
|
//public class JPASensorItemDaoTest {
|
||||||
|
//
|
||||||
private SensorItemDao sensorItemDao = null;
|
// private SensorItemDao sensorItemDao = null;
|
||||||
|
//
|
||||||
@Before
|
// @Before
|
||||||
public void before() {
|
// public void before() {
|
||||||
this.sensorItemDao = new JPASensorItemDao();
|
// this.sensorItemDao = new JPASensorItemDao();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Ignore
|
// @Ignore
|
||||||
@Test
|
// @Test
|
||||||
public void create() {
|
// public void create() {
|
||||||
|
//
|
||||||
|
//
|
||||||
SensorItem sensorItem = new SensorItem();
|
// SensorItem sensorItem = new SensorItem();
|
||||||
|
//
|
||||||
Crawler crawler = new Crawler();
|
// Crawler crawler = new Crawler();
|
||||||
crawler.setId(1L);
|
// crawler.setId(1L);
|
||||||
|
//
|
||||||
SensorItemCategory category = new SensorItemCategory();
|
// SensorItemCategory category = new SensorItemCategory();
|
||||||
category.setId(1L);
|
// category.setId(1L);
|
||||||
|
//
|
||||||
sensorItem.setCrawler(crawler);
|
// sensorItem.setCrawler(crawler);
|
||||||
sensorItem.setDataType("int");
|
// sensorItem.setDataType("int");
|
||||||
sensorItem.setDescription("count getget");
|
// sensorItem.setDescription("count getget");
|
||||||
sensorItem.setName("net.mysql.connection_count");
|
// sensorItem.setName("net.mysql.connection_count");
|
||||||
sensorItem.setSensorItemCategory(category);
|
// sensorItem.setSensorItemCategory(category);
|
||||||
|
//
|
||||||
this.sensorItemDao.create(sensorItem);
|
// this.sensorItemDao.create(sensorItem);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Ignore
|
// @Ignore
|
||||||
@Test
|
// @Test
|
||||||
public void list() {
|
// public void list() {
|
||||||
|
//
|
||||||
Crawler crawler = new Crawler();
|
// Crawler crawler = new Crawler();
|
||||||
crawler.setId(1L);
|
// crawler.setId(1L);
|
||||||
|
//
|
||||||
List<SensorItem> is = this.sensorItemDao.findAllByCrawlerId(crawler);
|
// List<SensorItem> is = this.sensorItemDao.findAllByCrawlerId(crawler);
|
||||||
|
//
|
||||||
|
//
|
||||||
System.out.println(is.size());
|
// System.out.println(is.size());
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
|
@ -1,59 +1,59 @@
|
||||||
package com.loafle.overflow.sensor.dao;
|
//package com.loafle.overflow.sensor.dao;
|
||||||
|
//
|
||||||
import com.loafle.overflow.module.sensor.dao.JPASensorItemMappingDao;
|
//import com.loafle.overflow.module.sensor.dao.JPASensorItemMappingDao;
|
||||||
import com.loafle.overflow.module.sensor.dao.SensorItemMappingDao;
|
//import com.loafle.overflow.module.sensor.dao.SensorItemMappingDao;
|
||||||
import org.junit.Before;
|
//import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
//import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
//import org.junit.Test;
|
||||||
|
//
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by root on 17. 6. 9.
|
// * Created by root on 17. 6. 9.
|
||||||
*/
|
// */
|
||||||
public class JPASensorItemMappingDaoTest {
|
//public class JPASensorItemMappingDaoTest {
|
||||||
|
//
|
||||||
private SensorItemMappingDao sensorItemMappingDao = null;
|
// private SensorItemMappingDao sensorItemMappingDao = null;
|
||||||
|
//
|
||||||
@Before
|
// @Before
|
||||||
public void before() {
|
// public void before() {
|
||||||
this.sensorItemMappingDao = new JPASensorItemMappingDao();
|
// this.sensorItemMappingDao = new JPASensorItemMappingDao();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
@Ignore
|
// @Ignore
|
||||||
@Test
|
// @Test
|
||||||
public void create() {
|
// public void create() {
|
||||||
|
//
|
||||||
SensorItemMapping mapping = new SensorItemMapping();
|
// SensorItemMapping mapping = new SensorItemMapping();
|
||||||
|
//
|
||||||
Sensor sensor = new Sensor();
|
// Sensor sensor = new Sensor();
|
||||||
|
//
|
||||||
sensor.setId(1L);
|
// sensor.setId(1L);
|
||||||
|
//
|
||||||
SensorItem sensorItem = new SensorItem();
|
// SensorItem sensorItem = new SensorItem();
|
||||||
|
//
|
||||||
sensorItem.setId(1L);
|
// sensorItem.setId(1L);
|
||||||
|
//
|
||||||
mapping.setSensor(sensor);
|
// mapping.setSensor(sensor);
|
||||||
|
//
|
||||||
mapping.setSensorItem(sensorItem);
|
// mapping.setSensorItem(sensorItem);
|
||||||
|
//
|
||||||
this.sensorItemMappingDao.create(mapping);
|
// this.sensorItemMappingDao.create(mapping);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void list() {
|
// public void list() {
|
||||||
|
//
|
||||||
Sensor sensor = new Sensor();
|
// Sensor sensor = new Sensor();
|
||||||
|
//
|
||||||
sensor.setId(1L);
|
// sensor.setId(1L);
|
||||||
|
//
|
||||||
List<SensorItemMapping> ml = this.sensorItemMappingDao.findAllBySensorId(sensor);
|
// List<SensorItemMapping> ml = this.sensorItemMappingDao.findAllBySensorId(sensor);
|
||||||
|
//
|
||||||
System.out.println(ml.size());
|
// System.out.println(ml.size());
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
Loading…
Reference in New Issue
Block a user