Extending JMeter

JMeterを拡張する

Note to developers: JMeter is undergoing large changes. The following description of JMeter's architecture will likely change in the near future. If you would like your changes to work with an upcoming JMeter 1.6, please join our mailing list, and we will work with you and your modifications. 開発者に注意:JMeterは大きく変化しつつあります。 以下に書くJMeterのアーキテクチャーは近いうちに変わります。 もし変更した部分を次のJMeter 1.6で動かしたいのであれば、メーリングリストに加わり、 メンバーが変更点を動かします。

Customizing JMeter to suit your needs.

要求に合わせてJMeterをカスタマイズする

 

Extensible Interfaces

There are five basic objects in JMeter which provide extensibility:

拡張可能なインターフェイス

拡張することができるJMeterの基本オブジェクトは5つあります:

Visualizers

The Visualizer interface exists in the org.apache.jmeter.visualizers package. JMeter maintains an instance of each visualizer it is aware of for each thread group currently available to the user. A visualizer provides a method of recording the data which JMeter generates. A visualizer may represent the data graphically (GraphVisualizer), persistently (FileVisualizer) or both (TBD). The visualizer contains three methods:

ビジュアライザー

ビジュアライザーインターフェイスはorg.apache.jmeter.visualizersパッケージにあります。 JMeterはユーザーが現在手に入れられる各スレッドグループ用に、各ビジュアライザーのインスタンスを持っています。 JMeterが作るデータを記録するメソッドを提供しています。 また、グラフ化したり(GraphVisualizer)、保存したり(FileVisualizer)、またはその両方で(TBD)データを表示します。 ビジュアライザーには3つのメソッドがあります:
add(SampleResult result) adds data to the visualization.
JMeter calls the add method to include new data in the visualizer. The visualizer should add the data into its data representation.
add(SampleResult result)はビジュアライザーにデータを追加します。
JMeterはaddメソッドを呼び、ビジュアライザーに新しいデータを含めます。 ビジュアライザーはデータをデータ表示部分に追加します。
clear() clears all data in the visualizer currently
JMeter calls clear when the user requests that all visualizers be cleared. When the clear method is called the visualizer should clear all data from its representation and re-initialize itself.
clear()は現在ビジュアライザーにあるすべてのデータを消去します。
ユーザーがすべてのビジュアライザーをくりあしたいという要求を出した時に、JMeterはclearを呼びます。 clearメソッドが呼ばれると、ビジュアライザーは表示部分からすべてのデータを削除し、 再度初期化を行います。
getControlPanel() obtains the GUI for the visualizer
JMeter calls getControlPanel at start up time to prepare the visualizer for display.
getControlPanel()はビジュアライザー用のGUIを取得します。
JMeterはビジュアライザーに表示の準備を行わせるため、起動時にgetControlPanelを呼びます。

Timers

Timers provide a framework for delaying in between samples. This is important in order to obtain a true balanced load on a function rather than a calm-STORM-calm-STORM-calm... pattern. Timers contain two methods:

タイマー

タイマーはサンプル間の間隔を設定するためのフレームワークです。 静か-激しい-静か-激しい-静か...というパターンよりも本当にバランスの取れた負荷を機能に対して掛けるには、 重要です。タイマーは2つのメソッドを持ちます:
delay() wait for a Timer specific amount of time
JMeter calls this function prior to every sample. The Timer should wait for a period of time and then return.
delay()は、タイマーが定めた時間だけ待ちます。
JMeterは各サンプルに先んじてこの機能を呼びます。タイマーは一定時間待ってから返します。
set() prepare for sampling
JMeter calls this function prior to the begining of a test session. The timer should initialize itself, read any values from its UI and prepare for operation.
set()は、サンプリングの準備をします。
JMeterはテストセッションを開始する前にこの機能を呼びます。タイマーは自らを初期化し、 UIから値を読みとって処理の準備をします。

SamplerControllers

The sampler controller is by far the most complicated, but also the most powerful, interface in JMeter. It allows a user to customize what, where and when JMeter tests. It provides six methods:

サンプラーコントローラー

