|
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 |
 |
This tutorial is written for Cactus 1.2 only. It will need
to adapted if you're using Cactus 1.3
|
 |
本チュートリアルは、Cactus 1.2 に限定して書かれています。
Cactus 1.3 を使用している場合は、それに適応させる必要があります。
|
This tutorial explains how to run Cactus tests within VisualAge for
Java WebSphere Test Environment.
本チュートリアルでは、VisualAge for Java WebSphere Test Environment で
Cactus テストを実行する方法について説明します。
We have received reports that the following tutorial works with
VAJava 3.5.2 and 3.5.3. Please tell us if you find that it works with
other versions.
次に示すチュートリアルは、VAJava 3.5.2 および 3.5.3 での動作が報告されています。
他のバージョンで動作が確認された場合、教えてください。
|
| ステップ 1 : VAJava への正しいパッケージのインポート/Step 1 : Import the correct packages in VAJava |
Let's assume the following conventions :
{Cactus dir} is the directory where you
have unzipped the Cactus distribution or sources and
{VAJava dir} is the directory where
VAJava is installed. Let's also define {WTE dir}
to be the WebSphere Test Environment directories, i.e.
{VAJava dir}/ide/project_resources/IBM WebSphere Test
Environment.
次の取り決めをしましょう :
{Cactus dir} は、
Cactus ディストリビューションやソースを解凍したディレクトリで、
{VAJava dir} は、
VAJava がインスト−ルされたディレクトリとします。
また、
{WTE dir}
WebSphere Test Environment ディレクトリ、
即ち、
{VAJava dir}/ide/project_resources/IBM WebSphere Test
Environment としましょう。
You need to create 3 projects : one for JUnit, one for Cactus (
let's call it "Cactus") and
optionally one for Log4j. Note that the Log4j one is useful only if
wish to get some Cactus runtime logs. If you don't import the Log4j
classes, some Cactus classes will appear with a red cross in VAJava
but you can safely ignore them as they won't be executed.
3 つのプロジェクトを作る必要があります :
一つは JUnit のため、
一つは Cactus のため(これを "Cactus" と呼ぶことにします)、
オプションとして、もう一つは Log4j のためにです。
Log4j プロジェクトは、
Cactus 実行時のログを取得したい場合にのみ便利です。
Log4j クラスをインポートしない場合、
VAJava において、幾つかの Cactus のクラスに赤いばつ印が現れるかもしれませんが、それらは実行されないので無視してしまっても問題ありません。
 |
You can either import the source files or the compiled classes as you
wish. If you import the source file, you should import the following
directories : {Cactus dir}/src/framework/servlet22 and
{Cactus dir}/src/framework/share. You also need to
copy the following files into
{VAJava dir}/ide/project_resources/Cactus :
log_client.properties and
log_server.properties which are located in
{Cactus dir}/sample/conf/test. If you have imported from
the Cactus jar file, and you have selected to import resources files
then they have been automatically imported for you.
|
 |
ソースファイルでも、コンパイルされたクラスでも、
好きなほうをインポートすることができます。
ソースファイルをインポートした場合、
{Cactus dir}/src/framework/servlet22 および
{Cactus dir}/src/framework/share
のディレクトリをインポートしなければなりません。
また、次の
{Cactus dir}/sample/conf/test にある
log_client.properties および
log_server.properties のファイルを
{VAJava dir}/ide/project_resources/Cactus
にコピーしなければなりません。
Cactus jar ファイルからインポートし、
リソースファイルをインポートするために選択した場合、
自動的にインポートがなされます。
|
|
| ステップ 2 : cactus.properties ファイルの設定/Step 2 : Set up the cactus.properties file |
Copy your cactus.properties file (see the
Configuration Howto
tutorial for details on cactus.properties) to
{VAJava dir}/ide/project_resources/Cactus.
自分の cactus.properties ファイルを
{VAJava dir}/ide/project_resources/Cactus へコピーします。
(cactus.properties について詳しくは
設定 Howto
チュートリアルをご覧ください。)
 |
As WebSphere does not support the jsp-file tag in
web.xml, we cannot map the redirector JSP to a name, so
instead of writing
"cactus.jspRedirectorURL =
http://localhost:8080/test/JspRedirector" in
cactus.properties, you should simply
put the JSP file name, as in
"cactus.jspRedirectorURL =
http://localhost:8080/test/jspRedirector.jsp". This is only needed
if you have test cases that extend JspTestCase.
|
 |
WebSphere では、web.xml において
jsp-file タグをサポートしないので、
JSP リダイレクタから名前へマップできません。
そこで、
cactus.properties ファイルで
"cactus.jspRedirectorURL =
http://localhost:8080/test/JspRedirector" と書く代わりに、
単に
"cactus.jspRedirectorURL =
http://localhost:8080/test/jspRedirector.jsp"
のように JSP ファイル名を設定しなければなりません。
JspTestCase を拡張したテストケースがあるとき、
しなければならないのはこれだけです。
|
|
| ステップ 3 : WebSphere Test Environment の変更/Step 3 : Modify WebSphere Test Environment |
| default.servlet_engine の編集/Edit default.servlet_engine |
Edit {WTE dir}/properties/default.servlet_engine and
add the following under the default_app webgroup :
{WTE dir}/properties/default.servlet_engine を編集し、
default_app webgroup の下に次を加えます :
<websphere-webgroup name="test">
<description>Cactus Testing Web Application</description>
<document-root>$approot$/web</document-root>
<classpath>$approot$/servlets</classpath>
<root-uri>/test</root-uri>
<auto-reload enabled="true" polling-interval="3000"/>
<shared-context>false</shared-context>
</websphere-webgroup>
|
 |
The init-parameter is only needed if you wish to run
sample application provided in the Cactus distribution. Also, in
order to run this sample application you'll need to copy the
{Cactus dir}/sample/web/test/test.jsp file to
{WTE dir}/hosts/default_host/test/web/test as it is
used by a test case.
|
 |
Cactus ディストリビューションで提供されるサンプルアプリケーションを実行したい場合にのみ、
init-parameter が必要です。
また、サンプルアプリケーションを実行するには、
テストケースで使用するため、
{Cactus dir}/sample/web/test/test.jsp ファイルを
{WTE dir}/hosts/default_host/test/web/test
へコピーする必要があります。
|
|
| test ディレクトリの作成/Create a test directory |
Create a directory called test under
{WTE dir}/hosts/default_host. Under test
create another 2 subdirectories : servlets and
web.
test という名前のディレクトリを
{WTE dir}/hosts/default_host
ディレクトリの下に作成します。
さらに、test の下に、
servlets と web の 2
つのサブディレクトリを作成します。
|
| test.webapp ファイルの作成/Create a test.webapp file |
Create a test.webapp file in
{WTE dir}/host/default_app/servlets and put the following
content :
test.webapp ファイルを
{WTE dir}/host/default_app/servlets に作成し、
次の内容を設定します :
<?xml version="1.0"?>
<webapp>
<name>test</name>
<description>Cactus testing web application</description>
<error-page>/ErrorReporter</error-page>
<servlet>
<name>ServletRedirector</name>
<description>Cactus Testing ServletRedirector</description>
<code>org.apache.cactus.server.ServletTestRedirector</code>
<servlet-path>/ServletRedirector</servlet-path>
<autostart>false</autostart>
<init-parameter>
<name>param1</name>
<value>value1 used for testing</value>
</init-parameter>
</servlet>
<!-- Note: We don't provide a mapping for the JSP Redirector because
WebSphere does not support the jsp-file tag of the Servlet 2.2
specification -->
<!-- メモ: WebSphere では Servlet 2.2 仕様の jsp-file タグを
サポートしていないので、JSP リダイレクタのマッピングを提供しません -->
<servlet>
<name>ErrorReporter</name>
<description>Default error reporter servlet</description>
<code>com.ibm.servlet.engine.webapp.DefaultErrorReporter</code>
<servlet-path>/ErrorReporter</servlet-path>
<autostart>true</autostart>
</servlet>
<servlet>
<name>jsp</name>
<description>JSP support servlet</description>
<!--
WARNING:
If you use the JSP 1.0 compiler, use the following
<code>com.ibm.ivj.jsp.runtime.JspDebugServlet</code>
If you use the JSP 1.1 compiler (VAJava 3.5.3 only), use the following
<code>com.ibm.ivj.jsp.jasper.runtime.JspDebugServlet</code>
-->
<!--
警告:
JSP 1.0 コンパイラを使う場合、
<code>com.ibm.ivj.jsp.runtime.JspDebugServlet</code> を使います。
JSP 1.1 コンパイラ(VAJava 3.5.3 のみ) を使う場合、
<code>com.ibm.ivj.jsp.jasper.runtime.JspDebugServlet</code> を使います
-->
<code>com.ibm.ivj.jsp.jasper.runtime.JspDebugServlet</code>
<init-parameter>
<name>workingDir</name>
<value>$server_root$/temp/default_app</value>
</init-parameter>
<init-parameter>
<name>jspemEnabled</name>
<value>true</value>
</init-parameter>
<init-parameter>
<name>scratchdir</name>
<value>$server_root$/temp/JSP1_1/default_app</value>
</init-parameter>
<init-parameter>
<name>keepgenerated</name>
<value>true</value>
</init-parameter>
<autostart>true</autostart>
<servlet-path>*.jsp</servlet-path>
</servlet>
<servlet>
<name>file</name>
<description>File serving servlet</description>
<code>com.ibm.servlet.engine.webapp.SimpleFileServlet</code>
<servlet-path>/</servlet-path>
<init-parameter>
<name></name>
<value></value>
</init-parameter>
<autostart>true</autostart>
</servlet>
</webapp>
|
|
| Cactus リダイレクタファイルのコピー/Copy the Cactus JSP Redirector file |
Copy the {Cactus dir}/sample/web/test/jspRedirector.jsp
file to {WTE dir}/hosts/default_host/test/web.
{Cactus dir}/sample/web/test/jspRedirector.jsp
ファイルを
{WTE dir}/hosts/default_host/test/web
へコピーします。
|
|
| ステップ 4 : VAJava workspace classpath の編集/Step 4 : Edit VAJava workspace classpath |
Add the following to the VAJava workspace classpath (select menu
"Window... | Resources" under VAJava) :
次のものを VAJava workspace classpath に加えます
(VAJava で "Window... | Resources" メニューを選びます) :
{VAJava dir}\ide\project_resources\JUnit\;
{VAJava dir}\ide\project_resources\Cactus\;
{VAJava dir}\ide\project_resources\Log4j\;
{VAJava dir}\ide\project_resources\Servlet API Classes\;
|
|
| ステップ 5 : VAJava workspace classpath の編集/Step 5 : Edit VAJava workspace classpath |
In the WebSphere Test Environment under Servlet Engine, add Cactus,
JUnit, Log4j, and the project that contained the tests to the
classpath.
サーブレットエンジン上の WebSphere Test Environment において、
クラスパスに Cactus、JUnit、Log4j およびテストを含むプロジェクトを加えます。
|
| 最後のノート/Final note |
 |
With this configuration, you'll find cactus_client.log
under {VAJava dir}/ide/project_resources/{project being
tested} and cactus_server.log under
{VAJava dir}/ide/tools/com-ibm-ivj-ui-webcontrolcenter
when you run your tests.
|
 |
この設定により、
テストを行った場合に、
{VAJava dir}/ide/project_resources/{project being
tested} ディレクトリの下に
cactus_client.log ファイルが、そして、
{VAJava dir}/ide/tools/com-ibm-ivj-ui-webcontrolcenter
ディレクトリの下に
cactus_server.log ファイルができます。
|
|
|
|