1 /******************************************************************
3 * Copyright 2016 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
21 package org.iotivity.test.ca.tc.stc;
23 import android.content.Context;
24 import junit.framework.TestCase;
25 import org.iotivity.CAJni;
26 import org.iotivity.test.ca.tc.helper.*;
28 import android.test.AndroidTestCase;
30 import static org.iotivity.test.ca.tc.helper.TestInfo.*;
32 public class CAClientTest extends AndroidTestCase {
34 public CAClientTest() {
37 protected void setUp() throws Exception {
40 CAJni.setContext(getContext(), MainActivity.getActivity());
43 protected void tearDown() throws Exception {
49 * @see CAResult_t CAInitialize()
50 * @see void CARegisterHandler(CARequestCallback ReqHandler,
51 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
52 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
53 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
54 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
55 * CAEndpoint_t **object)
56 * @see void CADestroyEndpoint(CAEndpoint_t *object)
57 * @see void CADestroyToken(CAToken_t token)
58 * @see CAResult_t CAHandleRequestResponse()
59 * @see void CATerminate()
60 * @objective Check the functionality of CASelectNetwork to receive response
61 * message when available network is selected
62 * @target CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
64 * @test_data Request Messages Response Messages
65 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
66 * Select Network by CASelectNetwork API 3. [Server] Call
67 * CARegisterHandler to register handler 4. [Server] Call
68 * CAStartListeningServer to start server 5. [Server] Call
69 * CAHandleRequestResponse periodically to recieve client
70 * request 6. [Client] Call CAInitialize to initialize CA 7.
71 * [Client] Select Network by CASelectNetwork API 8. [Client]
72 * Call CARegisterHandler to register handler 9. [Client]
73 * Call CAStartDiscoveryServer 10.[Client] Call
74 * CAGenerateToken to generate token 11.[Client] Call
75 * CACreateEndpoint to create endpoint for server
76 * @procedure 1. [Server] Configure the server simulator with a request to
77 * send back a certain amount of response messages 2. [Client]
78 * Attempt to receive the requested amount of unicast response
79 * messages from the server simulator 3. [Client] Check and
80 * compare the received amount with the requested amount
81 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
82 * [CLient] Terminate CA
83 * @expected The requested amount of response messages should be received in
87 public void testLeSelectNetworkForIncomingMessages_P() {
89 if (!CAJni.establishConnectionWithServer()) {
94 CAJni.setupTestCase(MESSAGE_INCOMING, MESSAGE_PAYLOAD,
97 if (!CAJni.initClientNetwork()) {
102 if (!CAJni.sendConfigurationRequest(SEND_MESSAGE,
103 MESSAGE_RESPONSE, CA_PUT)) {
109 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
118 * @see CAResult_t CAInitialize()
119 * @see void CARegisterHandler(CARequestCallback ReqHandler,
120 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
121 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
122 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
123 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
124 * CAEndpoint_t **object)
125 * @see void CADestroyEndpoint(CAEndpoint_t *object)
126 * @see void CADestroyToken(CAToken_t token)
127 * @see CAResult_t CAHandleRequestResponse()
128 * @see void CATerminate()
129 * @objective Check the functionality of CASelectNetwork & CAUnSelectNetwork
130 * to receive response message when no network is selected
131 * @target CAResult_t CASelectNetwork(CATransportAdapter_t
133 * @target CAResult_t CAUnSelectNetwork(CATransportAdapter_t
134 * nonInterestedNetwork)
136 * @test_data Request Messages Response Messages
137 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
138 * Select Network by CASelectNetwork API 3. [Server] Call
139 * CARegisterHandler to register handler 4. [Server] Call
140 * CAStartListeningServer to start server 5. [Server] Call
141 * CAHandleRequestResponse periodically to recieve client
142 * request 6. [Client] Call CAInitialize to initialize CA 7.
143 * [Client] Select Network by CASelectNetwork API 8. [Client]
144 * Call CARegisterHandler to register handler 9. [Client]
145 * Call CAStartDiscoveryServer 10.[Client] Call
146 * CAGenerateToken to generate token 11.[Client] Call
147 * CACreateEndpoint to create endpoint for server
148 * @procedure 1. [Server] Configure the server simulator with a request to
149 * send back a certain amount of response messages 2. [Client]
150 * UnSelect the network 3. [Client] Attempt to receive the
151 * requested amount of unicast response messages from the server
152 * simulator 4. [Client] Check and compare the received amount
154 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
155 * [Client] Terminate CA
156 * @expected The received amount should be zero in client side
158 public void testLeSelectUnAvailableNetworkForIncomingMessages_N() {
160 if (!CAJni.establishConnectionWithServer()) {
165 CAJni.setupTestCase(MESSAGE_INCOMING, MESSAGE_PAYLOAD,
168 if (!CAJni.initClientNetwork()) {
173 if (!CAJni.sendConfigurationRequest(SEND_MESSAGE,
174 MESSAGE_RESPONSE, CA_PUT)) {
180 if (!CAJni.unSelectNetwork()) {
186 if (CAJni.selectCustomNetwork(INVALID_NETWORK, CA_STATUS_OK)) {
192 if (!CAJni.checkReceiveCount(0)) {
201 * @see CAResult_t CAInitialize()
202 * @see void CARegisterHandler(CARequestCallback ReqHandler,
203 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
204 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
205 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
206 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
207 * CAEndpoint_t **object)
208 * @see CAResult_t CASendRequest(const CAEndpoint_t *object, const
209 * CARequestInfo_t *requestInfo)
210 * @see void CADestroyEndpoint(CAEndpoint_t *object)
211 * @see void CADestroyToken(CAToken_t token)
212 * @see CAResult_t CAHandleRequestResponse()
213 * @see void CATerminate()
214 * @objective Check the functionality of CASelectNetwork to send message
215 * when available network is selected
216 * @target CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
218 * @test_data Request Messages Request Messages
219 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
220 * Select Network by CASelectNetwork API 3. [Server] Call
221 * CARegisterHandler to register handler 4. [Server] Call
222 * CAStartListeningServer to start server 5. [Server] Call
223 * CAHandleRequestResponse periodically to recieve client
224 * request 6. [Client] Call CAInitialize to initialize CA 7.
225 * [Client] Select Network by CASelectNetwork API 8. [Client]
226 * Call CARegisterHandler to register handler 9. [Client]
227 * Call CAStartDiscoveryServer 10.[Client] Call
228 * CAGenerateToken to generate token 11.[Client] Call
229 * CACreateEndpoint to create endpoint for server
230 * @procedure 1. [Client] Attempt to send a certain amount of request
231 * messages to the server simulator 2. [Client] Attempt to
232 * receive acknowledgments for all the sent messages
233 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
234 * [CLient] Terminate CA
235 * @expected The number of acknowledgments should be equal to the amount of
238 public void testLeSelectNetworkForOutgoingMessages_P() {
240 if (!CAJni.establishConnectionWithServer()) {
246 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_PAYLOAD,
249 if (!CAJni.initClientNetwork()) {
254 if (!CAJni.sendRequest(URI_TYPE_NORMAL, PAYLOAD_TYPE_NORMAL,
255 CA_MSG_NONCONFIRM, CA_PUT, HEADER_NONE, false)) {
261 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
270 * @see CAResult_t CAInitialize()
271 * @see void CARegisterHandler(CARequestCallback ReqHandler,
272 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
273 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
274 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
275 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
276 * CAEndpoint_t **object)
277 * @see void CADestroyEndpoint(CAEndpoint_t *object)
278 * @see void CADestroyToken(CAToken_t token)
279 * @see CAResult_t CAHandleRequestResponse()
280 * @see void CATerminate()
281 * @objective Test the effect of select/unselect network on incoming unicast
283 * @target CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
284 * @target CAResult_t CAUnSelectNetwork(CATransportAdapter_t
285 * nonInterestedNetwork)
287 * @test_data Request Messages Response Messages
288 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
289 * Select Network by CASelectNetwork API 3. [Server] Call
290 * CARegisterHandler to register handler 4. [Server] Call
291 * CAStartListeningServer to start server 5. [Server] Call
292 * CAHandleRequestResponse periodically to recieve client
293 * request 6. [Client] Call CAInitialize to initialize CA 7.
294 * [Client] Call CARegisterHandler to register handler 8.
295 * [Client] Call CAStartDiscoveryServer
296 * @procedure 1. [Client] Select Network by CASelectNetwork API 2. [Client]
297 * Call CAGenerateToken to generate token 3. [Client] Call
298 * CACreateEndpoint to create endpoint for server 4. [Server]
299 * Configure the server simulator with a request to send back a
300 * certain amount of response messages 5. [Client] Attempt to
301 * receive the requested amount of unicast response messages from
302 * the server simulator 6. [Client] Check and compare the
303 * received amount with the requested amount 7. [Client] Destroy
304 * token 8. [Client] Destroy endpoint 9. [CLient] Unselect the
305 * network 10.Repeat procedure 1 to 8 multiple times
306 * @post_condition [CLient] Terminate CA
307 * @expected The requested amount of response messages should be received
308 * each time in client side
310 public void testLeSelectNetworkSequentiallyForIncomingMessages_P() {
312 if (!CAJni.establishConnectionWithServer()) {
318 CAJni.setupTestCase(MESSAGE_INCOMING, MESSAGE_PAYLOAD,
321 if (!CAJni.initClientNetwork()) {
326 for (int i = 0; i < TRY_COUNT; i++) {
328 if (!CAJni.selectNetwork()) {
335 if (!CAJni.sendConfigurationRequest(SEND_MESSAGE,
336 MESSAGE_RESPONSE, CA_PUT)) {
342 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
348 if (!CAJni.unSelectNetwork()) {
362 * @see CAResult_t CAInitialize()
363 * @see void CATerminate()
364 * @objective Test the effect of selecting network and receving incoming
365 * unicast messages for multiple times
366 * @target CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
367 * @target CAResult_t CAUnSelectNetwork(CATransportAdapter_t
368 * nonInterestedNetwork)
369 * @target void CARegisterHandler(CARequestCallback ReqHandler,
370 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
371 * @target CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
372 * @target CAResult_t CACreateEndpoint(CATransportFlags_t flags,
373 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
374 * CAEndpoint_t **object)
375 * @target void CADestroyEndpoint(CAEndpoint_t *object)
376 * @target void CADestroyToken(CAToken_t token)
377 * @target CAResult_t CAHandleRequestResponse()
379 * @test_data Request Messages Response Messages
380 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
381 * Select Network by CASelectNetwork API 3. [Server] Call
382 * CARegisterHandler to register handler 4. [Server] Call
383 * CAStartListeningServer to start server 5. [Server] Call
384 * CAHandleRequestResponse periodically to recieve client
385 * request 6. [Client] Call CAInitialize to initialize CA 7.
386 * [Client] Call CARegisterHandler to register handler 8.
387 * [Client] Call CAStartDiscoveryServer
388 * @procedure 1. [Client] Select Network by CASelectNetwork API 2. [Client]
389 * Call CAGenerateToken to generate token 3. [Client] Call
390 * CACreateEndpoint to create endpoint for server 4. [Server]
391 * Configure the server simulator with a request to send back a
392 * certain amount of response messages 5. [Client] Attempt to
393 * receive the requested amount of unicast response messages from
394 * the server simulator 6. [Client] Check and compare the
395 * received amount with the requested amount 7. [Client] Destroy
396 * token 8. [Client] Destroy endpoint 9. Repeat procedure 1 to 8
398 * @post_condition [CLient] Terminate CA
399 * @expected The requested amount of response messages should be received
400 * each time in client side
402 public void testLeSelectNetworkMultipleTimesForIncomingMessages_P() {
404 if (!CAJni.establishConnectionWithServer()) {
410 CAJni.setupTestCase(MESSAGE_INCOMING, MESSAGE_PAYLOAD,
413 if (!CAJni.initClientNetwork()) {
418 for (int i = 0; i < TRY_COUNT; i++) {
419 if (!CAJni.selectNetwork()) {
425 if (!CAJni.sendConfigurationRequest(SEND_MESSAGE,
426 MESSAGE_RESPONSE, CA_PUT)) {
432 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
444 * @see CAResult_t CAInitialize()
445 * @see void CARegisterHandler(CARequestCallback ReqHandler,
446 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
447 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
448 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
449 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
450 * CAEndpoint_t **object)
451 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
452 * @see void CADestroyEndpoint(CAEndpoint_t *object)
453 * @see void CADestroyToken(CAToken_t token)
454 * @see CAResult_t CAHandleRequestResponse()
455 * @see void CATerminate()
456 * @objective Test unicast message sending functionality by sending out
458 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
459 * CARequestInfo_t *requestInfo)
461 * @test_data Request Messages Request Messages
462 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
463 * Select Network by CASelectNetwork API 3. [Server] Call
464 * CARegisterHandler to register handler 4. [Server] Call
465 * CAStartListeningServer to start server 5. [Server] Call
466 * CAHandleRequestResponse periodically to recieve client
467 * request 6. [Client] Call CAInitialize to initialize CA 7.
468 * [Client] Select Network by CASelectNetwork API 8. [Client]
469 * Call CARegisterHandler to register handler 9. [Client]
470 * Call CAStartDiscoveryServer 10.[Client] Call
471 * CAGenerateToken to generate token 11.[Client] Call
472 * CACreateEndpoint to create endpoint for server
473 * @procedure 1. [Client] Attempt to send a certain amount of request
474 * messages to the server simulator using no header option 2.
475 * [Client] Attempt to receive acknowledgments for all the sent
476 * messages 3. [Client] Check and compare the amount of received
477 * acknowledgments with the amount of sent messages
478 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
479 * [CLient] Terminate CA
480 * @expected The number of acknowledgments should be equal to the amount of
481 * sent messages and received header options should be same NULL
483 public void testLeSendRequest_P() {
485 if (!CAJni.establishConnectionWithServer()) {
490 for (int i = 0; i < TRY_COUNT; i++) {
492 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_PAYLOAD,
496 .setContext(getContext(), MainActivity.getActivity());
498 if (!CAJni.initClientNetwork()) {
503 if (!CAJni.sendRequest(URI_TYPE_NORMAL,
504 PAYLOAD_TYPE_NORMAL, CA_MSG_NONCONFIRM, CA_PUT,
505 HEADER_NONE, false)) {
511 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
521 * @see CAResult_t CAInitialize()
522 * @see void CARegisterHandler(CARequestCallback ReqHandler,
523 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
524 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
525 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
526 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
527 * CAEndpoint_t **object)
528 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
529 * @see void CADestroyEndpoint(CAEndpoint_t *object)
530 * @see void CADestroyToken(CAToken_t token)
531 * @see CAResult_t CAHandleRequestResponse()
532 * @see void CATerminate()
533 * @objective Test unicast message sending functionality by sending out
534 * request messages without header option
535 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
536 * CARequestInfo_t *requestInfo)
538 * @test_data Request Messages Request Messages
539 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
540 * Select Network by CASelectNetwork API 3. [Server] Call
541 * CARegisterHandler to register handler 4. [Server] Call
542 * CAStartListeningServer to start server 5. [Server] Call
543 * CAHandleRequestResponse periodically to recieve client
544 * request 6. [Client] Call CAInitialize to initialize CA 7.
545 * [Client] Select Network by CASelectNetwork API 8. [Client]
546 * Call CARegisterHandler to register handler 9. [Client]
547 * Call CAStartDiscoveryServer 10.[Client] Call
548 * CAGenerateToken to generate token 11.[Client] Call
549 * CACreateEndpoint to create endpoint for server
550 * @procedure 1. [Client] Attempt to send a certain amount of request
551 * messages to the server simulator using no header option 2.
552 * [Client] Attempt to receive acknowledgments for all the sent
553 * messages 3. [Client] Check and compare the amount of received
554 * acknowledgments with the amount of sent messages
555 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
556 * [CLient] Terminate CA
557 * @expected The number of acknowledgments should be equal to the amount of
558 * sent messages and received header options should be same NULL
560 public void testLeSendRequestWithoutHeaderOption_P() {
562 if (!CAJni.establishConnectionWithServer()) {
568 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_HEADER,
571 if (!CAJni.initClientNetwork()) {
576 if (!CAJni.sendRequest(URI_TYPE_NORMAL, PAYLOAD_TYPE_NORMAL,
577 CA_MSG_NONCONFIRM, CA_PUT, HEADER_NONE, false)) {
583 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
592 * @see CAResult_t CAInitialize()
593 * @see void CARegisterHandler(CARequestCallback ReqHandler,
594 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
595 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
596 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
597 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
598 * CAEndpoint_t **object)
599 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
600 * @see void CADestroyEndpoint(CAEndpoint_t *object)
601 * @see void CADestroyToken(CAToken_t token)
602 * @see CAResult_t CAHandleRequestResponse()
603 * @see void CATerminate()
604 * @objective Test unicast message sending functionality by sending out
605 * request messages with header option
606 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
607 * CARequestInfo_t *requestInfo)
609 * @test_data Request Messages Request Messages
610 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
611 * Select Network by CASelectNetwork API 3. [Server] Call
612 * CARegisterHandler to register handler 4. [Server] Call
613 * CAStartListeningServer to start server 5. [Server] Call
614 * CAHandleRequestResponse periodically to recieve client
615 * request 6. [Client] Call CAInitialize to initialize CA 7.
616 * [Client] Select Network by CASelectNetwork API 8. [Client]
617 * Call CARegisterHandler to register handler 9. [Client]
618 * Call CAStartDiscoveryServer 10.[Client] Call
619 * CAGenerateToken to generate token 11.[Client] Call
620 * CACreateEndpoint to create endpoint for server
621 * @procedure 1. [Client] Attempt to send a certain amount of request
622 * messages to the server simulator using header option 2.
623 * [Client] Attempt to receive acknowledgments for all the sent
624 * messages 3. [Client] Check and compare the amount of received
625 * acknowledgments with the amount of sent messages
626 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
627 * [CLient] Terminate CA
628 * @expected The number of acknowledgments should be equal to the amount of
629 * sent messages and received header option should be same as send
632 public void testLeSendRequestWithHeaderOption_P() {
634 if (!CAJni.establishConnectionWithServer()) {
640 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_HEADER,
643 if (!CAJni.initClientNetwork()) {
648 if (!CAJni.sendRequest(URI_TYPE_NORMAL, PAYLOAD_TYPE_NORMAL,
649 CA_MSG_NONCONFIRM, CA_PUT, HEADER_ONE, false)) {
655 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
664 * @see CAResult_t CAInitialize()
665 * @see void CARegisterHandler(CARequestCallback ReqHandler,
666 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
667 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
668 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
669 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
670 * CAEndpoint_t **object)
671 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
672 * @see void CADestroyEndpoint(CAEndpoint_t *object)
673 * @see void CADestroyToken(CAToken_t token)
674 * @see CAResult_t CAHandleRequestResponse()
675 * @see void CATerminate()
676 * @objective Test unicast message sending functionality by sending out
677 * request messages with header options
678 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
679 * CARequestInfo_t *requestInfo)
681 * @test_data Request Messages Request Messages
682 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
683 * Select Network by CASelectNetwork API 3. [Server] Call
684 * CARegisterHandler to register handler 4. [Server] Call
685 * CAStartListeningServer to start server 5. [Server] Call
686 * CAHandleRequestResponse periodically to recieve client
687 * request 6. [Client] Call CAInitialize to initialize CA 7.
688 * [Client] Select Network by CASelectNetwork API 8. [Client]
689 * Call CARegisterHandler to register handler 9. [Client]
690 * Call CAStartDiscoveryServer 10.[Client] Call
691 * CAGenerateToken to generate token 11.[Client] Call
692 * CACreateEndpoint to create endpoint for server
693 * @procedure 1. [Client] Attempt to send a certain amount of request
694 * messages to the server simulator using header options 2.
695 * [Client] Attempt to receive acknowledgments for all the sent
696 * messages 3. [Client] Check and compare the amount of received
697 * acknowledgments with the amount of sent messages
698 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
699 * [CLient] Terminate CA
700 * @expected The number of acknowledgments should be equal to the amount of
701 * sent messages and received header option should be same as send
704 public void testLeSendRequestWithHeaderOptions_P() {
706 if (!CAJni.establishConnectionWithServer()) {
712 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_HEADER,
715 if (!CAJni.initClientNetwork()) {
720 if (!CAJni.sendRequest(URI_TYPE_NORMAL, PAYLOAD_TYPE_NORMAL,
721 CA_MSG_NONCONFIRM, CA_PUT, HEADER_TWO, false)) {
727 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
736 * @see CAResult_t CAInitialize()
737 * @see CAResult_t CAInitialize()
738 * @see void CARegisterHandler(CARequestCallback ReqHandler,
739 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
740 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
741 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
742 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
743 * CAEndpoint_t **object)
744 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
745 * @see void CADestroyEndpoint(CAEndpoint_t *object)
746 * @see void CADestroyToken(CAToken_t token)
747 * @see CAResult_t CAHandleRequestResponse()
748 * @see void CATerminate()
749 * @objective Test unicast message sending functionality by sending out
750 * request messages with empty payloads
751 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
752 * CARequestInfo_t *requestInfo)
754 * @test_data Request Messages Empty Payloads
755 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
756 * Select Network by CASelectNetwork API 3. [Server] Call
757 * CARegisterHandler to register handler 4. [Server] Call
758 * CAStartListeningServer to start server 5. [Server] Call
759 * CAHandleRequestResponse periodically to recieve client
760 * request 6. [Client] Call CAInitialize to initialize CA 7.
761 * [Client] Select Network by CASelectNetwork API 8. [Client]
762 * Call CARegisterHandler to register handler 9. [Client]
763 * Call CAStartDiscoveryServer 10.[Client] Call
764 * CAGenerateToken to generate token 11.[Client] Call
765 * CACreateEndpoint to create endpoint for server
766 * @procedure 1. [Client] Keep the payload empty while forming the
767 * CARequestInfo_t 2. [Client] Attempt to send a certain amount
768 * of request messages to the server simulator using header
769 * options 3. [Client] Attempt to receive acknowledgments for all
770 * the sent messages 4. [Client] Check and compare the amount of
771 * received acknowledgments with the amount of sent messages
772 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
773 * [CLient] Terminate CA
774 * @expected The number of acknowledgments should be equal to the amount of
777 public void testLeSendRequestWithEmptyPayload_P() {
779 if (!CAJni.establishConnectionWithServer()) {
785 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_URI,
788 if (!CAJni.initClientNetwork()) {
793 if (!CAJni.sendRequest(URI_TYPE_NORMAL, PAYLOAD_TYPE_EMPTY,
794 CA_MSG_NONCONFIRM, CA_PUT, HEADER_NONE, false)) {
800 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
809 * @see CAResult_t CAInitialize()
810 * @see void CARegisterHandler(CARequestCallback ReqHandler,
811 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
812 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
813 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
814 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
815 * CAEndpoint_t **object)
816 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
817 * @see void CADestroyEndpoint(CAEndpoint_t *object)
818 * @see void CADestroyToken(CAToken_t token)
819 * @see CAResult_t CAHandleRequestResponse()
820 * @see void CATerminate()
821 * @objective Test unicast message sending functionality by sending out
822 * request messages with null payloads
823 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
824 * CARequestInfo_t *requestInfo)
826 * @test_data Request Messages NULL Payloads
827 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
828 * Select Network by CASelectNetwork API 3. [Server] Call
829 * CARegisterHandler to register handler 4. [Server] Call
830 * CAStartListeningServer to start server 5. [Server] Call
831 * CAHandleRequestResponse periodically to recieve client
832 * request 6. [Client] Call CAInitialize to initialize CA 7.
833 * [Client] Select Network by CASelectNetwork API 8. [Client]
834 * Call CARegisterHandler to register handler 9. [Client]
835 * Call CAStartDiscoveryServer 10.[Client] Call
836 * CAGenerateToken to generate token 11.[Client] Call
837 * CACreateEndpoint to create endpoint for server
838 * @procedure 1. [Client] Keep the payload null while forming the
839 * CARequestInfo_t 2. [Client] Attempt to send a certain amount
840 * of request messages to the server simulator using header
841 * options 3. [Client] Attempt to receive acknowledgments for all
842 * the sent messages 4. [Client] Check and compare the amount of
843 * received acknowledgments with the amount of sent messages
844 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
845 * [CLient] Terminate CA
846 * @expected The number of acknowledgments should be equal to the amount of
849 public void testLeSendRequestWithNullPayload_P() {
851 if (!CAJni.establishConnectionWithServer()) {
857 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_URI,
860 if (!CAJni.initClientNetwork()) {
865 if (!CAJni.sendRequest(URI_TYPE_NORMAL, PAYLOAD_TYPE_NULL,
866 CA_MSG_NONCONFIRM, CA_PUT, HEADER_NONE, false)) {
872 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
881 * @see CAResult_t CAInitialize()
882 * @see void CARegisterHandler(CARequestCallback ReqHandler,
883 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
884 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
885 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
886 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
887 * CAEndpoint_t **object)
888 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
889 * @see void CADestroyEndpoint(CAEndpoint_t *object)
890 * @see void CADestroyToken(CAToken_t token)
891 * @see CAResult_t CAHandleRequestResponse()
892 * @see void CATerminate()
893 * @objective Test unicast message retransmission functionality using
894 * message type CA_MSG_CONFIRM
895 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
896 * CARequestInfo_t *requestInfo)
898 * @test_data Request Messages Request message of type CA_MSG_CONFIRM
899 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
900 * Select Network by CASelectNetwork API 3. [Server] Call
901 * CARegisterHandler to register handler 4. [Server] Call
902 * CAStartListeningServer to start server 5. [Server] Call
903 * CAHandleRequestResponse periodically to recieve client
904 * request 6. [Client] Call CAInitialize to initialize CA 7.
905 * [Client] Select Network by CASelectNetwork API 8. [Client]
906 * Call CARegisterHandler to register handler 9. [Client]
907 * Call CAStartDiscoveryServer 10.[Client] Call
908 * CAGenerateToken to generate token 11.[Client] Call
909 * CACreateEndpoint to create endpoint for server
910 * @procedure 1. [Client] Set CAMessageType_t as CA_MSG_CONFIRM while
911 * forming CAInfo_t 2. [Client] Attempt to send 1 request, the
912 * server simulator will ignore it 3. [Client] Auto
913 * retransmission should occur 4. [Server] The server simulator
914 * is expected to respond to it with type CA_MSG_ACKNOWLEDGE 5.
915 * [Client] Attempt to receive the acknowledgement from server
916 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
917 * [CLient] Terminate CA
918 * @expected The request message should be acknowledged
920 public void testLeSendRequestWithMessageTypeConfirm_P() {
922 if (!CAJni.establishConnectionWithServer()) {
928 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_PAYLOAD,
931 if (!CAJni.initClientNetwork()) {
936 if (!CAJni.sendRequest(URI_TYPE_NORMAL, PAYLOAD_TYPE_NORMAL,
937 CA_MSG_CONFIRM, CA_PUT, HEADER_NONE, false)) {
943 if (!CAJni.checkReceiveCount(1)) {
952 * @see CAResult_t CAInitialize()
953 * @see void CARegisterHandler(CARequestCallback ReqHandler,
954 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
955 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
956 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
957 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
958 * CAEndpoint_t **object)
959 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
960 * @see void CADestroyEndpoint(CAEndpoint_t *object)
961 * @see void CADestroyToken(CAToken_t token)
962 * @see CAResult_t CAHandleRequestResponse()
963 * @see void CATerminate()
964 * @objective Test unicast message sending functionality using wrong
966 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
967 * CARequestInfo_t *requestInfo)
969 * @test_data Request Messages Wrong endpoint URI
970 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
971 * Select Network by CASelectNetwork API 3. [Server] Call
972 * CARegisterHandler to register handler 4. [Server] Call
973 * CAStartListeningServer to start server 5. [Server] Call
974 * CAHandleRequestResponse periodically to recieve client
975 * request 6. [Client] Call CAInitialize to initialize CA 7.
976 * [Client] Select Network by CASelectNetwork API 8. [Client]
977 * Call CARegisterHandler to register handler 9. [Client]
978 * Call CAStartDiscoveryServer 10.[Client] Call
979 * CAGenerateToken to generate token 11.[Client] Call
980 * CACreateEndpoint to create endpoint from a wrong URI which
981 * does not belong to the server
982 * @procedure 1. [Client] Attempt to send a certain amount of request
983 * messages to the server 2. [Client] Attempt to receive
984 * acknowledgments for all the sent messages 3. [Client] Check
985 * and compare the amount of received acknowledgments with zero
986 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
987 * [CLient] Terminate CA
988 * @expected The received amount should be zero
990 public void testLeSendRequestWithWrongEndpoint_N() {
992 if (!CAJni.establishConnectionWithServer()) {
997 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_PAYLOAD,
1000 if (!CAJni.initClientNetwork()) {
1005 if (!CAJni.sendRequest(URI_TYPE_ARBITRARY_ENDPOINT,
1006 PAYLOAD_TYPE_NORMAL, CA_MSG_NONCONFIRM, CA_PUT, HEADER_NONE,
1013 if (!CAJni.checkReceiveCount(0)) {
1022 * @see CAResult_t CAInitialize()
1023 * @see void CARegisterHandler(CARequestCallback ReqHandler,
1024 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
1025 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
1026 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
1027 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
1028 * CAEndpoint_t **object)
1029 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
1030 * @see void CADestroyEndpoint(CAEndpoint_t *object)
1031 * @see void CADestroyToken(CAToken_t token)
1032 * @see CAResult_t CAHandleRequestResponse()
1033 * @see void CATerminate()
1034 * @objective Test unicast message retransmission functionality using
1036 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
1037 * CARequestInfo_t *requestInfo)
1038 * @transport bt, ble
1039 * @test_data Request Messages Request message of invalid method
1040 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
1041 * Select Network by CASelectNetwork API 3. [Server] Call
1042 * CARegisterHandler to register handler 4. [Server] Call
1043 * CAStartListeningServer to start server 5. [Server] Call
1044 * CAHandleRequestResponse periodically to recieve client
1045 * request 6. [Client] Call CAInitialize to initialize CA 7.
1046 * [Client] Select Network by CASelectNetwork API 8. [Client]
1047 * Call CARegisterHandler to register handler 9. [Client]
1048 * Call CAStartDiscoveryServer 10.[Client] Call
1049 * CAGenerateToken to generate token 11.[Client] Call
1050 * CACreateEndpoint to create endpoint for server
1051 * @procedure 1. [Client] Set meythodas CA_INVALID while forming CAInfo_t 2.
1052 * [Client] Attempt to send 1 request, the server simulator will
1053 * ignore it 3. [Client] Auto retransmission should occur 4.
1054 * [Server] The server simulator is expected to respond to it
1055 * with type CA_MSG_ACKNOWLEDGE 5. [Client] Attempt to receive
1056 * the acknowledgement from server
1057 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
1058 * [CLient] Terminate CA
1059 * @expected The request message should be acknowledged
1061 public void testLeSendRequestWithInvalidMethod_N() {
1063 if (!CAJni.establishConnectionWithServer()) {
1069 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_PAYLOAD,
1072 if (!CAJni.initClientNetwork()) {
1077 if (!CAJni.sendRequest(URI_TYPE_NORMAL, PAYLOAD_TYPE_NORMAL,
1078 CA_MSG_NONCONFIRM, CA_INVALID, HEADER_NONE, false)) {
1084 if (!CAJni.checkReceiveCount(0)) {
1093 * @see CAResult_t CAInitialize()
1094 * @see void CARegisterHandler(CARequestCallback ReqHandler,
1095 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
1096 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
1097 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
1098 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
1099 * CAEndpoint_t **object)
1100 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
1101 * @see void CADestroyEndpoint(CAEndpoint_t *object)
1102 * @see void CADestroyToken(CAToken_t token)
1103 * @see CAResult_t CAHandleRequestResponse()
1104 * @see void CATerminate()
1105 * @objective Test unicast message sending functionality by sending out GET
1107 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
1108 * CARequestInfo_t *requestInfo)
1109 * @transport bt, ble
1110 * @test_data Request Messages Request messages with method GET
1111 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
1112 * Select Network by CASelectNetwork API 3. [Server] Call
1113 * CARegisterHandler to register handler 4. [Server] Call
1114 * CAStartListeningServer to start server 5. [Server] Call
1115 * CAHandleRequestResponse periodically to recieve client
1116 * request 6. [Client] Call CAInitialize to initialize CA 7.
1117 * [Client] Select Network by CASelectNetwork API 8. [Client]
1118 * Call CARegisterHandler to register handler 9. [Client]
1119 * Call CAStartDiscoveryServer 10.[Client] Call
1120 * CAGenerateToken to generate token 11.[Client] Call
1121 * CACreateEndpoint to create endpoint for server
1122 * @procedure 1. [Client] Set CA_GET for CAMethod_t while forming
1123 * CARequestInfo_t 2. [Client] Attempt to send a certain amount
1124 * of request messages to the server 3. [Client] Attempt to
1125 * receive acknowledgments for all the sent messages 4. [Client]
1126 * Check and compare the amount of received acknowledgments with
1127 * the amount of sent messages
1128 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
1129 * [CLient] Terminate CA
1130 * @expected The number of acknowledgments should be equal to the amount of
1133 public void testLeSendGetRequest_P() {
1135 if (!CAJni.establishConnectionWithServer()) {
1140 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_PAYLOAD,
1143 if (!CAJni.initClientNetwork()) {
1148 if (!CAJni.sendRequest(URI_TYPE_NORMAL, PAYLOAD_TYPE_NORMAL,
1149 CA_MSG_NONCONFIRM, CA_GET, HEADER_NONE, false)) {
1155 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
1164 * @see CAResult_t CAInitialize()
1165 * @see void CARegisterHandler(CARequestCallback ReqHandler,
1166 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
1167 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
1168 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
1169 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
1170 * CAEndpoint_t **object)
1171 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
1172 * @see void CADestroyEndpoint(CAEndpoint_t *object)
1173 * @see void CADestroyToken(CAToken_t token)
1174 * @see CAResult_t CAHandleRequestResponse()
1175 * @see void CATerminate()
1176 * @objective Test unicast message sending functionality by sending out PUT
1178 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
1179 * CARequestInfo_t *requestInfo)
1180 * @transport bt, ble
1181 * @test_data Request Messages Request messages with method PUT
1182 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
1183 * Select Network by CASelectNetwork API 3. [Server] Call
1184 * CARegisterHandler to register handler 4. [Server] Call
1185 * CAStartListeningServer to start server 5. [Server] Call
1186 * CAHandleRequestResponse periodically to recieve client
1187 * request 6. [Client] Call CAInitialize to initialize CA 7.
1188 * [Client] Select Network by CASelectNetwork API 8. [Client]
1189 * Call CARegisterHandler to register handler 9. [Client]
1190 * Call CAStartDiscoveryServer 10.[Client] Call
1191 * CAGenerateToken to generate token 11.[Client] Call
1192 * CACreateEndpoint to create endpoint for server
1193 * @procedure 1. [Client] Set CA_PUT for CAMethod_t while forming
1194 * CARequestInfo_t 2. [Client] Attempt to send a certain amount
1195 * of request messages to the server 3. [Client] Attempt to
1196 * receive acknowledgments for all the sent messages 4. [Client]
1197 * Check and compare the amount of received acknowledgments with
1198 * the amount of sent messages
1199 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
1200 * [CLient] Terminate CA
1201 * @expected The number of acknowledgments should be equal to the amount of
1204 public void testLeSendPutRequest_P() {
1206 if (!CAJni.establishConnectionWithServer()) {
1212 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_PAYLOAD,
1215 if (!CAJni.initClientNetwork()) {
1220 if (!CAJni.sendRequest(URI_TYPE_NORMAL, PAYLOAD_TYPE_NORMAL,
1221 CA_MSG_NONCONFIRM, CA_PUT, HEADER_NONE, false)) {
1227 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
1236 * @see CAResult_t CAInitialize()
1237 * @see void CARegisterHandler(CARequestCallback ReqHandler,
1238 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
1239 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
1240 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
1241 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
1242 * CAEndpoint_t **object)
1243 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
1244 * @see void CADestroyEndpoint(CAEndpoint_t *object)
1245 * @see void CADestroyToken(CAToken_t token)
1246 * @see CAResult_t CAHandleRequestResponse()
1247 * @see void CATerminate()
1248 * @objective Test unicast message sending functionality by sending out POST
1250 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
1251 * CARequestInfo_t *requestInfo)
1252 * @transport bt, ble
1253 * @test_data Request Messages Request messages with method POST
1254 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
1255 * Select Network by CASelectNetwork API 3. [Server] Call
1256 * CARegisterHandler to register handler 4. [Server] Call
1257 * CAStartListeningServer to start server 5. [Server] Call
1258 * CAHandleRequestResponse periodically to recieve client
1259 * request 6. [Client] Call CAInitialize to initialize CA 7.
1260 * [Client] Select Network by CASelectNetwork API 8. [Client]
1261 * Call CARegisterHandler to register handler 9. [Client]
1262 * Call CAStartDiscoveryServer 10.[Client] Call
1263 * CAGenerateToken to generate token 11.[Client] Call
1264 * CACreateEndpoint to create endpoint for server
1265 * @procedure 1. [Client] Set CA_POST for CAMethod_t while forming
1266 * CARequestInfo_t 2. [Client] Attempt to send a certain amount
1267 * of request messages to the server 3. [Client] Attempt to
1268 * receive acknowledgments for all the sent messages 4. [Client]
1269 * Check and compare the amount of received acknowledgments with
1270 * the amount of sent messages
1271 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
1272 * [CLient] Terminate CA
1273 * @expected The number of acknowledgments should be equal to the amount of
1276 public void testLeSendPostRequest_P() {
1278 if (!CAJni.establishConnectionWithServer()) {
1284 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_PAYLOAD,
1287 if (!CAJni.initClientNetwork()) {
1292 if (!CAJni.sendRequest(URI_TYPE_NORMAL, PAYLOAD_TYPE_NORMAL,
1293 CA_MSG_NONCONFIRM, CA_POST, HEADER_NONE, false)) {
1299 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
1308 * @see CAResult_t CAInitialize()
1309 * @see void CARegisterHandler(CARequestCallback ReqHandler,
1310 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
1311 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
1312 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
1313 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
1314 * CAEndpoint_t **object)
1315 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
1316 * @see void CADestroyEndpoint(CAEndpoint_t *object)
1317 * @see void CADestroyToken(CAToken_t token)
1318 * @see CAResult_t CAHandleRequestResponse()
1319 * @see void CATerminate()
1320 * @objective Test unicast message sending functionality by sending out
1321 * DELETE request messages
1322 * @target CAResult_t CASendRequest(const CAEndpoint_t *object, const
1323 * CARequestInfo_t *requestInfo)
1324 * @transport bt, ble
1325 * @test_data Request Messages Request messages with method DELETE
1326 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
1327 * Select Network by CASelectNetwork API 3. [Server] Call
1328 * CARegisterHandler to register handler 4. [Server] Call
1329 * CAStartListeningServer to start server 5. [Server] Call
1330 * CAHandleRequestResponse periodically to recieve client
1331 * request 6. [Client] Call CAInitialize to initialize CA 7.
1332 * [Client] Select Network by CASelectNetwork API 8. [Client]
1333 * Call CARegisterHandler to register handler 9. [Client]
1334 * Call CAStartDiscoveryServer 10.[Client] Call
1335 * CAGenerateToken to generate token 11.[Client] Call
1336 * CACreateEndpoint to create endpoint for server
1337 * @procedure 1. [Client] Set CA_DELETE for CAMethod_t while forming
1338 * CARequestInfo_t 2. [Client] Attempt to send a certain amount
1339 * of request messages to the server 3. [Client] Attempt to
1340 * receive acknowledgments for all the sent messages 4. [Client]
1341 * Check and compare the amount of received acknowledgments with
1342 * the amount of sent messages
1343 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
1344 * [CLient] Terminate CA
1345 * @expected The number of acknowledgments should be equal to the amount of
1348 public void testLeSendDeleteRequest_P() {
1350 if (!CAJni.establishConnectionWithServer()) {
1356 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_PAYLOAD,
1359 if (!CAJni.initClientNetwork()) {
1364 if (!CAJni.sendRequest(URI_TYPE_NORMAL, PAYLOAD_TYPE_NORMAL,
1365 CA_MSG_NONCONFIRM, CA_DELETE, HEADER_NONE, false)) {
1371 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
1380 * @see CAResult_t CAInitialize()
1381 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
1382 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
1383 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
1384 * CAEndpoint_t **object)
1385 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
1386 * @see CAResult_t CASendRequest(const CAEndpoint_t *object, const
1387 * CARequestInfo_t *requestInfo)
1388 * @see void CADestroyEndpoint(CAEndpoint_t *object)
1389 * @see void CADestroyToken(CAToken_t token)
1390 * @see CAResult_t CAHandleRequestResponse()
1391 * @see void CATerminate()
1392 * @objective Test 'CARegisterHandler' by registering null response handler
1393 * @target void CARegisterHandler(CARequestCallback ReqHandler,
1394 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
1395 * @transport bt, ble
1396 * @test_data Request Messages null response handler
1397 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
1398 * Select Network by CASelectNetwork API 3. [Server] Call
1399 * CARegisterHandler to register handler 4. [Server] Call
1400 * CAStartListeningServer to start server 5. [Server] Call
1401 * CAHandleRequestResponse periodically to recieve client
1402 * request 6. [Client] Call CAInitialize to initialize CA 7.
1403 * [Client] Select Network by CASelectNetwork API 8. [Client]
1404 * Call CAGenerateToken to generate token 9. [Client] Call
1405 * CACreateEndpoint to create endpoint for server
1406 * @procedure 1. [Client] Call CARegisterHandler with Null Response Handler
1407 * 2. [Server] Configure the server with a request to send back a
1408 * certain amount of response messages 3. [Client] Attempt to
1409 * receive a certain amount of unicast response messages from the
1410 * server 4. [Client] Check and compare the received amount with
1412 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
1413 * [CLient] Terminate CA
1414 * @expected No response messages should be received
1416 public void testLeReceiveWithNullResponseHandler_N() {
1418 if (!CAJni.establishConnectionWithServer()) {
1424 CAJni.setupTestCase(MESSAGE_INCOMING, MESSAGE_PAYLOAD,
1427 if (!CAJni.initNetwork()) {
1432 CAJni.registerHandler(HANDLER_NORMAL, HANDLER_NULL);
1434 if (!CAJni.sendConfigurationRequest(SEND_MESSAGE,
1435 MESSAGE_RESPONSE, CA_PUT)) {
1441 if (!CAJni.checkReceiveCount(0)) {
1450 * @see CAResult_t CAInitialize()
1451 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
1452 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
1453 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
1454 * CAEndpoint_t **object)
1455 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
1456 * @see CAResult_t CASendRequest(const CAEndpoint_t *object, const
1457 * CARequestInfo_t *requestInfo)
1458 * @see void CADestroyEndpoint(CAEndpoint_t *object)
1459 * @see void CADestroyToken(CAToken_t token)
1460 * @see void CATerminate()
1461 * @objective Test the impact or consequence of not calling
1462 * CARegisterHandler Test in receiving response
1463 * @target CAResult_t CAHandleRequestResponse()
1464 * @transport bt, ble
1465 * @test_data Request Messages none
1466 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
1467 * Select Network by CASelectNetwork API 3. [Server] Call
1468 * CARegisterHandler to register handler 4. [Server] Call
1469 * CAStartListeningServer to start server 5. [Server] Call
1470 * CAHandleRequestResponse periodically to recieve client
1471 * request 6. [Client] Call CAInitialize to initialize CA 7.
1472 * [Client] Select Network by CASelectNetwork API 8. [Client]
1473 * Do not Register the handler 9. [Client] Call
1474 * CAGenerateToken to generate token 10. [Client] Call
1475 * CACreateEndpoint to create endpoint for server
1476 * @procedure 1. [Server] Configure the server with a request to send back a
1477 * certain amount of response messages 2. [Client] Attempt to
1478 * receive the requested amount of unicast response messages from
1479 * the server 3. [Client] Check and compare the received amount
1481 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
1482 * [CLient] Terminate CA
1483 * @expected No response messages should be received
1485 public void testLeReceiveResponseWithoutCallingCARegisterHandler_N() {
1487 CAJni.setupTestCase(MESSAGE_OUTGOING, MESSAGE_PAYLOAD,
1490 if (!CAJni.initNetwork()) {
1495 if (!CAJni.sendRequestToAll(URI_TYPE_NORMAL,
1496 PAYLOAD_TYPE_NORMAL, CA_MSG_NONCONFIRM, CA_GET, HEADER_NONE)) {
1502 if (!CAJni.checkReceiveCount(0)) {
1512 * @see CAResult_t CAInitialize()
1513 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
1514 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
1515 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
1516 * CAEndpoint_t **object)
1517 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
1518 * @see CAResult_t CASendRequest(const CAEndpoint_t *object, const
1519 * CARequestInfo_t *requestInfo)
1520 * @see void CADestroyEndpoint(CAEndpoint_t *object)
1521 * @see void CADestroyToken(CAToken_t token)
1522 * @see CAResult_t CAHandleRequestResponse()
1523 * @see void CATerminate()
1524 * @objective Test 'CARegisterHandler' when registration is done twice by
1525 * using two different response handler
1526 * @target void CARegisterHandler(CARequestCallback ReqHandler,
1527 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
1528 * @transport bt, ble
1529 * @test_data Request Messages two different response handler
1530 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
1531 * Select Network by CASelectNetwork API 3. [Server] Call
1532 * CARegisterHandler to register handler 4. [Server] Call
1533 * CAStartListeningServer to start server 5. [Server] Call
1534 * CAHandleRequestResponse periodically to recieve client
1535 * request 6. [Client] Call CAInitialize to initialize CA 7.
1536 * [Client] Select Network by CASelectNetwork API
1537 * @procedure 1. [Client] Call CARegisterHandler twice with two different
1538 * Response Handler 2. [Client] Call CAStartDiscoveryServer 3.
1539 * [Client] Call CAGenerateToken to generate token 4. [Client]
1540 * Call CACreateEndpoint to create endpoint for server 5.
1541 * [Server] Configure the server with a request to send back a
1542 * certain amount of response messages 6. [Client] Attempt to
1543 * receive the requested amount of unicast response messages from
1544 * the server 7. [Client] Check and compare the received amount
1545 * by the both handler with the requested amount
1546 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
1547 * [CLient] Terminate CA
1548 * @expected Second handler will receive requested amount of response
1549 * messages and first handler will receive no response message
1551 public void testLeReceiveWithSecondResponseHandler_P() {
1553 if (!CAJni.establishConnectionWithServer()) {
1559 CAJni.setupTestCase(MESSAGE_INCOMING, MESSAGE_PAYLOAD,
1562 if (!CAJni.initNetwork()) {
1567 CAJni.registerHandler(HANDLER_NORMAL, HANDLER_NORMAL);
1568 CAJni.registerHandler(HANDLER_NORMAL, HANDLER_SECOND);
1570 if (!CAJni.startDiscoveryServer(CA_STATUS_OK)) {
1576 if (!CAJni.sendConfigurationRequest(SEND_MESSAGE,
1577 MESSAGE_RESPONSE, CA_PUT)) {
1583 if (!CAJni.checkReceiveCount(TOTAL_MESSAGE)) {
1592 * @see CAResult_t CAInitialize()
1593 * @see CAResult_t CAGenerateToken(CAToken_t *token, uint8_t tokenLength)
1594 * @see CAResult_t CACreateEndpoint(CATransportFlags_t flags,
1595 * CATransportAdapter_t adapter, const char *addr, uint16_t port,
1596 * CAEndpoint_t **object)
1597 * @see CAResult_t CASelectNetwork(const uint32_t interestedNetwork)
1598 * @see CAResult_t CASendRequest(const CAEndpoint_t *object, const
1599 * CARequestInfo_t *requestInfo)
1600 * @see void CADestroyEndpoint(CAEndpoint_t *object)
1601 * @see void CADestroyToken(CAToken_t token)
1602 * @see CAResult_t CAHandleRequestResponse()
1603 * @see void CATerminate()
1604 * @objective Test 'CARegisterHandler' by doing registration twice using
1605 * first a valid response handler then a null response handler
1606 * @target void CARegisterHandler(CARequestCallback ReqHandler,
1607 * CAResponseCallback RespHandler, CAErrorCallback ErrorHandler)
1608 * @transport bt, ble
1609 * @test_data Request Messages valid response handler & null response handler
1610 * @pre_condition 1. [Server] Call CAInitialize to initialize CA 2. [Server]
1611 * Select Network by CASelectNetwork API 3. [Server] Call
1612 * CARegisterHandler to register handler 4. [Server] Call
1613 * CAStartListeningServer to start server 5. [Server] Call
1614 * CAHandleRequestResponse periodically to recieve client
1615 * request 6. [Client] Call CAInitialize to initialize CA 7.
1616 * [Client] Select Network by CASelectNetwork API
1617 * @procedure 1. [Client] Call CARegisterHandler twice by using first a
1618 * valid response handler then a null response handler 2.
1619 * [Client] Call CAStartDiscoveryServer 3. [Client] Call
1620 * CAGenerateToken to generate token 4. [Client] Call
1621 * CACreateEndpoint to create endpoint for server 5. [Server]
1622 * Configure the server with a request to send back a certain
1623 * amount of response messages 6. [Client] Attempt to receive the
1624 * requested amount of unicast response messages from the server
1625 * 7. [Client] Check and compare the received amount wit zero
1626 * @post_condition 1. [Client] Destroy token 2. [Client] Destroy endpoint 3.
1627 * [CLient] Terminate CA
1628 * @expected No response messages should be received
1630 public void testLeReceiveAfterRegisteringWithValidFollowedByNullResponseHandler_N() {
1632 if (!CAJni.establishConnectionWithServer()) {
1638 CAJni.setupTestCase(MESSAGE_INCOMING, MESSAGE_PAYLOAD,
1641 if (!CAJni.initNetwork()) {
1646 CAJni.registerHandler(HANDLER_NORMAL, HANDLER_NORMAL);
1648 CAJni.registerHandler(HANDLER_NORMAL, HANDLER_NULL);
1650 if (!CAJni.sendConfigurationRequest(SEND_MESSAGE,
1651 MESSAGE_RESPONSE, CA_PUT)) {
1657 if (!CAJni.checkReceiveCount(0)) {