summaryrefslogtreecommitdiff
path: root/CIAO/connectors/dds4ccm/tests/Getter/Receiver/Getter_Test_Receiver_exec.cpp
blob: bd20a56aec6ba4c0bb39831a5682572785712441 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
// -*- C++ -*-
/**
 * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.3
 * TAO and the TAO IDL Compiler have been developed by:
 *       Center for Distributed Object Computing
 *       Washington University
 *       St. Louis, MO
 *       USA
 *       http://www.cs.wustl.edu/~schmidt/doc-center.html
 * and
 *       Distributed Object Computing Laboratory
 *       University of California at Irvine
 *       Irvine, CA
 *       USA
 * and
 *       Institute for Software Integrated Systems
 *       Vanderbilt University
 *       Nashville, TN
 *       USA
 *       http://www.isis.vanderbilt.edu/
 *
 * Information about TAO is available at:
 *     http://www.dre.vanderbilt.edu/~schmidt/TAO.html
 **/

#include "Getter_Test_Receiver_exec.h"
#include "tao/ORB_Core.h"
#include "ace/Reactor.h"
#include "ace/OS_NS_sys_time.h"
#include "dds4ccm/impl/dds4ccm_conf.h"
#include "dds4ccm/impl/dds4ccm_utils.h"

namespace CIAO_Getter_Test_Receiver_Impl
{

  /**
   * Facet Executor Implementation Class: info_get_status_exec_i
   */

  info_get_status_exec_i::info_get_status_exec_i (
        ::Getter_Test::CCM_Receiver_Context_ptr ctx)
    : ciao_context_ (
        ::Getter_Test::CCM_Receiver_Context::_duplicate (ctx))
  {
  }

  info_get_status_exec_i::~info_get_status_exec_i (void)
  {
  }

  // Operations from ::CCM_DDS::PortStatusListener