サンプラーコントローラーは、JMeterの中でもっとも複雑ですが、もっとも強力なインターフェイスです。 JMeterが何をどこでいつテストするかをカスタマイズします。6つのメソッドを提供します:
start()
JMeter calls this immediatly prior to starting a test. It is most often use to disable the SamplerController's GUI.
start()
JMeterはテストを始める前にすぐこのメソッドを呼びます。ほとんどの場合、 サンプラーコントローラーのGUIを使用不可にするために使われます。
stop()
JMeter calls this when a user requests a stop to a test. It is most often used to re-enable the SamplerController's GUI.
stop()
ユーザーがテストに停止要求をすると、JMeterはこのメソッドを呼びます。ほとんどの場合、 サンプラーコントローラーのGUIを有効にするのに使われます。
getControlPanel() Get the GUI for the SamplerController
JMeter calls this at start up to create the its GUI. This is how a user enters information into the SamplerController.
getControlPanel()は、サンプラーコントローラー用にGUIを入手します。
JMeterはGUIを作るため、起動時にこのメソッドを呼びます。 このようにしてユーザーはサンプラーコントローラーに情報を入力します。
getName() Get the SamplerController's display name.
JMeter uses this name in the list of SamplerControllers that it displays.
getName()は、サンプラーコントローラーの表示名を入手します。
JMeterは表示するサンプラーコントローラーのリストにこの名前を使います。
getDefaultThreadGroups()
Gets the default list of threadgroups.
getDefaultThreadGroups()
スレッドグループのデフォルトリストを入手します。
getSampleThreads(String threadGroup,int numThreads)
When the user hits start, use this method to get all the JMeterThread objects you want for a threadgroup. Each JMeterThread object implements Runnable and it is used to sample the test entries.
getSampleThreads(String threadGroup,int numThreads)
ユーザーがスタートを押すと、このメソッドを使ってスレッドグループ用に欲しいJMeterスレッドオブジェクトを すべて入手します。各JMeterスレッドオブジェクトはRunnableを実装し、テスト項目のサンプルを取るのに使われます。

Samplers

Samplers are simple - they are the objects that know the protocol of that which you wish to sample. The HTTPSampler knows how to request a URL from a web server, for instance.

サンプラー

サンプラーは単純です - サンプルを取りたいもののプロトコルを知ってるオブジェクトです。 例えば、HTTPSamplerはウェブサーバーからURLを要求する方法を知っています。

The interface for Sampler is as follows: サンプラーのインターフェイスは以下のとおりです:

public SampleResult sample(Entry e)
JMeterThread implementations will loop through all the test samples given to them, and call the sample method on the Sampler (also given to them) for each test entry. SampleResult is essentially a Map containing information about the sampling (timing data is included, as well as the test response from the url).
public SampleResult sample(Entry e)
JMeterThreadの実装は、与えられたテストサンプルが終わるまでループし、 (一緒に与えられている)各テスト項目用のサンプラーのサンプルメソッドを呼びます。 サンプル結果は、基本的にサンプリングに関する情報を集めたMapです (タイミングデータやURLからのレスポンスが含まれます)。

TestSample

TestSamples are objects that collect information from users about each test sample the user wants to test. The TestSample object is also responsible for serving up its test entries. The interface:

テストサンプル

テストサンプルは、テストしたい各テストサンプルについて、 ユーザーから情報を収集するオブジェクトです。 テストサンプルオブジェクトは、テスト項目を提供する役割も持ちます。 インターフェイスは以下の通り:
public java.awt.Container getGUI()
Returns the GUI used to collect information from the user.
public java.awt.Container getGUI()
ユーザーから情報を収集するのに使うGUIを返します。
public Entry[] getEntries()
Gets a list of entries to be sampled from the TestSample object
public Entry[] getEntries()
テストサンプルオブジェクトからサンプルを取る項目のリストを入手します。
public String[] getThreadGroups()
Get all the thread groups the user selected for this TestSample
public String[] getThreadGroups()
このテストサンプルのためにユーザーが選択したスレッドグループをすべて入手します。
public void setThreadGroups(String[] threadGroups)
Set the thread groups the user may choose from
public void setThreadGroups(String[] threadGroups)
ユーザーが選択するスレッドグループを設定します。
public String getName()
Get a name for this TestSample
public String getName()
このテストサンプルの名前を入手します。
public void setName(String name)
Set the name for this TestSample
public void setName(String name)
このテストサンプルの名前を設定します。
public void reset()
inform the test sample that a sampling run is starting
public void reset()
テストサンプルに、サンプルが始まっていることを知らせます。

Copyright (c) 1999 The Java Apache Project.
$Id: extending.html,v 1.1.1.1 2003/04/14 11:47:02 ami Exp $
All rights reserved.