Merge remote-tracking branch 'origin/master'
# Conflicts: # src/test/java/com/loafle/overflow/module/member/dao/MemberDAOTest.java
This commit is contained in:
commit
f357e99f67
|
@ -26,7 +26,7 @@ public class ApiKey {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Column(name = "API_KEY", nullable = false, length = 50)
|
@Column(name = "API_KEY", nullable = false, unique = true,length = 50)
|
||||||
public String getApiKey() {
|
public String getApiKey() {
|
||||||
return apiKey;
|
return apiKey;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.loafle.overflow.module.apikey.service;
|
||||||
|
|
||||||
|
import com.loafle.overflow.module.apikey.dao.ApiKeyDAO;
|
||||||
|
import com.loafle.overflow.module.apikey.model.ApiKey;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by snoop on 17. 6. 28.
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ApiKeyService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiKeyDAO apiKeyDAO;
|
||||||
|
|
||||||
|
|
||||||
|
public void regist(ApiKey apiKey) {
|
||||||
|
|
||||||
|
this.apiKeyDAO.save(apiKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean check(String apiKey) {
|
||||||
|
|
||||||
|
ApiKey retApiKey = this.apiKeyDAO.findByApiKey(apiKey);
|
||||||
|
|
||||||
|
if(retApiKey == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.loafle.overflow.module.domain.service;
|
||||||
|
|
||||||
|
import com.loafle.overflow.module.domain.dao.DomainMemberDAO;
|
||||||
|
import com.loafle.overflow.module.domain.model.DomainMember;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by snoop on 17. 6. 28.
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DomainMemberService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DomainMemberDAO domainMemberDAO;
|
||||||
|
|
||||||
|
public void regist(DomainMember domainMember) {
|
||||||
|
this.domainMemberDAO.save(domainMember);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.loafle.overflow.module.domain.service;
|
||||||
|
|
||||||
|
import com.loafle.overflow.module.domain.dao.DomainDAO;
|
||||||
|
import com.loafle.overflow.module.domain.model.Domain;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by snoop on 17. 6. 28.
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DomainService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DomainDAO domainDAO;
|
||||||
|
|
||||||
|
public void regist(Domain domain) {
|
||||||
|
this.domainDAO.save(domain);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
datasource.url=jdbc:postgresql://192.168.1.103:5432/overflow
|
datasource.url=jdbc:postgresql://192.168.1.209:5432/overflow
|
||||||
datasource.username=overflow
|
datasource.username=overflow
|
||||||
datasource.password=qwer5795
|
datasource.password=qwer5795
|
||||||
datasource.driver-class-name=org.postgresql.Driver
|
datasource.driver-class-name=org.postgresql.Driver
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.loafle.overflow.module.apikey.service;
|
||||||
|
|
||||||
|
import com.loafle.overflow.module.apikey.model.ApiKey;
|
||||||
|
import com.loafle.overflow.module.domain.model.Domain;
|
||||||
|
import com.loafle.overflow.spring.AppConfig;
|
||||||
|
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
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 snoop on 17. 6. 28.
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
||||||
|
|
||||||
|
public class ApiKeyServiceTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiKeyService apiKeyService;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
@Test
|
||||||
|
public void regist() throws Exception {
|
||||||
|
|
||||||
|
ApiKey apiKey = new ApiKey();
|
||||||
|
|
||||||
|
apiKey.setApiKey("70124b775bd511e7b059080027658d13");
|
||||||
|
|
||||||
|
Domain domain = new Domain();
|
||||||
|
domain.setId(1);
|
||||||
|
|
||||||
|
apiKey.setDomain(domain);
|
||||||
|
|
||||||
|
this.apiKeyService.regist(apiKey);
|
||||||
|
|
||||||
|
|
||||||
|
Assert.assertNotEquals(apiKey.getId(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
@Test
|
||||||
|
public void check() throws Exception {
|
||||||
|
|
||||||
|
// ApiKey apiKey = this.apiKeyDAO.findByApiKey("52abd6fd57e511e7ac52080027658d13");
|
||||||
|
|
||||||
|
regist();
|
||||||
|
|
||||||
|
boolean result= this.apiKeyService.check("70124b775bd511e7b059080027658d13");
|
||||||
|
|
||||||
|
Assert.assertNotEquals(result, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.loafle.overflow.module.domain.service;
|
||||||
|
|
||||||
|
import com.loafle.overflow.module.domain.model.Domain;
|
||||||
|
import com.loafle.overflow.module.domain.model.DomainMember;
|
||||||
|
import com.loafle.overflow.module.member.model.Member;
|
||||||
|
import com.loafle.overflow.spring.AppConfig;
|
||||||
|
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
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 snoop on 17. 6. 28.
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
||||||
|
public class DomainMemberServiceTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DomainMemberService domainMemberService;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
@Test
|
||||||
|
public void regist() throws Exception {
|
||||||
|
|
||||||
|
DomainMember domainMember = new DomainMember();
|
||||||
|
|
||||||
|
Domain domain = new Domain();
|
||||||
|
domain.setId(1);
|
||||||
|
|
||||||
|
Member member = new Member();
|
||||||
|
member.setId(1);
|
||||||
|
|
||||||
|
domainMember.setDomain(domain);
|
||||||
|
domainMember.setMember(member);
|
||||||
|
|
||||||
|
this.domainMemberService.regist(domainMember);
|
||||||
|
|
||||||
|
Assert.assertNotEquals(domainMember.getId(), 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.loafle.overflow.module.domain.service;
|
||||||
|
|
||||||
|
import com.loafle.overflow.module.domain.model.Domain;
|
||||||
|
import com.loafle.overflow.spring.AppConfig;
|
||||||
|
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
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 snoop on 17. 6. 28.
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
||||||
|
public class DomainServiceTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DomainService domainService;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
@Test
|
||||||
|
public void regist() throws Exception {
|
||||||
|
|
||||||
|
Domain domain = new Domain();
|
||||||
|
|
||||||
|
domain.setName("overFlow's domain22");
|
||||||
|
|
||||||
|
this.domainService.regist(domain);
|
||||||
|
|
||||||
|
Assert.assertNotEquals(domain.getId(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe;
|
||||||
import com.loafle.overflow.spring.AppConfig;
|
import com.loafle.overflow.spring.AppConfig;
|
||||||
import com.loafle.overflow.spring.JdbcConfiguration;
|
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -26,6 +27,7 @@ public class NoAuthProbeServiceTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private NoAuthProbeService noAuthProbeService;
|
private NoAuthProbeService noAuthProbeService;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void regist() throws Exception {
|
public void regist() throws Exception {
|
||||||
|
|
||||||
|
@ -53,6 +55,7 @@ public class NoAuthProbeServiceTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void readAllByDomain() throws Exception {
|
public void readAllByDomain() throws Exception {
|
||||||
|
|
||||||
|
@ -65,6 +68,7 @@ public class NoAuthProbeServiceTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void read() throws Exception {
|
public void read() throws Exception {
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.loafle.overflow.module.probe.model.Probe;
|
||||||
import com.loafle.overflow.spring.AppConfig;
|
import com.loafle.overflow.spring.AppConfig;
|
||||||
import com.loafle.overflow.spring.JdbcConfiguration;
|
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -24,6 +25,7 @@ public class ProbeServiceTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProbeService probeService;
|
private ProbeService probeService;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void regist() throws Exception {
|
public void regist() throws Exception {
|
||||||
|
|
||||||
|
@ -50,10 +52,12 @@ public class ProbeServiceTest {
|
||||||
Assert.assertNotEquals(probe.getId(), 0);
|
Assert.assertNotEquals(probe.getId(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void readAllByDomain() throws Exception {
|
public void readAllByDomain() throws Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void readByProbeKey() throws Exception {
|
public void readByProbeKey() throws Exception {
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.loafle.overflow.module.probe.model.ProbeTask;
|
||||||
import com.loafle.overflow.spring.AppConfig;
|
import com.loafle.overflow.spring.AppConfig;
|
||||||
import com.loafle.overflow.spring.JdbcConfiguration;
|
import com.loafle.overflow.spring.JdbcConfiguration;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -26,6 +27,7 @@ public class ProbeTaskServiceTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProbeTaskService probeTaskService;
|
private ProbeTaskService probeTaskService;
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void regist() throws Exception {
|
public void regist() throws Exception {
|
||||||
|
|
||||||
|
@ -47,6 +49,7 @@ public class ProbeTaskServiceTest {
|
||||||
Assert.assertNotEquals(probeTask.getId(), 0);
|
Assert.assertNotEquals(probeTask.getId(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void readAllByProbe() throws Exception {
|
public void readAllByProbe() throws Exception {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user