This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.daumcorp.be; | |
import org.junit.Before; | |
import org.junit.Test; | |
/** | |
* Created by karian7 on 2/27/14. | |
*/ | |
public class AuthServiceTest { | |
public static final String NOUSER = "nouser@daum.net"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public static class TestConfig { | |
@Bean | |
AccountRepository accountRepository() { | |
return mock(AccountRepository.class); | |
} | |
@Bean | |
GravatarClient gravatarClient() { | |
return mock(GravatarClient.class); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.daumcorp.be; | |
import com.daumcorp.cafe.gravatar.Gravatar; | |
import com.daumcorp.cafe.gravatar.GravatarClient; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.mockito.internal.verification.Only; | |
import java.util.HashMap; | |
import java.util.Map; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.daumcorp.be; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.postgresql.ds.PGSimpleDataSource; | |
import org.springframework.jdbc.core.JdbcTemplate; | |
import javax.sql.DataSource; | |
import java.sql.Connection; | |
import java.sql.PreparedStatement; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.daumcorp.be; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.postgresql.ds.PGSimpleDataSource; | |
import javax.sql.DataSource; | |
import java.sql.Connection; | |
import java.sql.PreparedStatement; | |
import java.sql.ResultSet; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>postgresql</groupId> | |
<artifactId>postgresql</artifactId> | |
<version>9.1-902.jdbc4</version> | |
</dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-source-plugin</artifactId> | |
<executions> | |
<execution> | |
<id>attach-sources</id> | |
<goals> | |
<goal>jar</goal> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<!DOCTYPE mapper | |
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
<mapper namespace="com.daumcorp.be.CommentRepositoryTest$CommentRepository"> | |
<select id="list" resultType="comment"> | |
select no, email, comment, create_time as createTime from comment | |
order by no desc | |
limit #{limit} offset #{offset} | |
</select> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.daumcorp.be; | |
import org.apache.commons.lang.StringUtils; | |
/** | |
* Created by karian7 on 2/18/14. | |
*/ | |
public class PasswordChangeService { | |
private AccountRepository accountRepository; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DBAccountRepository implements AccountRepository { | |
private final NamedParameterJdbcTemplate jdbcTemplate; | |
public DBAccountRepository(DataSource dataSource) { | |
jdbcTemplate = new NamedParameterJdbcTemplate(dataSource); | |
} | |
@Override | |
public Account findByEmail(final String email) { | |
String query = "select email, name, password from account where email = :email and use = 'Y'"; |