cvs, subversion처럼 git에서도 스크립트 실행을 처리하게 해야 리눅스/맥에서 실행할 수 있다.

update-index의 chmod  매개변수를 활용하면 리눅스의 chmod처럼 활용할 수 있다. 


$ git update-index --chmod=+x startup.sh

$ git update-index --chmod=+x shutdown.sh

$ git status

On branch master

Your branch is up-to-date with 'origin/master'.


Changes to be committed:

  (use "git reset HEAD <file>..." to unstage)


modified:   shutdown.sh

modified:   startup.sh


Changes not staged for commit:

  (use "git add <file>..." to update what will be committed)

  (use "git checkout -- <file>..." to discard changes in working directory)


modified:   shutdown.sh

modified:   startup.sh


$ git ls-tree HEAD

100644 blob bc80dddc71cb094e6efde19042b53b2d18a6fcdc shutdown.sh

100644 blob 47baf26b27bf3e8e86a53c69c8b940cf1c09625a startup.sh


$ git commit -m "스크립트 퍼미션 변경"

[master 2f88f31] 스크립트 퍼미션 변경

 2 files changed, 0 insertions(+), 0 deletions(-)

 mode change 100644 => 100755 script/shutdown.sh

 mode change 100644 => 100755 script/startup.sh

 

 

 $ git push



Posted by '김용환'
,


외부로의 maven 저장소 연결을 하려면, proxy를 통해서 빌드를 해야 하는 환경이 있다.

gradle은 이를 지원하며, gradle.properties 파일에 다음을 추가한다.

systemProp.http.proxyHost=proxy.google.io
systemProp.http.proxyPort=9999
systemProp.http.nonProxyHosts=localhost

systemProp.https.proxyHost=proxy.google.io
systemProp.https.proxyPort=9999
systemProp.https.nonProxyHosts=localhost

만약 내부 서버 중 일부는 proxy를 태우지 않으려면, 다음과 같이 nonProxyHosts에 glob패턴으로 서버를 지정할 수 있다.


systemProp.https.nonProxyHosts=*.google.com|localhost

Posted by '김용환'
,


.gitignore 설정 파일을 처음부터 만들지 못해서 정상적인 ignore 처리가 안될 때 다음과 같이 처리한다.



$ git rm -r --cached .

$ git add .

$ git commit -m "git ignore appled"

$ git push



그리고, push 이후 다시 서버쪽에서 ignore 가 처리가 되면 다시 pull하고 push하면 깨끗하게 정리된다.


$ git pull

$ git add .

$ git commit -m "git ignore appled"

$ git push

Posted by '김용환'
,


git (version 1.8.5.2) 에서 한글 브랜치 이름은 지원하나. merge(rebase)가 되지 않는다..


한글 브랜치 이름은 안쓰는 것이 좋을듯 하다. 



Posted by '김용환'
,


Legacy System을 잘 운영하기 위해서는 BlackBox 테스트 환경이 필요하다. 그래야 화이트 박스 테스트 코드를 짜지 않더라도 기본적인 테스트가 가능하다. (게다가 소스를 만질 수 없는 상황이라면 더더욱 Blackbox 테스트 환경이 필요하다)


서버의 중요 jar는 계약관게에 있어서 볼 수 없고, TestCode 조차 없는 운영중인 Legacy System을 만지고 있다. 게다 이 Legacy System은 UI는 없고 json/rest 기반 통신 서버이며 바로 직접 테스트할 수 없고 A,B,C Agent를 통해서 작업해야만 했다. 


즉, 아래와 같은 시스템이다.  하나의 API를 던지면 multicast 되는 형태의 솔루션이다. 

    A Agent---> 서버 --> B Agent 도착,

                              --> C Agent 도착 



Functional Test를 위해서는 ..

A Agent에 rest/json request를 보내고 그에 대한 응답을 체크하고

B Agent의  rest/json reponse와 C Agent의 rest/json reponse를 받아 정상적인지 체크해야 하는 상항이다. 


