first total dao commit
This commit is contained in:
commit
46a7351c37
28
.gitignore
vendored
Normal file
28
.gitignore
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Created by .ignore support plugin (hsz.mobi)
|
||||
### Java template
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
.idea/
|
||||
*.iml
|
||||
target/
|
48
pom.xml
Normal file
48
pom.xml
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.loafle</groupId>
|
||||
<artifactId>maven_parent_jar</artifactId>
|
||||
<version>1.0.0-RELEASE</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.loafle</groupId>
|
||||
<artifactId>overflow_jpa_dao</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>com.loafle.overflow_jpa_dao</name>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-entitymanager</artifactId>
|
||||
<version>5.2.10.Final</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.loafle</groupId>
|
||||
<artifactId>overflow_member</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.loafle</groupId>
|
||||
<artifactId>overflow_jpa_base_dao</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>9.4-1200-jdbc41</version>
|
||||
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
10
src/main/java/com/loafle/overflow/agent/dao/AgentDAO.java
Normal file
10
src/main/java/com/loafle/overflow/agent/dao/AgentDAO.java
Normal file
|
@ -0,0 +1,10 @@
|
|||
package com.loafle.overflow.agent.dao;
|
||||
|
||||
import com.loafle.overflow.agent.model.Agent;
|
||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 5. 29.
|
||||
*/
|
||||
public interface AgentDAO extends BaseDAO<Agent> {
|
||||
}
|
11
src/main/java/com/loafle/overflow/agent/dao/JPAAgentDAO.java
Normal file
11
src/main/java/com/loafle/overflow/agent/dao/JPAAgentDAO.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package com.loafle.overflow.agent.dao;
|
||||
|
||||
import com.loafle.overflow.agent.model.Agent;
|
||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 5. 29.
|
||||
*/
|
||||
public class JPAAgentDAO extends JPABaseDAO<Agent> implements AgentDAO {
|
||||
}
|
46
src/main/java/com/loafle/overflow/agent/model/Agent.java
Normal file
46
src/main/java/com/loafle/overflow/agent/model/Agent.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
package com.loafle.overflow.agent.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 5. 29.
|
||||
*/
|
||||
|
||||
@Entity(name="AGENT")
|
||||
public class Agent implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name="AUTHORIZED_DATE")
|
||||
private Long authorizedDate;
|
||||
|
||||
@Column(name="DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getAuthorizedDate() {
|
||||
return authorizedDate;
|
||||
}
|
||||
|
||||
public void setAuthorizedDate(Long authorizedDate) {
|
||||
this.authorizedDate = authorizedDate;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
12
src/main/java/com/loafle/overflow/apikey/dao/ApiKeyDao.java
Normal file
12
src/main/java/com/loafle/overflow/apikey/dao/ApiKeyDao.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
package com.loafle.overflow.apikey.dao;
|
||||
|
||||
import com.loafle.overflow.apikey.model.Apikey;
|
||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
||||
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 1.
|
||||
*/
|
||||
public interface ApiKeyDao extends BaseDAO<Apikey> {
|
||||
Apikey findByApiKey(Apikey apikey);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.loafle.overflow.apikey.dao;
|
||||
|
||||
import com.loafle.overflow.apikey.model.Apikey;
|
||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||
|
||||
|
||||
import javax.persistence.Query;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 1.
|
||||
*/
|
||||
public class JPAApiKeyDao extends JPABaseDAO<Apikey> implements ApiKeyDao {
|
||||
public Apikey findByApiKey(Apikey apikey) {
|
||||
|
||||
Query query = getEntityManager().createNativeQuery("SELECT ak.* FROM API_KEY ak WHERE ak.API_KEY = :apikey", Apikey.class);
|
||||
query.setParameter("apikey", apikey.getApiKey());
|
||||
|
||||
Apikey ak = null;
|
||||
try {
|
||||
ak = (Apikey)query.getSingleResult();
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
return ak;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
61
src/main/java/com/loafle/overflow/apikey/model/Apikey.java
Normal file
61
src/main/java/com/loafle/overflow/apikey/model/Apikey.java
Normal file
|
@ -0,0 +1,61 @@
|
|||
package com.loafle.overflow.apikey.model;
|
||||
|
||||
import com.loafle.overflow.member.model.Member;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 1.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name ="API_KEY")
|
||||
public class Apikey {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name="API_KEY", unique=true, nullable=false)
|
||||
private String apiKey;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name="CREATE_DATE", nullable=false)
|
||||
private Date createDate;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "MEMBER_ID", nullable=false)
|
||||
private Member member;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
public Member getMember() {
|
||||
return member;
|
||||
}
|
||||
|
||||
public void setMember(Member member) {
|
||||
this.member = member;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.loafle.overflow.member.dao;
|
||||
|
||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||
import com.loafle.overflow.member.model.Member;
|
||||
|
||||
import javax.persistence.Query;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 5. 25.
|
||||
*/
|
||||
public class JPAMemberDAO extends JPABaseDAO<Member> implements MemberDAO{
|
||||
public Member findByEmail(Member member) {
|
||||
|
||||
Query query = getEntityManager().createNativeQuery("SELECT m.* FROM MEMBER m WHERE m.email = :email", Member.class);
|
||||
query.setParameter("email", member.getEmail());
|
||||
|
||||
Member retMember = null;
|
||||
try {
|
||||
retMember = (Member)query.getSingleResult();
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
return retMember;
|
||||
}
|
||||
}
|
||||
}
|
11
src/main/java/com/loafle/overflow/member/dao/MemberDAO.java
Normal file
11
src/main/java/com/loafle/overflow/member/dao/MemberDAO.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package com.loafle.overflow.member.dao;
|
||||
|
||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
||||
import com.loafle.overflow.member.model.Member;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 5. 25.
|
||||
*/
|
||||
public interface MemberDAO extends BaseDAO<Member> {
|
||||
public Member findByEmail(Member member);
|
||||
}
|
104
src/main/java/com/loafle/overflow/member/model/Member.java
Normal file
104
src/main/java/com/loafle/overflow/member/model/Member.java
Normal file
|
@ -0,0 +1,104 @@
|
|||
package com.loafle.overflow.member.model;
|
||||
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 5. 23.
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name="MEMBER")
|
||||
public class Member implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name="EMAIL", unique=true, nullable=false)
|
||||
private String email;
|
||||
|
||||
@Column(name="PW_SALT", nullable=false)
|
||||
private String pwSalt;
|
||||
|
||||
@Column(name="DIGEST", nullable=false)
|
||||
private String digest;
|
||||
|
||||
@Column(name="NAME", nullable=false)
|
||||
private String name;
|
||||
|
||||
@Column(name="COMPANY", nullable=false)
|
||||
private String company;
|
||||
|
||||
@Column(name="PHONE")
|
||||
private String phone;
|
||||
|
||||
@Column(name="AUTHORIZED_DATE")
|
||||
private Long authorizedDate;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPwSalt() {
|
||||
return pwSalt;
|
||||
}
|
||||
|
||||
public void setPwSalt(String pwSalt) {
|
||||
this.pwSalt = pwSalt;
|
||||
}
|
||||
|
||||
public String getDigest() {
|
||||
return digest;
|
||||
}
|
||||
|
||||
public void setDigest(String digest) {
|
||||
this.digest = digest;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCompany() {
|
||||
return company;
|
||||
}
|
||||
|
||||
public void setCompany(String company) {
|
||||
this.company = company;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public Long getAuthorizedDate() {
|
||||
return authorizedDate;
|
||||
}
|
||||
|
||||
public void setAuthorizedDate(Long authorizedDate) {
|
||||
this.authorizedDate = authorizedDate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.loafle.overflow.noauthagent.dao;
|
||||
|
||||
import com.loafle.overflow.commons.dao.JPABaseDAO;
|
||||
import com.loafle.overflow.noauthagent.model.NoAuthAgent;
|
||||
|
||||
import javax.persistence.Query;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 5. 30.
|
||||
*/
|
||||
public class JPANoAuthAgentDAO extends JPABaseDAO<NoAuthAgent> implements NoAuthAgentDao {
|
||||
public NoAuthAgent findByTempKey(NoAuthAgent noAuthAgent) {
|
||||
Query query = getEntityManager().createNativeQuery("SELECT na.* FROM NOAUTH_AGENT na WHERE na.TEMP_KEY = :tempkey", NoAuthAgent.class);
|
||||
query.setParameter("tempkey", noAuthAgent.getTempKey());
|
||||
|
||||
NoAuthAgent authAgent = null;
|
||||
try {
|
||||
authAgent = (NoAuthAgent)query.getSingleResult();
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
return authAgent;
|
||||
}
|
||||
}
|
||||
|
||||
public List<NoAuthAgent> findAllByNoAuth(NoAuthAgent noAuthAgent) {
|
||||
|
||||
Query query = getEntityManager().createNativeQuery("SELECT na.* FROM NOAUTH_AGENT na WHERE na.AUTH_STATUS != :authStatus", NoAuthAgent.class);
|
||||
query.setParameter("authStatus", noAuthAgent.getAuthStatus().toString());
|
||||
|
||||
List<NoAuthAgent> authAgentList = null;
|
||||
try {
|
||||
authAgentList = (List<NoAuthAgent>)query.getResultList();
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
return authAgentList;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.loafle.overflow.noauthagent.dao;
|
||||
|
||||
import com.loafle.overflow.commons.dao.BaseDAO;
|
||||
import com.loafle.overflow.noauthagent.model.NoAuthAgent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 5. 30.
|
||||
*/
|
||||
public interface NoAuthAgentDao extends BaseDAO<NoAuthAgent> {
|
||||
NoAuthAgent findByTempKey(NoAuthAgent noAuthAgent);
|
||||
List<NoAuthAgent> findAllByNoAuth(NoAuthAgent noAuthAgent);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.loafle.overflow.noauthagent.model;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 5. 31.
|
||||
*/
|
||||
public enum AuthType {
|
||||
ACCEPT("ACT"),
|
||||
REFUSE("RFE"),
|
||||
WAIT("WIT");
|
||||
|
||||
private String stringValue;
|
||||
AuthType(String string) {stringValue = string;}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return stringValue;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.loafle.overflow.noauthagent.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 5. 30.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "NOAUTH_AGENT")
|
||||
public class NoAuthAgent {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name="TEMP_KEY", unique=true, nullable=false)
|
||||
private String tempKey;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name="DATE", nullable=false)
|
||||
private Date date;
|
||||
|
||||
@Column(name="API_KEY", nullable=false)
|
||||
private String apiKey;
|
||||
|
||||
@Column(name="AUTH_STATUS", nullable=false)
|
||||
@Enumerated(EnumType.STRING)
|
||||
private AuthType authStatus;
|
||||
|
||||
@Column(name="LOCAL_IP", nullable=false)
|
||||
private long localIP;
|
||||
|
||||
@Column(name="HOST_NAME")
|
||||
private String hostName;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTempKey() {
|
||||
return tempKey;
|
||||
}
|
||||
|
||||
public void setTempKey(String tempKey) {
|
||||
this.tempKey = tempKey;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
public AuthType getAuthStatus() {
|
||||
return authStatus;
|
||||
}
|
||||
|
||||
public void setAuthStatus(AuthType authStatus) {
|
||||
this.authStatus = authStatus;
|
||||
}
|
||||
|
||||
public long getLocalIP() {
|
||||
return localIP;
|
||||
}
|
||||
|
||||
public void setLocalIP(long localIP) {
|
||||
this.localIP = localIP;
|
||||
}
|
||||
|
||||
public String getHostName() {
|
||||
return hostName;
|
||||
}
|
||||
|
||||
public void setHostName(String hostName) {
|
||||
this.hostName = hostName;
|
||||
}
|
||||
}
|
0
src/main/resources/_
Normal file
0
src/main/resources/_
Normal file
|
@ -0,0 +1,28 @@
|
|||
package com.loafle.overflow.agent.dao;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 4.
|
||||
*/
|
||||
public class JPAAgentDAOTest {
|
||||
|
||||
private JPAAgentDAO jpaAgentDAO = null;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
this.jpaAgentDAO = new JPAAgentDAO();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void createAgent() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.loafle.overflow.apikey.dao;
|
||||
|
||||
import com.loafle.overflow.apikey.model.Apikey;
|
||||
import com.loafle.overflow.member.model.Member;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 4.
|
||||
*/
|
||||
public class JPAApiKeyDaoTest {
|
||||
|
||||
private JPAApiKeyDao jpaApiKeyDao;
|
||||
|
||||
@Before
|
||||
public void Before() {
|
||||
this.jpaApiKeyDao = new JPAApiKeyDao();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void findByApiKey() throws Exception {
|
||||
|
||||
Apikey apikey = new Apikey();
|
||||
|
||||
apikey.setApiKey("1111111");
|
||||
|
||||
Apikey a = this.jpaApiKeyDao.findByApiKey(apikey);
|
||||
|
||||
System.out.println(a.getId());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createApiKey() {
|
||||
Apikey apikey = new Apikey();
|
||||
|
||||
apikey.setApiKey("1111111");
|
||||
apikey.setCreateDate(new Date());
|
||||
Member member = new Member();
|
||||
member.setId((long)2);
|
||||
apikey.setMember(member);
|
||||
|
||||
|
||||
jpaApiKeyDao.create(apikey);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.loafle.overflow.member.dao;
|
||||
|
||||
import com.loafle.overflow.member.model.Member;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 4.
|
||||
*/
|
||||
public class JPAMemberDAOTest {
|
||||
|
||||
private JPAMemberDAO jpaMemberDAO = null;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
|
||||
this.jpaMemberDAO = new JPAMemberDAO();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findByEmail() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createMember() {
|
||||
Member m = new Member();
|
||||
|
||||
m.setName("insanity3");
|
||||
m.setCompany("loafle");
|
||||
m.setDigest("bbbbbbbbb");
|
||||
m.setPwSalt("salktttt");
|
||||
m.setPhone("000-000-0000");
|
||||
m.setEmail("insanity33@loafle.com");
|
||||
|
||||
this.jpaMemberDAO.create(m);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.loafle.overflow.noauthagent.dao;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 4.
|
||||
*/
|
||||
public class JPANoAuthAgentDAOTest {
|
||||
|
||||
private JPANoAuthAgentDAO jpaNoAuthAgentDAO = null;
|
||||
|
||||
@Before
|
||||
public void Before() {
|
||||
this.jpaNoAuthAgentDAO = new JPANoAuthAgentDAO();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findByTempKey() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findAllByNoAuth() throws Exception {
|
||||
}
|
||||
|
||||
}
|
21
src/test/resources/META-INF/persistence.xml
Normal file
21
src/test/resources/META-INF/persistence.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?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.com.loafle.overflow.member.model.Member</class>
|
||||
<class>com.loafle.overflow.member.com.loafle.overflow.noauthagent.model.NoAuthAgent</class>
|
||||
<class>com.loafle.overflow.member.com.loafle.overflow.apikey.model.Apikey</class>
|
||||
<class>com.loafle.overflow.member.com.loafle.overflow.agent.model.Agent</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-drop"/>-->
|
||||
<property name="hibernate.hbm2ddl.auto" value="update"/>
|
||||
<property name="hibernate.show_sql" value="true" />
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
|
||||
</persistence>
|
17
src/test/resources/logback.xml
Normal file
17
src/test/resources/logback.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="3 seconds">
|
||||
<contextName>overflow_jpa_dao</contextName>
|
||||
<!-- TRACE > DEBUG > INFO > WARN > ERROR -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>
|
||||
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{32} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
<logger name="com.loafle" level="ALL" />
|
||||
</configuration>
|
Loading…
Reference in New Issue
Block a user