  void
  info_get_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */,
  const ::DDS::RequestedDeadlineMissedStatus & /* status */)
  {
    /* Your code here. */
  }

  void
  info_get_status_exec_i::on_sample_lost (::DDS::DataReader_ptr /* the_reader */,
  const ::DDS::SampleLostStatus & /* status */)
  {
    /* Your code here. */
  }

  /**
   * Facet Executor Implementation Class: info_fixed_status_exec_i
   */

  info_fixed_status_exec_i::info_fixed_status_exec_i (
        ::Getter_Test::CCM_Receiver_Context_ptr ctx)
    : ciao_context_ (
        ::Getter_Test::CCM_Receiver_Context::_duplicate (ctx))
  {
  }

  info_fixed_status_exec_i::~info_fixed_status_exec_i (void)
  {
  }

  // Operations from ::CCM_DDS::PortStatusListener

  void
  info_fixed_status_exec_i::on_requested_deadline_missed (::DDS::DataReader_ptr /* the_reader */,
  const ::DDS::RequestedDeadlineMissedStatus & /* status */)
  {
    /* Your code here. */
  }

  void
  info_fixed_status_exec_i::on_sample_lost (::DDS::DataReader_ptr /* the_reader */,
  const ::DDS::SampleLostStatus & /* status */)
  {
    /* Your code here. */
  }

  /**
   * Facet Executor Implementation Class: getter_invoke_exec_i
   */

  getter_invoke_exec_i::getter_invoke_exec_i (
        ::Getter_Test::CCM_Receiver_Context_ptr ctx,
        Receiver_exec_i & callback)
    : ciao_context_ (
        ::Getter_Test::CCM_Receiver_Context::_duplicate (ctx))
      , callback_ (callback)
  {
  }

  getter_invoke_exec_i::~getter_invoke_exec_i (void)
  {
  }

  // Operations from ::GetInvoker

  void
  getter_invoke_exec_i::start_timeout_get_one (void)
  {
    this->callback_.timeout_get_one ();
  }

  void
  getter_invoke_exec_i::start_timeout_get_many (void)
  {
    this->callback_.timeout_get_many ();
  }

  void
  getter_invoke_exec_i::start_get_one (const char * key,
  ::CORBA::Long fixed_key,
  ::CORBA::Long iteration)
  {
    this->callback_.start_get_one (key, fixed_key, iteration);
  }

  void
  getter_invoke_exec_i::start_get_many (::CORBA::Short keys,
  ::CORBA::Long iterations)
  {
    this->callback_.start_get_many (keys, iterations);
  }

  /**
   * GetOneHandler
   */
  GetOneHandler::GetOneHandler (Receiver_exec_i &callback,
                                const char * key,
                                CORBA::Long fixed_key,
                                CORBA::Long iteration)
    : callback_ (callback)
      , key_ (CORBA::string_dup (key))
      , fixed_key_ (fixed_key)
      , iteration_ (iteration)
  {
    this->reference_counting_policy ().value (
      ACE_Event_Handler::Reference_Counting_Policy::ENABLED);

  }

  GetOneHandler::~GetOneHandler (void)
  {
  }

  int
  GetOneHandler::handle_exception (ACE_HANDLE)
  {
    this->callback_.get_one (this->key_.in (), this->fixed_key_, this->iteration_);
    return 0;
  }

  /**
   * GetManyHandler
   */
  GetManyHandler::GetManyHandler (Receiver_exec_i &callback,
                                  CORBA::UShort keys,
                                  CORBA::Long iterations)
    : callback_ (callback),
      keys_ (keys),
      iterations_ (iterations)
  {
    this->reference_counting_policy ().value (
      ACE_Event_Handler::Reference_Counting_Policy::ENABLED);
  }

  GetManyHandler::~GetManyHandler (void)
  {
  }

  int
  GetManyHandler::handle_exception (ACE_HANDLE)
  {
    this->callback_.get_many (this->keys_, this->iterations_);
    return 0;
  }

  /**
   * Component Executor Implementation Class: Receiver_exec_i
   */

  Receiver_exec_i::Receiver_exec_i (void) :
    fixed_handle_ (DDS::HANDLE_NIL),
    variable_handle_ (DDS::HANDLE_NIL)
  {
  }

  Receiver_exec_i::~Receiver_exec_i (void)
  {
  }

  // Supported operations and attributes.
  ACE_Reactor*
  Receiver_exec_i::reactor (void)
  {
    ACE_Reactor* reactor = 0;
    ::CORBA::Object_var ccm_object =
      this->ciao_context_->get_CCM_object();
    if (! ::CORBA::is_nil (ccm_object.in ()))
      {
        ::CORBA::ORB_var orb = ccm_object->_get_orb ();
        if (! ::CORBA::is_nil (orb.in ()))
          {
            reactor = orb->orb_core ()->reactor ();
          }
      }
    if (reactor == 0)
      {
        throw ::CORBA::INTERNAL ();
      }
    return reactor;
  }

  void
  Receiver_exec_i::start_get_one (const char * key,
                                  CORBA::Long fixed_key,
                                  CORBA::Long iteration)
  {
    GetOneHandler* rh = new GetOneHandler (*this,
                                           key,
                                           fixed_key,
                                           iteration);
    ACE_Event_Handler_var safe_event_handler (rh);
    this->reactor ()->notify (rh);
  }

  void
  Receiver_exec_i::start_get_many (CORBA::Short keys,
                         CORBA::Long iterations)
  {
    GetManyHandler* rh = new  GetManyHandler (*this, keys, iterations);
    ACE_Event_Handler_var safe_event_handler (rh);
    this->reactor ()->notify (rh);
 }

  void
  Receiver_exec_i::get_many (CORBA::Short keys , CORBA::Long iterations)
  {
    // this is very hard to test in a controlled environment.
    // When data arrives in DDS, the waiting ends and the
    // Getter starts to read the data. In this test we expected
    // therefor more then one, and less then but not exactly max_delivered_data.
    // On the other hand, when the user want to have all the
    // samples in DDS, one shouldn't use the wait method.
    // Since the spec is not clear about this, the test will
    // pass when at least one sample is returned.
     ::Getter_Test::GetterTestConnector::Getter_var getter =
      this->ciao_context_->get_connection_info_get_fresh_data ();

    DDS::Duration_t to;
    to.sec = 20;
    to.nanosec = 0;
    getter->time_out (to);
    getter->max_delivered_data (40);
    ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::get_many: "
                          "Start getting data from DDS: "
                          "#keys <%d> - #iterations <%d> with timeout: "
                          "sec <%d> - nanosec <%u>\n",
                          keys, iterations,
                          getter->time_out ().sec,
                          getter->time_out ().nanosec));

    GetterTestSeq gettertest_seq;
    ::CCM_DDS::ReadInfoSeq readinfo;
    bool const result = getter->get_many (gettertest_seq, readinfo);
    if (result)
      {
        if (gettertest_seq.length () == 0)
          {
            ACE_ERROR ((LM_ERROR, "Receiver_exec_i::get_many: "
                                  "No data returned. "
                                  "number of samples: "
                                  "expected at least one - received <0>\n"));
          }
        if (gettertest_seq.length () == 1)
          {
            ACE_ERROR ((LM_ERROR, "Receiver_exec_i::get_many: "
                                  "Not enough data returned. "
                                  "number of samples: "
                                  "expected at least two - received <1>\n"));
          }
        if (gettertest_seq.length () > 40)
          {
            ACE_ERROR ((LM_ERROR, "Receiver_exec_i::get_many: "
                                  "To much data returned. "
                                  "number of samples: "
                                  "expected not more then 40 - received <1>\n"));
           }
        for (CORBA::ULong i = 0; i < gettertest_seq.length (); ++i)
          {
            ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::get_many: "
                                  "Returned data : key <%C> - iteration <%d> - handle "
                                  DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER
                                  "\n",
                                  gettertest_seq[i].key.in (),
                                  gettertest_seq[i].iteration,
                                  DDS_INSTANCE_HANDLE_LOG(readinfo[i].instance_handle)));
          }
      }
    else
      {
        ACE_ERROR ((LM_ERROR, "ERROR: GET MANY: "
                              "Time out occurred\n"));
      }
    // Wait a while before reading.
    ACE_Time_Value tv (3, 0);
    ACE_OS::sleep (tv);
    this->read_many (keys, iterations, gettertest_seq);
  }

  void
  Receiver_exec_i::read_many (CORBA::Short keys ,
                              CORBA::Long iterations,
                              const GetterTestSeq& gettertest_seq)
  {
    ::Getter_Test::GetterTestConnector::Reader_var reader =
      this->ciao_context_->get_connection_info_get_data ();

    GetterTestSeq read_seq;
    ::CCM_DDS::ReadInfoSeq readinfos;
    ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::read_many - "
                "Start checking samples in DDS\n"));
    reader->read_all (read_seq, readinfos);
    // we expect all samples written during the test for get one (KEY_1)
    // AND all samples written during the test for get many (number of keys)
    ::CORBA::ULong expected =
      static_cast < ::CORBA::ULong > (iterations * (keys + 1));
    if (read_seq.length () != expected)
      {
        ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::read_many - "
                              "Unexpected number of samples received: "
                              "expected <%d> - received <%u>\n",
                              expected, read_seq.length ()));
      }
    for (::CORBA::ULong i = 0; i < read_seq.length (); ++i)
      {
        ACE_DEBUG ((LM_DEBUG, "READ ALL : Receiver_exec_i::read_many - "
                              "Sample received: key <%C> - iteration <%d> - "
                              "sample_read_state <%C>\n",
                              read_seq[i].key.in (),
                              read_seq[i].iteration,
                              CIAO::DDS4CCM::translate_ccm_dds_accessstatus (readinfos[i].access_status)));
      }

    for (::CORBA::Short key = 0; key < keys; ++key)
      {
        ::CORBA::Long iter = 0;
        char str_key[8];
        ACE_OS::sprintf (str_key, "KEY_%d", key + 1);
        for (::CORBA::ULong i = 0; i < read_seq.length (); ++i)
          {
            if (ACE_OS::strcmp (read_seq[i].key.in (), str_key) == 0)
              ++iter;
            if (iter > iterations)
              ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::read_many - "
                          "Unexpected number of iterations received "
                          "for key <%C>: <%d>\n",
                          str_key,
                          iter));
          }
      }
    // check which sample states should be ALREADY_SEEN/FRESH_INFO
    for (::CORBA::ULong readed = 0; readed < read_seq.length (); ++readed)
      {
        ::CCM_DDS::AccessStatus received_access_status =
          readinfos[readed].access_status;
        bool found = false;

        for (::CORBA::ULong got = 0;
             got < gettertest_seq.length () && !found;
             ++got)
          {
            if (ACE_OS::strcmp (read_seq[readed].key.in (),
                                gettertest_seq[got].key.in ()) == 0 &&
                read_seq[readed].iteration == gettertest_seq[got].iteration)
              {
                found = true;
                if (received_access_status != ::CCM_DDS::ALREADY_SEEN)
                  {
                    ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::read_many - "
                                "Unexpected access state received: "
                                "expected <%C> - received <%C>\n",
                                CIAO::DDS4CCM::translate_ccm_dds_accessstatus (::CCM_DDS::ALREADY_SEEN),
                                CIAO::DDS4CCM::translate_ccm_dds_accessstatus (received_access_status)));
                  }
              }
          }
        // Samples which are not read by get_many or get_one (the samples belonging to
        // KEY_1), should have FRESH_INFO as access status.
        if (!found && ACE_OS::strcmp (read_seq[readed].key.in (), "KEY_1") != 0)
          {
            if (received_access_status != ::CCM_DDS::FRESH_INFO)
              {
                ACE_ERROR ((LM_ERROR, "ERROR: Receiver_exec_i::read_many - "
                            "Unexpected access state received for sample "
                            "<%C>:<%d> : "
                            "expected <%C> - received <%C>\n",
                            read_seq[readed].key.in (),
                            read_seq[readed].iteration,
                            CIAO::DDS4CCM::translate_ccm_dds_accessstatus (::CCM_DDS::FRESH_INFO),
                            CIAO::DDS4CCM::translate_ccm_dds_accessstatus (received_access_status)));
              }
          }
      }
  }


  void
  Receiver_exec_i::get_one_fixed (CORBA::Long fixed_key, CORBA::Long iteration)
  {
    ::Getter_Test::GetterFixedConnector::Getter_var fixed =
      this->ciao_context_->get_connection_info_fixed_fresh_data ();

    DDS::Duration_t to;
    to.sec = 5;
    to.nanosec = 0;
    fixed->time_out (to);
    ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::get_one_fixed: "
                          "Start getting data from DDS: "
                          "key <%u> - iteration <%d> "
                          " with timeout: "
                          "sec <%u> - nanosec <%u>\n",
                          fixed_key, iteration,
                          fixed->time_out ().sec,
                          fixed->time_out ().nanosec));
    GetterFixed gettertest_info;
    ::CCM_DDS::ReadInfo readinfo;
    ACE_Time_Value const tv = ACE_OS::gettimeofday ();
    CORBA::Boolean const result = fixed->get_one (gettertest_info, readinfo);
    if (result)
      {
        if (this->fixed_handle_ == DDS::HANDLE_NIL)
          {
            this->fixed_handle_ = readinfo.instance_handle;
          }
        ACE_Time_Value dur = ACE_OS::gettimeofday () - tv;
        ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::get_one_fixed: "
                               "get_one took <%#T>\n",
                               &dur));
        if (gettertest_info.key != fixed_key)
          {
            ACE_ERROR ((LM_ERROR, "ERROR FIXED: GET ONE: "
                                  "Expected key does "
                                  "not match received key: "
                                  "expected <%u> - received <%C>\n",
                                  fixed_key,
                                  gettertest_info.key));
          }
        if (gettertest_info.iteration != iteration)
          {
            ACE_ERROR ((LM_ERROR, "ERROR FIXED: GET ONE: "
                                  "Expected iteration does "
                                  "not match received iteration: "
                                  "expected <%d> - received <%d>\n",
                                  iteration,
                                  gettertest_info.iteration));
          }
        // check readinfo struct.
        if ((readinfo.instance_handle != ::DDS::HANDLE_NIL) &&
            (this->fixed_handle_ != readinfo.instance_handle))
          {
            ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR FIXED: GET MANY: ")
                    ACE_TEXT ("received instance handle should be nil or not change ")
                    ACE_TEXT ("for unkeyed data: ")
                    ACE_TEXT ("key <%u> - iteration <%u> handle ")
                    DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER
                    ACE_TEXT ("\n"),
                    gettertest_info.key,
                    gettertest_info.iteration,
                    DDS_INSTANCE_HANDLE_LOG(readinfo.instance_handle)));
          }
        if (readinfo.source_timestamp.sec == 0 &&
            readinfo.source_timestamp.nanosec == 0)
          {
            ACE_ERROR ((LM_ERROR, "ERROR FIXED: READ ONE LAST: "
                                "source timestamp seems to be invalid (nil) "
                                "key <%u> - iteration <%d>\n",
                                gettertest_info.key,
                                gettertest_info.iteration));
          }
        ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::get_one_fixed: "
                              "Returned data : key <%u> - iteration <%d>\n",
                              gettertest_info.key,
                              gettertest_info.iteration));
      }
    else
      {
        ACE_ERROR ((LM_ERROR, "ERROR FIXED: GET ONE: "
                              "Time out while waiting for "
                              "key <%u> - iteration <%d>\n",
                              fixed_key,
                              iteration));
      }
  }

  void
  Receiver_exec_i::get_one_variable (const char * key, CORBA::Long iteration)
  {
    ::Getter_Test::GetterTestConnector::Getter_var getter =
      this->ciao_context_->get_connection_info_get_fresh_data ();

    DDS::Duration_t to;
    to.sec = 5;
    to.nanosec = 0;
    getter->time_out (to);
    ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::get_one_variable: "
                          "Start getting data from DDS: "
                          "key <%C> - iteration <%d> "
                          " with timeout: "
                          "sec <%d> - nanosec <%u>\n",
                          key, iteration,
                          getter->time_out ().sec,
                          getter->time_out ().nanosec));
    GetterTest_var gettertest_info;
    ::CCM_DDS::ReadInfo readinfo;
    ACE_Time_Value tv = ACE_OS::gettimeofday ();
    CORBA::Boolean const result = getter->get_one (gettertest_info.out (), readinfo);
    if (result)
      {
        if (this->variable_handle_ == DDS::HANDLE_NIL)
          {
            this->variable_handle_ = readinfo.instance_handle;
          }
        ACE_Time_Value dur = ACE_OS::gettimeofday () - tv;
        ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::get_one_variable: "
                               "get_one took <%#T>\n",
                               &dur));
        if (ACE_OS::strcmp (gettertest_info->key, key) != 0)
          {
            ACE_ERROR ((LM_ERROR, "ERROR VARIABLE: GET ONE: "
                                  "Expected key does "
                                  "not match received key: "
                                  "expected <%C> - received <%C>\n",
                                  key,
                                  gettertest_info->key.in ()));
          }
        if (gettertest_info->iteration != iteration)
          {
            ACE_ERROR ((LM_ERROR, "ERROR VARIABLE: GET ONE: "
                                  "Expected iteration does "
                                  "not match received iteration: "
                                  "expected <%d> - received <%d>\n",
                                  iteration,
                                  gettertest_info->iteration));
          }
        // check readinfo struct.
        if ((readinfo.instance_handle != ::DDS::HANDLE_NIL) &&
            (this->fixed_handle_ != readinfo.instance_handle))
          {
            ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR VARIABLE: GET MANY: ")
                    ACE_TEXT ("received instance handle should be nil or not change ")
                    ACE_TEXT ("for unkeyed data: ")
                    ACE_TEXT ("key <%C> - iteration <%u> - handle ")
                    DDS_INSTANCE_HANDLE_FORMAT_SPECIFIER
                    ACE_TEXT ("\n"),
                    gettertest_info->key.in (),
                    gettertest_info->iteration,
                    DDS_INSTANCE_HANDLE_LOG(readinfo.instance_handle)));
          }
        if (readinfo.source_timestamp.sec == 0 &&
            readinfo.source_timestamp.nanosec == 0)
          {
            ACE_ERROR ((LM_ERROR, "ERROR VARIABLE: READ ONE LAST: "
                                "source timestamp seems to be invalid (nil) "
                                "key <%C> - iteration <%d>\n",
                                gettertest_info->key.in (),
                                gettertest_info->iteration));
          }
        ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::get_one_variable: "
                              "Returned data : key <%C> - iteration <%d>\n",
                              gettertest_info->key.in (),
                              gettertest_info->iteration));
      }
    else
      {
        ACE_ERROR ((LM_ERROR, "ERROR VARIABLE: GET ONE: "
                              "Time out while waiting for "
                              "key <%C> - iteration <%d>\n",
                              key,
                              iteration));
      }
  }

  void
  Receiver_exec_i::get_one (const char * key,
                            CORBA::Long fixed_key,
                            CORBA::Long iteration)
  {
    this->get_one_variable (key, iteration);
    this->get_one_fixed (fixed_key, iteration);
  }

  void
  Receiver_exec_i::timeout_get_one_fixed (void)
  {
    try
      {
        ::Getter_Test::GetterFixedConnector::Getter_var fixed =
          this->ciao_context_->get_connection_info_fixed_fresh_data ();

        DDS::Duration_t to;
        to.sec = 1;
        to.nanosec = 0;
        fixed->time_out (to);
        ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::timeout_get_one_fixed: "
                              "Start getting data from DDS: timeout: "
                              "sec <%d> - nanosec <%u>\n",
                              fixed->time_out ().sec,
                              fixed->time_out ().nanosec));
        GetterFixed gettertest_info;
        ::CCM_DDS::ReadInfo readinfo;
        CORBA::Boolean const result = fixed->get_one (gettertest_info, readinfo);
        if (result)
          {
            ACE_ERROR ((LM_ERROR, "ERROR FIXED: TIMEOUT GET ONE: "
                                  "Returning true when get no data.\n"));
          }
        else
          {
            ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::timeout_get_one_fixed: "
                                  "Expected to return no data.\n"));
          }
      }
    catch (const CCM_DDS::InternalError& )
      {
        ACE_ERROR ((LM_ERROR, "ERROR FIXED: TIMEOUT GET ONE: "
                               "Caught unexcepted InternalError "
                               "exception\n"));
      }
    catch (const ::CORBA::Exception& ex)
      {
        ex._tao_print_exception ("ERROR FIXED: TIMEOUT GET ONE:");
        ACE_ERROR ((LM_ERROR,
                "ERROR: Receiver_exec_i::timeout_get_one_fixed : Exception caught\n"));
      }
  }

  void
  Receiver_exec_i::timeout_get_one_variable (void)
  {
    try
      {
        ::Getter_Test::GetterTestConnector::Getter_var getter =
          this->ciao_context_->get_connection_info_get_fresh_data ();

        DDS::Duration_t to;
        to.sec = 1;
        to.nanosec = 0;
        getter->time_out (to);
        ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::timeout_get_one_variable: "
                              "Start getting data from DDS: timeout: "
                              "sec <%d> - nanosec <%u>\n",
                              getter->time_out ().sec,
                              getter->time_out ().nanosec));
        GetterTest_var gettertest_info;;
        ::CCM_DDS::ReadInfo readinfo;
        CORBA::Boolean result = getter->get_one (gettertest_info.out (), readinfo);
        if (result)
          {
            ACE_ERROR ((LM_ERROR, "ERROR VARIABLE: TIMEOUT GET ONE: "
                                  "Returning true when get no data.\n"));
          }
        else
          {
            ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::timeout_get_one_variable: "
                                  "Expected to return no data.\n"));
          }
      }
    catch (const CCM_DDS::InternalError& )
      {
        ACE_ERROR ((LM_ERROR, "ERROR VARIABLE: TIMEOUT GET ONE: "
                               "Caught unexcepted InternalError "
                               "exception\n"));
      }
    catch (const ::CORBA::Exception& ex)
      {
        ex._tao_print_exception ("ERROR VARIABLE: TIMEOUT GET ONE:");
        ACE_ERROR ((LM_ERROR,
                "ERROR: Receiver_exec_i::timeout_get_one_variable : Exception caught\n"));
      }
  }

  void
  Receiver_exec_i::timeout_get_one (void)
  {
    this->timeout_get_one_variable ();
    this->timeout_get_one_fixed ();
  }

  void
  Receiver_exec_i::timeout_get_many (void)
  {
    try
      {
        ::Getter_Test::GetterTestConnector::Getter_var getter =
          this->ciao_context_->get_connection_info_get_fresh_data ();

        DDS::Duration_t to;
        to.sec = 3;
        to.nanosec = 0;
        getter->time_out (to);
        ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::timeout_get_many: "
                              "Start getting data from DDS: timeout: "
                              "sec <%d> - nanosec <%u>\n",
                              getter->time_out ().sec,
                              getter->time_out ().nanosec));
        GetterTestSeq gettertest_seq;
        ::CCM_DDS::ReadInfoSeq readinfo;
        CORBA::Boolean const result = getter->get_many (gettertest_seq, readinfo);
        if (result)
          {
            ACE_ERROR ((LM_ERROR, "ERROR: TIMEOUT GET MANY: "
                                  "Returning true when get no data.\n"));
          }
        else
          {
            ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::timeout_get_many: "
                                  "Expected to return no data.\n"));
          }
      }
    catch (const CCM_DDS::InternalError&)
      {
        ACE_ERROR ((LM_ERROR, "ERROR: TIMEOUT GET MANY: "
                               "Caught unexcepted InternalError "
                               "exception\n"));
      }
    catch (const ::CORBA::Exception& ex)
      {
        ex._tao_print_exception ("ERROR: TIMEOUT GET MANY:");
        ACE_ERROR ((LM_ERROR,
                      "ERROR: Receiver_exec_i::timeout_get_many : Exception caught\n"));
      }
  }

  // Component attributes and port operations.

  ::CCM_DDS::CCM_PortStatusListener_ptr
  Receiver_exec_i::get_info_get_status (void)
  {
    if ( ::CORBA::is_nil (this->ciao_info_get_status_.in ()))
      {
        info_get_status_exec_i *tmp = 0;
        ACE_NEW_RETURN (
          tmp,
          info_get_status_exec_i (
            this->ciao_context_.in ()),
            ::CCM_DDS::CCM_PortStatusListener::_nil ());

          this->ciao_info_get_status_ = tmp;
      }

    return
      ::CCM_DDS::CCM_PortStatusListener::_duplicate (
        this->ciao_info_get_status_.in ());
  }

  ::CCM_DDS::CCM_PortStatusListener_ptr
  Receiver_exec_i::get_info_fixed_status (void)
  {
    if ( ::CORBA::is_nil (this->ciao_info_fixed_status_.in ()))
      {
        info_fixed_status_exec_i *tmp = 0;
        ACE_NEW_RETURN (
          tmp,
          info_fixed_status_exec_i (
            this->ciao_context_.in ()),
            ::CCM_DDS::CCM_PortStatusListener::_nil ());

          this->ciao_info_fixed_status_ = tmp;
      }

    return
      ::CCM_DDS::CCM_PortStatusListener::_duplicate (
        this->ciao_info_fixed_status_.in ());
  }

  ::CCM_GetInvoker_ptr
  Receiver_exec_i::get_getter_invoke (void)
  {
    if ( ::CORBA::is_nil (this->ciao_getter_invoke_.in ()))
      {
        getter_invoke_exec_i *tmp = 0;
        ACE_NEW_RETURN (
          tmp,
          getter_invoke_exec_i (
            this->ciao_context_.in (),
            *this),
            ::CCM_GetInvoker::_nil ());

          this->ciao_getter_invoke_ = tmp;
      }

    return
      ::CCM_GetInvoker::_duplicate (
        this->ciao_getter_invoke_.in ());
  }

  // Operations from Components::SessionComponent.

  void
  Receiver_exec_i::set_session_context (
    ::Components::SessionContext_ptr ctx)
  {
    this->ciao_context_ =
      ::Getter_Test::CCM_Receiver_Context::_narrow (ctx);

    if ( ::CORBA::is_nil (this->ciao_context_.in ()))
      {
        throw ::CORBA::INTERNAL ();
      }
  }

  void
  Receiver_exec_i::configuration_complete (void)
  {
    /* Your code here. */
  }

  void
  Receiver_exec_i::ccm_activate (void)
  {
    /* Your code here. */
  }

  void
  Receiver_exec_i::ccm_passivate (void)
  {
    /* Your code here. */
  }

  void
  Receiver_exec_i::ccm_remove (void)
  {
    /* Your code here. */
  }

  extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr
  create_Getter_Test_Receiver_Impl (void)
  {
    ::Components::EnterpriseComponent_ptr retval =
      ::Components::EnterpriseComponent::_nil ();

    ACE_NEW_NORETURN (
      retval,
      Receiver_exec_i);

    return retval;
  }
}