UI가 없어 selenium 이라는 툴도 쓰기 어렵다. 그렇다면 대안 SoapUi나 Jmeter가 되는데..

SoapUI는 vendor (http://www.soapui.org/)가 있고, jmeter는 apache 재단것이다.

(사실 난 jmeter 초반 유저라.. 아주 구린 형태만 기억하고 있었다. 그러나 지금은 기능성이나 완성도가 많이 좋아졌다. 현재 최신 버전은 가끔씩 잘 적용이 안되기도 하지만.. )

soapui는 soap을 테스트했던 것으로 테스트를 시작했지만 지금은 rest도 지원하고 있다. 게다가 loadui라는 툴도 제공한다. soap ui는 advanced 기능이 필요한 경우 enterprise 버전을 annual로 내야하는 상황이었다. 아무리 좋아도 그런 툴들의 특징은 쓰다보다가... 자연스럽게 enterprise로 갈 수 밖에 없다. 
soap ui의 스크립트는 groovy인데 반해 jmeter는 bsf, javascript를 지원했다. 



팀원과 토론 끝에 jmeter를 쓰기로 했다.  (팀원은 리눅스, 나는 mac 사용자다.....;;)

DB, Agent들과 서버를 모두 standalone으로 실행하고 스크립트를 실행시켜 자동으로 하게 했다.

jmeter는 성능 툴에서 시작했지만 functional test에도 적당했다. Thread Group 단위를 하나의 테스트 단위로 잡았고 순서를 보장하거나 순서를 보장하지 않는 경우에도 테스트할 수 있었다.

그리고 Assetion및 통과 여부를 지정하여 테스트할 수 있다.  (soapui에 있는 기능이 많이 jmeter안에 있었다.)





속도, 테스트 결과도 볼 수 있다. 



 


결론

jmeter를 이용하면 function test (black box) 툴로 쓸만하게 사용할 것 같다. (계속 작업중)



참고자료



http://blazemeter.com/blog/http-request-defaults


http://stackoverflow.com/questions/11306584/how-to-parse-jmeter-response-and-make-new-request


regular expression extractor

http://jmeter.apache.org/usermanual/component_reference.html#Regular_Expression_Extractor


http://community.blazemeter.com/knowledgebase/articles/64307-using-jmeter-functions-part-ii


http://community.blazemeter.com/knowledgebase/topics/10018-jmeter-tutorials


http://mxiayan.wordpress.com/2013/01/08/user-bsf-postprocessor-to-parse-json-response-and-save-the-properties-as-jmeter-variables/


http://fabiouechi.blogspot.kr/2012/04/jmeter-using-bsf-assertion-to-fail.html


http://stackoverflow.com/questions/14321662/running-multiple-thread-groups-sequentially-in-jmeter


http://jmeter.apache.org/api/index.html


http://stackoverflow.com/questions/5702621/jmeter-if-controller-with-parameters


http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf



Posted by '김용환'
,

 


웹 서비스 어플용 깔끔용 maven 파일.



maven clean compile jetty:run
maven clean compile tomcat:run


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>com.google.controller</groupId>
 <artifactId>restful</artifactId>
 <packaging>war</packaging>
 <version>0.0.1-SNAPSHOT</version>
 
 <properties>
  <spring.version>3.0.5.RELEASE</spring.version>
  <jdk-version>1.6</jdk-version>
 </properties>
 
 <dependencies>
  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-core</artifactId>
   <version>${spring.version}</version>
  </dependency>
  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-web</artifactId>
   <version>${spring.version}</version>
  </dependency>
  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-webmvc</artifactId>
   <version>${spring.version}</version>
  </dependency>
  <dependency>
   <groupId>org.codehaus.jackson</groupId>
   <artifactId>jackson-mapper-asl</artifactId>
   <version>1.7.1</version>
  </dependency>
  <dependency>
   <groupId>org.springframework.ws</groupId>
   <artifactId>spring-oxm</artifactId>
   <version>1.5.10</version>
  </dependency>
  <dependency>
   <groupId>com.sun.xml.bind</groupId>
   <artifactId>jaxb-impl</artifactId>
   <version>2.2.2</version>
  </dependency>
  <dependency>
   <groupId>com.thoughtworks.xstream</groupId>
   <artifactId>xstream</artifactId>
   <version>1.4</version>
  </dependency>
  <dependency>
   <groupId>net.java.dev.rome</groupId>
   <artifactId>rome</artifactId>
   <version>1.0.0</version>
  </dependency>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-oxm</artifactId>
    <version>${spring.version}</version>
  </dependency> 
  <dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>servlet-api</artifactId>
   <version>2.5</version>
   <scope>provided</scope>
  </dependency>
  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>4.8.2</version>
  </dependency>
  
  <!-- standard.jar -->
  <dependency>
   <groupId>taglibs</groupId>
   <artifactId>standard</artifactId>
   <version>1.1.2</version>
  </dependency>
  <!-- JSTL -->
  <dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>jstl</artifactId>
   <version>1.1.2</version>
  </dependency>
 </dependencies>
 <build>
  <finalName>restful-demo</finalName>
  <plugins>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <configuration>
     <encoding>${source-encoding}</encoding>
    </configuration>
   </plugin>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
     <meminitial>256m</meminitial>
     <maxmem>1024m</maxmem>
     <source>${jdk-version}</source>
     <target>${jdk-version}</target>
     <debug>true</debug>
     <optimize>true</optimize>
     <encoding>${source-encoding}</encoding>
     <showDeprecations>true</showDeprecations>
    </configuration>
   </plugin>
   <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <version>1.0</version>
    <configuration>
     <path>/</path>
    </configuration>
   </plugin>
   <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <configuration>
     <scanIntervalSeconds>3</scanIntervalSeconds>
     <contextPath>/</contextPath>
    </configuration>
   </plugin>
  </plugins>
 </build>
</project>
Posted by '김용환'
,

왜냐면. totoisesvn/cvs 때문에 덕을 봐서.. 얘네들은 좀 안심이 된다.


(1)  git 소스 코드 매니지 툴인 msysgit를 설치한다.
http://code.google.com/p/msysgit/ 에 접근한다. 



아래 싸이트에서 다운받으라고 한다.
https://git.wiki.kernel.org/index.php/MSysGit:InstallMSysGit

살펴보니.. 
How to install it
Download the net installer. Run it







오케 Download를 실행한다. 그러면 아래 주소로 발생
http://code.google.com/p/msysgit/downloads/list


exe 파일로 된 설치파일을 설치한다.
Git-1.7.6-preview20110708.exe




(2) tortoisegit 를 설치한다.

아래 주소로 들어가면 운영체제에 맞는 msi 파일을 선택한다.
http://code.google.com/p/tortoisegit/downloads/list

Tortoisegit-1.6.5.0-32bit 버전을 설치해본다.
 



설치를 한다. (잘 모르면 그냥 next하면 된다.)


(3) tortoisesvn처럼 폴더를 하나 생성하고 마우스 오른쪽 버튼을 누른다.
 



Git Create repository here 선택한다.




그러면 repository 하나 생긴 것.



이번에는 git bash를 선택한다.




그러면 cygwin 스크린이 뜬다.



/E/csrc/git (BARE:master)

$ mkdir git-repos


/E/csrc/git (BARE:master)

$ cd git-repos/


/E/csrc/git/git-repos (BARE:master)

$ git clone git://git.denx.de/u-boot.git

Cloning into u-boot...

remote: Counting objects: 146060, done.

remote: Compressing objects: 100% (30302/30302), done.

remote: Total 146060 (delta 118629), reused 141233 (delta 114342)

Receiving objects: 100% (146060/146060), 38.41 MiB | 795 KiB/s, done.

Resolving deltas: 100% (118629/118629), done.

 /E/csrc/git/git-repos (BARE:master)

$ ls -al

total 4

drwxr-xr-x    3 nhn      Administ        0 Jul 19 18:35 .

drwxr-xr-x    7 nhn      Administ     4096 Jul 19 18:34 ..

drwxr-xr-x   20 nhn      Administ     4096 Jul 19 18:36 u-boot




이번엔 Chromium 소스를 다운받아본다.
마우스 오른쪽 버튼을 누르고, Git Bash 선택한다.





아래 git 소스 위치를 확인한다.
http://code.google.com/p/chromium/wiki/UsingGit

git clone http://git.chromium.org/git/chromium.git src

어느 주소에 다운받는지 확인하고 소스를 다운받는다.



UI로는 이렇게 하면 된다. 

git clone을 선택한다.


clipboard 에 복사한 내용이 자동으로 들어간다.



 

 

Posted by '김용환'
,

[maven] type - pom

etc tools 2011. 5. 27. 14:36

여러 개의 모듈로 나누어진 maven jar가 있다고 할 때, 여러 개의 모듈을 일일히 dependency를 거니까 상당히 귀찮아진다. 좀 간편하게 하기 위해서 만들어지는 것이 있다.

하나의 프로젝트만 걸고, 그 pom파일에서 정의된 파일만 받아오게 한다.  

ehcache가 대표적인 케이스이다.

http://repo1.maven.org/maven2/net/sf/ehcache/ehcache/2.4.2/
ehcache-2.4.2.pom 20-Apr-2011 15:13 5645 ehcache-2.4.2.pom.asc 20-Apr-2011 15:13 197 ehcache-2.4.2.pom.asc.md5 20-Apr-2011 15:13 32 ehcache-2.4.2.pom.asc.sha1 20-Apr-2011 15:13 40 ehcache-2.4.2.pom.md5 20-Apr-2011 15:13 32 ehcache-2.4.2.pom.sha1 20-Apr-2011 15:13 40

ehcache-2.4.2.pom 파일의 dependency는 다음과 같다. 여러개의 jar를 포함한다. 
<dependencies>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcache-core.version}</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-terracotta</artifactId>
<version>${ehcache-terracotta.version}</version>
</dependency>
<!--Add concrete implementation to the assembly only-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.6.1</version>
<scope>provided</scope>
</dependency>
<!--
Add sources and javadoc to the assembly. These are not classpath dependencies
-->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcache-core.version}</version>
<classifier>javadoc</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcache-core.version}</version>
<classifier>sources</classifier>
<scope>provided</scope>
</dependency>



