JBuilder 4 との統合/JBuilder 4 Integration

Last update : July 6 2002
Doc for : v1.3

Cactusについて
  • Cactus とは
  • ニュース
  • 変更履歴
  • 特徴/開発状況
  • 目標
  • ロードマップ/ToDo
  • 協力者
  • 協力者募集
  • Cactus ユーザ
  • テスト済環境 ...
  • ライセンス


  • ダウンロード
  • ダウンロード


  • ドキュメント
  • Cactus の仕組み
  • さぁ始めよう
  • モック対コンテナ
  • Javadocs
  • └Javadocs
  • よくある質問


  • Howto ガイド
  • クラスパス Howto
  • 設定 Howto
  • アップグレードHowto
  • テストケース Howto
  • セキュリティHowto
  • Ant Howto
  • HttpUnit Howto
  • サンプル Howto
  • EJB Howto
  • IDE Howto
  • JUnitEE Howto


  • サポート
  • Bug DB
  • メーリングリスト


  • その他
  • 名前の由来
  • ロゴコンテスト
  • 参考文献
  • アクセス状況
  • └WebAlizer


  • 開発者向け
  • CVS
  • コード規約
  • ビルドの結果


  • 序文および必要条件/Forewords and Requirements

    First of all, you need to download the Cactus distribution

    まず最初に、Cactus ディストリビューションをダウンロードする必要があります


    ステップ 1 : JBuilder ライブラリの生成/Step 1 : Create JBuilder libraries

    Let's assume the following conventions : {Cactus dir} is the directory where you have unzipped the Cactus distribution or sources. Let's also assume {Tomcat dir} to be the Tomcat directory.

    次の取り決めをしましょう : {Cactus dir} は、 Cactus ディストリビューションを解凍したディレクトリです。 また、{Tomcat dir} を、 Tomcat のディレクトリとします。

    jbuilder libraries

    JUnit ライブラリの作成/Create the JUnit library

    Create a JUnit library and include junit.jar.

    JUnit ライブラリを作成し、junit.jarをインクルードします。


    Cactus ライブラリの作成/Create the Cactus library

    Create a Cactus library containing cactus.jar and aspectjrt.jar (you can actually create a separate library for AspectJ if you wish).

    cactus.jar および aspectjrt.jar の入っている Cactus ライブラリを作成します。 (お望みなら、実際に AspectJ の別のライブラリを作ることもできます)

    Note You can also add the source file directories in the source tab. This way, you will be able to debug inside cactus sources.

    Note ソースタブにソースファイルディレクトリを加えることもできます。 この方法により、Cactus のソースの中身をデバッグすることができます。


    Tomcat ライブラリの作成/Create the tomcat library

    Create another library named tomcat and add all the jar files from {Tomcat dir}/lib.

    tomcat という名前の別のライブラリを作成し、 {Tomcat dir}/lib の全ての jar ファイルを加えます。

    Note If you use JBuilder 4 Enterprise or JBuilder 4 Professionnal, you don't need to create this library because Tomcat 3.1 is provided with those versions.

    Note JBuilder 4 Enterprise あるいは、JBuilder 4 Professionnal を使っている場合、それらのバージョンに Tomcat 3.1 はついているので、 このライブラリを作成する必要はありません。



    ステップ 2 : cactus.properties ファイルの設定/Step 2 : Set up the cactus.properties file

    Edit a new file named cactus.properties (see the Configuration Howto tutorial for more details on cactus.properties).

    cactus.properties という名前の新しいファイルを編集します。 (cactus.properties の詳しい説明は、 Configuration Howto チュートリアルをご覧ください。)

    Copy your cactus.properties file to a directory present in your classpath. You can copy it to a directory and add this directory in the class tab of the cactus library.

    自分の cactus.properties ファイルを自分のクラスパスにある任意のディレクトリにコピーします。 任意のディレクトリにコピーして、 そのディレクトリを Cactus ライブラリのクラスタブに加えることもできます。


    ステップ 3 : Tomcat 環境の設定/Step 3 : Configure Tomcat Environment

    cactus webapp の作成/Create a cactus webapp

    Create and edit the file {Tomcat dir}/webapps/cactus/WEB-INF/web.xml. Here is an example for Servlet API 2.2 :

    {Tomcat dir}/webapps/cactus/WEB-INF/web.xml ファイルを作成して編集します。 ここで、Servlet API 2.2 の例を示します :

    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
        "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    
    <web-app>
        <servlet>
            <servlet-name>ServletRedirector</servlet-name>
            <servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>ServletRedirector</servlet-name>
            <url-pattern>/ServletRedirector</url-pattern>
        </servlet-mapping>
    </web-app>
    

    Note You can edit {Tomcat dir}/conf/web.xml instead if you prefer.
    You can also edit the web.xml file of the webapp where is located the servlet(s) you want to test.
    Don't forget to modify cactus.properties file accordingly.

    Note そのほうがよければ、 {Tomcat dir}/conf/web.xml の方を代わりに編集することもできます。
    また、テストしたいサーブレットが置かれた webapp ディレクトリの web.xml を編集することも可能です。
    それに合わせて、cactus.properties ファイルを変更することを忘れないでください。


    ステップ 4 : 自分のプロジェクトの設定/Step 4 : Configure your project

    1. Put -classic -Dtomcat.home="{Tomcat dir}" as the VM parameters for your project and org.apache.tomcat.startup.Tomcat as the main class.
    2. プロジェクトの VM のパラメータとして、 -classic -Dtomcat.home="{Tomcat dir}" を、 メインクラスとして、 org.apache.tomcat.startup.Tomcat を設定します。
    3. Add the following libraries in the Required Libraries tab in the project properties :
      プロジェクトプロパティの Required Libraries タブに次のライブラリを加えます :
      • tomcat
      • servlet
      • junit
      • cactus

      jbuilder libraries


    ステップ 5 : サーブレットのテストとデバッグ/Step 5 : Test and debug your servlet

    サーブレットのテスト/Test your servlet

    1. Start Tomcat using the Run/Run Project menu.
    2. Run/Run Project メニューにより Tomcat を起動します
    3. Run your unit tests : right Click on the file containing your test case and click on run
    4. 単体テストを実行します : 自分のテストケースが含まれているファイルをクリックし、run をクリックします。

    自分のサーブレットとテストのデバッグ/Debug your servlet and your tests

    You can easily print the results of the methods on the server-side itself.

    サーバー側自身のメソッドの結果は簡単に出力できます。

    You can also start Tomcat in debug mode (Run/debug project). This way, you can stop at breakpoints on methods that are executed on the server side (void testXXX() for example)

    Tomcat をデバッグモードで起動することもできます。 (Run/debug project) この方法により、 サーバー側で実行されるメソッドをブレークポイントで停止させることもできます。 (例えば、void testXXX() など)

    If you right click on the file containing your test case and click on debug, you can stop at breakpoints on methods that are executed on the client side like void endXXX(WebResponse) or void beginXXX(WebRequest)

    自分のテストケースが入っているファイルを右クリックし、 debug をクリックした場合、 void endXXX(WebResponse) や、 void beginXXX(WebRequest) のようにクライアント側で実行されたメソッドにおいて、ブレークポイントで停止させることができます。





    Copyright © 2000-2002 The Apache Software Foundation. All Rights Reserved.