updateExecutionDefinitions インターフェイスは、XML ファイルから実行計画を更新するために使用します。すべての呼び出しの HTTP の応答には、変更された実行計画の XML 構造が含まれます。新しいコードの識別子は、更新された XML 実行計画の構造から取得できます。
次の表は、updateExecutionDefinitions インターフェイスのパラメータを表しています。
| インターフェイス URL | パラメータ | 説明 |
|---|---|---|
|
http://<front-end URL>/servicesExchange?hid=updateExecutionDefinitions |
sid | ユーザー認証用の Web サービス トークンまたはセッション識別子。Web サービス トークンは、Silk Central UI の 設定ページ から生成できます。このページにアクセスするには、Silk Central メニューに表示されているユーザー名にマウス カーソルを移動し、ユーザー設定 を選択します。セッション識別子は、利用可能な Web サービス のうちの logonUser メソッドを呼び出すことで取得できます。 |
例:http://<front-end URL>/servicesExchange?hid=updateExecutionDefinitions&sid=<webServiceToken>
実行を検証するために使用される XML スキーマ定義ファイルは、フロントエンド サーバー URL http://<フロントエンド URL>/silkroot/xsl/executionplan.xsd を使用してダウンロードするか、フロントエンド サーバーのインストール フォルダ <Silk Central インストール フォルダ>/wwwroot/silkroot/xsl/executionplan.xsd からコピーできます。
以下のコードでは、Apache HttpClient を使用して、実行計画が更新されます。
import org.apache.commons.httpclient.*; // Apache HttpClient
String webServiceToken = "e39a0b5b-45db-42db-84b2-b85028d954d5";
string xml = loadExecutionPlanUtf8(DEMO_EXECUTION_PLAN_XML);
HttpClient client = new HttpClient();
URL webServiceUrl = new URL("http", mWebServiceHelper.getHost(),
mWebServiceHelper.getPort(),
String.format("/servicesExchange?hid=%s&sid=%s",
"updateExecutionDefinitions",
webServiceToken));
StringPart ExecutionPlanXml = new StringPart(DEMO_EXECUTION_PLAN_XML, xml,
"UTF-8");
ExecutionPlanXml.setContentType("text/xml");
Part[] parts = {ExecutionPlanXml};
PostMethod filePost = new PostMethod(webServiceUrl.toExternalForm());
filePost.setRequestEntity(new MultipartRequestEntity(parts,
filePost.getParams()));
client.getHttpConnectionManager().getParams().setConnectionTimeout(60000);
int status = client.executeMethod(filePost);
System.out.println(filePost.getStatusLine());
String responseXml = filePost.getResponseBodyAsString();
リクエスト毎に 1 つの添付ファイルのみアップロードすることができます。Apache HttpComponents をダウンロードするには、http://hc.apache.org/downloads.cgi を参照してください。必要なライブラリについては、コンポーネントのドキュメントを参照してください。
次のコードは、createExecutionDefinitions サービス、および updateExecutionDefinitions サービスを使用して Silk Central へアップロードすることができる実行計画の例を示しています。この例では、実行計画の 1 つにカスタム スケジュールを作成し、テストを実行計画に割り当てます (共に、手動割り当てとフィルタを使用)。この例では、構成を含んだ構成スイートも作成されます。
<?xml version="1.0" encoding="UTF-8"?>
<ExecutionPlan xmlns="http://www.borland.com/ExecPlanSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://<front-end URL>/silkroot/xsl/executionplan.xsd">
<Folder name="Folder1">
<Description>Description of the folder</Description>
<ExecDef name="ExecutionDefinition1" TestContainerId="1">
<Description>Description1</Description>
<CustomSchedule>
<start>2009-11-26T21:32:52</start>
<end>
<forever>true</forever>
</end>
<Interval day="1" hour="2" minute="3"></Interval>
<adjustDaylightSaving>false</adjustDaylightSaving>
<exclusions>
<days>Monday</days>
<days>Wednesday</days>
<from>21:32:52</from>
<to>22:32:52</to>
</exclusions>
<definiteRun>2009-11-27T21:35:12</definiteRun>
</CustomSchedule>
<ReadFromBuildInfoFile>true</ReadFromBuildInfoFile>
<Priority>High</Priority>
<SetupTestDefinition>73</SetupTestDefinition>
<CleanupTestDefinition>65</CleanupTestDefinition>
<AssignedTestDefinitions>
<ManualAssignment useTestPlanOrder="true">
<TestId>6</TestId>
<TestId>5</TestId>
</ManualAssignment>
</AssignedTestDefinitions>
</ExecDef>
<ExecDef name="ExecutionDefinition2" TestContainerId="1">
<Description>Description2</Description>
<Build>1</Build>
<Version>1</Version>
<Priority>Low</Priority>
<SourceControlLabel>Label1</SourceControlLabel>
<DependentExecDef id="65">
<Condition>Passed</Condition>
<Deployment>
<Specific>
<Execution type="Server" id="1"/>
<Execution type="Tester" id="0"/>
</Specific>
</Deployment>
</DependentExecDef>
<DependentExecDef id="70">
<Condition>Failed</Condition>
<Deployment>
<Specific>
<Execution type="Tester" id="0"/>
</Specific>
</Deployment>
</DependentExecDef>
<DependentExecDef id="68">
<Condition>Any</Condition>
<Deployment>
<UseFromCurrentExedDef>true</UseFromCurrentExedDef>
</Deployment>
</DependentExecDef>
</ExecDef>
<ConfigSuite name="ConfigSuite1" TestContainerId="1">
<Description>ConfigSuite1 desc</Description>
<CustomSchedule>
<start>2009-11-26T21:32:52</start>
<end>
<times>1</times>
</end>
<Interval day="1" hour="2" minute="3"/>
<adjustDaylightSaving>false</adjustDaylightSaving>
<exclusions>
<days>Monday</days>
<days>Wednesday</days>
<from>21:32:52</from>
<to>22:32:52</to>
</exclusions>
<definiteRun>2009-11-27T21:35:12</definiteRun>
</CustomSchedule>
<ConfigExecDef name="Config1">
<Description>Config1 desc</Description>
<Priority>Medium</Priority>
</ConfigExecDef>
<ConfigExecDef name="Config2">
<Priority>Medium</Priority>
<DependentExecDef id="69">
<Condition>Any</Condition>
<Deployment>
<UseFromCurrentExedDef>true</UseFromCurrentExedDef>
</Deployment>
</DependentExecDef>
</ConfigExecDef>
<Build>8</Build>
<Version>2</Version>
<SourceControlLabel>ConfigSuite1 label</SourceControlLabel>
<SetupTestDefinition>73</SetupTestDefinition>
<CleanupTestDefinition>65</CleanupTestDefinition>
<AssignedTestDefinitions>
<ManualAssignment useTestPlanOrder="true">
<TestId>6</TestId>
<TestId>5</TestId>
</ManualAssignment>
</AssignedTestDefinitions>
</ConfigSuite>
</Folder>
</ExecutionPlan>