collaboration with eclipse final
DESCRIPTION
Collaboration with eclipseTRANSCRIPT
jsp / eclipse 정보공유 http://okjsp.pe.kr
Effective Software Project Collaboration
using Eclipse okjsp2011.08
jsp / eclipse 정보공유 http://okjsp.pe.kr
Schedule
1,2 이클립스 기본
3 VCS & 빌드 도구 ANT
4 이클립스와 협업 프로세스
5,6 이클립스 웹개발
7,… 이클립스와 테스트 자동화
jsp / eclipse 정보공유 http://okjsp.pe.kr
0. Set up
• jdk 1.7
• eclipse 3.7 indigo
• tomcat 7.0.19
• mysql 5.5
• Github.com
jsp / eclipse 정보공유 http://okjsp.pe.kr
JAVA_HOME
jsp / eclipse 정보공유 http://okjsp.pe.kr
java -version
jsp / eclipse 정보공유 http://okjsp.pe.kr
Ganymede
jsp / eclipse 정보공유 http://okjsp.pe.kr
eclipse 3.4 JEE
jsp / eclipse 정보공유 http://okjsp.pe.kr
1. 이클립스 개요
• Source Compile
• Project Build
• Tool positioning
• 개발 생산성 향상
• IDE
jsp / eclipse 정보공유 http://okjsp.pe.kr
Source Compile
• javac
• eclipse auto compile
• src
• build or classes
jsp / eclipse 정보공유 http://okjsp.pe.kr
Project Build
• build script
• ready for use
jsp / eclipse 정보공유 http://okjsp.pe.kr
Tool positioning
요구분석
설계
개발
테스트
usecase
modeling
IDE
Testing Tool
릴리스 build Tool
jsp / eclipse 정보공유 http://okjsp.pe.kr
개발 생산성 향상
• requirement 확인
• control complexity
• refactoring
• automation
jsp / eclipse 정보공유 http://okjsp.pe.kr
IDE
• coding
• compile/build
• run/debug
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 컴파일과 빌드의 차이점은?
• IDE의 기본 기능 세 가지는?
jsp / eclipse 정보공유 http://okjsp.pe.kr
2. Hello World 실행하기
• Java Application
• Java Web Application
• Console View
• Argument, Parameter, Method Signature
jsp / eclipse 정보공유 http://okjsp.pe.kr
Start
jsp / eclipse 정보공유 http://okjsp.pe.kr
Perspective
jsp / eclipse 정보공유 http://okjsp.pe.kr
Java Project
jsp / eclipse 정보공유 http://okjsp.pe.kr
jsp / eclipse 정보공유 http://okjsp.pe.kr
Java Application
• main()
• Java Project
jsp / eclipse 정보공유 http://okjsp.pe.kr
Create Class
jsp / eclipse 정보공유 http://okjsp.pe.kr
Create Class
jsp / eclipse 정보공유 http://okjsp.pe.kr
Hello World
jsp / eclipse 정보공유 http://okjsp.pe.kr
Run
jsp / eclipse 정보공유 http://okjsp.pe.kr
Quick Access ^3
jsp / eclipse 정보공유 http://okjsp.pe.kr
Console ViewConsole View Preferences
jsp / eclipse 정보공유 http://okjsp.pe.kr
Java Web Application
• servlet container
• Dynamic Web Project
jsp / eclipse 정보공유 http://okjsp.pe.kr
Argument, Parameter, Method Signature
• Argument
•main(String[] args)
• Parameter
• key, value pairs transfer
• Query String
• Method Signature
• public static void main(String[] args)
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 구구단 출력 프로그램을 자바프로젝트로 작성하기
• 웹 프로젝트로 구구단을 작성하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
3. 코드 네비게이션
• Reading Code
• Readability
• Find
• Open Resource
• Definition
• References
jsp / eclipse 정보공유 http://okjsp.pe.kr
legend
• ctrl : ^
• alt : @
• shift : ~
jsp / eclipse 정보공유 http://okjsp.pe.kr
Find/Search
• 찾기/바꾸기
• ^ + F
• 파일 찾기
• ^ + ~ + R, @ + n u
• 문자열 포함된 소스 찾기
• contextMenu + find
• ^ + H
jsp / eclipse 정보공유 http://okjsp.pe.kr
Find/Search #2
• 코드 패턴 찾기
• ^ + j, ^~ + j ; incremental find
• ^ + k, ^~ + k ; selection find
• 상속 관계 찾기
• ^ + t
• 메소드 찾기
• ^ + o ; Outline
jsp / eclipse 정보공유 http://okjsp.pe.kr
Find/Search #3
• 선언부 찾기
• ^ + leftClick
• f3
• 참조 소스 목록
• ctrl + shift + g
• contextMenu > References > Project
• 같은 변수 찾기
• 형광펜
jsp / eclipse 정보공유 http://okjsp.pe.kr
Navigate
• 라인번호로 이동
• ^ + L
• 중괄호({} brace) 처음과 끝
• ctrl + shift + p
• @ + ~ + 좌우화살표
jsp / eclipse 정보공유 http://okjsp.pe.kr
Navigate #2
• 파일과 파일 사이 이동
• ^ + f6
• 뒤로/앞으로
• @ + 좌우 화살표
jsp / eclipse 정보공유 http://okjsp.pe.kr
코드 비교하기
• compare with...
• replace with...
jsp / eclipse 정보공유 http://okjsp.pe.kr
편집
• copy & paste
• ^ + insert / ~ + insert
• ^ + c / ^ + v
• ^ + @ + 상하 화살표
• method copy/remove
• outline view에서 copy/remove
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 오픈소스 프로젝트 import 하기
• 편집기 단축키 중 ctrl+shift+R의역할은?
• 자바 편집기에서 ctrl+shift+G의역할은?
• 클래스, 메소드, 변수의 선언위치로이동하는 단축키는?
jsp / eclipse 정보공유 http://okjsp.pe.kr
4. 프로젝트 기반의소스 아키텍처
• 개발 표준
• 소스 디렉토리 구조
• 서비스 디렉토리 구조
• 버젂관리 해야할 것
• 빌드 스크립트의 가변성
jsp / eclipse 정보공유 http://okjsp.pe.kr
개발 표준
• 용어집
• 코딩 컨벤션
• CRUD 코드 샘플
jsp / eclipse 정보공유 http://okjsp.pe.kr
소스 디렉토리 구조
• src
• src/java
• src/test
• WebContent
• WebContent/WEB-INF/web.xml
• WebContent/WEB-INF/lib
• WebContent/WEB-INF/classes
• docs
jsp / eclipse 정보공유 http://okjsp.pe.kr
서비스 디렉토리 구조
• Context Root
• /WEB-INF/web.xml
• /WEB-INF/lib
• /WEB-INF/classes
jsp / eclipse 정보공유 http://okjsp.pe.kr
버젂관리 해야할 것
• src
• WebContent/
• .ignore
• project configuration
jsp / eclipse 정보공유 http://okjsp.pe.kr
빌드 스크립트의가변성
• properties 이용
• relative path
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 다이나믹 웹 프로젝트 기본 폴더구조는?
jsp / eclipse 정보공유 http://okjsp.pe.kr
5. 프로퍼티 에디터플러그인 설치하기
• Properties의 특성
• 프로젝트 내에서 properties 파일의위치
• propedit plugin
jsp / eclipse 정보공유 http://okjsp.pe.kr
Update Site URL
http://propedit.sourceforge.jp/eclipse/updates/
jsp / eclipse 정보공유 http://okjsp.pe.kr
Software Updates
jsp / eclipse 정보공유 http://okjsp.pe.kr
Check plugin & Install
jsp / eclipse 정보공유 http://okjsp.pe.kr
Plugin Licenses
jsp / eclipse 정보공유 http://okjsp.pe.kr
Install Complete
jsp / eclipse 정보공유 http://okjsp.pe.kr
Software Updates
• Installed Software
• Update...
• Uninstall...
• Revert Configuration...
• Available Software
• Update site url
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 플러그인 설치의 두 가지 방법을기술
• AnyEdit plugin
• Subversive plugin
• pathtools
jsp / eclipse 정보공유 http://okjsp.pe.kr
6. Mylyn과 작업리스트
• Mylyn 개요
• ToDo 리스트의 관리
• 일정관리
jsp / eclipse 정보공유 http://okjsp.pe.kr
New Task
jsp / eclipse 정보공유 http://okjsp.pe.kr
Mylyn 개요
• Task List
• Planning
• Context
• Category
• Activate Task
• Focus on Active Task
jsp / eclipse 정보공유 http://okjsp.pe.kr
Task List
jsp / eclipse 정보공유 http://okjsp.pe.kr
ToDo 리스트의 관리
• Context 와 연결
• 우선숚위
• Estimation
jsp / eclipse 정보공유 http://okjsp.pe.kr
일정관리
• Personal Planning
• Scheduled for
• Due
• Estimated hours
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• Mylyn과 구글의 이슈트래커와 연결
jsp / eclipse 정보공유 http://okjsp.pe.kr
Day-2
jsp / eclipse 정보공유 http://okjsp.pe.kr
이클립스 서브버전 플러그인Subversive
• Ganymede project
• Polarion license
• Team UI
jsp / eclipse 정보공유 http://okjsp.pe.kr
eclipse.org/subversive
jsp / eclipse 정보공유 http://okjsp.pe.kr
Subversive Update URL
http://www.polarion.com/products/svn/subversive.php?src=eclipseproject
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 오픈소스 프로젝트 호스팅 서비스와서브버젂 플러그인을 연결해서프로젝트 소스를 가져오기
jsp / eclipse 정보공유 http://okjsp.pe.kr
Version Control System 기본
• 버전관리 라이프사이클
• import
• add
• commit
• checkout
• update
• repository
• sandbox
jsp / eclipse 정보공유 http://okjsp.pe.kr
젂통적인 개발방식
server
client
browser
개발자A
개발자B
ftp, telnet
ftp, telnet
jsp / eclipse 정보공유 http://okjsp.pe.kr
VCS를 이용한 개발
VCS
server
client
browser
개발자A
개발자B
build
: sandbox;
VCS서버와 sync되는 소스 작업공간
jsp / eclipse 정보공유 http://okjsp.pe.kr
용어• 저장소 Repository버젂 관리되는 파일이 저장되는 서버의 기준 디렉토리
• 모듈 Module저장소의 하위 단위, 한 모듈은 보통 하나의 프로젝트
• 체크아웃 checkout모듈을 작업자의 PC로 가져오는 명령
• 샌드박스 sandbox파일의 수정이 가능한 VCS서버와 동기화되는 작업공간.
• 전송 Commit작업 완료된 파일을 VCS서버에 반영
jsp / eclipse 정보공유 http://okjsp.pe.kr
Source Repository
Image from: http://designpatternschash.blogspot.com/2008/09/what-is-tortoise-svn.html
jsp / eclipse 정보공유 http://okjsp.pe.kr
Update, Commit
Image from: http://designpatternschash.blogspot.com/2008/09/what-is-tortoise-svn.html
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• VCS 용어의 의미를 기술
• import
• commit
• update
• conflict
• repository
• sandbox
jsp / eclipse 정보공유 http://okjsp.pe.kr
소스의 공유와 배포에 관하여
• Sandbox
• Update Frequently
• Commit by function unit
• Team Communication
• Time Gap
jsp / eclipse 정보공유 http://okjsp.pe.kr
Process
jsp / eclipse 정보공유 http://okjsp.pe.kr
VCS Best Practices
• 작업 시작 젂에 항상 project update를 시행
• 완료된 파일은 매일 점심 식사 젂과 퇴근젂에 젂송(Commit)
• 충돌이 자주 생기는 파일은 해당작업자들간의 의사소통이 잘 안 된다는 표시
• 에러가 난 파일은 해결될 때까지젂송(Commit) 자제
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• VCS를 이용한 공유시 소스의 이력을볼 수 있는 방법은?
• 웹 애플리케이션 배포시 이상이생겼을 경우 원상복구를 빨리 할 수있는 방법을 기술하시오.
jsp / eclipse 정보공유 http://okjsp.pe.kr
버젂 비교하기
• Compare with ...
• Source Tree Time Machine
jsp / eclipse 정보공유 http://okjsp.pe.kr
Show in History
jsp / eclipse 정보공유 http://okjsp.pe.kr
https svn trust
jsp / eclipse 정보공유 http://okjsp.pe.kr
History View
jsp / eclipse 정보공유 http://okjsp.pe.kr
Compare With ...
jsp / eclipse 정보공유 http://okjsp.pe.kr
Get Content
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 히스토리 뷰에서 과거 소스의 내용을가져와 현재의 소스에 적용하는 방법
• 일주일 전 프로젝트 소스 가져오기
jsp / eclipse 정보공유 http://okjsp.pe.kr
ANT 빌드스크립트 만들기
• project
• target
• task
jsp / eclipse 정보공유 http://okjsp.pe.kr
Ant.apache.org
jsp / eclipse 정보공유 http://okjsp.pe.kr
Ant Outline
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 이클립스IDE와 빌드툴의 차이
• 기존 프로젝트에 ANT 빌드스크립트를 적용하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
ANT를 이용한 자동화
• Build Script
• Crontab
• Conditional Build based on property
• javadoc
• JUnit
jsp / eclipse 정보공유 http://okjsp.pe.kr
ftp task
<target name="upload" depends="publish" description="ftp upload text files">
<ftp server="${ftp.server}" port="21" remotedir="${ftp.remotedir}"
userid="${ftp.userid}" password="${ftp.password}"depends="yes“ binary="yes">
<fileset dir="${publish.home}"><!-- jsp 파일 업로드 --><include name=“**/*.jsp"/>
<!-- class 파일과 resources 업로드 --><include name="WEB-INF/classes/kr/**/*.class"/>
<!-- 정적인 파일 업로드 --><include name="**/*.htm*"/>
</fileset></ftp>
</target>
jsp / eclipse 정보공유 http://okjsp.pe.kr
Optional Task
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• ftp를 이용하려면 필요한 라이브러리
• 빌드날짜가 포함된 jar 파일생성하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
Day-3
jsp / eclipse 정보공유 http://okjsp.pe.kr
1. 지속적인 통합Continuous Integration
• 주기적인 빌드를 통해서 프로젝트 팀간의 인터페이스 격차를 조기에 발견
• 빅뱅통합에 드는 비싼 비용을 절감
• PC급의 빌드 서버 활용
jsp / eclipse 정보공유 http://okjsp.pe.kr
Commit Time issue
• interfaces, xml small but important files
• break whole build
• fear of commit
• short periodical commit time interval
jsp / eclipse 정보공유 http://okjsp.pe.kr
Best Practices
• Maintain a Single Source Repository.
• Automate the Build
• Make Your Build Self-Testing
• Everyone Commits Every Day
• Build the Mainline on an Integration Machine
• Keep the Build Fast
• Test in a Clone of the Production Environment
• Make it Easy for Anyone to Get the Latest Executable
• Everyone can see what's happening
• Automate Deployment
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 지속적인 통합의 장점 세 가지 기술
• 지속적인 통합의 프랙티스 열 가지기술
jsp / eclipse 정보공유 http://okjsp.pe.kr
2. Hudson 개요
• Building/testing software project continuously
• Monitoring execution of externally-run jobs
jsp / eclipse 정보공유 http://okjsp.pe.kr
Hudson Plugins
• installation
• Using interface
• http://yourhost/hudson/managePlugins
• Download
• download *.hpi file into
• $HUDSON_HOME/plugins
source: http://wiki.hudson-ci.org/display/HUDSON/Plugins
jsp / eclipse 정보공유 http://okjsp.pe.kr
Hudson Plugins #1
• Source code management
• Build triggers
• Build tools
• Build wrappers
• Build notifiers
• Slave launchers and controllers
jsp / eclipse 정보공유 http://okjsp.pe.kr
Hudson Plugins #2
• Build reports
• Artifact uploaders
• External site/tool integrations
• UI plugins
• Page decorators
• Misc
jsp / eclipse 정보공유 http://okjsp.pe.kr
Hudson Plugins
jsp / eclipse 정보공유 http://okjsp.pe.kr
Hudson Plugins
jsp / eclipse 정보공유 http://okjsp.pe.kr
Findbugs plugin
jsp / eclipse 정보공유 http://okjsp.pe.kr
Hudson Security
• java -jar hudson.war
--argumentsRealm.passwd.kenu=okpass
--argumentsRealm.roles.kenu=admin
jsp / eclipse 정보공유 http://okjsp.pe.kr
Hudson Security
jsp / eclipse 정보공유 http://okjsp.pe.kr
Hudson Security
jsp / eclipse 정보공유 http://okjsp.pe.kr
Hudson Security
jsp / eclipse 정보공유 http://okjsp.pe.kr
Hudson Security
• Quick and Simple Security <http://hudson.gotdns.com/wiki/display/HUDSON/Quick+and+Simple+Security>
• Standard Security Setup <http://hudson.gotdns.com/wiki/display/HUDSON/Standard+Security+Setup>
• Apache frontend for security <http://hudson.gotdns.com/wiki/display/HUDSON/Apache+frontend+for+security>
• Authenticating scripted clients <http://hudson.gotdns.com/wiki/display/HUDSON/Authenticating+scripted+clients>
• Help! I locked myself out! <http://hudson.gotdns.com/wiki/display/HUDSON/Disable+security>
jsp / eclipse 정보공유 http://okjsp.pe.kr
Eclipse plugin
source: http://code.google.com/p/hudson-eclipse/
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• Hudson의 두 가지 목적은?
• Hudson 플러그인 설치 방법 두 가지
• Hudson의 기본인증 기능을 설치하기
• 구글 메싞저와 연결하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
3. Hudson과Subversion 연결
jsp / eclipse 정보공유 http://okjsp.pe.kr
Check out URL
jsp / eclipse 정보공유 http://okjsp.pe.kr
Job Configure
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 오픈소스 프로젝트와 Hudson 연결
jsp / eclipse 정보공유 http://okjsp.pe.kr
4. 개발프로세스에서이클립스 포지셔닝
jsp / eclipse 정보공유 http://okjsp.pe.kr
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 이클립스 프로젝트의 Ant 빌드스크립트를 만들고 Hudson을통해 개발서버에 배포하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
5. Eclipse Communication Framework
jsp / eclipse 정보공유 http://okjsp.pe.kr
ECF in Ganymede
jsp / eclipse 정보공유 http://okjsp.pe.kr
jsp / eclipse 정보공유 http://okjsp.pe.kr
Real-time Shared Editing
http://www.vimeo.com/1195398?pg=embed&sec=1195398
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• ECF 프레임워크를 통해서 짝프로그래밍하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
6. 프로젝트 Health Check
jsp / eclipse 정보공유 http://okjsp.pe.kr
Health Check
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 프로젝트 모니터링을 위해 Hudson에메일 설정하기
• JUnit Report 설정하기
• Findbugs를 통해 프로젝트 버그 정적분석하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
Day-4
jsp / eclipse 정보공유 http://okjsp.pe.kr
1. 웹프로젝트의 특징
• ServerSide Script
• ClientSide Script
jsp / eclipse 정보공유 http://okjsp.pe.kr
Java ProjectDynamic Web Project
jsp / eclipse 정보공유 http://okjsp.pe.kr
설정 파일 비교
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 서버 사이드 스크립트와 클라이언트사이드 스크립트의 런타임 차이점
• Client/Server 애플리케이션과 웹애플리케이션의 차이점
jsp / eclipse 정보공유 http://okjsp.pe.kr
2. 톰캣 서버 연결
• Target Runtime
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 톰캣 서버 포트를 8080에서 9090으로변경하기
• 프로젝트 퍼블리쉬하지 않게 설정조정하기
• 자바 프로젝트와 다이나믹 웹프로젝트의 차이점
jsp / eclipse 정보공유 http://okjsp.pe.kr
3. JSP/Servlet 만들기
jsp / eclipse 정보공유 http://okjsp.pe.kr
Servlet 만들기
jsp / eclipse 정보공유 http://okjsp.pe.kr
Servlet 클래스
jsp / eclipse 정보공유 http://okjsp.pe.kr
URL Mapping
jsp / eclipse 정보공유 http://okjsp.pe.kr
Servlet Template
jsp / eclipse 정보공유 http://okjsp.pe.kr
doGet()
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<h1>Hello World</h1>");
out.close();
jsp / eclipse 정보공유 http://okjsp.pe.kr
URL mapping
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• DB를 이용해 방명록 만들기
jsp / eclipse 정보공유 http://okjsp.pe.kr
4. 한글 인코딩 처리
jsp / eclipse 정보공유 http://okjsp.pe.kr
Java Hangul
new String(string.getBytes("8859_1"), "ms949");
new String(string.getBytes("ms949"), "8859_1");
jsp / eclipse 정보공유 http://okjsp.pe.kr
홖경변수
System.getProperty("user.language");
JAVA_OPTS="-Duser.language=en"
JAVA_OPTS="-Duser.language=ko"
jsp / eclipse 정보공유 http://okjsp.pe.kr
JSP encoding
<%@ page pageEncoding="ms949" %>
<%@ page contentType="text/html;charset=ms949" %>
jsp / eclipse 정보공유 http://okjsp.pe.kr
JSP encodingrequest.setCharacterEncoding("ms949");
Filter<filter>
<filter-name>Set Character Encoding</filter-name><filter-class>filters.SetCharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>utf-8</param-value></init-param>
</filter>
<filter-mapping><filter-name>Set Character Encoding</filter-name><url-pattern>/*</url-pattern>
</filter-mapping>
jsp / eclipse 정보공유 http://okjsp.pe.kr
한글 문제 처리 방법
• 다른 DB클라이언트로 한글 확인
• 인코딩 함수 모두 제거 후 점진 적용
• 브라우저의 소스보기에서 한글 확인
• 중간단계의 한글 깨짐 해결우선숚위는 최하위로
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 자바에서의 캐릭터 인코딩 처리 기술
• JSP의 인코딩 처리 기술
• 한글 문제 처리 방법
• HTTP에서의 인코딩 처리 기술
jsp / eclipse 정보공유 http://okjsp.pe.kr
5. Spring 웹프레임워크 다루기
• JPetStore 샘플을 통해서 스프링프레임워크 숙지
jsp / eclipse 정보공유 http://okjsp.pe.kr
warfile.bat 실행
jsp / eclipse 정보공유 http://okjsp.pe.kr
hsqldb 서버 기동
jsp / eclipse 정보공유 http://okjsp.pe.kr
import war file
jsp / eclipse 정보공유 http://okjsp.pe.kr
Import src
jsp / eclipse 정보공유 http://okjsp.pe.kr
JPetStore 실행
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• Spring Framework 에서 다음을 순서대로나열하시오
• Controller
• DAO
• Service
• JSP
• applicationContext.xml
jsp / eclipse 정보공유 http://okjsp.pe.kr
6. 원격 서버 배포하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
배포시 주의사항
• 개발 서버는 Hudson 등을 통해자동화 가능
• 운영계는 원상복구에 대한 이슈가크기 때문에 심볼릭 링크 등을통해서 빠르게 원복할 수 있도록 함
jsp / eclipse 정보공유 http://okjsp.pe.kr
ftp ant task 등
<ftp server="${ftp.server}"
port="21"
remotedir="${ftp.remotedir}"
userid="${ftp.userid}"
password="${ftp.password}"
depends="yes"
binary="yes"
>
<fileset dir="${publish.home}">
<include name="images/**/*.gif"/>
<include name="images/**/*.jpg"/>
<include name="WEB-INF/lib/*.jar"/>
<include name="WEB-INF/classes/*.class"/>
</fileset>
</ftp>
jsp / eclipse 정보공유 http://okjsp.pe.kr
Remote System Explorer
jsp / eclipse 정보공유 http://okjsp.pe.kr
RSE Ftp
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 톰캣에서 war 파일로 프로젝트배포하기
• ant의 ftp 태스크를 이용해서배포하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
Day-5
jsp / eclipse 정보공유 http://okjsp.pe.kr
이클립스와 테스트 자동화
• 1. 이클립스에서 지원하는 테스트케이스
• 2. JUnit 이해하기
• 3. 테스트케이스와 리팩토링
• 4. Findbugs 플러그인을 통한 품질향상
• 5. JUnit과 Findbugs의 지속적인 리포트
• 6. Selenium을 이용한 웹 UI 레코딩 테스트
jsp / eclipse 정보공유 http://okjsp.pe.kr
1. 이클립스에서지원하는 테스트케이스
• 테스트케이스는 입력값과 출력값을지정해서 테스트 되는 함수가 그조건의 충족 여부를 확인 가능한프로그램
• assertEquals(예상출력, 함수(입력));
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트의 자동화
• 테스트케이스는 프로그램으로자동화해야 한다.
• 품질은 테스트의 범위와 실행 횟수에영향을 받는다.
• 수작업의 테스트는 기한 내 테스트실행 횟수를 감소시킨다.
• 테스트는 빨리 쉽게 수행 가능해야한다.
jsp / eclipse 정보공유 http://okjsp.pe.kr
Test Harness
• Scaffold
• Outside of Application
• Fine grained TestCases
• It’s useful for changing software
• Acrobatic with safety net
jsp / eclipse 정보공유 http://okjsp.pe.kr
jsp / eclipse 정보공유 http://okjsp.pe.kr
jsp / eclipse 정보공유 http://okjsp.pe.kr
TestCase 제작
jsp / eclipse 정보공유 http://okjsp.pe.kr
TestCase 제작
jsp / eclipse 정보공유 http://okjsp.pe.kr
TestCase 제작
jsp / eclipse 정보공유 http://okjsp.pe.kr
TestCase 제작
package net.okjsp;
import junit.framework.TestCase;
public class HelloWorldTest extends TestCase {
}
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트 메소드
jsp / eclipse 정보공유 http://okjsp.pe.kr
assert...
• assertTrue(실행결과);
• assertFalse(실행결과);
• assertEquals(목적값, 실행결과);
• assertEquals(float목적값, 실행결과, 오차범위);
jsp / eclipse 정보공유 http://okjsp.pe.kr
일단 테스트 고
jsp / eclipse 정보공유 http://okjsp.pe.kr
JUnit Result
jsp / eclipse 정보공유 http://okjsp.pe.kr
컴파일 되게 만들기
jsp / eclipse 정보공유 http://okjsp.pe.kr
컴파일 되게 만들기
jsp / eclipse 정보공유 http://okjsp.pe.kr
다시 테스트 고
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트 통과하게 하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
기능 추가하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
컴파일 되게 만들기
jsp / eclipse 정보공유 http://okjsp.pe.kr
다시 테스트 고
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트 통과하게 하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
리팩토링 하기-중복제거재홗용
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트 히스토리
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트 조건 강화하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
다시 테스트 고
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트 통과하게 하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트에 관하여
jsp / eclipse 정보공유 http://okjsp.pe.kr
Test and Debug
jsp / eclipse 정보공유 http://okjsp.pe.kr
참고
• http://junit.org
• http://www.eclipse.org
• http://xper.org
• http://okjsp.tistory.com/tag/test
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 테스트케이스란?
jsp / eclipse 정보공유 http://okjsp.pe.kr
2. JUnit 이해하기
• java version of xUnit family.
• CPPUnit, JSUnit, ASUnit, httpUnit…
• Kent Beck, Erich Gamma
• assert
• TestCase, TestSuite
• Matter of S/W quality.
jsp / eclipse 정보공유 http://okjsp.pe.kr
sf.net/projects/junit
jsp / eclipse 정보공유 http://okjsp.pe.kr
TestCase
• Ver3.8.x
• Extends TestCase
• assertTrue
• assertEquals
• Ver4.x
• Annotation
jsp / eclipse 정보공유 http://okjsp.pe.kr
TestSuite
• AllTests
• Group of TestCases
• Regression Test Automation
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• JUnit 테스트케이스로 디버깅하기
• TestCase와 TestSuite 구분하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
3. 테스트케이스와리팩토링
jsp / eclipse 정보공유 http://okjsp.pe.kr
리팩토링 하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
리팩토링 하기-inline
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트 스위트
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트 스위트
jsp / eclipse 정보공유 http://okjsp.pe.kr
젂체 테스트하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
정리-테스트 리듬
• Rhythm
• TestCase
• Change Small Code
• All Test
• Refactoring
• All Test
• 돌다리도 두드려 가라.
• 모래 코드 위에 코드를 추가하지 말라.
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트 코드 분리하기-소스폴더
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트 코드 분리하기-소스폴더
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트 코드 분리-Move
jsp / eclipse 정보공유 http://okjsp.pe.kr
테스트 코드 분리-Move
jsp / eclipse 정보공유 http://okjsp.pe.kr
다시 테스트 고
jsp / eclipse 정보공유 http://okjsp.pe.kr
JUnit Beyond
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 리팩토링이란?
• 리팩토링과 테스트케이스의 관계?
jsp / eclipse 정보공유 http://okjsp.pe.kr
4. Findbugs 플러그인을통한 품질향상
jsp / eclipse 정보공유 http://okjsp.pe.kr
from
• http://findbugs.sourceforge.net
jsp / eclipse 정보공유 http://okjsp.pe.kr
What for
• Find Java Program Bugs
• Search by bug patterns
• Search for compiled byte code
• Refer source code for Human Readable
• Provide fix guide for each bug
jsp / eclipse 정보공유 http://okjsp.pe.kr
Tool• Command line• Desktop Application
• Java Web Start; jnlp• Plugin
• IDE: • Eclipse, NetBeans …
• Build Tool:• Ant, Maven
• CI Tool : • Hudson
jsp / eclipse 정보공유 http://okjsp.pe.kr
Command line
• Download, Unzip, set Path
• options
• findbugs -textui-javahome /path/to/jdk1.5.0 -xml -output findbugs.xml /path/to/classes
jsp / eclipse 정보공유 http://okjsp.pe.kr
Desktop
jsp / eclipse 정보공유 http://okjsp.pe.kr
Eclipse plugin
• Update URL
• http://findbugs.cs.umd.edu/eclipse/
jsp / eclipse 정보공유 http://okjsp.pe.kr
Eclipse plugin-editor
jsp / eclipse 정보공유 http://okjsp.pe.kr
Eclipse plugin-view
jsp / eclipse 정보공유 http://okjsp.pe.kr
Eclipse plugin-perspective
jsp / eclipse 정보공유 http://okjsp.pe.kr
Related
• http://findbugs.sourceforge.net
• https://hudson.dev.java.net
• http://okjsp.tistory.com/tag/findbugs
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• Findbugs 이클립스 플러그인사용하기
• Hudson 플러그인으로 리포팅하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
5. JUnit과 Findbugs의지속적인 리포트
jsp / eclipse 정보공유 http://okjsp.pe.kr
JUnit Ant Task
• junit-ant.jar, junit.jar
copy to $ANT_HOME/lib/
<target name="test" depends="compile">
<junit>
<classpath refid="test.classpath"/>
<test name="test.UnitTest"></test>
</junit>
</target>
jsp / eclipse 정보공유 http://okjsp.pe.kr
junitreport<mkdir dir="report/html"/>
<junit printsummary="on" haltonfailure="on">
<classpath refid="test.classpath"/>
<formatter type="xml"/>
<batchtest todir="report">
<fileset dir="dst">
<include name="**/*Test*"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="report">
<fileset dir="report">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="report/html"/>
</junitreport>
jsp / eclipse 정보공유 http://okjsp.pe.kr
junitreport
jsp / eclipse 정보공유 http://okjsp.pe.kr
Findbugs Ant Task
• $FINDBUGS_HOME/lib/findbugs-ant.jar
copy to $ANT_HOME/lib/
<taskdef name="findbugs"
classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
<target name="findbugs" depends="compile">
<findbugs home="${findbugs.home}"
output="xml" outputFile="findbugs.xml"
jvmargs="-Xms512M -Xmx1024M " timeout="1800000">
<sourcePath path="WebContent/WEB-INF/src" />
<class location="WebContent/WEB-INF/classes" />
</findbugs>
</target>
jsp / eclipse 정보공유 http://okjsp.pe.kr
HUDSON Report
• https://hudson.dev.java.net/
jsp / eclipse 정보공유 http://okjsp.pe.kr
How to use in our team
• Each one’s IDE; before commit;
• Using App’s Health Care
• CI graph
• Code Review
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• JUnit과 Findbugs의 Ant 연결 파일과Ant Task 실행을 위해 파일을 복사할위치는 어디인가?
jsp / eclipse 정보공유 http://okjsp.pe.kr
6. Selenium을 이용한웹 UI 레코딩 테스트
• Overview
• Install
• UI Recording
jsp / eclipse 정보공유 http://okjsp.pe.kr
• Install Firefox
• http://getFirefox.com
• 도구 > 부가 기능
• Search "Selenium"
jsp / eclipse 정보공유 http://okjsp.pe.kr
install
jsp / eclipse 정보공유 http://okjsp.pe.kr
Selenium IDE
jsp / eclipse 정보공유 http://okjsp.pe.kr
Recording
jsp / eclipse 정보공유 http://okjsp.pe.kr
VerifyText
jsp / eclipse 정보공유 http://okjsp.pe.kr
Replay
jsp / eclipse 정보공유 http://okjsp.pe.kr
tune
jsp / eclipse 정보공유 http://okjsp.pe.kr
TestCase
jsp / eclipse 정보공유 http://okjsp.pe.kr
TestSuite
jsp / eclipse 정보공유 http://okjsp.pe.kr
Selenium Core
• Selenium Core is a DHTML test execution framework.
jsp / eclipse 정보공유 http://okjsp.pe.kr
연습문제
• 방명록 웹UI 테스트케이스 작성하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
정리
05.09 이클립스 기본
05.16 서브버젂과 빌드 도구 ANT
05.23 이클립스와 협업 프로세스
05.30 이클립스 웹개발
06.13 이클립스와 테스트 자동화
jsp / eclipse 정보공유 http://okjsp.pe.kr
이클립스 기본
• 이클립스 개요
• Hello World 실행하기
• 코드 네비게이션
• 프로젝트 기반의 소스 아키텍처
• 프로퍼티 에디터 플러그인 설치하기
• Mylyn과 작업리스트
jsp / eclipse 정보공유 http://okjsp.pe.kr
서브버젂과 빌드 도구 ANT
• 1. 이클립스 서브버젂 플러그인 Subversive
• 2. Version Control System 기본
• 3. 소스의 공유와 배포에 관하여
• 4. 버젂 비교하기
• 5. ANT 빌드스크립트 만들기
• 6. ANT를 이용한 자동화
jsp / eclipse 정보공유 http://okjsp.pe.kr
이클립스와 협업 프로세스
• 1. 지속적인 통합 Continuous Integration
• 2. Hudson 개요
• 3. Hudson과 Subversion 연결
• 4. 개발프로세스에서 이클립스 포지셔닝
• 5. Eclipse Communication Framework
• 6. 프로젝트 Health Check
jsp / eclipse 정보공유 http://okjsp.pe.kr
이클립스 웹개발
• 1. 웹프로젝트의 특징
• 2. 톰캣 서버 연결
• 3. JSP/Servlet 만들기
• 4. 경우에 따른 인코딩 처리
• 5. Spring 웹 프레임워크 다루기
• 6. 원격 서버 배포하기
jsp / eclipse 정보공유 http://okjsp.pe.kr
이클립스와 테스트 자동화
• 1. 이클립스에서 지원하는 테스트케이스
• 2. JUnit 이해하기
• 3. 테스트케이스와 리팩토링
• 4. Findbugs 플러그인을 통한 품질향상
• 5. JUnit과 Findbugs의 지속적인 리포트
• 6. Selenium을 이용한 웹 UI 레코딩 테스트
jsp / eclipse 정보공유 http://okjsp.pe.kr
수고하셨습니다.이클립스로
행복한 개발하세요.