http://repo1.maven.org/maven2/net/sf/ehcache/ehcache-core/2.4.2/

Index of /maven2/net/sf/ehcache/ehcache-core/2.4.2/


../
ehcache-core-2.4.2-javadoc.jar                     20-Apr-2011 14:47             3046399
ehcache-core-2.4.2-javadoc.jar.asc                 20-Apr-2011 14:47                 197
ehcache-core-2.4.2-javadoc.jar.asc.md5             20-Apr-2011 14:47                  32
ehcache-core-2.4.2-javadoc.jar.asc.sha1            20-Apr-2011 14:47                  40
ehcache-core-2.4.2-javadoc.jar.md5                 20-Apr-2011 14:47                  32
ehcache-core-2.4.2-javadoc.jar.sha1                20-Apr-2011 14:47                  40
ehcache-core-2.4.2-sources.jar                     20-Apr-2011 14:47              804606
ehcache-core-2.4.2-sources.jar.asc                 20-Apr-2011 14:47                 197
ehcache-core-2.4.2-sources.jar.asc.md5             20-Apr-2011 14:47                  32
ehcache-core-2.4.2-sources.jar.asc.sha1            20-Apr-2011 14:47                  40
ehcache-core-2.4.2-sources.jar.md5                 20-Apr-2011 14:47                  32
ehcache-core-2.4.2-sources.jar.sha1                20-Apr-2011 14:47                  40
ehcache-core-2.4.2.jar                             20-Apr-2011 14:47              989884
ehcache-core-2.4.2.jar.asc                         20-Apr-2011 14:47                 197
ehcache-core-2.4.2.jar.asc.md5                     20-Apr-2011 14:47                  32
ehcache-core-2.4.2.jar.asc.sha1                    20-Apr-2011 14:47                  40
ehcache-core-2.4.2.jar.md5                         20-Apr-2011 14:47                  32
ehcache-core-2.4.2.jar.sha1                        20-Apr-2011 14:47                  40
ehcache-core-2.4.2.pom                             20-Apr-2011 14:47               34428
ehcache-core-2.4.2.pom.asc                         20-Apr-2011 14:47                 197
ehcache-core-2.4.2.pom.asc.md5                     20-Apr-2011 14:47                  32
ehcache-core-2.4.2.pom.asc.sha1                    20-Apr-2011 14:47                  40
ehcache-core-2.4.2.pom.md5                         20-Apr-2011 14:47                  32 
ehcache-core-2.4.2.pom.sha1                        20-Apr-2011 14:47                  40
 

 

