프로젝트를 check out 한다. 터미널을 실행하고, 다음 command를 실행한다.

git clone https://github.com/infinispan/infinispan-embedded-tutorial.git

cd infinispan-embedded-tutorial

 

위의 command를 통해서 git repository에 있는 프로젝트를 local copy하고, 현재 디렉토리를 변경하여 프로젝트의 root 디렉토리에 위치할 수 있다. 이제 Step-0으로 이동해보자.

 

git checkout -f step-0

 

이러한 초기 과정은 우리가 Weather application을 구현한 maven java project를 위한 것이다.  application은 다양한 도시의 현재 날씨 데이터를 얻기 위해 OpenWeatherMap (openweathermap.org) API를 이용한다. 인터넷 연결이 안되거나 문제가 있다면 random weather service를 이용할 수 있도록 pom.xml 파일내에 있는 주석을 해제하라. 이 초기 과정은 dependency가 전혀 없고, JDK logging을 사용한다. 다음 이미지는 프로젝트의 구성도를 보여준다.

사용자 삽입 이미지

컴파일하고 실행해 보자

mvn clean package

 

Maven command-line으로 실행한 2개의 goal (clean, package)을 순서대로 실행할 것이다.  첫번째 goal (clean)은 이전에 생성된 파일을 지우고, 두번째 goal (package)은 프로젝트를 컴파일하고 unit test를 실행하고,컴파일한 code jar 파일로 package할 것이다. 이제 우리는 code를 실행해 볼 수 있다. WeatherApp Classmain() method WeatherService를 초기화하고 list에 있는 도시의 현재 온도를 두 번 읽어온다. 그리고 list에 있는 도시의 데이터를 모두 얻어오는데 걸린 경과 시간을 출력한다. 현재 단계에서는 cache가 없으므로, application은 매번 데이터를 얻어와야 하기 때문에 정말 느리다.

 

mvn exec:exec

 

[output]

---- Fetching weather information ----
Rome, Italy - Temperature: 12.9° C, Conditions: light rain
Como, Italy - Temperature: 6.3° C, Conditions: Sky is Clear
Basel, Switzerland - Temperature: 0.8° C, Conditions: overcast clouds
Bern, Switzerland - Temperature: -1.6° C, Conditions: broken clouds
London, UK - Temperature: 1.8° C, Conditions: light rain
Newcastle, UK - Temperature: 2.6° C, Conditions: scattered clouds
Bucharest, Romania - Temperature: 9.3° C, Conditions: scattered clouds
Cluj-Napoca, Romania - Temperature: 6.4° C, Conditions: scattered clouds
Ottawa, Canada - Temperature: -7.0° C, Conditions: overcast clouds
Toronto, Canada - Temperature: -7.0° C, Conditions: broken clouds
Lisbon, Portugal - Temperature: 14.6° C, Conditions: overcast clouds
Porto, Portugal - Temperature: 12.2° C, Conditions: moderate rain
Raleigh, USA - Temperature: 3.9° C, Conditions: Sky is Clear
Washington, USA - Temperature: 3.4° C, Conditions: light rain
---- Fetched in 2210ms ----
---- Fetching weather information ----
Rome, Italy - Temperature: 12.9° C, Conditions: light rain
Como, Italy - Temperature: 6.3° C, Conditions: Sky is Clear
Basel, Switzerland - Temperature: 0.8° C, Conditions: overcast clouds
Bern, Switzerland - Temperature: -1.6° C, Conditions: broken clouds
London, UK - Temperature: 1.8° C, Conditions: light rain
Newcastle, UK - Temperature: 2.6° C, Conditions: scattered clouds
Bucharest, Romania - Temperature: 9.3° C, Conditions: scattered clouds
Cluj-Napoca, Romania - Temperature: 6.4° C, Conditions: scattered clouds
Ottawa, Canada - Temperature: -7.0° C, Conditions: overcast clouds
Toronto, Canada - Temperature: -7.0° C, Conditions: broken clouds
Lisbon, Portugal - Temperature: 14.6° C, Conditions: overcast clouds
Porto, Portugal - Temperature: 12.2° C, Conditions: moderate rain
Raleigh, USA - Temperature: 3.9° C, Conditions: Sky is Clear
Washington, USA - Temperature: 3.4° C, Conditions: light rain
---- Fetched in 1820ms ----

 

 

다음 단계에서 수행하는 작업은 더 흥미로울 것이다.


받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://www.yongbi.net/rss/response/667

트랙백 주소 :: http://www.yongbi.net/trackback/667

트랙백 RSS :: http://www.yongbi.net/rss/trackback/667

댓글을 달아 주세요

댓글 RSS 주소 : http://www.yongbi.net/rss/comment/667
[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다