© 2021 CData Software Japan, LLC | www.cdata.com/jp
内部のインターフェーステストの一例
JDBCとAPIリクエスト検証ファイルの組み合わせ
@Test
public void SampleTest() throws Exception {
Class.forName("cdata.jdbc.kintone.KintoneDriver");
String testFile = "requestCheckFile.txt";
Connection conn = DriverManager.getConnection(
"jdbc:kintone:User=myuseraccount;Password=mypassword;Url=http:
//subdomain.domain.com;" + testFile
);
Statement stat = conn.createStatement();
boolean ret = stat.execute(
"SELECT RecordId,Revision FROM [顧客管理(営業支援パック)] "
);
int row = 0;
if (ret) {
ResultSet rs = pstmt.getResultSet();
while (rs.next()) {
if (row == 0) {
assertEquals("3", resultSet.getString("RecordId"));
assertEquals("10", resultSet.getString("Revision"));
}
}
row++;
}
assertEquals(10, row);
}
RequestLines=3,11 | ValidateRequest=JSON | ResponseLines=16,16 |
NextData=18 | ValidateUrl=https://XXXX.kintone.com/k/v1/apps.json |
RequestHeaders=3,11
Host: XXXX.kintone.com
Authorization: Basic XXXXXXXXX==
Accept: application/json
Accept-Encoding: gzip, deflate
User-Agent: CData Data Provider Engine - www.cdata.com - Accepts: gzip
Content-Type: application/json
Content-Length: 13
X-Cybozu-Authorization: XXXXXXXXXX==
X-HTTP-Method-Override: GET
{"limit":100}
{"apps":[{"appId":"3","code":"","name":“TimeCard","description":"
勤
務時間を記録するアプリです。
","createdAt":"2016-10-
26T10:12:04.000Z","creator":{"code":"Administrator","name":"Administrato
r"},"modifiedAt":"2017-01-29T10:50:44.000Z","modifier":{"code
…
リクエストのダミーファイルを作成し
ビジネスロジックを通じて生成される想定のSQL
とAPIリクエストの整合性をチェック
レスポンスの結果もResultSetとして検証