아래와 같이 사용하면 pom파일에서 정의된 모든 depdencency를 다운받을 수 있다.
 
<dependency>
<groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <version>2.3.1</version> <type>pom</type> </dependency>

 만약 <type>pom</type>이 없으면, jar없다고 빌드에러가 뜨니. 잘 확인할 것.

=> 개발할 때, 이렇게 모듈처럼 개발하고, parent maven 프로젝트를 만드면 좋을 것 같음. 
Posted by '김용환'
,

grep과 같은 툴이 있다. findstr.exe 파일이다.

netstat -anp | findstr 'TIME'

keytool.exe -list -keystore jssecacerts -storepass changeit | findstr dev-ssl

Posted by '김용환'
,


1)
컴파일을 하고 나면, 실행할 수 있는 jar가 생기는데. 단독으로 쓰기가 어렵기 때문에 classpath를 지정해줘야 하는 이슈가 생긴다.(허드슨 hpi 도 대표적인 케이스라 할 수 있겠다.)
이런 불편함이 존재해서, 관련 lib들을 하나의 jar로 묶을 수 있는 방법이 있다.


 <build>
  <pluginManagement>
   <plugins>
    <plugin>
     <artifactId>maven-assembly-plugin</artifactId>
     <inherited>false</inherited>
     <configuration>
      <descriptorRefs>
       <descriptorRef>jar-with-dependencies</descriptorRef>
      </descriptorRefs>
     </configuration>
    </plugin>
   </plugins>
  </pluginManagement>


