diff --git a/src/main/java/com/loafle/overflow/central/module/apikey/service/CentralApiKeyService.java b/src/main/java/com/loafle/overflow/central/module/apikey/service/CentralApiKeyService.java index a191f12..897fa1d 100644 --- a/src/main/java/com/loafle/overflow/central/module/apikey/service/CentralApiKeyService.java +++ b/src/main/java/com/loafle/overflow/central/module/apikey/service/CentralApiKeyService.java @@ -1,9 +1,10 @@ package com.loafle.overflow.central.module.apikey.service; -import com.loafle.overflow.central.commons.exception.OverflowException; + import com.loafle.overflow.central.module.apikey.dao.ApiKeyDAO; +import com.loafle.overflow.core.exception.OverflowException; import com.loafle.overflow.model.apikey.ApiKey; import com.loafle.overflow.model.domain.Domain; import com.loafle.overflow.service.central.apikey.ApiKeyService; diff --git a/src/main/java/com/loafle/overflow/central/module/discovery/model/DiscoveryStartInfo.java b/src/main/java/com/loafle/overflow/central/module/discovery/model/DiscoveryStartInfo.java deleted file mode 100644 index 27e0796..0000000 --- a/src/main/java/com/loafle/overflow/central/module/discovery/model/DiscoveryStartInfo.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.loafle.overflow.central.module.discovery.model; - -import java.util.List; - -/** - * Created by snoop on 17. 9. 29. - */ -public class DiscoveryStartInfo { - String startIp; - String endIP; - String excludeIp; - String startPort; - String endPort; - List services; - - public String getStartIp() { - return startIp; - } - - public void setStartIp(String startIp) { - this.startIp = startIp; - } - - public String getEndIP() { - return endIP; - } - - public void setEndIP(String endIP) { - this.endIP = endIP; - } - - public String getExcludeIp() { - return excludeIp; - } - - public void setExcludeIp(String excludeIp) { - this.excludeIp = excludeIp; - } - - public String getStartPort() { - return startPort; - } - - public void setStartPort(String startPort) { - this.startPort = startPort; - } - - public String getEndPort() { - return endPort; - } - - public void setEndPort(String endPort) { - this.endPort = endPort; - } - - public List getServices() { - return services; - } - - public void setServices(List services) { - this.services = services; - } -} diff --git a/src/main/java/com/loafle/overflow/central/module/discovery/service/CentralDiscoveryService.java b/src/main/java/com/loafle/overflow/central/module/discovery/service/CentralDiscoveryService.java index 863d81e..2214e14 100644 --- a/src/main/java/com/loafle/overflow/central/module/discovery/service/CentralDiscoveryService.java +++ b/src/main/java/com/loafle/overflow/central/module/discovery/service/CentralDiscoveryService.java @@ -4,7 +4,7 @@ package com.loafle.overflow.central.module.discovery.service; import com.loafle.overflow.central.commons.model.SessionMetadata; import com.loafle.overflow.central.commons.service.MessagePublisher; -import com.loafle.overflow.central.module.discovery.model.DiscoveryStartInfo; + import com.loafle.overflow.core.annotation.ProbeAPI; import com.loafle.overflow.core.annotation.WebappAPI; import com.loafle.overflow.core.exception.OverflowException; diff --git a/src/main/java/com/loafle/overflow/central/module/discovery/type/PortType.java b/src/main/java/com/loafle/overflow/central/module/discovery/type/PortType.java deleted file mode 100644 index 67fe74f..0000000 --- a/src/main/java/com/loafle/overflow/central/module/discovery/type/PortType.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.loafle.overflow.central.module.discovery.type; - -/** - * Created by snoop on 17. 6. 27. - */ -public enum PortType { - TCP("TCP"), - UDP("UDP"), - TLS("TLS"); - - private String stringValue; - PortType(String string) {stringValue = string;} - - @Override - public String toString() { - return stringValue; - } -} \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/central/module/domain/dao/DomainMemberDAO.java b/src/main/java/com/loafle/overflow/central/module/domain/dao/DomainMemberDAO.java index 8265f2a..eaae6b1 100644 --- a/src/main/java/com/loafle/overflow/central/module/domain/dao/DomainMemberDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/domain/dao/DomainMemberDAO.java @@ -1,9 +1,10 @@ package com.loafle.overflow.central.module.domain.dao; -import com.loafle.overflow.central.module.member.model.Member; + import com.loafle.overflow.model.domain.Domain; import com.loafle.overflow.model.domain.DomainMember; +import com.loafle.overflow.model.member.Member; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; diff --git a/src/main/java/com/loafle/overflow/central/module/domain/service/CentralDomainMemberService.java b/src/main/java/com/loafle/overflow/central/module/domain/service/CentralDomainMemberService.java index 0abed4d..9c5a8a3 100644 --- a/src/main/java/com/loafle/overflow/central/module/domain/service/CentralDomainMemberService.java +++ b/src/main/java/com/loafle/overflow/central/module/domain/service/CentralDomainMemberService.java @@ -3,9 +3,10 @@ package com.loafle.overflow.central.module.domain.service; import com.loafle.overflow.central.module.domain.dao.DomainMemberDAO; import com.loafle.overflow.central.module.member.dao.MemberDAO; -import com.loafle.overflow.central.module.member.model.Member; + import com.loafle.overflow.model.domain.Domain; import com.loafle.overflow.model.domain.DomainMember; +import com.loafle.overflow.model.member.Member; import com.loafle.overflow.service.central.domain.DomainMemberService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/loafle/overflow/central/module/email/dao/EmailAuthDAO.java b/src/main/java/com/loafle/overflow/central/module/email/dao/EmailAuthDAO.java index a12fd40..3949908 100644 --- a/src/main/java/com/loafle/overflow/central/module/email/dao/EmailAuthDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/email/dao/EmailAuthDAO.java @@ -1,7 +1,8 @@ package com.loafle.overflow.central.module.email.dao; -import com.loafle.overflow.central.module.email.model.EmailAuth; -import com.loafle.overflow.central.module.member.model.Member; + +import com.loafle.overflow.model.email.EmailAuth; +import com.loafle.overflow.model.member.Member; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/src/main/java/com/loafle/overflow/central/module/email/exception/EmailOverAuthException.java b/src/main/java/com/loafle/overflow/central/module/email/exception/EmailOverAuthException.java deleted file mode 100644 index cf818bc..0000000 --- a/src/main/java/com/loafle/overflow/central/module/email/exception/EmailOverAuthException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.loafle.overflow.central.module.email.exception; - -import com.loafle.overflow.central.commons.exception.OverflowRuntimeException; - -/** - * Created by geek on 17. 11. 22. - */ -public class EmailOverAuthException extends OverflowRuntimeException { - public EmailOverAuthException() { - super(); - } - - public EmailOverAuthException(String message) { - super(message); - } -} diff --git a/src/main/java/com/loafle/overflow/central/module/email/model/EmailAuth.java b/src/main/java/com/loafle/overflow/central/module/email/model/EmailAuth.java deleted file mode 100644 index 3f764b6..0000000 --- a/src/main/java/com/loafle/overflow/central/module/email/model/EmailAuth.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.loafle.overflow.central.module.email.model; - -import com.loafle.overflow.central.module.member.model.Member; - -import javax.persistence.*; -import java.util.Date; - -/** - * Created by root on 17. 6. 22. - */ -@Entity -@Table(name = "EMAIL_AUTH", schema = "public") -public class EmailAuth { - private long id; - private String emailAuthKey; - private Date createDate; - private Date authConfirmDate; - private Member member; - - @Id - @GeneratedValue(strategy= GenerationType.IDENTITY) - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - @Basic - @Column(name = "EMAIL_AUTH_KEY", nullable = true, length = 50) - public String getEmailAuthKey() { - return emailAuthKey; - } - - public void setEmailAuthKey(String emailAuthKey) { - this.emailAuthKey = emailAuthKey; - } - - @Basic - @Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false) - public Date getCreateDate() { - return createDate; - } - - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } - - @Basic - @Column(name = "AUTH_CONFIRM_DATE", nullable = true, insertable = true, updatable = true) - public Date getAuthConfirmDate() { - return authConfirmDate; - } - - public void setAuthConfirmDate(Date authConfirmDate) { - this.authConfirmDate = authConfirmDate; - } - - @ManyToOne - @JoinColumn(name = "MEMBER_ID", nullable = false) - public Member getMember() { - return member; - } - - public void setMember(Member member) { - this.member = member; - } -} diff --git a/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java b/src/main/java/com/loafle/overflow/central/module/email/service/CentralEmailAuthService.java similarity index 87% rename from src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java rename to src/main/java/com/loafle/overflow/central/module/email/service/CentralEmailAuthService.java index 51ecb1f..c07e622 100644 --- a/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java +++ b/src/main/java/com/loafle/overflow/central/module/email/service/CentralEmailAuthService.java @@ -1,17 +1,19 @@ package com.loafle.overflow.central.module.email.service; -import com.loafle.overflow.central.commons.model.Mail; + import com.loafle.overflow.central.commons.utils.EmailSender; import com.loafle.overflow.central.module.domain.dao.DomainDAO; import com.loafle.overflow.central.module.domain.dao.DomainMemberDAO; -import com.loafle.overflow.central.module.domain.model.Domain; -import com.loafle.overflow.central.module.domain.model.DomainMember; import com.loafle.overflow.central.module.email.dao.EmailAuthDAO; -import com.loafle.overflow.central.module.email.exception.EmailOverAuthException; -import com.loafle.overflow.central.module.email.model.EmailAuth; + import com.loafle.overflow.central.module.member.dao.MemberDAO; -import com.loafle.overflow.central.module.member.model.Member; -import com.loafle.overflow.central.module.meta.model.MetaMemberStatus; +import com.loafle.overflow.core.exception.OverflowException; +import com.loafle.overflow.core.model.Mail; +import com.loafle.overflow.model.domain.Domain; +import com.loafle.overflow.model.domain.DomainMember; +import com.loafle.overflow.model.email.EmailAuth; +import com.loafle.overflow.model.member.Member; +import com.loafle.overflow.model.meta.MetaMemberStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.MailException; import org.springframework.stereotype.Service; @@ -25,7 +27,7 @@ import java.util.*; * Created by geek on 17. 6. 28. */ @Service("EmailAuthService") -public class EmailAuthService { +public class CentralEmailAuthService { @Autowired private EmailAuthDAO emailAuthDAO; @@ -77,7 +79,7 @@ public class EmailAuthService { return this.emailAuthDAO.findOne(id); } - public EmailAuth readByAuthKey(String authKey) throws UnsupportedEncodingException { + public EmailAuth readByAuthKey(String authKey) throws OverflowException, UnsupportedEncodingException { System.out.println("authKey = [" + authKey + "]"); String deStr = URLDecoder.decode(authKey, "UTF-8"); System.out.println("deStr = [" + deStr + "]"); @@ -98,7 +100,7 @@ public class EmailAuthService { Date nowDate = new Date(); if (!nowDate.before(futureDate)) { - throw new EmailOverAuthException("The authentication expiration time has passed."); + throw new OverflowException("The authentication expiration time has passed.", new Throwable()); } auth.setAuthConfirmDate(new Date()); diff --git a/src/test/java/com/loafle/overflow/central/module/apikey/service/ApiKeyServiceTest.java b/src/test/java/com/loafle/overflow/central/module/apikey/service/ApiKeyServiceTest.java index 36cbc88..5428f6c 100644 --- a/src/test/java/com/loafle/overflow/central/module/apikey/service/ApiKeyServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/apikey/service/ApiKeyServiceTest.java @@ -1,9 +1,12 @@ package com.loafle.overflow.central.module.apikey.service; import com.google.protobuf.Api; -import com.loafle.overflow.central.module.apikey.model.ApiKey; -import com.loafle.overflow.central.module.domain.model.Domain; + import com.loafle.overflow.central.spring.AppConfigTest; +import com.loafle.overflow.core.exception.OverflowException; +import com.loafle.overflow.model.apikey.ApiKey; +import com.loafle.overflow.model.domain.Domain; +import com.loafle.overflow.service.central.apikey.ApiKeyService; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -58,7 +61,7 @@ public class ApiKeyServiceTest { @Ignore @Test - public void findByDomain() { + public void findByDomain() throws OverflowException { Domain domain = new Domain(); domain.setId(1); @@ -70,7 +73,7 @@ public class ApiKeyServiceTest { } @Test - public void readByApiKey() { + public void readByApiKey() throws OverflowException { ApiKey apiKey = this.apiKeyService.readByApiKey("52abd6fd57e511e7ac52080027658d13"); diff --git a/src/test/java/com/loafle/overflow/central/module/auth/service/AuthCrawlerServiceTest.java b/src/test/java/com/loafle/overflow/central/module/auth/service/AuthCrawlerServiceTest.java index 0a4919e..ad5155f 100644 --- a/src/test/java/com/loafle/overflow/central/module/auth/service/AuthCrawlerServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/auth/service/AuthCrawlerServiceTest.java @@ -1,9 +1,10 @@ package com.loafle.overflow.central.module.auth.service; -import com.loafle.overflow.central.module.auth.model.AuthCrawler; -import com.loafle.overflow.central.module.meta.model.MetaCrawler; -import com.loafle.overflow.central.module.target.model.Target; import com.loafle.overflow.central.spring.AppConfigTest; +import com.loafle.overflow.core.exception.OverflowException; +import com.loafle.overflow.model.auth.AuthCrawler; +import com.loafle.overflow.model.meta.MetaCrawler; +import com.loafle.overflow.model.target.Target; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -19,7 +20,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; public class AuthCrawlerServiceTest { @Autowired - private AuthCrawlerService authCrawlerService; + private CentralAuthCrawlerService authCrawlerService; @Test public void regist() throws Exception { @@ -47,7 +48,7 @@ public class AuthCrawlerServiceTest { } @Test - public void findAuth() { + public void findAuth() throws OverflowException { MetaCrawler metaCrawler = new MetaCrawler(); metaCrawler.setId((short)23); diff --git a/src/test/java/com/loafle/overflow/central/module/domain/service/DomainMemberServiceTest.java b/src/test/java/com/loafle/overflow/central/module/domain/service/DomainMemberServiceTest.java index fdfc54d..fd7c116 100644 --- a/src/test/java/com/loafle/overflow/central/module/domain/service/DomainMemberServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/domain/service/DomainMemberServiceTest.java @@ -1,9 +1,12 @@ package com.loafle.overflow.central.module.domain.service; -import com.loafle.overflow.central.module.domain.model.Domain; -import com.loafle.overflow.central.module.domain.model.DomainMember; -import com.loafle.overflow.central.module.member.model.Member; + import com.loafle.overflow.central.spring.AppConfigTest; +import com.loafle.overflow.core.exception.OverflowException; +import com.loafle.overflow.model.domain.Domain; +import com.loafle.overflow.model.domain.DomainMember; +import com.loafle.overflow.model.member.Member; +import com.loafle.overflow.service.central.domain.DomainMemberService; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -48,7 +51,7 @@ public class DomainMemberServiceTest { } @Test - public void readAllMemberByDomain() { + public void readAllMemberByDomain() throws OverflowException { Domain domain = new Domain(); domain.setId(1); diff --git a/src/test/java/com/loafle/overflow/central/module/domain/service/DomainServiceTest.java b/src/test/java/com/loafle/overflow/central/module/domain/service/DomainServiceTest.java index f15944e..3280996 100644 --- a/src/test/java/com/loafle/overflow/central/module/domain/service/DomainServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/domain/service/DomainServiceTest.java @@ -1,7 +1,8 @@ package com.loafle.overflow.central.module.domain.service; -import com.loafle.overflow.central.module.domain.model.Domain; + import com.loafle.overflow.central.spring.AppConfigTest; +import com.loafle.overflow.model.domain.Domain; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -20,7 +21,7 @@ import static org.junit.Assert.*; public class DomainServiceTest { @Autowired - private DomainService domainService; + private CentralDomainService domainService; @Ignore @Test diff --git a/src/test/java/com/loafle/overflow/central/module/email/service/EmailAuthServiceTest.java b/src/test/java/com/loafle/overflow/central/module/email/service/EmailAuthServiceTest.java index 2e8561c..0a16dfd 100644 --- a/src/test/java/com/loafle/overflow/central/module/email/service/EmailAuthServiceTest.java +++ b/src/test/java/com/loafle/overflow/central/module/email/service/EmailAuthServiceTest.java @@ -1,7 +1,8 @@ package com.loafle.overflow.central.module.email.service; -import com.loafle.overflow.central.module.email.model.EmailAuth; + import com.loafle.overflow.central.spring.AppConfigTest; +import com.loafle.overflow.model.email.EmailAuth; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -22,7 +23,7 @@ import java.util.Date; public class EmailAuthServiceTest { @Autowired - EmailAuthService emailAuthService; + CentralEmailAuthService emailAuthService; @Test @Ignore