test config

This commit is contained in:
geek 2017-08-08 17:51:46 +09:00
parent 61b5026cbf
commit 4321b9255e
5 changed files with 38 additions and 12 deletions

View File

@ -1,10 +1,7 @@
package com.loafle.overflow.spring;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.*;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
@ -13,6 +10,7 @@ import org.springframework.core.io.Resource;
*/
@Configuration
@ComponentScan(basePackages = {"com.loafle.overflow"}, excludeFilters = @ComponentScan.Filter({Configuration.class}))
@Import({JdbcConfiguration.class, MailConfiguration.class})
@PropertySource({"classpath:database.properties","classpath:mail.properties"})
public class AppConfig {
@Bean

View File

@ -2,14 +2,13 @@ package com.loafle.overflow.module.member.dao;
import com.loafle.overflow.module.member.model.Member;
import com.loafle.overflow.module.meta.model.MetaMemberStatus;
import com.loafle.overflow.spring.AppConfig;
import com.loafle.overflow.spring.JdbcConfiguration;
import com.loafle.overflow.spring.MailConfiguration;
import com.loafle.overflow.spring.*;
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.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@ -17,9 +16,10 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* Created by geek on 17. 6. 28.
*/
@Ignore
//@Ignore
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class, MailConfiguration.class})
@ActiveProfiles("test")
@ContextConfiguration(classes = {AppConfig.class, AppConfigTest.class})
public class MemberDAOTest {
@Autowired

View File

@ -3,12 +3,14 @@ package com.loafle.overflow.module.member.service;
import com.loafle.overflow.module.member.model.Member;
import com.loafle.overflow.module.meta.model.MetaMemberStatus;
import com.loafle.overflow.spring.AppConfig;
import com.loafle.overflow.spring.AppConfigTest;
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.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@ -17,14 +19,15 @@ import java.util.Date;
/**
* Created by insanity on 17. 6. 28.
*/
@Ignore
//@Ignore
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
@ActiveProfiles("test")
@ContextConfiguration(classes = {AppConfig.class, AppConfigTest.class})
public class MemberServiceTest {
@Autowired
MemberService memberService;
@Ignore
@Test
public void regist() throws Exception {
Member m = new Member();

View File

@ -0,0 +1,11 @@
datasource.url=jdbc:postgresql://192.168.1.209:5432/overflow
datasource.username=overflow
datasource.password=qwer5795
datasource.driver-class-name=org.postgresql.Driver
jpa.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
jpa.database=postgresql
jpa.hibernate.ddl-auto=create
#jpa.hibernate.ddl-auto=update
jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
jpa.show-sql=true

View File

@ -0,0 +1,14 @@
# Naver SMTP
mail.host=smtp.worksmobile.com
mail.port=465
mail.username=geek@loafle.com
mail.password=@loafle@5795
mail.protocol=smtps
mail.properties.mail.smtp.auth=true
mail.transport.protocol=smtp
mail.properties.mail.smtp.starttls.enable=true
mail.smtps.ssl.checkserveridentity=true
mail.smtps.ssl.trust=*