diff --git a/src/main/java/cokr/xit/foundation/test/TestDao.java b/src/main/java/cokr/xit/foundation/test/TestDao.java index 86ef43c..0d3cc8b 100644 --- a/src/main/java/cokr/xit/foundation/test/TestDao.java +++ b/src/main/java/cokr/xit/foundation/test/TestDao.java @@ -1,7 +1,5 @@ package cokr.xit.foundation.test; -import org.springframework.stereotype.Repository; - import cokr.xit.foundation.component.AbstractDao; /**JUnit 테스트 프로그램에서 SQL문을 실행할 때 사용하는 DAO.
@@ -9,7 +7,7 @@ import cokr.xit.foundation.component.AbstractDao; * TestDao의 매퍼 파일은 test.xml이다. * @author mjkhan */ -@Repository("testDao") +//@Repository("testDao") public class TestDao extends AbstractDao { /**주어진 INSERT문을 실행한다. * @param sql INSERT SQL diff --git a/src/main/java/cokr/xit/foundation/test/TestMapper.java b/src/main/java/cokr/xit/foundation/test/TestMapper.java new file mode 100644 index 0000000..1bcd049 --- /dev/null +++ b/src/main/java/cokr/xit/foundation/test/TestMapper.java @@ -0,0 +1,30 @@ +package cokr.xit.foundation.test; + +import java.util.Map; + +import org.egovframe.rte.psl.dataaccess.mapper.Mapper; + +import cokr.xit.foundation.component.AbstractMapper; + +@Mapper("testMapper") +public interface TestMapper extends AbstractMapper { + int insert(Map params); + + default int execInsert(String sql) { + return insert(params().set("sql", sql)); + } + + int update(Map params); + + default int execUpdate(String sql) { + return update(params().set("sql", sql)); + } + + int delete(Map params); + + default int execDelete(String sql) { + return delete(params().set("sql", sql)); + } + + void commit(); +} \ No newline at end of file diff --git a/src/main/java/cokr/xit/foundation/test/TestSupport.java b/src/main/java/cokr/xit/foundation/test/TestSupport.java index 3cfc0e6..2793451 100644 --- a/src/main/java/cokr/xit/foundation/test/TestSupport.java +++ b/src/main/java/cokr/xit/foundation/test/TestSupport.java @@ -32,8 +32,8 @@ import cokr.xit.foundation.data.DataObject; @ContextConfiguration("classpath:spring/context-*.xml") @ActiveProfiles("test") public class TestSupport extends AbstractComponent { - @Resource(name="testDao") - protected TestDao testDao; + @Resource(name="testMapper") + protected TestMapper testMapper; protected DataObject dataObject() { return new DataObject(); diff --git a/src/main/java/cokr/xit/foundation/util/RandomNumber.java b/src/main/java/cokr/xit/foundation/util/Random.java similarity index 84% rename from src/main/java/cokr/xit/foundation/util/RandomNumber.java rename to src/main/java/cokr/xit/foundation/util/Random.java index 2a93188..777e8cd 100644 --- a/src/main/java/cokr/xit/foundation/util/RandomNumber.java +++ b/src/main/java/cokr/xit/foundation/util/Random.java @@ -5,12 +5,12 @@ import java.util.concurrent.ThreadLocalRandom; /**난수 발생기 * @author mjkhan */ -public class RandomNumber { +public class Random { /**지정한 자릿수의 난수를 반환한다. * @param digit 자릿수 * @return 지정한 자릿수의 난수 */ - public static final String get(int digit) { + public static final String number(int digit) { if (digit < 1) throw new IllegalArgumentException("digit < 1"); diff --git a/src/main/java/cokr/xit/foundation/web/AccessFilter.java b/src/main/java/cokr/xit/foundation/web/AccessFilter.java index b237704..af9dd4f 100644 --- a/src/main/java/cokr/xit/foundation/web/AccessFilter.java +++ b/src/main/java/cokr/xit/foundation/web/AccessFilter.java @@ -28,6 +28,14 @@ public class AccessFilter implements Filter { public void doFilter(ServletRequest sreq, ServletResponse sresp, FilterChain chain) throws IOException, ServletException { HttpServletRequest hreq = (HttpServletRequest)sreq; String action = hreq.getRequestURI().replace(hreq.getContextPath(), ""); + + if ("/".equals(action) || action.endsWith(".do")) + setAccess(hreq, action); + + chain.doFilter(sreq, sresp); + } + + private void setAccess(HttpServletRequest hreq, String action) { HttpSession session = hreq.getSession(false); Access access = new Access() @@ -40,8 +48,6 @@ public class AccessFilter implements Filter { .setCurrent(); hreq.setAttribute("currentAccess", access); - - chain.doFilter(sreq, sresp); } @Override