PutRowTest.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. <?php
  2. namespace Aliyun\OTS\Tests;
  3. use Aliyun\OTS;
  4. use Aliyun\OTS\ColumnTypeConst;
  5. use Aliyun\OTS\ComparatorTypeConst;
  6. use Aliyun\OTS\RowExistenceExpectationConst;
  7. require __DIR__ . "/TestBase.php";
  8. require __DIR__ . "/../../../vendor/autoload.php";
  9. $usedTables = array (
  10. "myTable",
  11. "myTable1"
  12. );
  13. SDKTestBase::cleanUp ( $usedTables );
  14. SDKTestBase::createInitialTable ( array (
  15. "table_meta" => array (
  16. "table_name" => $usedTables[0],
  17. "primary_key_schema" => array (
  18. "PK1" => ColumnTypeConst::CONST_INTEGER,
  19. "PK2" => ColumnTypeConst::CONST_STRING
  20. )
  21. ),
  22. "reserved_throughput" => array (
  23. "capacity_unit" => array (
  24. "read" => 0,
  25. "write" => 0
  26. )
  27. )
  28. ) );
  29. SDKTestBase::createInitialTable ( array (
  30. "table_meta" => array (
  31. "table_name" => $usedTables[1],
  32. "primary_key_schema" => array (
  33. "PK1" => ColumnTypeConst::CONST_INTEGER,
  34. "PK2" => ColumnTypeConst::CONST_STRING
  35. )
  36. ),
  37. "reserved_throughput" => array (
  38. "capacity_unit" => array (
  39. "read" => 0,
  40. "write" => 0
  41. )
  42. )
  43. ) );
  44. SDKTestBase::waitForTableReady ();
  45. class PutRowTest extends SDKTestBase {
  46. /*
  47. *
  48. * TableNameOfZeroLength
  49. * 表名长度为0的情况,期望返回错误消息:Invalid table name: '{TableName}'. 中包含的TableName与输入一致。
  50. */
  51. public function testTableNameOfZeroLength() {
  52. $tablename1 = array (
  53. "table_name" => "",
  54. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  55. "primary_key" => array (
  56. "PK1" => 1,
  57. "PK2" => "a1"
  58. ),
  59. "attribute_columns" => array (
  60. "attr1" => "name",
  61. "attr2" => 256
  62. )
  63. );
  64. try {
  65. $this->otsClient->putRow ( $tablename1 );
  66. } catch ( \Aliyun\OTS\OTSServerException $exc ) {
  67. $c = "Invalid table name: ''.";
  68. $this->assertEquals ( $c, $exc->getOTSErrorMessage () );
  69. }
  70. // print_r($this->otsClient->putRow($tablename));
  71. // die;
  72. $tablename2 = array (
  73. "table_name" => "testU+0053",
  74. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  75. "primary_key" => array (
  76. "PK1" => 1,
  77. "PK2" => "a1"
  78. ),
  79. "attribute_columns" => array (
  80. "attr1" => "name",
  81. "attr2" => 256
  82. )
  83. );
  84. try {
  85. $this->otsClient->putRow ( $tablename2 );
  86. $this->fail ( 'An expected exception has not been raised.' );
  87. } catch ( \Aliyun\OTS\OTSServerException $exc ) {
  88. $c = "Invalid table name: 'testU+0053'.";
  89. $this->assertEquals ( $c, $exc->getOTSErrorMessage () );
  90. }
  91. }
  92. /*
  93. * ColumnNameOfZeroLength
  94. * 列名长度为0的情况,期望返回错误消息:Invalid column name: '{ColumnName}'. 中包含的ColumnName与输入一致
  95. * ColumnNameWithUnicode
  96. * 列名包含Unicode,期望返回错误信息:Invalid column name: '{ColumnName}'. 中包含的ColumnName与输入一致。
  97. * 1KBColumnName
  98. * 列名包含Unicode,期望返回错误信息:Invalid column name: '{ColumnName}'. 中包含的ColumnName与输入一致。
  99. */
  100. public function testColumnNameLength() {
  101. global $usedTables;
  102. // ColumnNameOfZeroLength
  103. $tablename1 = array (
  104. "table_name" => $usedTables[0],
  105. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  106. "primary_key" => array (
  107. "PK1" => 1,
  108. "PK2" => "a1"
  109. ),
  110. "attribute_columns" => array (
  111. "" => "name",
  112. "attr2" => 256
  113. )
  114. );
  115. try {
  116. $this->otsClient->putRow ( $tablename1 );
  117. $this->fail ( 'An expected exception has not been raised.' );
  118. } catch ( \Aliyun\OTS\OTSServerException $exc ) {
  119. $c = "Invalid column name: ''.";
  120. $this->assertEquals ( $c, $exc->getOTSErrorMessage () );
  121. }
  122. // ColumnNameWithUnicode
  123. $tablename2 = array (
  124. "table_name" => $usedTables[0],
  125. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  126. "primary_key" => array (
  127. "PK1" => 1,
  128. "PK2" => "a1"
  129. ),
  130. "attribute_columns" => array (
  131. "#name" => "name",
  132. "attr2" => 256
  133. )
  134. );
  135. try {
  136. $this->otsClient->putRow ( $tablename2 );
  137. $this->fail ( 'An expected exception has not been raised.' );
  138. } catch ( \Aliyun\OTS\OTSServerException $exc ) {
  139. $c = "Invalid column name: '#name'.";
  140. $this->assertEquals ( $c, $exc->getOTSErrorMessage () );
  141. }
  142. // 1KBColumnName
  143. $name = "";
  144. for($i = 1; $i < 1025; $i ++) {
  145. $name .= "a";
  146. }
  147. $tablename3 = array (
  148. "table_name" => $usedTables[0],
  149. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  150. "primary_key" => array (
  151. "PK1" => 1,
  152. "PK2" => "a1"
  153. ),
  154. "attribute_columns" => array (
  155. "{$name}" => "name",
  156. "attr2" => 256
  157. )
  158. );
  159. try {
  160. $this->otsClient->putRow ( $tablename3 );
  161. $this->fail ( 'An expected exception has not been raised.' );
  162. } catch ( \Aliyun\OTS\OTSServerException $exc ) {
  163. $c = "Invalid column name: '{$name}'.";
  164. $this->assertEquals ( $c, $exc->getOTSErrorMessage () );
  165. }
  166. }
  167. /*
  168. * 10WriteCUConsumed
  169. * 测试接口消耗10个写CU时返回的CU Consumed符合预期。
  170. */
  171. public function testWrite10CUConsumed() {
  172. global $usedTables;
  173. $name = "";
  174. for($i = 1; $i < (4097 * 9); $i ++) {
  175. $name .= "a";
  176. }
  177. $tablename = array (
  178. "table_name" => $usedTables[1],
  179. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  180. "primary_key" => array (
  181. "PK1" => 1,
  182. "PK2" => "a1"
  183. ),
  184. "attribute_columns" => array (
  185. "att2" => $name
  186. )
  187. );
  188. if (is_array ( $this->otsClient->putRow ( $tablename ) )) {
  189. $name = $this->otsClient->putRow ( $tablename );
  190. $this->assertEquals ( $name['consumed']['capacity_unit']['write'], 10 );
  191. $this->assertEquals ( $name['consumed']['capacity_unit']['read'], 0 );
  192. }
  193. // print_r($name['consumed']['capacity_unit']['write']);die;
  194. // $getrow = $this->otsClient->putRow($tablename);
  195. }
  196. /*
  197. * 测试不同类型的列值
  198. * NormanStringValue
  199. * 测试StringValue为10个字节的情况。
  200. * UnicodeStringValue
  201. * 测试StringValue包含Unicode字符的情况。
  202. */
  203. public function testNormanStringValue() {
  204. global $usedTables;
  205. $name = "";
  206. for($i = 1; $i < (1025 * 10); $i ++) {
  207. $name .= "a";
  208. }
  209. // echo strlen($a);die;
  210. $tablename = array (
  211. "table_name" => $usedTables[0],
  212. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  213. "primary_key" => array (
  214. "PK1" => 11,
  215. "PK2" => "a11"
  216. ),
  217. "attribute_columns" => array (
  218. "att2" => $name
  219. )
  220. );
  221. $this->otsClient->putRow ( $tablename );
  222. $body = array (
  223. "table_name" => $usedTables[0],
  224. "primary_key" => array (
  225. 'PK1' => 11,
  226. 'PK2' => 'a11'
  227. ),
  228. "columns_to_get" => array ()
  229. );
  230. if (is_array ( $this->otsClient->getRow ( $body ) )) {
  231. $name = $this->otsClient->getRow ( $body );
  232. $this->assertEquals ( $name['row']['attribute_columns']['att2'], $tablename['attribute_columns']['att2'] );
  233. }
  234. // print_r($name);die;
  235. // $getrow = $this->otsClient->putRow($tablename);
  236. //
  237. }
  238. /*
  239. * 测试不同类型的列值
  240. * UnicodeStringValue
  241. * 测试StringValue包含Unicode字符的情况。
  242. * EmptyStringValue
  243. * 测试空字符串的情况。
  244. */
  245. public function testUnicodeStringValue() {
  246. global $usedTables;
  247. // echo strlen($a);die;
  248. $tablename = array (
  249. "table_name" => $usedTables[0],
  250. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  251. "primary_key" => array (
  252. "PK1" => 12,
  253. "PK2" => "a12"
  254. ),
  255. "attribute_columns" => array (
  256. "att1" => "sdfv\u597d",
  257. "att2" => "U+0053"
  258. )
  259. );
  260. $this->otsClient->putRow ( $tablename );
  261. $body = array (
  262. "table_name" => $usedTables[0],
  263. "primary_key" => array (
  264. 'PK1' => 12,
  265. 'PK2' => 'a12'
  266. )
  267. );
  268. if (is_array ( $this->otsClient->getRow ( $body ) )) {
  269. $name = $this->otsClient->getRow ( $body );
  270. // UnicodeStringValue
  271. $this->assertEquals ( $name['row']['attribute_columns'], $tablename['attribute_columns'] );
  272. }
  273. $tablename = array (
  274. "table_name" => $usedTables[0],
  275. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  276. "primary_key" => array (
  277. "PK1" => 13,
  278. "PK2" => "a13"
  279. ),
  280. "attribute_columns" => array (
  281. "att1" => "",
  282. "att2" => ""
  283. )
  284. );
  285. $this->otsClient->putRow ( $tablename );
  286. $body = array (
  287. "table_name" => $usedTables[0],
  288. "primary_key" => array (
  289. 'PK1' => 13,
  290. 'PK2' => 'a13'
  291. )
  292. );
  293. if (is_array ( $this->otsClient->getRow ( $body ) )) {
  294. $name = $this->otsClient->getRow ( $body );
  295. // UnicodeStringValue
  296. $this->assertEmpty ( $name['row']['attribute_columns']['att1'] );
  297. $this->assertEmpty ( $name['row']['attribute_columns']['att2'] );
  298. }
  299. // print_r($name);die;
  300. // $getrow = $this->otsClient->putRow($tablename);
  301. //
  302. }
  303. /*
  304. * StringValueTooLong
  305. * 测试字符串长度为1MB的情况,期望返回错误消息 最长65536。
  306. */
  307. public function testStringValueTooLong() {
  308. global $usedTables;
  309. $name = "";
  310. for($i = 1; $i < (1025 * 1024 * 5); $i ++) {
  311. $name .= "a";
  312. }
  313. // echo strlen($a);die;
  314. $tablename = array (
  315. "table_name" => $usedTables[0],
  316. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  317. "primary_key" => array (
  318. "PK1" => 20,
  319. "PK2" => "a20"
  320. ),
  321. "attribute_columns" => array (
  322. "att1" => $name
  323. )
  324. );
  325. try {
  326. $this->otsClient->putRow ( $tablename );
  327. $this->fail ( 'An expected exception has not been raised.' );
  328. } catch ( \Aliyun\OTS\OTSServerException $exc ) {
  329. $c = "The length of attribute column: 'att1' exceeded the MaxLength:";
  330. $this->assertContains ( $c, $exc->getOTSErrorMessage () );
  331. }
  332. }
  333. /*
  334. * CASE_ID: NormalIntegerValue
  335. * 测试IntegerValue值为10的情况。
  336. * CASE_ID: IntegerValueInBoundary
  337. * 测试IntegerValue的值为8位有符号整数的最小值或最大值的情况
  338. * 负8位整数getRow获取的值为4293856185
  339. * 正8位整数最大4293856185最下为0
  340. */
  341. public function testIntegerValue() {
  342. global $usedTables;
  343. $tablename = array (
  344. "table_name" => $usedTables[0],
  345. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  346. "primary_key" => array (
  347. "PK1" => 30,
  348. "PK2" => "a30"
  349. ),
  350. "attribute_columns" => array (
  351. "attr10" => - 10
  352. )
  353. );
  354. $this->otsClient->putRow ( $tablename );
  355. $body = array (
  356. "table_name" => $usedTables[0],
  357. "primary_key" => array (
  358. "PK1" => 30,
  359. "PK2" => "a30"
  360. ),
  361. "columns_to_get" => array ()
  362. );
  363. $getrow = $this->otsClient->getRow ( $body );
  364. $this->assertEquals ( $getrow['row']['attribute_columns']['attr10'], - 10 );
  365. $tablename = array (
  366. "table_name" => $usedTables[0],
  367. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  368. "primary_key" => array (
  369. "PK1" => 31,
  370. "PK2" => "a31"
  371. ),
  372. "attribute_columns" => array (
  373. "attr1" => 1,
  374. "attr2" => 0,
  375. "attr3" => 4293856185
  376. )
  377. );
  378. $this->otsClient->putRow ( $tablename );
  379. $body = array (
  380. "table_name" => $usedTables[0],
  381. "primary_key" => array (
  382. "PK1" => 31,
  383. "PK2" => "a31"
  384. ),
  385. "columns_to_get" => array ()
  386. );
  387. $getrow1 = $this->otsClient->getRow ( $body );
  388. // echo $getrow['row']['attribute_columns']['attr1'];die;
  389. $this->assertEquals ( $getrow1['row']['attribute_columns']['attr1'], 1 );
  390. $this->assertEquals ( $getrow1['row']['attribute_columns']['attr2'], 0 );
  391. $this->assertEquals ( $getrow1['row']['attribute_columns']['attr3'], 4293856185 );
  392. }
  393. /*
  394. * NormalDoubleValue
  395. * 测试DoubleValue值为3.1415926的情况。
  396. * DoubleValueInBoundary
  397. * 测试DoubleValue的值为8位有符号浮点数的最小值或最大值的情况
  398. */
  399. public function testDoubleValue() {
  400. global $usedTables;
  401. $tablename = array (
  402. "table_name" => $usedTables[0],
  403. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  404. "primary_key" => array (
  405. "PK1" => 40,
  406. "PK2" => "a40"
  407. ),
  408. "attribute_columns" => array (
  409. "attr10" => 3.1415926
  410. )
  411. );
  412. $this->otsClient->putRow ( $tablename );
  413. $body = array (
  414. "table_name" => $usedTables[0],
  415. "primary_key" => array (
  416. "PK1" => 40,
  417. "PK2" => "a40"
  418. ),
  419. "columns_to_get" => array ()
  420. );
  421. $getrow = $this->otsClient->getRow ( $body );
  422. $this->assertEquals ( $getrow['row']['attribute_columns']['attr10'], 3.1415926 );
  423. $tablename = array (
  424. "table_name" => $usedTables[0],
  425. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  426. "primary_key" => array (
  427. "PK1" => 41,
  428. "PK2" => "a41"
  429. ),
  430. "attribute_columns" => array (
  431. "attr11" => - 0.0000001,
  432. "attr12" => 9.9999999
  433. )
  434. );
  435. $this->otsClient->putRow ( $tablename );
  436. $body = array (
  437. "table_name" => $usedTables[0],
  438. "primary_key" => array (
  439. "PK1" => 41,
  440. "PK2" => "a41"
  441. ),
  442. "columns_to_get" => array ()
  443. );
  444. $getrow1 = $this->otsClient->getRow ( $body );
  445. // echo $getrow1['row']['attribute_columns']['attr11'];die;
  446. $this->assertEquals ( $getrow1['row']['attribute_columns']['attr11'], - 0.0000001 );
  447. // $this->assertEquals($getrow1['row']['attribute_columns']['attr2'],0);
  448. $this->assertEquals ( $getrow1['row']['attribute_columns']['attr12'], 9.9999999 );
  449. }
  450. /*
  451. * BooleanValueTrue
  452. * 描述:测试布尔值为True的情况。
  453. * BooleanValueFalse
  454. * 描述:测试布尔值为False的情况
  455. */
  456. public function testBooleanValue() {
  457. global $usedTables;
  458. $tablename = array (
  459. "table_name" => $usedTables[0],
  460. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  461. "primary_key" => array (
  462. "PK1" => 50,
  463. "PK2" => "a50"
  464. ),
  465. "attribute_columns" => array (
  466. "attr1" => true,
  467. "attr2" => false
  468. )
  469. );
  470. $this->otsClient->putRow ( $tablename );
  471. $body = array (
  472. "table_name" => $usedTables[0],
  473. "primary_key" => array (
  474. "PK1" => 50,
  475. "PK2" => "a50"
  476. ),
  477. "columns_to_get" => array ()
  478. );
  479. $getrow = $this->otsClient->getRow ( $body );
  480. $this->assertEquals ( $getrow['row']['attribute_columns']['attr1'], 1 );
  481. $this->assertEquals ( $getrow['row']['attribute_columns']['attr2'], 0 );
  482. }
  483. /*
  484. * ExpectNotExistConditionWhenRowNotExist
  485. * 描述:测试行不存在的条件下,写操作的Condition为EXPECT_NOT_EXIST。
  486. * ExpectNotExistConditionWhenRowExist
  487. * 测试行存在的条件下,写操作的Condition为EXPECT_NOT_EXIST,返回错误信息Condition check failed.
  488. */
  489. public function testExpectNotExistConditionWhenRowNotExist() {
  490. global $usedTables;
  491. $request = array (
  492. "table_name" => $usedTables[0],
  493. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  494. "primary_key" => array (
  495. "PK1" => 50,
  496. "PK2" => "a50"
  497. )
  498. );
  499. $this->otsClient->deleteRow ( $request );
  500. $tablename = array (
  501. "table_name" => $usedTables[0],
  502. "condition" => RowExistenceExpectationConst::CONST_EXPECT_NOT_EXIST,
  503. "primary_key" => array (
  504. "PK1" => 50,
  505. "PK2" => "a50"
  506. ),
  507. "attribute_columns" => array (
  508. "attr1" => true,
  509. "attr2" => false
  510. )
  511. );
  512. $this->otsClient->putRow ( $tablename );
  513. $body = array (
  514. "table_name" => $usedTables[0],
  515. "primary_key" => array (
  516. "PK1" => 50,
  517. "PK2" => "a50"
  518. ),
  519. "columns_to_get" => array ()
  520. );
  521. $getrow = $this->otsClient->getRow ( $body );
  522. $this->assertEquals ( $getrow['row']['attribute_columns']['attr1'], 1 );
  523. $this->assertEquals ( $getrow['row']['attribute_columns']['attr2'], 0 );
  524. $tablename1 = array (
  525. "table_name" => $usedTables[0],
  526. "condition" => RowExistenceExpectationConst::CONST_EXPECT_NOT_EXIST,
  527. "primary_key" => array (
  528. "PK1" => 50,
  529. "PK2" => "a50"
  530. ),
  531. "attribute_columns" => array (
  532. "attr1" => true,
  533. "attr2" => false
  534. )
  535. );
  536. try {
  537. $this->otsClient->putRow ( $tablename1 );
  538. $this->fail ( 'An expected exception has not been raised.' );
  539. } catch ( \Aliyun\OTS\OTSServerException $exc ) {
  540. $a = $exc->getMessage ();
  541. $c = "Condition check failed.";
  542. $this->assertContains ( $c, $a );
  543. }
  544. }
  545. /**
  546. * 测试在使用ColumnCondition的过滤条件的时候,插入数据是否成功。
  547. */
  548. public function testPutRowWithColumnCondition() {
  549. global $usedTables;
  550. $delete_query = array (
  551. "table_name" => $usedTables[0],
  552. "condition" => RowExistenceExpectationConst::CONST_IGNORE,
  553. "primary_key" => array (
  554. "PK1" => 50,
  555. "PK2" => "a50"
  556. )
  557. );
  558. $this->otsClient->deleteRow ( $delete_query );
  559. $put_query1 = array (
  560. "table_name" => $usedTables[0],
  561. "condition" => RowExistenceExpectationConst::CONST_EXPECT_NOT_EXIST,
  562. "primary_key" => array (
  563. "PK1" => 50,
  564. "PK2" => "a50"
  565. ),
  566. "attribute_columns" => array (
  567. "attr1" => true,
  568. "attr2" => true
  569. )
  570. );
  571. $this->otsClient->putRow ( $put_query1 );
  572. $put_query2 = array (
  573. "table_name" => $usedTables[0],
  574. "condition" => array (
  575. "row_existence" => RowExistenceExpectationConst::CONST_EXPECT_EXIST,
  576. "column_filter" => array (
  577. "column_name" => "attr1",
  578. "value" => true,
  579. "comparator" => ComparatorTypeConst::CONST_EQUAL
  580. )
  581. ),
  582. "primary_key" => array (
  583. "PK1" => 50,
  584. "PK2" => "a50"
  585. ),
  586. "attribute_columns" => array (
  587. "attr3" => false,
  588. "attr4" => false
  589. )
  590. );
  591. $this->otsClient->putRow ( $put_query2 );
  592. $get_query = array (
  593. "table_name" => $usedTables[0],
  594. "primary_key" => array (
  595. "PK1" => 50,
  596. "PK2" => "a50"
  597. ),
  598. "columns_to_get" => array (
  599. "attr1",
  600. "attr2",
  601. "attr3",
  602. "attr4"
  603. )
  604. );
  605. $get_row_res = $this->otsClient->getRow ( $get_query );
  606. $this->assertEquals ( $get_row_res['row']['attribute_columns']['attr3'], false );
  607. $this->assertEquals ( $get_row_res['row']['attribute_columns']['attr4'], false );
  608. $put_query3 = array (
  609. "table_name" => $usedTables[0],
  610. "condition" => array (
  611. "row_existence" => RowExistenceExpectationConst::CONST_EXPECT_EXIST,
  612. "column_filter" => array (
  613. "column_name" => "attr3",
  614. "value" => true,
  615. "comparator" => ComparatorTypeConst::CONST_EQUAL
  616. )
  617. ),
  618. "primary_key" => array (
  619. "PK1" => 50,
  620. "PK2" => "a50"
  621. ),
  622. "attribute_columns" => array (
  623. "attr5" => false,
  624. "attr6" => false
  625. )
  626. );
  627. try {
  628. $this->otsClient->putRow ( $put_query3 );
  629. $this->fail ( 'An expected exception has not been raised.' );
  630. } catch ( \Aliyun\OTS\OTSServerException $exc ) {
  631. $a = $exc->getMessage ();
  632. $c = "Condition check failed.";
  633. $this->assertContains ( $c, $a );
  634. }
  635. }
  636. }