client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
}
+void tca05_request_and_cancel1_func()
+{
+ std::string testNo("05");
+ int subtest = 1;
+ cynara_check_id id;
+ RequestEntity callbackData = {RequestFunction(),
+ CYNARA_API_ACCESS_DENIED,
+ CYNARA_CALL_CAUSE_CANCEL};
+
+ Client client;
+
+ client.createRequest({testNo, subtest}, id, callbackData);
+ client.assertStatus(READWRITE);
+
+ client.cancel(id);
+ client.assertStatus(READWRITE);
+
+ //send request and cancel
+ client.process();
+ client.assertStatus(READ);
+
+ //get answer
+ client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
+}
+
+void tca05_request_and_cancel2_func()
+{
+ std::string testNo("05");
+ int subtest = 2;
+ cynara_check_id id1, id2;
+ Client client;
+
+ RequestEntity callbackData1 = {[&]()->void {client.cancel(id2);},
+ CYNARA_API_ACCESS_DENIED,
+ CYNARA_CALL_CAUSE_ANSWER};
+ RequestEntity callbackData2 = {RequestFunction(),
+ CYNARA_API_ACCESS_DENIED,
+ CYNARA_CALL_CAUSE_CANCEL};
+
+ client.createRequest({testNo, subtest}, id1, callbackData1);
+ client.createRequest({testNo, subtest}, id2, callbackData2);
+ client.assertStatus(READWRITE);
+
+ //send requests
+ client.process();
+ client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
+ client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
+}
+
+void tca05_request_and_cancel3_func()
+{
+ std::string testNo("05");
+ int subtest = 3;
+ cynara_check_id id;
+ RequestEntity callbackData = {RequestFunction(),
+ CYNARA_API_ACCESS_DENIED,
+ CYNARA_CALL_CAUSE_ANSWER};
+
+ Client client;
+
+ client.createRequest({testNo, subtest}, id, callbackData);
+ client.assertStatus(READWRITE);
+
+ //send request
+ client.process();
+ client.assertStatus(READ);
+
+ //get answer
+ client.process(CYNARA_API_SUCCESS, Client::IGNORE_TIMEOUT);
+ client.assertStatus(READ);
+
+ client.cancel(id, CYNARA_API_INVALID_PARAM);
+}
+
+void tca06_cancel_fail_func()
+{
+ cynara_check_id id = 0xDEAD;
+
+ Client client;
+
+ client.cancel(id, CYNARA_API_INVALID_PARAM);
+}
+
RUNNER_TEST_GROUP_INIT(cynara_async_tests)
RUN_CYNARA_TEST(tca01_initialize)
RUN_CYNARA_TEST(tca02_empty_cache_miss)
RUN_CYNARA_TEST(tca03_create_max_requests)
RUN_CYNARA_TEST(tca04_request_and_process)
+RUN_CYNARA_TEST(tca05_request_and_cancel1)
+RUN_CYNARA_TEST(tca05_request_and_cancel2)
+RUN_CYNARA_TEST(tca05_request_and_cancel3)
+RUN_CYNARA_TEST(tca06_cancel_fail)