added service
domain , domainmember
This commit is contained in:
parent
51b3f65be5
commit
54bf0422f8
|
@ -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,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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user