....
</build>

전체를 하나의 jar로 만들어보기
#] mvn assembly:assembly

aaa-1.0-jar-with-dependencies.jar 이런 파일이 target 디렉토리 밑에 생겼을 것이다.
zip 프로그램으로 보면, maven lib가 다 들어가 있음을 확인할 수 있다.


2)

사실 이런 방법보다는 아래와 같이 project 설정을 하고, target 디렉토리와 소스 repository와 같은 파일들을 모아줄 수 있게 한다.

 <build>
  <pluginManagement>
   <plugins>
    <plugin>
     <artifactId>maven-assembly-plugin</artifactId>
     <inherited>false</inherited>
     <configuration>
      <descriptorRefs>
       <descriptorRef>project</descriptorRef>
      </descriptorRefs>
     </configuration>
    </plugin>
   </plugins>
  </pluginManagement>


....
</build>
#] mvn assembly:assembly -DdescriptorId=jar-with-dependencies
똑같은 효과를 누릴 수 있다.



3)

jar -jar 파일명.jar 하면 바로 실행할 수 있게 하려면, archive를 넣어주면 된다.

 <build>
  <pluginManagement>
   <plugins>
    <plugin>
     <artifactId>maven-assembly-plugin</artifactId>
     <inherited>false</inherited>
     <configuration>
      <descriptorRefs>
       <descriptorRef>jar-with-dependencies</descriptorRef>
      </descriptorRefs>
     </configuration>
             <archive>
              <manifest>
                <mainClass>org.Test</mainClass>
              </manifest>
            </archive>

    </plugin>
   </plugins>
  </pluginManagement>


....
</build>




4)
descriptorRef 설정의 종류는 여러가지가 있다.
- bin
- src
- project
- jar-with-dependencies
Posted by '김용환'
,