added service
apikey ignore
This commit is contained in:
parent
1e83857756
commit
51b3f65be5
|
@ -26,7 +26,7 @@ public class ApiKey {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "API_KEY", nullable = false, length = 50)
|
||||
@Column(name = "API_KEY", nullable = false, unique = true,length = 50)
|
||||
public String getApiKey() {
|
||||
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,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);
|
||||
}
|
||||
|
||||
}
|
|
@ -30,7 +30,7 @@ public class MemberDAOTest {
|
|||
m.setName("insanity2");
|
||||
m.setCompanyName("loafle");
|
||||
m.setPw("bbbbbbbbb");
|
||||
m.setPwSalt("salktttt");
|
||||
// m.setPwSalt("salktttt");
|
||||
m.setPhone("000-000-0000");
|
||||
m.setEmail("insanity111@loafle.com");
|
||||
m.setStatus(new MetaMemberStatus((short)1));
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe;
|
|||
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;
|
||||
|
@ -26,6 +27,7 @@ public class NoAuthProbeServiceTest {
|
|||
@Autowired
|
||||
private NoAuthProbeService noAuthProbeService;
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void regist() throws Exception {
|
||||
|
||||
|
@ -53,6 +55,7 @@ public class NoAuthProbeServiceTest {
|
|||
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void readAllByDomain() throws Exception {
|
||||
|
||||
|
@ -65,6 +68,7 @@ public class NoAuthProbeServiceTest {
|
|||
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
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.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;
|
||||
|
@ -24,6 +25,7 @@ public class ProbeServiceTest {
|
|||
@Autowired
|
||||
private ProbeService probeService;
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void regist() throws Exception {
|
||||
|
||||
|
@ -50,10 +52,12 @@ public class ProbeServiceTest {
|
|||
Assert.assertNotEquals(probe.getId(), 0);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void readAllByDomain() throws Exception {
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
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.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;
|
||||
|
@ -26,6 +27,7 @@ public class ProbeTaskServiceTest {
|
|||
@Autowired
|
||||
private ProbeTaskService probeTaskService;
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void regist() throws Exception {
|
||||
|
||||
|
@ -47,6 +49,7 @@ public class ProbeTaskServiceTest {
|
|||
Assert.assertNotEquals(probeTask.getId(), 0);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void readAllByProbe() throws Exception {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user