target

changed
   target model
This commit is contained in:
snoop 2017-06-07 19:37:30 +09:00
parent 43f0673463
commit 7d34fdb484
4 changed files with 53 additions and 6 deletions

View File

@ -1,6 +1,7 @@
package com.loafle.overflow.target.model; package com.loafle.overflow.target.model;
import com.loafle.overflow.member.model.Member; import com.loafle.overflow.member.model.Member;
import com.loafle.overflow.target.type.PortType;
import com.loafle.overflow.target.type.TargetType; import com.loafle.overflow.target.type.TargetType;
import javax.persistence.*; import javax.persistence.*;
@ -19,26 +20,30 @@ public class Target {
@Column(name="IP", nullable=false) @Column(name="IP", nullable=false)
private long ip; private long ip;
@Column(name="PORT", nullable=false) @Column(name="PORT")
private int port; private int port;
@Column(name="TARGET_TYPE", nullable=false) @Column(name="TARGET_TYPE")
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private TargetType targetType; private TargetType targetType;
@Column(name="VENDOR_NAME", nullable=false) @Column(name="VENDOR_NAME")
private String vendorName; private String vendorName;
@Column(name="KINDS", nullable=false) @Column(name="KINDS")
private String kinds; private String kinds;
@Column(name="VERSION", nullable=false) @Column(name="VERSION")
private String version; private String version;
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
@Column(name="CREATE_DATE", nullable=false , columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false) @Column(name="CREATE_DATE", nullable=false , columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false)
private Date createDate; private Date createDate;
@Column(name="PORT_TYPE")
@Enumerated(EnumType.STRING)
private PortType portType;
@ManyToOne @ManyToOne
@JoinColumn(name = "MEMBER_ID", nullable=false) @JoinColumn(name = "MEMBER_ID", nullable=false)
private Member member; private Member member;
@ -114,4 +119,12 @@ public class Target {
public void setMember(Member member) { public void setMember(Member member) {
this.member = member; this.member = member;
} }
public PortType getPortType() {
return portType;
}
public void setPortType(PortType portType) {
this.portType = portType;
}
} }

View File

@ -0,0 +1,19 @@
package com.loafle.overflow.target.type;
/**
* Created by root on 17. 6. 7.
*/
public enum PortType {
TCP("TCP"),
UDP("UDP");
private String stringValue;
PortType(String string) {stringValue = string;}
@Override
public String toString() {
return stringValue;
}
}

View File

@ -1,6 +1,7 @@
package com.loafle.overflow.noauthagent.dao; package com.loafle.overflow.noauthagent.dao;
import com.loafle.overflow.noauthagent.model.NoAuthAgent; import com.loafle.overflow.noauthagent.model.NoAuthAgent;
import com.loafle.overflow.noauthagent.type.AuthType;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
@ -23,24 +24,37 @@ public class JPANoAuthAgentDAOTest {
@Test @Test
public void findByTempKey() throws Exception { public void findByTempKey() throws Exception {
NoAuthAgent noAuthAgent = new NoAuthAgent();
noAuthAgent.setTempKey("3398473-90847903874");
NoAuthAgent aa = this.jpaNoAuthAgentDAO.findByTempKey(noAuthAgent);
System.out.println(aa.getAuthStatus());
} }
@Test @Test
public void findAllByNoAuth() throws Exception { public void findAllByNoAuth() throws Exception {
} }
@Ignore
@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);
this.jpaNoAuthAgentDAO.create(noAuthAgent); this.jpaNoAuthAgentDAO.create(noAuthAgent);
} }
} }

View File

@ -8,6 +8,7 @@
<class>com.loafle.overflow.apikey.model.Apikey</class> <class>com.loafle.overflow.apikey.model.Apikey</class>
<class>com.loafle.overflow.agent.model.Agent</class> <class>com.loafle.overflow.agent.model.Agent</class>
<class>com.loafle.overflow.email.model.EmailAuth</class> <class>com.loafle.overflow.email.model.EmailAuth</class>
<class>com.loafle.overflow.target.model.Target</class>
<properties> <properties>
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://192.168.1.106:5432/postgres" /> <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.driver" value="org.postgresql.Driver" />